add -Werror=declaration-after-statement only to stdlib extension modu… · python/cpython@acb8c52 (original) (raw)
5 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -71,12 +71,17 @@ OPT= @OPT@ | ||
71 | 71 | BASECFLAGS= @BASECFLAGS@ |
72 | 72 | BASECPPFLAGS= @BASECPPFLAGS@ |
73 | 73 | CONFIGURE_CFLAGS= @CFLAGS@ |
74 | +# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions. | |
75 | +# Use it when a compiler flag should _not_ be part of the distutils CFLAGS | |
76 | +# once Python is installed (Issue #21121). | |
77 | +CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@ | |
74 | 78 | CONFIGURE_CPPFLAGS= @CPPFLAGS@ |
75 | 79 | CONFIGURE_LDFLAGS= @LDFLAGS@ |
76 | 80 | # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the |
77 | 81 | # command line to append to these values without stomping the pre-set |
78 | 82 | # values. |
79 | 83 | PY_CFLAGS= (BASECFLAGS)(BASECFLAGS) (BASECFLAGS)(OPT) (CONFIGURECFLAGS)(CONFIGURE_CFLAGS) (CONFIGURECFLAGS)(CFLAGS) $(EXTRA_CFLAGS) |
84 | +PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) | |
80 | 85 | # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to |
81 | 86 | # be able to build extension modules using the directories specified in the |
82 | 87 | # environment variables |
@@ -91,7 +96,7 @@ ARFLAGS= @ARFLAGS@ | ||
91 | 96 | # Extra C flags added for building the interpreter object files. |
92 | 97 | CFLAGSFORSHARED=@CFLAGSFORSHARED@ |
93 | 98 | # C flags used for building the interpreter object files |
94 | -PY_CORE_CFLAGS= (PYCFLAGS)(PY_CFLAGS) (PYCFLAGS)(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE | |
99 | +PY_CORE_CFLAGS= (PYCFLAGS)(PY_CFLAGS) (PYCFLAGS)(PY_CFLAGS_NODIST) (PYCPPFLAGS)(PY_CPPFLAGS) (PYCPPFLAGS)(CFLAGSFORSHARED) -DPy_BUILD_CORE | |
95 | 100 | |
96 | 101 | |
97 | 102 | # Machine-dependent subdirectories |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -27,6 +27,9 @@ Core and Builtins | ||
27 | 27 | Library |
28 | 28 | ------- |
29 | 29 | |
30 | +- Issue #21121: Don't force 3rd party C extensions to be built with | |
31 | + -Werror=declaration-after-statement. | |
32 | + | |
30 | 33 | - Issue #21975: Fixed crash when using uninitialized sqlite3.Row (in particular |
31 | 34 | when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the |
32 | 35 | __new__() method. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -662,6 +662,7 @@ SHLIB_SUFFIX | ||
662 | 662 | LIBTOOL_CRUFT |
663 | 663 | OTHER_LIBTOOL_OPT |
664 | 664 | UNIVERSAL_ARCH_FLAGS |
665 | +CFLAGS_NODIST | |
665 | 666 | BASECFLAGS |
666 | 667 | OPT |
667 | 668 | ABIFLAGS |
@@ -6292,6 +6293,7 @@ fi | ||
6292 | 6293 | |
6293 | 6294 | |
6294 | 6295 | |
6296 | + | |
6295 | 6297 | # The -arch flags for universal builds on OSX |
6296 | 6298 | UNIVERSAL_ARCH_FLAGS= |
6297 | 6299 | |
@@ -6452,7 +6454,7 @@ asecho"as_echo "asecho"ac_cv_declaration_after_statement_warning" >&6; } | ||
6452 | 6454 | |
6453 | 6455 | if test $ac_cv_declaration_after_statement_warning = yes |
6454 | 6456 | then |
6455 | -BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" | |
6457 | +CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement" | |
6456 | 6458 | fi |
6457 | 6459 | |
6458 | 6460 | # if using gcc on alpha, use -mieee to get (near) full IEEE 754 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1138,6 +1138,7 @@ then | ||
1138 | 1138 | fi |
1139 | 1139 | |
1140 | 1140 | AC_SUBST(BASECFLAGS) |
1141 | +AC_SUBST(CFLAGS_NODIST) | |
1141 | 1142 | |
1142 | 1143 | # The -arch flags for universal builds on OSX |
1143 | 1144 | UNIVERSAL_ARCH_FLAGS= |
@@ -1222,7 +1223,7 @@ yes) | ||
1222 | 1223 | |
1223 | 1224 | if test $ac_cv_declaration_after_statement_warning = yes |
1224 | 1225 | then |
1225 | -BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" | |
1226 | +CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement" | |
1226 | 1227 | fi |
1227 | 1228 | |
1228 | 1229 | # if using gcc on alpha, use -mieee to get (near) full IEEE 754 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -19,6 +19,12 @@ | ||
19 | 19 | |
20 | 20 | cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ |
21 | 21 | |
22 | +# Add special CFLAGS reserved for building the interpreter and the stdlib | |
23 | +# modules (Issue #21121). | |
24 | +cflags = sysconfig.get_config_var('CFLAGS') | |
25 | +py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST') | |
26 | +sysconfig.get_config_vars()['CFLAGS'] = cflags + ' ' + py_cflags_nodist | |
27 | + | |
22 | 28 | def get_platform(): |
23 | 29 | # cross build |
24 | 30 | if "_PYTHON_HOST_PLATFORM" in os.environ: |