xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1061da546Spatrick //===-- lldb-python.h -------------------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9061da546Spatrick #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
10061da546Spatrick #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
11061da546Spatrick 
12*f6aab3d8Srobert // BEGIN FIXME
13*f6aab3d8Srobert // This declaration works around a clang module build failure.
14*f6aab3d8Srobert // It should be deleted ASAP.
15*f6aab3d8Srobert #include "llvm/Support/Error.h"
16*f6aab3d8Srobert static llvm::Expected<bool> *g_fcxx_modules_workaround;
17*f6aab3d8Srobert // END
18*f6aab3d8Srobert 
19061da546Spatrick #include "lldb/Host/Config.h"
20061da546Spatrick 
21061da546Spatrick // Python.h needs to be included before any system headers in order to avoid
22061da546Spatrick // redefinition of macros
23061da546Spatrick 
24061da546Spatrick #if LLDB_ENABLE_PYTHON
25061da546Spatrick #include "llvm/Support/Compiler.h"
26061da546Spatrick #if defined(_WIN32)
27061da546Spatrick // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
28061da546Spatrick // need to ensure this doesn't happen.  At the same time, Python.h will also try
29061da546Spatrick // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
30061da546Spatrick // so that PosixApi.h doesn't redefine it.
31061da546Spatrick #define NO_PID_T
32061da546Spatrick #endif
33061da546Spatrick #if defined(__linux__)
34061da546Spatrick // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
35061da546Spatrick // may be different from the value that Python defines it to be which results
36061da546Spatrick // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
37061da546Spatrick // holds for _XOPEN_SOURCE.
38061da546Spatrick #undef _POSIX_C_SOURCE
39061da546Spatrick #undef _XOPEN_SOURCE
40061da546Spatrick #endif
41061da546Spatrick 
42061da546Spatrick // Include locale before Python so _PY_PORT_CTYPE_UTF8_ISSUE doesn't cause
43061da546Spatrick // macro redefinitions.
44061da546Spatrick #if defined(__APPLE__)
45061da546Spatrick #include <locale>
46061da546Spatrick #endif
47061da546Spatrick 
48061da546Spatrick // Include python for non windows machines
49061da546Spatrick #include <Python.h>
50061da546Spatrick #endif
51061da546Spatrick 
52061da546Spatrick #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
53