10b57cec5SDimitry Andric //===-- lldb-python.h -------------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H 100b57cec5SDimitry Andric #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H 110b57cec5SDimitry Andric 12*04eeddc0SDimitry Andric // BEGIN FIXME 13*04eeddc0SDimitry Andric // This declaration works around a clang module build failure. 14*04eeddc0SDimitry Andric // It should be deleted ASAP. 15*04eeddc0SDimitry Andric #include "llvm/Support/Error.h" 16*04eeddc0SDimitry Andric static llvm::Expected<bool> *g_fcxx_modules_workaround; 17*04eeddc0SDimitry Andric // END 18*04eeddc0SDimitry Andric 19480093f4SDimitry Andric #include "lldb/Host/Config.h" 20480093f4SDimitry Andric 210b57cec5SDimitry Andric // Python.h needs to be included before any system headers in order to avoid 220b57cec5SDimitry Andric // redefinition of macros 230b57cec5SDimitry Andric 24480093f4SDimitry Andric #if LLDB_ENABLE_PYTHON 250b57cec5SDimitry Andric #include "llvm/Support/Compiler.h" 260b57cec5SDimitry Andric #if defined(_WIN32) 270b57cec5SDimitry Andric // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t. We 280b57cec5SDimitry Andric // need to ensure this doesn't happen. At the same time, Python.h will also try 290b57cec5SDimitry Andric // to redefine a bunch of stuff that PosixApi.h defines. So define it all now 300b57cec5SDimitry Andric // so that PosixApi.h doesn't redefine it. 310b57cec5SDimitry Andric #define NO_PID_T 320b57cec5SDimitry Andric #endif 330b57cec5SDimitry Andric #if defined(__linux__) 340b57cec5SDimitry Andric // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined. This value 350b57cec5SDimitry Andric // may be different from the value that Python defines it to be which results 360b57cec5SDimitry Andric // in a warning. Undefine _POSIX_C_SOURCE before including Python.h The same 370b57cec5SDimitry Andric // holds for _XOPEN_SOURCE. 380b57cec5SDimitry Andric #undef _POSIX_C_SOURCE 390b57cec5SDimitry Andric #undef _XOPEN_SOURCE 400b57cec5SDimitry Andric #endif 410b57cec5SDimitry Andric 420b57cec5SDimitry Andric // Include locale before Python so _PY_PORT_CTYPE_UTF8_ISSUE doesn't cause 430b57cec5SDimitry Andric // macro redefinitions. 440b57cec5SDimitry Andric #if defined(__APPLE__) 450b57cec5SDimitry Andric #include <locale> 460b57cec5SDimitry Andric #endif 470b57cec5SDimitry Andric 480b57cec5SDimitry Andric // Include python for non windows machines 490b57cec5SDimitry Andric #include <Python.h> 50480093f4SDimitry Andric #endif 510b57cec5SDimitry Andric 520b57cec5SDimitry Andric #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H 53