From: Fernando P. <fpe...@gm...> - 2006-06-09 07:08:34
|
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__)) customize_compiler(self) 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 Cheers, f |
From: David M. C. <co...@ph...> - 2006-06-09 21:45:37
|
On Fri, 9 Jun 2006 15:19:14 -0600 "Fernando Perez" <fpe...@gm...> wrote: > On 6/9/06, David M. Cooke <co...@ph...> wrote: > > On Thu, Jun 08, 2006 at 11:28:04PM -0600, Fernando Perez wrote: > > > > 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) > > > > Go ahead. > > > > I'm against random messages being printed out anyways -- I'd get > > rid of the '<weave: compiling>' too. There's a bunch of code in scipy > > with 'print' statements that I don't think belong in a library. (Now, > > if we defined a logging framework, that'd be ok with me!) > > Before I commit anything, let's decide on that one. Weave used to > print 'None' whenever it compiled anything, I changed it a while ago > to the current 'weave:compiling'. I'm also of the opinion that > libraries should operate quietly, but with weave I've always wanted > that message in there. The reason is that when weave compiles (esp. > with blitz in the picture), the execution takes a long time. The same > function goes from miliseconds to 30 seconds of run time depending on > whether compilation is happening or not. > > This difference is so dramatic that I think a message is justified > (absent a proper logging framework). It's helpful to know that the > time is going into c++ compilation, and not your code hanging for 30 > seconds. Ok, I'll give you that one :-) It's the other 1000 uses of print that I'm concerned about. inline_tools.compile_function takes a verbose flag, though, which eventually gets passed to build_tools.build_extension (which I believe does all the compiling for weave). It's probably more reasonable to have inline_tools.compile_function default to verbose=1 instead of 0, then build_extension will print 'Compiling code...' (that should be changed to mention weave). -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |co...@ph... |
From: Tim H. <tim...@co...> - 2006-06-09 21:58:08
|
David M. Cooke wrote: >On Fri, 9 Jun 2006 15:19:14 -0600 >"Fernando Perez" <fpe...@gm...> wrote: > > > >>On 6/9/06, David M. Cooke <co...@ph...> wrote: >> >> >>>On Thu, Jun 08, 2006 at 11:28:04PM -0600, Fernando Perez wrote: >>> >>> >>>>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) >>>> >>>> >>>Go ahead. >>> >>>I'm against random messages being printed out anyways -- I'd get >>>rid of the '<weave: compiling>' too. There's a bunch of code in scipy >>>with 'print' statements that I don't think belong in a library. (Now, >>>if we defined a logging framework, that'd be ok with me!) >>> >>> >>Before I commit anything, let's decide on that one. Weave used to >>print 'None' whenever it compiled anything, I changed it a while ago >>to the current 'weave:compiling'. I'm also of the opinion that >>libraries should operate quietly, but with weave I've always wanted >>that message in there. The reason is that when weave compiles (esp. >>with blitz in the picture), the execution takes a long time. The same >>function goes from miliseconds to 30 seconds of run time depending on >>whether compilation is happening or not. >> >>This difference is so dramatic that I think a message is justified >>(absent a proper logging framework). It's helpful to know that the >>time is going into c++ compilation, and not your code hanging for 30 >>seconds. >> >> > >Ok, I'll give you that one :-) It's the other 1000 uses of print that I'm >concerned about. > >inline_tools.compile_function takes a verbose flag, though, which eventually >gets passed to build_tools.build_extension (which I believe does all the >compiling for weave). It's probably more reasonable to have >inline_tools.compile_function default to verbose=1 instead of 0, then >build_extension will print 'Compiling code...' (that should be changed to >mention weave). > > Assuming inline_tools doesn't already use logging, might it be advantageous to have it use Python's logging module? >>> logging.getLogger("scipy.weave").warning("compiling -- this may take some time") WARNING:scipy.weave:compiling -- this may take some time [I think warning is the lowest level that gets displayed by default] -tim |
From: Fernando P. <fpe...@gm...> - 2006-06-09 22:28:12
|
On 6/9/06, David M. Cooke <co...@ph...> wrote: > > This difference is so dramatic that I think a message is justified > > (absent a proper logging framework). It's helpful to know that the > > time is going into c++ compilation, and not your code hanging for 30 > > seconds. > > Ok, I'll give you that one :-) It's the other 1000 uses of print that I'm > concerned about. > > inline_tools.compile_function takes a verbose flag, though, which eventually > gets passed to build_tools.build_extension (which I believe does all the > compiling for weave). It's probably more reasonable to have > inline_tools.compile_function default to verbose=1 instead of 0, then > build_extension will print 'Compiling code...' (that should be changed to > mention weave). I failed to mention that I agree with you: the proper solution is to use logging for this. For now I'll commit the strict-prototypes fix, and if I find myself with a lot of spare time, I'll try to clean things up a little bit to use logging (there's already a logger instance running in there). Cheers, f |
From: David M. C. <co...@ph...> - 2006-06-09 08:02:48
|
On Thu, Jun 08, 2006 at 11:28:04PM -0600, Fernando Perez wrote: > 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) Go ahead. I'm against random messages being printed out anyways -- I'd get rid of the '<weave: compiling>' too. There's a bunch of code in scipy with 'print' statements that I don't think belong in a library. (Now, if we defined a logging framework, that'd be ok with me!) -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |co...@ph... |
From: Fernando P. <fpe...@gm...> - 2006-06-09 21:26:09
|
On 6/9/06, David M. Cooke <co...@ph...> wrote: > On Thu, Jun 08, 2006 at 11:28:04PM -0600, Fernando Perez wrote: > > 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) > > Go ahead. > > I'm against random messages being printed out anyways -- I'd get > rid of the '<weave: compiling>' too. There's a bunch of code in scipy > with 'print' statements that I don't think belong in a library. (Now, > if we defined a logging framework, that'd be ok with me!) Before I commit anything, let's decide on that one. Weave used to print 'None' whenever it compiled anything, I changed it a while ago to the current 'weave:compiling'. I'm also of the opinion that libraries should operate quietly, but with weave I've always wanted that message in there. The reason is that when weave compiles (esp. with blitz in the picture), the execution takes a long time. The same function goes from miliseconds to 30 seconds of run time depending on whether compilation is happening or not. This difference is so dramatic that I think a message is justified (absent a proper logging framework). It's helpful to know that the time is going into c++ compilation, and not your code hanging for 30 seconds. Opinions? f |