[Python-Dev] what environment variable should contain compiler warning suppression flags? (original) (raw)

Roumen Petrov bugtrack at roumenpetrov.info
Sun Jun 27 21:25:16 CEST 2010


Brett Cannon wrote:

On Sat, Jun 26, 2010 at 16:37, M.-A. Lemburg<mal at egenix.com> wrote:

Brett Cannon wrote:

On Wed, Jun 23, 2010 at 14:53, Brett Cannon<brett at python.org> wrote: [SKIP] Since no one objected I swapped the order in r82259. In case anyone else uses clang to compile Python, this means that -Wno-unused-value will now work to silence the warning about unused return values that is caused by some macros. Probably using -Wno-empty-body is also good to avoid all the warnings triggered by the UCS4 macros in cjkcodecs.

Right now you cannot change order of CFLAGS and OPT

I think you need to come up with a different solution and revert the change...

OPT has historically been the only variable to use for adjusting the Python C compiler settings. Just found the relevant section in the README.

As the name implies this was usually used to adjust the optimizer settings, including raising the optimization level from the default or disabling it. It meant optional to me, not optimization. I hate abbreviations sometimes. With your change CFLAGS will always override OPT and thus any optimization definitions made in OPT will no longer have an effect. That was the point; OPT defines defaults through configure.in and I simply wanted to add to those instead of having OPT completely overwritten by me.

Now if you confirm that (see configure.in ) : # Optimization messes up debuggers, so turn it off for # debug builds. OPT="-g -O0 -Wall $STRICT_PROTO" is not issue for py3k then left you commit as is (Note that Mark point this). But if optimization "messes up debuggers" you may revert change.

I know that is difficult to reach consensus on compiler/preprocessor flags for python build process. Next is a shot list with issues about this:

This is still open "configure doesn't set up CFLAGS properly" ( http://bugs.python.org/issue1104249 ) - must be closed as fixed.

Note that CFLAGS defines -O2 on many platforms. So then wouldn't that mean they want that to be the optimization level? Or is the historical reason that default exists is so that some default exists but to expect the application to override as desired?

In your particular case, you should try setting OPT to "... -Wno-unused-value ..." (ie. replace -Wall with your setting). So what is CFLAGS for then? configure -h says it's for "C compiler flags"; that's extremely ambiguous. And it doesn't help that OPT is not mentioned by configure -h as that is what I have always gone by to know what flags are available for compilation. -Brett

If you like to see some flags the could you look into http://bugs.python.org/issue3718 how to define an option to be visible by configure --help. In addition AC_ARG_VAR will allow environment variable to be cached for subsequent run of config.status otherwise you must specify only on configure command line.

About all XXflags variables if is good configure script to be simplified to use only CPPFLAGS and CFLAGS to minimize configuration troubles and other build falures. A good sample if configure set preprocessor/compiler flags other then CPPFLAGS/CFLAGS is this issue "OSX: duplicate -arch flags in CFLAGS breaks sysconfig" ( http://bugs.python.org/issue8607 )

Roumen



More information about the Python-Dev mailing list