More fallout from global.cc namespace changes

Danny Smith danny_r_smith_2001@yahoo.co.nz
Sat Oct 12 16:45:00 GMT 2002


Recent changes to globals.cc caused following error when building abi_check
on mingw32, which uses __GTHREAD_MUTEX_INIT_FUNCTION rather than
__GTHREAD_MUTEX_INIT. 

make[2]: Entering directory
`/develop/gcc/build/mingw32/libstdc++-v3/testsuite'
LD_RUN_PATH=/develop/gcc/build/mingw32/libstdc++-v3/src/.libs /bin/sh
../libtool --tag=CXX --mode=link `echo /develop/gcc/build/gcc/xgcc
-shared-libgcc -B/develop/gcc/build/gcc/ -nostdinc++ 
-L/develop/gcc/build/mingw32/libstdc++-v3/src
-L/develop/gcc/build/mingw32/libstdc++-v3/src/.libs -B/mingw/mingw32/bin/
-B/mingw/mingw32/lib/ -isystem /mingw/mingw32/include  | sed
's/xgcc/g++/g'`  -O2  -o abi_check  abi_check.o  -lm
/develop/gcc/build/gcc/g++ -shared-libgcc -B/develop/gcc/build/gcc/
-nostdinc++ -B/mingw/mingw32/bin/ -B/mingw/mingw32/lib/ -isystem
/mingw/mingw32/include -O2 -o abi_check abi_check.o 
-L/develop/gcc/build/mingw32/libstdc++-v3/src
-L/develop/gcc/build/mingw32/libstdc++-v3/src/.libs -lm
abi_check.o(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x38):abi_check.cc:
undefined reference to `std::_GLIBCPP_mutex_address'
abi_check.o(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x6b):abi_check.cc:
undefined reference to `std::_GLIBCPP_mutex'
abi_check.o(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x7d):abi_check.cc:
undefined reference to `std::_GLIBCPP_mutex_address_init()'
abi_check.o(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x98):abi_check.cc:
undefined reference to `std::_GLIBCPP_mutex'
abi_check.o(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0xb3):abi_check.cc:
undefined reference to `std::_GLIBCPP_mutex_init()'
abi_check.o(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0xb8):abi_check.cc:
undefined reference to `std::_GLIBCPP_once'
make[2]: *** [abi_check] Error 1


The symbols are defined in namespace __gnu_cxx in globals.cc but declared
in
namespace std in stl_threads.h.

The following fixes by, declaring in __gnu_cxx is stl_threads.h. An
alternative is to revert part of the change and define these in namespace
std in globals.cc, as before.

2002-10-12  Danny Smith  <dannysmith@users.sourceforge.net> 

	* include/bits/stl_threads.h (_GLIBCPP_mutex,
	_GLIBCPP_mutex_init,_GLIBCPP_mutex_address,
	_GLIBCPP_mutex_address_init, _GLIBCPP_once):
	Declare in namespace __gnu_cxx.


--- stl_threads.h.bak	Tue Dec 04 21:13:39 2001
+++ stl_threads.h	Sun Oct 13 00:04:27 2002
@@ -126,6 +126,7 @@ namespace std
     return __result;
   }
 #endif
+} //namespace std
 
   // Locking class.  Note that this class *does not have a
   // constructor*.  It must be initialized either statically, with
@@ -141,13 +142,26 @@ namespace std
   // functions, and no private or protected members.
 
 #if !defined(__GTHREAD_MUTEX_INIT) &&
defined(__GTHREAD_MUTEX_INIT_FUNCTION)
+namespace __gnu_cxx
+{
   extern __gthread_mutex_t _GLIBCPP_mutex;
   extern __gthread_mutex_t *_GLIBCPP_mutex_address;
   extern __gthread_once_t _GLIBCPP_once;
   extern void _GLIBCPP_mutex_init (void);
   extern void _GLIBCPP_mutex_address_init (void);
+}
+namespace std
+{
+  using __gnu_cxx::_GLIBCPP_mutex;
+  using __gnu_cxx::_GLIBCPP_mutex_address;
+  using __gnu_cxx::_GLIBCPP_once;
+  using __gnu_cxx::_GLIBCPP_mutex_init;
+  using __gnu_cxx::_GLIBCPP_mutex_address_init;
+}
 #endif
 
+namespace std
+{
   struct _STL_mutex_lock
   {
     // The class must be statically initialized with __STL_MUTEX_INITIALIZER.

http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
- Always be connected to your Messenger Friends



More information about the Libstdc++ mailing list