diff options
| author | Victor Stinner <vstinner@python.org> | 2024-06-28 12:41:37 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-28 12:41:37 (GMT) |
| commit | 43709d5d5424725ec061de2c12c3761affde69ef (patch) | |
| tree | d37b95065bd4fc00e8b55dfaacbf3d3d18181588 /Lib/test/test_cppext | |
| parent | ef3c400434eab53e358ebfa5da0411fab722cafb (diff) | |
| download | cpython-43709d5d5424725ec061de2c12c3761affde69ef.zip cpython-43709d5d5424725ec061de2c12c3761affde69ef.tar.gz cpython-43709d5d5424725ec061de2c12c3761affde69ef.tar.bz2 | |
Check for compiler warnings in test_cext on Windows (#121088)
On Windows, test_cext and test_cppext now pass /WX flag to the MSC
compiler to treat all compiler warnings as errors. In verbose mode,
these tests now log the compiler commands to help debugging.
Change Py_BUILD_ASSERT_EXPR implementation on Windows to avoid a
compiler warning about an unnamed structure.
Diffstat (limited to 'Lib/test/test_cppext')
| -rw-r--r-- | Lib/test/test_cppext/__init__.py | 2 | ||||
| -rw-r--r-- | Lib/test/test_cppext/setup.py | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_cppext/__init__.py b/Lib/test/test_cppext/__init__.py index 00a2840..efd7944 100644 --- a/Lib/test/test_cppext/__init__.py +++ b/Lib/test/test_cppext/__init__.py @@ -76,6 +76,8 @@ class TestCPPExt(unittest.TestCase): cmd = [python_exe, '-X', 'dev', '-m', 'pip', 'install', '--no-build-isolation', os.path.abspath(pkg_dir)] + if support.verbose: + cmd.append('-v') run_cmd('Install', cmd) # Do a reference run. Until we test that running python diff --git a/Lib/test/test_cppext/setup.py b/Lib/test/test_cppext/setup.py index 80b3e0d..f1848f2 100644 --- a/Lib/test/test_cppext/setup.py +++ b/Lib/test/test_cppext/setup.py @@ -10,6 +10,7 @@ from setuptools import setup, Extension SOURCE = 'extension.cpp' + if not support.MS_WINDOWS: # C++ compiler flags for GCC and clang CPPFLAGS = [ @@ -19,8 +20,11 @@ if not support.MS_WINDOWS: '-Werror', ] else: - # Don't pass any compiler flag to MSVC - CPPFLAGS = [] + # MSVC compiler flags + CPPFLAGS = [ + # Treat all compiler warnings as compiler errors + '/WX', + ] def main(): |
