[Lldb-commits] [lldb] r208520 - python: silence macro redefinition warnings

Saleem Abdulrasool compnerd at compnerd.org
Sun May 11 23:44:01 PDT 2014


Author: compnerd
Date: Mon May 12 01:44:01 2014
New Revision: 208520

URL: http://llvm.org/viewvc/llvm-project?rev=208520&view=rev
Log:
python: silence macro redefinition warnings

Python defines _XOPEN_SOURCE and _POSIX_C_SOURCE unconditionally.  On Linux,
this is problematic as glibc's features.h defines these values if _GNU_SOURCE is
defined to the value that is currently implemented.  Python defines it to the
versions that it requires, which may be different.  Undefine the macros on Linux
(technically, this should be safe to do globally) before including the python
headers.

Modified:
    lldb/trunk/include/lldb/lldb-python.h

Modified: lldb/trunk/include/lldb/lldb-python.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-python.h?rev=208520&r1=208519&r2=208520&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-python.h (original)
+++ lldb/trunk/include/lldb/lldb-python.h Mon May 12 01:44:01 2014
@@ -18,6 +18,15 @@
 
 #else
 
+#if defined(__linux__)
+// features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
+// may be different from the value that Python defines it to be which results
+// in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
+// holds for _XOPEN_SOURCE.
+#undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
 #include <Python.h>
 
 #endif // LLDB_DISABLE_PYTHON





More information about the lldb-commits mailing list