mirror of
https://github.com/postgres/postgres.git
synced 2026-10-31 05:54:36 +03:00
Hide warnings from Python headers when using gcc-compatible compiler.
Like commit388e80132, use "#pragma GCC system_header" to silence warnings appearing within the Python headers, since newer Python versions no longer worry about some restrictions we still use like -Wdeclaration-after-statement. This patch improves on388e80132by inventing a separate wrapper header file, allowing the pragma to be tightly scoped to just the Python headers and not other stuff we have laying about in plpython.h. I applied the same technique to plperl for the same reason: the original patch suppressed warnings for a good deal of our own code, not only the Perl headers. Like the previous commit, back-patch to supported branches. Peter Eisentraut and Tom Lane Discussion: https://postgr.es/m/ae523163-6d2a-4b81-a875-832e48dec502@eisentraut.org
This commit is contained in:
@@ -20,27 +20,10 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Python versions <= 3.8 otherwise define a replacement, causing macro
|
||||
* redefinition warnings.
|
||||
* Pull in Python headers via a wrapper header, to control the scope of
|
||||
* the system_header pragma therein.
|
||||
*/
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
/* Python uses #pragma to bring in a non-default libpython on VC++ if
|
||||
* _DEBUG is defined */
|
||||
#undef _DEBUG
|
||||
/* Also hide away errcode, since we load Python.h before postgres.h */
|
||||
#define errcode __msvc_errcode
|
||||
#include <Python.h>
|
||||
#undef errcode
|
||||
#define _DEBUG
|
||||
#elif defined (_MSC_VER)
|
||||
#define errcode __msvc_errcode
|
||||
#include <Python.h>
|
||||
#undef errcode
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
#include "plpython_system.h"
|
||||
|
||||
/* define our text domain for translations */
|
||||
#undef TEXTDOMAIN
|
||||
|
||||
Reference in New Issue
Block a user