Why do we care about compiler warnings in swig-generated code?

I just started running some tests on my Ubuntu 10.04 machine (swig 1.3.40,
gcc 4.4.3), and I ran into this on a few different _wrap.cc files:

 [     CXX] ALPHA/python/swig/event_wrap.cc -> .fo
cc1plus: warnings being treated as errors
build/ALPHA/python/swig/event_wrap.cc: In function 'PyObject*
_wrap_new_Cycles(PyObject*, PyObject*)':
build/ALPHA/python/swig/event_wrap.cc:3380: error: 'argv[0]' may be used
uninitialized in this function
build/ALPHA/python/swig/event_wrap.cc: In function 'PyObject*
_wrap_simulate(PyObject*, PyObject*)':
build/ALPHA/python/swig/event_wrap.cc:4590: error: 'argv[0]' may be used
uninitialized in this function
scons: *** [build/ALPHA/python/swig/event_wrap.fo] Error 1
scons: building terminated because of errors.

I went poking around in src/SConscript and I see that we have a mildly
elaborate setup to (1) use a different build environment for swig files,
swig_env, so we can have finer-grain control over warnings, and (2) figure
out based on the compiler type and version which warnings to suppress.  I
saw that the -Wno-maybe-uninitialized flag was added to swig_env only for
gcc versions >= 4.7, so I changed that to make it unconditional, only to
find that that flag isn't even valid for gcc 4.4; I had to use
-Wno-uninitialized instead.

So I could solve my immediate problem by adding -Wno-uninitialized for gcc
4.4, though I'm not sure if this is really a gcc 4.4 issue or a swig 1.3.40
issue (or maybe it's specific to that particular combination).  But in the
bigger picture I wonder: why do we really care?  We're not going to go fix
the swig output to get rid of warnings, and as long as the code compiles
and runs, we probably don't care about them.  Wouldn't it be simpler to get
rid of the whole swig_env thing and all the code that sets it up, and just
add 'Werror=False' when we compile swig sources?

Steve
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to