mirror of
https://github.com/python/cpython.git
synced 2025-11-12 03:22:06 +00:00
gh-129666: Add C11/C++11 to docs and -pedantic-errors to GCC/clang test_c[pp]ext tests (GH-130692)
Disable pedantic check for c++03 (unlimited API) Also add a check for c++03 *limited* API, which passes in pedantic mode after removing a comma in the `PySendResult` declaration, and allowing `long long`.
This commit is contained in:
parent
6c48ed7d62
commit
d91cc9db15
8 changed files with 75 additions and 1 deletions
|
|
@ -19,6 +19,17 @@
|
|||
# warnings
|
||||
'-Werror',
|
||||
]
|
||||
|
||||
CPPFLAGS_PEDANTIC = [
|
||||
# Ask for strict(er) compliance with the standard.
|
||||
# We cannot do this for c++03 unlimited API, since several headers in
|
||||
# Include/cpython/ use commas at end of `enum` declarations, a C++11
|
||||
# feature for which GCC has no narrower option than -Wpedantic itself.
|
||||
'-pedantic-errors',
|
||||
|
||||
# We also use `long long`, a C++11 feature we can enable individually.
|
||||
'-Wno-long-long',
|
||||
]
|
||||
else:
|
||||
# MSVC compiler flags
|
||||
CPPFLAGS = [
|
||||
|
|
@ -27,6 +38,7 @@
|
|||
# Treat all compiler warnings as compiler errors
|
||||
'/WX',
|
||||
]
|
||||
CPPFLAGS_PEDANTIC = []
|
||||
|
||||
|
||||
def main():
|
||||
|
|
@ -45,6 +57,10 @@ def main():
|
|||
else:
|
||||
cppflags.append(f'-std={std}')
|
||||
|
||||
if limited or (std != 'c++03'):
|
||||
# See CPPFLAGS_PEDANTIC docstring
|
||||
cppflags.extend(CPPFLAGS_PEDANTIC)
|
||||
|
||||
# gh-105776: When "gcc -std=11" is used as the C++ compiler, -std=c11
|
||||
# option emits a C++ compiler warning. Remove "-std11" option from the
|
||||
# CC command.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue