xref: /llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h (revision bcadb5a3d1b17a581c4ac991f129eb8441a81c48)
1 //===-- lldb-python.h -------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
11 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
12 
13 // Python.h needs to be included before any system headers in order to avoid
14 // redefinition of macros
15 
16 #include "llvm/Support/Compiler.h"
17 #if defined(_WIN32)
18 // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
19 // need to ensure this doesn't happen.  At the same time, Python.h will also try
20 // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
21 // so that PosixApi.h doesn't redefine it.
22 #define NO_PID_T
23 #endif
24 #if defined(__linux__)
25 // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
26 // may be different from the value that Python defines it to be which results
27 // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
28 // holds for _XOPEN_SOURCE.
29 #undef _POSIX_C_SOURCE
30 #undef _XOPEN_SOURCE
31 #endif
32 
33 // Include python for non windows machines
34 #include <Python.h>
35 
36 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
37