diff options
author | Petr Viktorin <encukou@gmail.com> | 2025-03-04 14:10:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-04 14:10:09 +0100 |
commit | d91cc9db155024b0a221cf32f4f49617544618bf (patch) | |
tree | 405a618c801aeb2d9120887a2001b19050c5db0f /Lib/test/test_cppext/setup.py | |
parent | 6c48ed7d62c6ca0eb24935b0e612f9e4a1a3b1bc (diff) | |
download | cpython-d91cc9db155024b0a221cf32f4f49617544618bf.tar.gz cpython-d91cc9db155024b0a221cf32f4f49617544618bf.zip |
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`.
Diffstat (limited to 'Lib/test/test_cppext/setup.py')
-rw-r--r-- | Lib/test/test_cppext/setup.py | 16 |
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. |