Add -fno-common where supported (WAF only)
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 10 May 2011 02:07:30 +0000 (11:37 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 10 May 2011 02:07:30 +0000 (11:37 +0930)
Normally under UNIX, uninitialized non-static global variables get
placed in the "common" section, where they are merged at link time.
This means if two C files define "int debug", they will end up
referring to the same variable.  Or if one does "float level" and the
other does "int level" you'll get an accidental union.

Such bugs can be hard to track down; fortunately GCC offers
-fno-common to disable this feature.  It didn't reveal any places
which need fixing, however).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
buildtools/wafsamba/samba_autoconf.py

index 174ca142102a038bfab7751dcf48ce469229fa58..207d7320b95445b250c72a4fc75087025b01372a 100644 (file)
@@ -597,7 +597,7 @@ def SAMBA_CONFIG_H(conf, path=None):
 
     if Options.options.developer:
         # we add these here to ensure that -Wstrict-prototypes is not set during configure
-        conf.ADD_CFLAGS('-Wall -g -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Werror-implicit-function-declaration -Wformat=2 -Wno-format-y2k -Wmissing-prototypes',
+        conf.ADD_CFLAGS('-Wall -g -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Werror-implicit-function-declaration -Wformat=2 -Wno-format-y2k -Wmissing-prototypes -fno-common',
                         testflags=True)
         if os.getenv('TOPLEVEL_BUILD'):
             conf.ADD_CFLAGS('-Wcast-qual', testflags=True)