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