]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_cext, test_cppext: enable /W4 warnings on Windows (#124253)
authorVictor Stinner <vstinner@python.org>
Thu, 19 Sep 2024 20:32:01 +0000 (22:32 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Sep 2024 20:32:01 +0000 (22:32 +0200)
Add an explicit cast to (void*) and add Py_UNUSED() to fix some
warnings in extension.c.

Lib/test/test_cext/extension.c
Lib/test/test_cext/setup.py
Lib/test/test_cppext/setup.py

index eb23dbe20353bae467acf2c64cc95df95e6c69cb..b76abe1d74c628584a827f1a1c113b6527d7b773 100644 (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}
 };
 
index 19edc5e663c55dccb4e645965562e323a7540ce3..e97749b45ea6f31d20ec3eec10a112b61eb99d04 100644 (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',
     ]
index f1848f2fd42a46bf8edc608442d4fb80e90881f6..d97b238b8d147726b09790ef824c9fd3d97ac381 100644 (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',
     ]