changeset f254d8a17da9 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f254d8a17da9
description:
style: Force Python.h to be included before main header
Python's header files set various compiler macros (e.g.,
_XOPEN_SOURCE) unconditionally. This triggers preprocessor warnings
that end up being treated as errors. The Python integration manual [1]
strongly recommends that Python.h is included before any system
header. The style guide used to mandate that Python.h is included
first in any file that needs it. This requirement was changed to
always include a source file's main header first, which ended up
triggering these errors.
This change updates the style checker to always include Python.h
before the main header file.
[1] https://docs.python.org/2/extending/extending.html
Change-Id: Id6a4f7fc64a336a8fd26691a0ca682abeb1d1579
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-by: Nikos Nikoleris <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Pierre-Yves Péneau <[email protected]>
diffstat:
src/python/swig/pyevent.cc | 4 ++--
src/sim/init.cc | 4 ++--
src/sim/py_interact.cc | 4 ++--
util/style/sort_includes.py | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diffs (61 lines):
diff -r 63325e5b0a9d -r f254d8a17da9 src/python/swig/pyevent.cc
--- a/src/python/swig/pyevent.cc Fri Jan 27 15:07:20 2017 -0600
+++ b/src/python/swig/pyevent.cc Tue Feb 07 15:28:33 2017 +0000
@@ -28,10 +28,10 @@
* Authors: Nathan Binkert
*/
+#include <Python.h>
+
#include "python/swig/pyevent.hh"
-#include <Python.h>
-
#include "base/misc.hh"
#include "sim/async.hh"
#include "sim/eventq.hh"
diff -r 63325e5b0a9d -r f254d8a17da9 src/sim/init.cc
--- a/src/sim/init.cc Fri Jan 27 15:07:20 2017 -0600
+++ b/src/sim/init.cc Tue Feb 07 15:28:33 2017 +0000
@@ -41,10 +41,10 @@
* Authors: Nathan Binkert
*/
+#include <Python.h>
+
#include "sim/init.hh"
-#include <Python.h>
-
#include <marshal.h>
#include <zlib.h>
diff -r 63325e5b0a9d -r f254d8a17da9 src/sim/py_interact.cc
--- a/src/sim/py_interact.cc Fri Jan 27 15:07:20 2017 -0600
+++ b/src/sim/py_interact.cc Tue Feb 07 15:28:33 2017 +0000
@@ -29,10 +29,10 @@
* Steve Reinhardt
*/
+#include <Python.h>
+
#include "sim/py_interact.hh"
-#include <Python.h>
-
void
py_interact()
{
diff -r 63325e5b0a9d -r f254d8a17da9 util/style/sort_includes.py
--- a/util/style/sort_includes.py Fri Jan 27 15:07:20 2017 -0600
+++ b/util/style/sort_includes.py Tue Feb 07 15:28:33 2017 +0000
@@ -169,8 +169,8 @@
)
block_order = (
+ ('python', ),
('main', ),
- ('python', ),
('c', ),
('stl', ),
('cc', ),
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev