This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年06月14日 11:50 by ronaldoussoren, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue18211-hack.txt | ronaldoussoren, 2013年06月18日 12:47 | review | ||
| issue18211-hack-v2.txt | ronaldoussoren, 2013年06月18日 13:08 | review | ||
| Messages (11) | |||
|---|---|---|---|
| msg191119 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年06月14日 11:50 | |
Changeset a3559c8c614b added -Werror=statement-after-declaration to the CFLAGS for compiler that support it. This new flags is fine for CPython itself (which is explicitly writting in C89 style to support older compilers and Microsoft Visual Studio), but the new flags also gets used when building 3th-party extensions using distutils and might cause problems there when that code uses C99. I don't have a good solution for this yet, the flag is useful to have when building CPython to avoid regressions in C89 support but shouldn't be used when building 3th-party extensions. |
|||
| msg191311 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2013年06月17日 02:47 | |
Yes, we definitely need some way for CPython compiler flags to not infect everything built with distutils. |
|||
| msg191404 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年06月18日 12:47 | |
Is "-Werror=statement-after-declaration" the right solution anyway? This errors out on just one of the incompatibilities between C89 and C99, although it is one that is easy to get wrong accidentally. Gcc (and clang) also support '-std=c89' that forces the compiler to support only that standard. Not that switching to that flag would get us closer to closing this issue :-) BTW. To make things more fun: both sysconfig and distutils.sysconfig contain code to parse the Makefile, and those two sets of code are not equivalent (distutils.sysconfig lets you override values using the environment, sysconfig does not). The attached crude hack fixes this particular issue, but I'm far from convinced that is is the right solution for two reasons: first of all it is a hack, second of all it drops the -Werror flag when building CPython's extensions. A better solution would be the introduction of a new variable in the Makefile that contains those CFLAGS that should only be used during the build of Python itself, all those flags can then be ignored by the Makefile parsers in distutils.sysconfig and sysconfig. The disadvantage is that is introduces even more complexity in the Makefile. |
|||
| msg191405 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年06月18日 13:08 | |
I had a patch that only changed distutils.sysconfig.get_config_var('CFLAGS') when not building python, but then noticed that this doesn't work: the setup.py file for stdlib extensions fetches information from the toplevel sysconfig file, not distutils.sysconfig and uses that to override some information (look for "make CC=altcc").
There are two problems there, for which I'll file separate issues:
1) setup.py shouldn't use sysconfig but distutils.sysconfig
2) the block of code that I mentioned earlier is not necessary at all, the comment is plain wrong (tested by removing the compiler update and running 'make CC=no-such-file')
V2 of the hack triggers the change of BASECFLAGS only when not building the stdlib, but that doesn't work right now because of the issues mentioned earlier.
|
|||
| msg191407 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年06月18日 13:13 | |
The setup.py issues are in #18255. |
|||
| msg191415 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年06月18日 15:04 | |
I just noticed the patch is not good enough: "python-config --cflags" still prints the -Werror flag because it is now a shell script and doesn't use sysconfig data at all. |
|||
| msg193158 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年07月16日 10:07 | |
By the way, I don't think that Python should pass the optimization level (-O0 or -O3) to extensions, except for builtin extensions (of the stdlib). |
|||
| msg193182 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2013年07月16日 16:14 | |
Why not? |
|||
| msg193607 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年07月23日 15:53 | |
I also don't understand why the optimization level shouldn't be used when building 3th-party extensions. Removing the -O flag for build_ext would be a regression compared to the current behavior because 3th-party extensions would suddenly be compiled with less optimization than before and extension authors would have to arrange for those flags themselves. That's fine on platforms using a compiler with a command-line interface that's simular to GCC, but the are compilers that don't (such as a number of vendor compilers for the various commercial unix systems). |
|||
| msg217872 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2014年05月04日 12:40 | |
Closing this one because Issue21121 contains a usable patch. |
|||
| msg217873 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2014年05月04日 12:41 | |
Sigh. Actually closing doesn't work due to the dependency :-( |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:46 | admin | set | github: 62411 |
| 2014年05月04日 18:08:47 | eric.araujo | set | status: open -> closed dependencies: - CPython setup.py problems stage: needs patch -> resolved |
| 2014年05月04日 12:41:04 | ronaldoussoren | set | messages: + msg217873 |
| 2014年05月04日 12:40:21 | ronaldoussoren | set | superseder: -Werror=declaration-after-statement is added even for extension modules through setup.py resolution: duplicate messages: + msg217872 |
| 2013年07月23日 15:53:29 | ronaldoussoren | set | messages: + msg193607 |
| 2013年07月16日 16:14:40 | benjamin.peterson | set | messages: + msg193182 |
| 2013年07月16日 10:07:09 | vstinner | set | messages: + msg193158 |
| 2013年07月16日 10:04:57 | vstinner | set | nosy:
+ vstinner |
| 2013年06月18日 15:04:16 | ronaldoussoren | set | messages: + msg191415 |
| 2013年06月18日 13:13:54 | ronaldoussoren | set | dependencies:
+ CPython setup.py problems messages: + msg191407 |
| 2013年06月18日 13:08:03 | ronaldoussoren | set | files:
+ issue18211-hack-v2.txt messages: + msg191405 |
| 2013年06月18日 12:47:39 | ronaldoussoren | set | files:
+ issue18211-hack.txt messages: + msg191404 |
| 2013年06月17日 02:52:03 | Arfrever | set | nosy:
+ Arfrever |
| 2013年06月17日 02:47:23 | benjamin.peterson | set | messages: + msg191311 |
| 2013年06月14日 14:06:16 | jkloth | set | nosy:
+ jkloth |
| 2013年06月14日 12:30:23 | christian.heimes | set | nosy:
+ christian.heimes |
| 2013年06月14日 11:50:35 | ronaldoussoren | create | |