[Numpy-discussion] Getting rid of annoying weave nag

Fernando Perez fperez.net at gmail.com
Fri Jun 9 00:28:04 CDT 2006

Hi all,

the following warning about strict-prototypes in weave drives me crazy:

longs[~]> python wbuild.py
<weave: compiling>
cc1plus: warning: command line option "-Wstrict-prototypes" is valid
for Ada/C/ObjC but not for C++

since I use weave on auto-generated code, I get it lots of times and I
find spurious warnings to be very distracting.

Anyone object to this patch against current numpy SVN to get rid of
this thing? (tracking where the hell that thing was coming from was
all kinds of fun)

Index: ccompiler.py
--- ccompiler.py        (revision 2588)
+++ ccompiler.py        (working copy)
@@ -191,6 +191,19 @@
     log.info('customize %s' % (self.__class__.__name__))
     if need_cxx:
+        # In general, distutils uses -Wstrict-prototypes, but this option is
+        # not valid for C++ code, only for C.  Remove it if it's there to
+        # avoid a spurious warning on every compilation.  All the default
+        # options used by distutils can be extracted with:
+        # from distutils import sysconfig
+        # sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
+        # 'CCSHARED', 'LDSHARED', 'SO')
+        try:
+            self.compiler_so.remove('-Wstrict-prototypes')
+        except ValueError:
+            pass
         if hasattr(self,'compiler') and self.compiler[0].find('gcc')>=0:
             if sys.version[:3]>='2.3':
                 if not self.compiler_cxx:

### EOF



More information about the Numpy-discussion mailing list