[llvm-commits] [gcc-plugin] r76405 - /gcc-plugin/trunk/llvm-backend.cpp

Duncan Sands baldrick at free.fr
Mon Jul 20 01:14:24 PDT 2009


Author: baldrick
Date: Mon Jul 20 03:14:09 2009
New Revision: 76405

URL: http://llvm.org/viewvc/llvm-project?rev=76405&view=rev
Log:
Normalize header inclusions.  If anyone is wondering
why they go in this order, the reason is that gcc
poisons a bunch of routines (such as malloc), so if
gcc headers are included too early then the compiler
errors out on various llvm and system headers.

Modified:
    gcc-plugin/trunk/llvm-backend.cpp

Modified: gcc-plugin/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=76405&r1=76404&r2=76405&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Mon Jul 20 03:14:09 2009
@@ -19,9 +19,7 @@
 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
-#include "llvm-internal.h"
-#include "llvm-debug.h"
-#include "llvm-file-ostream.h"
+// LLVM headers
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/LLVMContext.h"
@@ -52,17 +50,24 @@
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/System/Program.h"
 
+// System headers
 #include <cassert>
+
+// GCC headers
 #undef VISIBILITY_HIDDEN
-extern "C" {
+#define IN_GCC
+
 #include "config.h"
+extern "C" {
 #include "system.h"
+}
 #include "coretypes.h"
-#include "flags.h"
+#include "target.h"
 #include "tree.h"
+
+#include "flags.h"
 #include "diagnostic.h"
 #include "output.h"
-#include "target.h"
 #include "toplev.h"
 #include "timevar.h"
 #include "tm.h"
@@ -71,7 +76,12 @@
 #include "langhooks.h"
 #include "cgraph.h"
 #include "params.h"
-}
+
+// Plugin headers
+#include "llvm-internal.h"
+#include "llvm-debug.h"
+#include "llvm-file-ostream.h"
+#include "bits_and_bobs.h"
 
 // Non-zero if bytecode from PCH is successfully read.
 int flag_llvm_pch_read;





More information about the llvm-commits mailing list