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

Steve Holden steve at holdenweb.com
Tue Jun 29 17:29:55 CEST 2010


Barry Warsaw wrote:
> On Jun 28, 2010, at 05:28 PM, M.-A. Lemburg wrote:
> 
>> How many Python users will compile Python in debug mode ?
> 
> How many Python users compile Python at all? :)
> 
>> 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.
> 
> Sure.
> 
>> 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.
> 
> Yes, but it's a PITA for several reasons, IMO:
> 
> * It's pretty underdocumented
> * It's obscure
> * It's hard to remember the exact fu needed because you do it infrequently
> * I usually only remember my mistake when gdb acts funny
> 
> I strongly suggest that --with-pydebug should be all you need to ensure the
> best debugging environment, which means turning off compiler optimization.
> Last time I tried, the -O0 was added and it worked well.  (I know this has
> been in flux though.)
> 
>> 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.
> 
> Yes, but that's *much* more rare than wanting to step through some bit of C
> code without going crazy.

I agree - trying to step through -O2 optimized code isn't going to help
debug your code, it's going to help you debug the optimizer. That's a
very rare use case.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/
"All I want for my birthday is another birthday" -
                                     Ian Dury, 1942-2000



More information about the Python-Dev mailing list