[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Issue: Non-constant struct initializers break build on Solaris/SunPRO

From: Daniel Richard G. <skunk_at_iSKUNK.ORG>
Date: Tue, 19 Jun 2012 17:15:16 -0400

Building Subversion 1.7.5 on Solaris 8 with the vendor (SunPRO) compiler
fails with errors of the form

    "subversion/libsvn_subr/sqlite.c", line 1208: non-constant initializer: op "NAME"
    cc: acomp failed for subversion/libsvn_subr/sqlite.c
    gmake: *** [subversion/libsvn_subr/sqlite.lo] Error 1

To generalize, this code is frowned upon:

    struct foobar {
        char *f;
        char *b;
    };
    
    int main(void)
    {
        char *foo = "foo";
        char *bar = "bar";
    
        struct foobar fb = { foo, bar };
    
        return 0;
    }

Compiling the above yields

    $ cc -c foo.c
    "foo.c", line 11: non-constant initializer: op "NAME"
    "foo.c", line 11: non-constant initializer: op "NAME"
    cc: acomp failed for foo.c

Rewriting the struct declaration/assignment as

        struct foobar fb;
        fb.f = foo;
        fb.b = bar;

allows the build to proceed.

The attached patch does this for the current SVN source and allows
Subversion to build on this system.

--Daniel

-- 
Daniel Richard G. || skunk_at_iSKUNK.ORG
My ASCII-art .sig got a bad case of Times New Roman.

Received on 2012-06-20 02:11:53 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.