0
0
mirror of https://github.com/python/cpython.git synced 2024-11-21 12:59:38 +01:00

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.
This commit is contained in:
Victor Stinner 2024-09-19 22:32:01 +02:00 committed by GitHub
parent 5f01111594
commit 7a2d77c903
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View File

@ -37,7 +37,13 @@ static PyMethodDef _testcext_methods[] = {
static int
_testcext_exec(PyObject *module)
_testcext_exec(
#ifdef __STDC_VERSION__
PyObject *module
#else
PyObject *Py_UNUSED(module)
#endif
)
{
#ifdef __STDC_VERSION__
if (PyModule_AddIntMacro(module, __STDC_VERSION__) < 0) {
@ -53,7 +59,7 @@ _testcext_exec(PyObject *module)
}
static PyModuleDef_Slot _testcext_slots[] = {
{Py_mod_exec, _testcext_exec},
{Py_mod_exec, (void*)_testcext_exec},
{0, NULL}
};

View File

@ -31,6 +31,8 @@ if not support.MS_WINDOWS:
else:
# MSVC compiler flags
CFLAGS = [
# Display warnings level 1 to 4
'/W4',
# Treat all compiler warnings as compiler errors
'/WX',
]

View File

@ -22,6 +22,8 @@ if not support.MS_WINDOWS:
else:
# MSVC compiler flags
CPPFLAGS = [
# Display warnings level 1 to 4
'/W4',
# Treat all compiler warnings as compiler errors
'/WX',
]