aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_cppext/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_cppext/setup.py')
-rw-r--r--Lib/test/test_cppext/setup.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_cppext/setup.py b/Lib/test/test_cppext/setup.py
index 019ff18446a..b30c9e2746c 100644
--- a/Lib/test/test_cppext/setup.py
+++ b/Lib/test/test_cppext/setup.py
@@ -19,6 +19,17 @@ if not support.MS_WINDOWS:
# 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 @@ else:
# 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.