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