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 // BEGIN FIXME
13*0b57cec5SDimitry Andric // This declaration works around a clang module build failure.
14*0b57cec5SDimitry Andric // It should be deleted ASAP.
15*0b57cec5SDimitry Andric #include "llvm/Support/Error.h"
16*0b57cec5SDimitry Andric static llvm::Expected<bool> *g_fcxx_modules_workaround;
17*0b57cec5SDimitry Andric // END
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric #include "lldb/Host/Config.h"
20*0b57cec5SDimitry Andric 
21*0b57cec5SDimitry Andric // Python.h needs to be included before any system headers in order to avoid
22*0b57cec5SDimitry Andric // redefinition of macros
23*0b57cec5SDimitry Andric 
24*0b57cec5SDimitry Andric #if LLDB_ENABLE_PYTHON
25*0b57cec5SDimitry Andric #include "llvm/Support/Compiler.h"
26*0b57cec5SDimitry Andric #if defined(_WIN32)
27*0b57cec5SDimitry Andric // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
28*0b57cec5SDimitry Andric // need to ensure this doesn't happen.  At the same time, Python.h will also try
29*0b57cec5SDimitry Andric // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
30*0b57cec5SDimitry Andric // so that PosixApi.h doesn't redefine it.
31*0b57cec5SDimitry Andric #define NO_PID_T
32*0b57cec5SDimitry Andric #endif
33*0b57cec5SDimitry Andric #if defined(__linux__)
34*0b57cec5SDimitry Andric // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
35*0b57cec5SDimitry Andric // may be different from the value that Python defines it to be which results
36*0b57cec5SDimitry Andric // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
37*0b57cec5SDimitry Andric // holds for _XOPEN_SOURCE.
38*0b57cec5SDimitry Andric #undef _POSIX_C_SOURCE
39*0b57cec5SDimitry Andric #undef _XOPEN_SOURCE
40*0b57cec5SDimitry Andric #endif
41*0b57cec5SDimitry Andric 
42*0b57cec5SDimitry Andric // Include locale before Python so _PY_PORT_CTYPE_UTF8_ISSUE doesn't cause
43*0b57cec5SDimitry Andric // macro redefinitions.
44*0b57cec5SDimitry Andric #if defined(__APPLE__)
45*0b57cec5SDimitry Andric #include <locale>
46 #endif
47 
48 // Include python for non windows machines
49 #include <Python.h>
50 #endif
51 
52 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
53