summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-09-26 21:20:56 +0000
committerIan Lance Taylor <iant@google.com>2006-09-26 21:20:56 +0000
commitd288e464ac39ad965115c86ba29c7dc07ed9f5d6 (patch)
treec890e318317b2541d34f07cd4ad81502e409ea9f
parent54dc6425456514cdc00cdfef5a21a7bdacfcad2d (diff)
downloadbinutils-gdb-d288e464ac39ad965115c86ba29c7dc07ed9f5d6.tar.gz
g++ 3.2.2 portability for grhat.
-rw-r--r--gold/config.in3
-rwxr-xr-xgold/configure42
-rw-r--r--gold/configure.ac10
-rw-r--r--gold/gold.h4
-rw-r--r--gold/object.h8
-rw-r--r--gold/po/gold.pot2
6 files changed, 66 insertions, 3 deletions
diff --git a/gold/config.in b/gold/config.in
index 8f1b30b700d..3a452ffd88b 100644
--- a/gold/config.in
+++ b/gold/config.in
@@ -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
diff --git a/gold/configure b/gold/configure
index 4bb97433efe..c0d93b7d1c6 100755
--- a/gold/configure
+++ b/gold/configure
@@ -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'
diff --git a/gold/configure.ac b/gold/configure.ac
index b7cdc5e51c4..024ac486503 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -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
diff --git a/gold/gold.h b/gold/gold.h
index f52d13129bc..20095eb8809 100644
--- a/gold/gold.h
+++ b/gold/gold.h
@@ -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>
diff --git a/gold/object.h b/gold/object.h
index eb3271e0329..7c27b7b802a 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -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>
diff --git a/gold/po/gold.pot b/gold/po/gold.pot
index e3adeff9fc9..ec385f407f5 100644
--- a/gold/po/gold.pot
+++ b/gold/po/gold.pot
@@ -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"