2009-04-23 Chris Demetriou <cgd@google.com>

* configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
        * configure: Regenerate.
        * config.in: Regenerate.
        * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
        if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
This commit is contained in:
Chris Demetriou 2009-04-24 19:33:42 +00:00
parent 92846e72ad
commit 40fde48809
5 changed files with 93 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2009-04-23 Chris Demetriou <cgd@google.com>
* configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
* configure: Regenerate.
* config.in: Regenerate.
* gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
* incremental.cc (Incremental_inputs_header_data): Renamed from

View File

@ -97,6 +97,9 @@
/* Define to 1 if you have the <tr1/unordered_map> header file. */
#undef HAVE_TR1_UNORDERED_MAP
/* Define if ::std::tr1::unordered_map::rehash is usable */
#undef HAVE_TR1_UNORDERED_MAP_REHASH
/* Define to 1 if you have the <tr1/unordered_set> header file. */
#undef HAVE_TR1_UNORDERED_SET

67
gold/configure vendored
View File

@ -6855,6 +6855,73 @@ fi
done
# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
# at link time with some versions of GCC.
echo "$as_me:$LINENO: checking whether ::std::tr1::unordered_map::rehash is usable." >&5
echo $ECHO_N "checking whether ::std::tr1::unordered_map::rehash is usable.... $ECHO_C" >&6
if test "${gold_cv_unordered_map_rehash+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <tr1/unordered_map>
void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 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_exeext'
{ (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
gold_cv_unordered_map_rehash=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
gold_cv_unordered_map_rehash=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $gold_cv_unordered_map_rehash" >&5
echo "${ECHO_T}$gold_cv_unordered_map_rehash" >&6
if test "$gold_cv_unordered_map_rehash" = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_TR1_UNORDERED_MAP_REHASH 1
_ACEOF
fi
# gcc 4.3.0 doesn't recognize the printf attribute on a template
# function. Check for that. This is gcc bug 35546. This test can
# probably be removed after the bug has been fixed for a while.

View File

@ -325,6 +325,19 @@ AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
AC_CHECK_HEADERS(byteswap.h)
AC_CHECK_FUNCS(mallinfo posix_fallocate)
# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
# at link time with some versions of GCC.
AC_CACHE_CHECK([whether ::std::tr1::unordered_map::rehash is usable.],
[gold_cv_unordered_map_rehash],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <tr1/unordered_map>
void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])])
if test "$gold_cv_unordered_map_rehash" = "yes"; then
AC_DEFINE(HAVE_TR1_UNORDERED_MAP_REHASH, 1,
[Define if ::std::tr1::unordered_map::rehash is usable])
fi
# gcc 4.3.0 doesn't recognize the printf attribute on a template
# function. Check for that. This is gcc bug 35546. This test can
# probably be removed after the bug has been fixed for a while.

View File

@ -65,7 +65,8 @@
// Figure out how to get a hash set and a hash map.
#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP)
#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) \
&& defined(HAVE_TR1_UNORDERED_MAP_REHASH)
#include <tr1/unordered_set>
#include <tr1/unordered_map>