[Python-Dev] what environment variable should contain compiler warning suppression flags?

M.-A. Lemburg mal at egenix.com
Mon Jun 28 17:28:03 CEST 2010


Mark Dickinson wrote:
> On Mon, Jun 28, 2010 at 3:04 PM, M.-A. Lemburg <mal at egenix.com> wrote:
>> Why do you think that the default -O2 is unwanted
> 
> Because it can cause debug builds of Python to be built with
> optimization enabled, as we've already seen at least twice.

Then let me put it this way:

How many Python users will compile Python in debug mode ?

The point is that the default build of Python should use
the correct production settings for the C compiler out of
the box and that's what AC_PROG_CC is all about.

I'm pretty sure that Python developers who want to use a
debug build have enough code foo to get the -O2 turned into a -O0
either by adjust OPT and/or by providing their own CFLAGS env var.

Also note that in some cases you may actually want to have
a debug build with optimizations turned on, e.g. to track down
a compiler optimization bug.

>> and how do you know
>> whether the compiler accepts -g as option ?
> 
> I don't.  It could easily be tested for, though.  Alternatively,
> setting an empty CFLAGS to '-g' could be done just for gcc, since this
> is the only compiler for which AC_PROG_CC adds -O2.

... and then end up with default Python builds which don't have
debug symbols available to track down core dumps, etc. ?

AC_PROG_CC checks whether the compiler supports -g and always
uses it in that case. The option is supported by more compilers
than just GCC. E.g. IBM's xlC and Intel's icl compilers support
that option as well.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 28 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2010-07-19: EuroPython 2010, Birmingham, UK                20 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-Dev mailing list