[Mesa-dev] [PATCH] mesa: Set -Werror=declaration-after-statement in mesa/Makefile

Ian Romanick idr at freedesktop.org
Fri Jan 28 14:30:35 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/28/2011 02:15 PM, Chad Versace wrote:
> On 01/28/2011 01:03 PM, Brian Paul wrote:
>> I think this should be done up in the configure.ac file.  Otherwise
>> we're assuming gcc in the Makefile.
> 
> I was attempting to limit this change to files within core mesa.
> 
> Setting this option globally breaks the Intel driver build, because
> those drivers use C99. For GCC builds, configure.ac explicitly sets
> --std=c99. See thread: "Mesa (master): mesa: fix compilation".
> 
> I am no Makefile or autoconf expert, so I see no other way to do this.

There are a couple ways to work around this, but neither is particularly
pleasant.

1. Assume gmake and put some conditional code in the Makefile.  Since
the makefiles already use the gmake 'include' extension, this is
probably reasonable:

if $(eq gcc,$(findstring gcc, $(CC)))
    C_ERROR_FLAGS := -Werror=declaration-after-statement
endif

2. Create two sets of flags in configure.ac: one for core Mesa and
another for DRI drivers.  This will require touching pretty much all the
makefiles.

3. Set a flag in configure.ac when CC is GCC.  Use this flag to do the
conditional error flags trick from #1.

if $(eq y,$(CC_IS_GCC))
    C_ERROR_FLAGS := -Werror=declaration-after-statement
endif

plus the required bits in configure.ac.

Option #3 is probably the best bet, but, like I mentioned above, I'm not
really fond of any of them.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1DQ4sACgkQX1gOwKyEAw++1QCfWFaOLV7ggSherVUr8t6/YqS5
PNwAnjOET43yT0rc7REq80lYSRGF/tIO
=/9zz
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list