1 /*-------------------------------------------------------------------------
3 * plpython_system.h - pull in Python's system header files
5 * We break this out as a separate header file to precisely control
6 * the scope of the "system_header" pragma. No Postgres-specific
7 * declarations should be put here. However, we do include some stuff
8 * that is meant to prevent conflicts between our code and Python.
10 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
11 * Portions Copyright (c) 1994, Regents of the University of California
13 * src/pl/plpython/plpython_system.h
15 *-------------------------------------------------------------------------
17 #ifndef PLPYTHON_SYSTEM_H
18 #define PLPYTHON_SYSTEM_H
21 * Newer versions of the Python headers trigger a lot of warnings with our
22 * preferred compiler flags (at least -Wdeclaration-after-statement is known
23 * to be problematic). The system_header pragma hides warnings from within
24 * the rest of this file, if supported.
26 #ifdef HAVE_PRAGMA_GCC_SYSTEM_HEADER
27 #pragma GCC system_header
31 * Python versions <= 3.8 otherwise define a replacement, causing macro
32 * redefinition warnings.
34 #define HAVE_SNPRINTF 1
36 #if defined(_MSC_VER) && defined(_DEBUG)
37 /* Python uses #pragma to bring in a non-default libpython on VC++ if
38 * _DEBUG is defined */
40 /* Also hide away errcode, since we load Python.h before postgres.h */
41 #define errcode __msvc_errcode
45 #elif defined (_MSC_VER)
46 #define errcode __msvc_errcode
53 #endif /* PLPYTHON_SYSTEM_H */