Issue #22463: Backport compiler warning fixes and workarounds
* Set but unused variable in Parser/pgen.c in non-debug builds. Patch by
Christian Heimes.
* Unused static function in Modules/readline.c. Patch by Georg Brandl.
* main_window unused in Modules/tkappinit.c. Patch by Gregory P. Smith.
* Dead assignment in Modules/_ctypes/cfield.c. Extracted from patch by Brett
Cannon.
* Expression result unused in PyObject_INIT macro expansions. Based on
patches by Christian Heimes.
* Load expat_config.h and therefore pyconfig.h before C stdlib headers are
loaded. This silences pre-processor warnings including '_POSIX_C_SOURCE
redefined'. Extracted from patch by Christian Heimes.
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 654d2fe..41bb074 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -107,7 +107,7 @@
/* Inline PyObject_New */
v = free_list;
free_list = (PyIntObject *)Py_TYPE(v);
- PyObject_INIT(v, &PyInt_Type);
+ (void)PyObject_INIT(v, &PyInt_Type);
v->ob_ival = ival;
return (PyObject *) v;
}
@@ -1466,7 +1466,7 @@
/* PyObject_New is inlined */
v = free_list;
free_list = (PyIntObject *)Py_TYPE(v);
- PyObject_INIT(v, &PyInt_Type);
+ (void)PyObject_INIT(v, &PyInt_Type);
v->ob_ival = ival;
small_ints[ival + NSMALLNEGINTS] = v;
}