<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I don't think ScriptInterpreter.h includes Python.h<div><br><div>ScriptInterpreterPython.h does - at a glance the main reasons for that are:</div><div> our ScriptInterpreterPythonObject is inlined in the .h file and uses Py_X*REF(x)</div><div> our Locker class uses a PyGILState_STATE as a member variable</div><div> the ScriptInterpreterPython itself defines several PyObject* member variables</div><div><br></div><div>We would have to look into working around these dependencies (and maybe others I failed to see) before removing the #include of Python.h</div><div>Incidentally, none of them seem insurmountable</div><div><div><br><div>
<div><div style="border-collapse: separate; border-spacing: 0px; "><i>Enrico Granata</i></div><div style="border-collapse: separate; border-spacing: 0px; ">✉ egranata@<font class="Apple-style-span" color="#ff230e"></font>.com</div><div>✆ (408) 972-7683</div></div>
</div>
<br><div><div>On Nov 29, 2012, at 5:07 PM, "Kaylor, Andrew" <<a href="mailto:andrew.kaylor@intel.com">andrew.kaylor@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">It looked to me like a whole lot of these were coming because ScriptInterpreterPython.h was being included somewhere deep in an include chain from places that probably didn't need Python at all.  I wondered if there was a way to avoid including Python.h from ScriptInterpreter.h and only bring it in when it was needed.<br><br>-Andy<br><br>-----Original Message-----<br>From: <a href="mailto:lldb-commits-bounces@cs.uiuc.edu">lldb-commits-bounces@cs.uiuc.edu</a> [mailto:lldb-<a href="mailto:commits-bounces@cs.uiuc.edu">commits-bounces@cs.uiuc.edu</a>] On Behalf Of Kopec, Matt<br>Sent: Thursday, November 29, 2012 2:05 PM<br>To: <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>Subject: Re: [Lldb-commits] fixing build warnings on Linux<br><br>Moving on, another warning popping up many times:<br><br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/lldb.cpp:13:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/Debugger.h:26:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/FormatManager.h:21:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/FormatNavigator.h:24:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/FormatClasses.h:28:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Interpreter/ScriptInterpreterPython.h:23:<br>In file included from /usr/include/python2.7/Python.h:8:<br>/usr/include/python2.7/pyconfig.h:1158:9: warning: '_POSIX_C_SOURCE' macro redefined #define _POSIX_C_SOURCE 200112L<br>        ^<br>/usr/include/features.h:163:10: note: previous definition is here<br># define _POSIX_C_SOURCE        200809L<br>         ^<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/lldb.cpp:13:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/Debugger.h:26:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/FormatManager.h:21:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/FormatNavigator.h:24:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Core/FormatClasses.h:28:<br>In file included from /home/mkopec1/dev/llvm/tools/lldb/source/../include/lldb/Interpreter/ScriptInterpreterPython.h:23:<br>In file included from /usr/include/python2.7/Python.h:8:<br>/usr/include/python2.7/pyconfig.h:1180:9: warning: '_XOPEN_SOURCE' macro redefined #define _XOPEN_SOURCE 600<br>        ^<br>/usr/include/features.h:165:10: note: previous definition is here # define _XOPEN_SOURCE  700<br><br><br><br>From Python documentation (<a href="http://docs.python.org/3.1/c-api/intro.html#include-files">http://docs.python.org/3.1/c-api/intro.html#include-files</a>):<br><br>Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included.<br><br><br><br>I suggest adding a new header (include/lldb/lldb-python.h) and including it at the top of each source file producing this warning. The header source would look like this:<br><br><br>#ifndef LLDB_lldb_python_h_<br>#define LLDB_lldb_python_h_<br><br>// Python.h needs to be included before any system headers in order to avoid redefinition of macros<br><br>#ifdef LLDB_DISABLE_PYTHON<br><br>// Python is disabled in this build<br><br>#else<br><br>#if defined (__APPLE__)<br>#include <Python/Python.h><br>#else<br>#include <Python.h><br>#endif<br><br>#endif // LLDB_DISABLE_PYTHON<br><br>#endif  // LLDB_lldb_python_h_<br><br><br>Thoughts?<br>________________________________________<br>From: <a href="mailto:lldb-commits-bounces@cs.uiuc.edu">lldb-commits-bounces@cs.uiuc.edu</a> [<a href="mailto:lldb-commits-bounces@cs.uiuc.edu">lldb-commits-bounces@cs.uiuc.edu</a>] on behalf of Kopec, Matt [<a href="mailto:matt.kopec@intel.com">matt.kopec@intel.com</a>]<br>Sent: Thursday, November 29, 2012 3:23 PM<br>To: Greg Clayton<br>Cc: <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>Subject: Re: [Lldb-commits] fixing build warnings on Linux<br><br>Yes, these do exist. Initially, I will replace the warning cases. Thanks :) ________________________________________<br>From: Greg Clayton [<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>]<br>Sent: Wednesday, November 28, 2012 4:32 PM<br>To: Kopec, Matt<br>Cc: <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>Subject: Re: [Lldb-commits] fixing build warnings on Linux<br><br>On Nov 28, 2012, at 12:58 PM, "Kopec, Matt" <<a href="mailto:matt.kopec@intel.com">matt.kopec@intel.com</a>> wrote:<br><br><blockquote type="cite">Hi all,<br><br>On Linux, there are hundreds of build warnings and I've taken steps to resolve them. Our goal is to be able to build trunk with -Werror.  Some warnings appear so often a patch would be painful to review. For these cases, I'll start with a category of warnings and a general solution on how to resolve for all instances.<br><br>Printf format placeholder warnings:<br><br>/home/mkopec1/dev/llvm/tools/lldb/source/API/SBBreakpoint.cpp:482:97: warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]<br>       log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_resolved);<br>                                                                                                                        ~~~                                     ^~~~~~~~~~~~~~~<br><br>%lu<br><br>On Mac OS X, uint64_t is unsigned long long but on Linux (and FreeBSD) may be unsigned long or unsigned long long. Using the macros in inttypes.h will use the correct format placeholder.<br><br><br>-         log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_resolved);<br>+        log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => <br>+ %" PRIu64, m_opaque_sp.get(), (uint64_t)num_resolved);<br><br>Does this seem reasonable?<br></blockquote><br>Yes, as long asthere are PRI macros for all formats ('i', 'u', 'x', 'o', etc).<br><br><br><br>_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits<br><br>_______________________________________________<br>lldb-commits mailing list<br>lldb-commits@cs.uiuc.edu<br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits<br><br>_______________________________________________<br>lldb-commits mailing list<br>lldb-commits@cs.uiuc.edu<br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits<br></blockquote></div><br></div></div></div></body></html>