1*0b57cec5SDimitry Andric //===-- lldb-python.h -------------------------------------------*- C++ -*-===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
10*0b57cec5SDimitry Andric #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
11*0b57cec5SDimitry Andric 
12*0b57cec5SDimitry Andric #include "lldb/Host/Config.h"
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric // Python.h needs to be included before any system headers in order to avoid
15*0b57cec5SDimitry Andric // redefinition of macros
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric #if LLDB_ENABLE_PYTHON
18*0b57cec5SDimitry Andric #include "llvm/Support/Compiler.h"
19*0b57cec5SDimitry Andric #if defined(_WIN32)
20*0b57cec5SDimitry Andric // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
21*0b57cec5SDimitry Andric // need to ensure this doesn't happen.  At the same time, Python.h will also try
22*0b57cec5SDimitry Andric // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
23*0b57cec5SDimitry Andric // so that PosixApi.h doesn't redefine it.
24*0b57cec5SDimitry Andric #define NO_PID_T
25*0b57cec5SDimitry Andric #endif
26*0b57cec5SDimitry Andric #if defined(__linux__)
27*0b57cec5SDimitry Andric // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
28*0b57cec5SDimitry Andric // may be different from the value that Python defines it to be which results
29*0b57cec5SDimitry Andric // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
30*0b57cec5SDimitry Andric // holds for _XOPEN_SOURCE.
31*0b57cec5SDimitry Andric #undef _POSIX_C_SOURCE
32*0b57cec5SDimitry Andric #undef _XOPEN_SOURCE
33*0b57cec5SDimitry Andric #endif
34*0b57cec5SDimitry Andric 
35*0b57cec5SDimitry Andric // Include locale before Python so _PY_PORT_CTYPE_UTF8_ISSUE doesn't cause
36*0b57cec5SDimitry Andric // macro redefinitions.
37*0b57cec5SDimitry Andric #if defined(__APPLE__)
38*0b57cec5SDimitry Andric #include <locale>
39*0b57cec5SDimitry Andric #endif
40*0b57cec5SDimitry Andric 
41*0b57cec5SDimitry Andric // Include python for non windows machines
42*0b57cec5SDimitry Andric #include <Python.h>
43*0b57cec5SDimitry Andric #endif
44*0b57cec5SDimitry Andric 
45*0b57cec5SDimitry Andric #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
46