8000 test_cext, test_cppext: enable /W4 warnings on Windows (#124253) · python/cpython@7a2d77c · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a2d77c

Browse files
authored
test_cext, test_cppext: enable /W4 warnings on Windows (#124253)
Add an explicit cast to (void*) and add Py_UNUSED() to fix some warnings in extension.c.
1 parent 5f01111 commit 7a2d77c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Lib/test/test_cext/extension.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ static PyMethodDef _testcext_methods[] = {
3737

3838

3939
static int
40-
_testcext_exec(PyObject *module)
40+
_testcext_exec(
41+
#ifdef __STDC_VERSION__
42+
PyObject *module
43+
#else
44+
PyObject *Py_UNUSED(module)
45+
#endif
46+
)
4147
{
4248
#ifdef __STDC_VERSION__
4349
if (PyModule_AddIntMacro(module, __STDC_VERSION__) < 0) {
@@ -53,7 +59,7 @@ _testcext_exec(PyObject *module)
5359
}
5460

5561
static PyModuleDef_Slot _testcext_slots[] = {
56-
{Py_mod_exec, _testcext_exec},
62+
{Py_mod_exec, (void*)_testcext_exec},
5763
{0, NULL}
5864
};
5965

Lib/test/test_cext/setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
else:
3232
# MSVC compiler flags
3333
CFLAGS = [
34+
# Display warnings level 1 to 4
35+
'/W4',
3436
# Treat all compiler warnings as compiler errors
3537
'/WX',
3638
]

Lib/test/test_cppext/setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
else:
2323
# MSVC compiler flags
2424
CPPFLAGS = [
25+
# Display warnings level 1 to 4
26+
'/W4',
2527
# Treat all compiler warnings as compiler errors
2628
'/WX',
2729
]

0 commit comments

Comments
 (0)
0