From: Andreas Sandberg Date: Tue, 7 Feb 2017 15:28:33 +0000 (+0000) Subject: style: Force Python.h to be included before main header X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=653b4657e67f24339abd18a154a57ca5d578b4b9;p=gem5.git 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 Reviewed-by: Nikos Nikoleris Reviewed-by: Jason Lowe-Power Reviewed-by: Pierre-Yves PĂ©neau --- diff --git a/src/python/swig/pyevent.cc b/src/python/swig/pyevent.cc index 53f3a3397..39c57d116 100644 --- a/src/python/swig/pyevent.cc +++ b/src/python/swig/pyevent.cc @@ -28,10 +28,10 @@ * Authors: Nathan Binkert */ -#include "python/swig/pyevent.hh" - #include +#include "python/swig/pyevent.hh" + #include "base/misc.hh" #include "sim/async.hh" #include "sim/eventq.hh" diff --git a/src/sim/init.cc b/src/sim/init.cc index d46e76324..f2395eec4 100644 --- a/src/sim/init.cc +++ b/src/sim/init.cc @@ -41,10 +41,10 @@ * Authors: Nathan Binkert */ -#include "sim/init.hh" - #include +#include "sim/init.hh" + #include #include diff --git a/src/sim/py_interact.cc b/src/sim/py_interact.cc index 8acff40dd..7e6527e81 100644 --- a/src/sim/py_interact.cc +++ b/src/sim/py_interact.cc @@ -29,10 +29,10 @@ * Steve Reinhardt */ -#include "sim/py_interact.hh" - #include +#include "sim/py_interact.hh" + void py_interact() { diff --git a/util/style/sort_includes.py b/util/style/sort_includes.py index 334d9e29e..a35b08468 100644 --- a/util/style/sort_includes.py +++ b/util/style/sort_includes.py @@ -169,8 +169,8 @@ class SortIncludes(object): ) block_order = ( - ('main', ), ('python', ), + ('main', ), ('c', ), ('stl', ), ('cc', ),