You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Daniel Richard G." <sk...@iSKUNK.ORG> on 2012/06/19 23:15:16 UTC

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

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@iSKUNK.ORG
My ASCII-art .sig got a bad case of Times New Roman.

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

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Jun 19, 2012 at 05:15:16PM -0400, Daniel Richard G. wrote:
> 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.

Thanks for submitting this patch!
Julian Foad has committed this patch in r1352068 (he isn't subscribed
to users@ and asked me to reply on his behalf).