xref: /llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h (revision f343968f5d87a91e020a5baf03c280ce7aa9cdb1)
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 redefinition of macros
14 
15 #ifdef LLDB_DISABLE_PYTHON
16 // Python is disabled in this build
17 #else
18 #include "llvm/Support/Compiler.h"
19 #if defined(LLVM_ON_WIN32)
20 // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We need to ensure
21 // this doesn't happen.
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 #endif // LLDB_DISABLE_PYTHON
36 
37 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
38