From 58c3151bbc045e8f575027f53c79e328381e7e61 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 26 Dec 2023 16:16:29 -0500 Subject: Hide warnings from Python headers when using gcc-compatible compiler. Like commit 388e80132, 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 on 388e80132 by 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 --- src/pl/plpython/plpython.h | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/pl/plpython/plpython.h') diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index 91f6f8d8607..f33f7b59207 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -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 -#undef errcode -#define _DEBUG -#elif defined (_MSC_VER) -#define errcode __msvc_errcode -#include -#undef errcode -#else -#include -#endif +#include "plpython_system.h" /* define our text domain for translations */ #undef TEXTDOMAIN -- cgit v1.2.3