1bcadb5a3SPavel Labath //===-- lldb-python.h -------------------------------------------*- C++ -*-===//
22c1f46dcSZachary Turner //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
62c1f46dcSZachary Turner //
72c1f46dcSZachary Turner //===----------------------------------------------------------------------===//
82c1f46dcSZachary Turner 
92c1f46dcSZachary Turner #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
102c1f46dcSZachary Turner #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
112c1f46dcSZachary Turner 
12*36cb29cbSAdrian Prantl // BEGIN FIXME
13*36cb29cbSAdrian Prantl // This declaration works around a clang module build failure.
14*36cb29cbSAdrian Prantl // It should be deleted ASAP.
15*36cb29cbSAdrian Prantl #include "llvm/Support/Error.h"
16*36cb29cbSAdrian Prantl static llvm::Expected<bool> *g_fcxx_modules_workaround;
17*36cb29cbSAdrian Prantl // END
18*36cb29cbSAdrian Prantl 
1959998b7bSJonas Devlieghere #include "lldb/Host/Config.h"
2059998b7bSJonas Devlieghere 
21b9c1b51eSKate Stone // Python.h needs to be included before any system headers in order to avoid
22b9c1b51eSKate Stone // redefinition of macros
232c1f46dcSZachary Turner 
244e26cf2cSJonas Devlieghere #if LLDB_ENABLE_PYTHON
25f343968fSZachary Turner #include "llvm/Support/Compiler.h"
26b1cb0b79SNico Weber #if defined(_WIN32)
27b9c1b51eSKate Stone // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
285a8ad459SZachary Turner // need to ensure this doesn't happen.  At the same time, Python.h will also try
295a8ad459SZachary Turner // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
305a8ad459SZachary Turner // so that PosixApi.h doesn't redefine it.
31f343968fSZachary Turner #define NO_PID_T
32f343968fSZachary Turner #endif
332c1f46dcSZachary Turner #if defined(__linux__)
342c1f46dcSZachary Turner // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
352c1f46dcSZachary Turner // may be different from the value that Python defines it to be which results
362c1f46dcSZachary Turner // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
372c1f46dcSZachary Turner // holds for _XOPEN_SOURCE.
382c1f46dcSZachary Turner #undef _POSIX_C_SOURCE
392c1f46dcSZachary Turner #undef _XOPEN_SOURCE
402c1f46dcSZachary Turner #endif
412c1f46dcSZachary Turner 
4263dd5d25SJonas Devlieghere // Include locale before Python so _PY_PORT_CTYPE_UTF8_ISSUE doesn't cause
4363dd5d25SJonas Devlieghere // macro redefinitions.
4463dd5d25SJonas Devlieghere #if defined(__APPLE__)
4563dd5d25SJonas Devlieghere #include <locale>
4663dd5d25SJonas Devlieghere #endif
4763dd5d25SJonas Devlieghere 
482c1f46dcSZachary Turner // Include python for non windows machines
492c1f46dcSZachary Turner #include <Python.h>
504e26cf2cSJonas Devlieghere #endif
512c1f46dcSZachary Turner 
522c1f46dcSZachary Turner #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
53