[llvm-commits] [dragonegg] r154995 - in /dragonegg/trunk: include/dragonegg/Internals.h include/x86/dragonegg/Target.h src/Aliasing.cpp src/Backend.cpp src/Cache.cpp src/Constants.cpp src/Convert.cpp src/Debug.cpp src/DefaultABI.cpp src/Trees.cpp src/Types.cpp src/arm/Target.cpp src/x86/ABIHack.inc src/x86/Target.cpp

Duncan Sands baldrick at free.fr
Wed Apr 18 02:57:20 PDT 2012


Author: baldrick
Date: Wed Apr 18 04:57:20 2012
New Revision: 154995

URL: http://llvm.org/viewvc/llvm-project?rev=154995&view=rev
Log:
Add support for the fact that GCC may or may not have been compiled as C++.
Thanks to Pax Team for telling me about ENABLE_BUILD_WITH_CXX.

Modified:
    dragonegg/trunk/include/dragonegg/Internals.h
    dragonegg/trunk/include/x86/dragonegg/Target.h
    dragonegg/trunk/src/Aliasing.cpp
    dragonegg/trunk/src/Backend.cpp
    dragonegg/trunk/src/Cache.cpp
    dragonegg/trunk/src/Constants.cpp
    dragonegg/trunk/src/Convert.cpp
    dragonegg/trunk/src/Debug.cpp
    dragonegg/trunk/src/DefaultABI.cpp
    dragonegg/trunk/src/Trees.cpp
    dragonegg/trunk/src/Types.cpp
    dragonegg/trunk/src/arm/Target.cpp
    dragonegg/trunk/src/x86/ABIHack.inc
    dragonegg/trunk/src/x86/Target.cpp

Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Wed Apr 18 04:57:20 2012
@@ -37,11 +37,6 @@
 union gimple_statement_d;
 union tree_node;
 
-extern "C" {
-extern void debug_gimple_stmt(union gimple_statement_d *);
-extern void debug_tree(union tree_node *);
-}
-
 namespace llvm {
   class Module;
   class GlobalVariable;

Modified: dragonegg/trunk/include/x86/dragonegg/Target.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/x86/dragonegg/Target.h?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/include/x86/dragonegg/Target.h (original)
+++ dragonegg/trunk/include/x86/dragonegg/Target.h Wed Apr 18 04:57:20 2012
@@ -46,7 +46,14 @@
    `inreg` parameter attribute */
 #define LLVM_TARGET_ENABLE_REGPARM
 
-extern "C" int ix86_regparm;
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
+extern "C" {
+#endif
+extern int ix86_regparm;
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 #define LLVM_TARGET_INIT_REGPARM(local_regparm, local_fp_regparm, type) \
   {                                                             \

Modified: dragonegg/trunk/src/Aliasing.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Aliasing.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Aliasing.cpp (original)
+++ dragonegg/trunk/src/Aliasing.cpp Wed Apr 18 04:57:20 2012
@@ -34,7 +34,10 @@
 #include <map>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -44,7 +47,9 @@
 #include "tree.h"
 
 #include "alias.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Wed Apr 18 04:57:20 2012
@@ -50,7 +50,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -75,7 +78,12 @@
 #include "tree-flow.h"
 #include "tree-pass.h"
 #include "version.h"
-}
+
+// TODO: In GCC, add targhooks.h to the list of plugin headers and remove this.
+tree default_mangle_decl_assembler_name (tree, tree);
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"
@@ -84,9 +92,6 @@
 #error Unsupported GCC major version
 #endif
 
-// TODO: In GCC, add targhooks.h to the list of plugin headers and remove this.
-extern "C" tree default_mangle_decl_assembler_name (tree, tree);
-
 // Non-zero if libcalls should not be simplified.
 int flag_no_simplify_libcalls;
 

Modified: dragonegg/trunk/src/Cache.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Cache.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Cache.cpp (original)
+++ dragonegg/trunk/src/Cache.cpp Wed Apr 18 04:57:20 2012
@@ -34,7 +34,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -44,7 +47,9 @@
 #include "tree.h"
 
 #include "ggc.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 using namespace llvm;
 
@@ -111,13 +116,17 @@
 
 
 // Include the garbage collector header.
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #if (GCC_MINOR > 5)
 #include "dragonegg/gt-cache-4.6.h"
 #else
 #include "dragonegg/gt-cache-4.5.h"
 #endif
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 bool getCachedInteger(tree t, int &Val) {
   if (!intCache)

Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Wed Apr 18 04:57:20 2012
@@ -38,7 +38,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -51,7 +54,9 @@
 #include "flags.h" // For POINTER_TYPE_OVERFLOW_UNDEFINED.
 #endif
 #include "tm_p.h"  // For CONSTANT_ALIGNMENT.
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Wed Apr 18 04:57:20 2012
@@ -40,7 +40,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -52,6 +55,9 @@
 #include "diagnostic.h"
 #include "except.h"
 #include "flags.h"
+#if (GCC_MINOR > 6)
+#include "gimple-pretty-print.h"
+#endif
 #include "langhooks.h"
 #include "output.h"
 #include "rtl.h"
@@ -74,7 +80,14 @@
 
 #define reg_raw_mode (default_target_regs.x_reg_raw_mode)
 #endif
-}
+
+#if (GCC_MINOR == 6)
+extern void debug_gimple_stmt(union gimple_statement_d *);
+#endif
+
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Wed Apr 18 04:57:20 2012
@@ -30,7 +30,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -43,7 +46,9 @@
 #include "langhooks.h"
 #include "toplev.h"
 #include "version.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/DefaultABI.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/DefaultABI.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Wed Apr 18 04:57:20 2012
@@ -27,7 +27,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -35,7 +38,9 @@
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/Trees.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Trees.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Trees.cpp (original)
+++ dragonegg/trunk/src/Trees.cpp Wed Apr 18 04:57:20 2012
@@ -28,7 +28,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -38,7 +41,9 @@
 #include "tree.h"
 
 #include "flags.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Wed Apr 18 04:57:20 2012
@@ -35,7 +35,10 @@
 #include <map>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -45,7 +48,9 @@
 #include "tree.h"
 
 #include "flags.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/arm/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/arm/Target.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/arm/Target.cpp (original)
+++ dragonegg/trunk/src/arm/Target.cpp Wed Apr 18 04:57:20 2012
@@ -32,7 +32,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -44,7 +47,9 @@
 #include "diagnostic.h"
 #include "gimple.h"
 #include "toplev.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"

Modified: dragonegg/trunk/src/x86/ABIHack.inc
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/ABIHack.inc?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/ABIHack.inc (original)
+++ dragonegg/trunk/src/x86/ABIHack.inc Wed Apr 18 04:57:20 2012
@@ -25,7 +25,10 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -47,7 +50,9 @@
 #include "cgraph.h"
 #include "gimple.h"
 #include "params.h"
-}
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 #ifndef CHECK_STACK_LIMIT
 #define CHECK_STACK_LIMIT (-1)

Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=154995&r1=154994&r2=154995&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Wed Apr 18 04:57:20 2012
@@ -31,7 +31,10 @@
 #include <gmp.h>
 
 // GCC headers
+#include "auto-host.h"
+#ifndef ENABLE_BUILD_WITH_CXX
 extern "C" {
+#endif
 #include "config.h"
 // Stop GCC declaring 'getopt' as it can clash with the system's declaration.
 #undef HAVE_DECL_GETOPT
@@ -42,8 +45,18 @@
 
 #include "diagnostic.h"
 #include "gimple.h"
+#if (GCC_MINOR > 6)
+#include "gimple-pretty-print.h"
+#endif
 #include "toplev.h"
-}
+
+#if (GCC_MINOR == 6)
+extern void debug_gimple_stmt(union gimple_statement_d *);
+#endif
+
+#ifndef ENABLE_BUILD_WITH_CXX
+} // extern "C"
+#endif
 
 // Trees header.
 #include "dragonegg/Trees.h"





More information about the llvm-commits mailing list