g++ 3.2.2 portability for grhat.
authorIan Lance Taylor <iant@google.com>
Tue, 26 Sep 2006 21:20:56 +0000 (21:20 +0000)
committerIan Lance Taylor <iant@google.com>
Tue, 26 Sep 2006 21:20:56 +0000 (21:20 +0000)
gold/config.in
gold/configure
gold/configure.ac
gold/gold.h
gold/object.h
gold/po/gold.pot

index 8f1b30b..3a452ff 100644 (file)
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Whether the C++ compiler can call a template member with no arguments */
+#undef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
index 4bb9743..c0d93b7 100755 (executable)
@@ -3937,6 +3937,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
+
 ac_ext=cc
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4723,6 +4724,47 @@ fi
 
 done
 
+
+cat >conftest.$ac_ext <<_ACEOF
+
+class c { public: template<int i> void fn(); };
+template<int i> void foo(c cv) { cv.fn<i>(); }
+template void foo<1>(c cv);
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MEMBER_TEMPLATE_SPECIFICATIONS
+_ACEOF
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
index b7cdc5e..024ac48 100644 (file)
@@ -29,8 +29,18 @@ LFS_CXXFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 AC_SUBST(LFS_CXXFLAGS)
 
 AC_LANG_PUSH(C++)
+
 AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map)
 AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
+
+dnl Test whether the compiler can specify a member templates to call.
+AC_COMPILE_IFELSE([
+class c { public: template<int i> void fn(); };
+template<int i> void foo(c cv) { cv.fn<i>(); }
+template void foo<1>(c cv);],
+[AC_DEFINE(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS, [],
+  [Whether the C++ compiler can call a template member with no arguments])])
+
 AC_LANG_POP(C++)
 
 AM_MAINTAINER_MODE
index f52d131..20095eb 100644 (file)
@@ -25,7 +25,7 @@
 
 // Figure out how to get a hash set and a hash map.
 
-#if HAVE_TR1_UNORDERED_SET && HAVE_TR1_UNORDERED_MAP
+#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP)
 
 #include <tr1/unordered_set>
 #include <tr1/unordered_map>
@@ -35,7 +35,7 @@
 #define Unordered_set std::tr1::unordered_set
 #define Unordered_map std::tr1::unordered_map
 
-#elif HAVE_EXT_HASH_MAP && HAVE_EXT_HASH_SET
+#elif defined(HAVE_EXT_HASH_MAP) && defined(HAVE_EXT_HASH_SET)
 
 #include <ext/hash_map>
 #include <ext/hash_set>
index eb3271e..7c27b7b 100644 (file)
@@ -85,12 +85,16 @@ class Object
   is_locked() const
   { return this->input_file_->file().is_locked(); }
 
+#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS
   // Return the sized target structure associated with this object.
   // This is like the target method but it returns a pointer of
   // appropriate checked type.
   template<int size, bool big_endian>
   Sized_target<size, big_endian>*
   sized_target();
+#else
+  virtual Target* sized_target() = 0;
+#endif
 
   // Read the symbol and relocation information.
   Read_symbols_data
@@ -198,6 +202,8 @@ class Object
   std::vector<Map_to_output> map_to_output_;
 };
 
+#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS
+
 // Implement sized_target inline for efficiency.  This approach breaks
 // static type checking, but is made safe using asserts.
 
@@ -210,6 +216,8 @@ Object::sized_target()
   return static_cast<Sized_target<size, big_endian>*>(this->target_);
 }
 
+#endif
+
 // A regular object file.  This is size and endian specific.
 
 template<int size, bool big_endian>
index e3adeff..ec385f4 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-26 13:58-0700\n"
+"POT-Creation-Date: 2006-09-26 14:19-0700\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"