mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
ef3c400434
commit
43709d5d54
5 changed files with 18 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue