This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Use of _PTHREADS for threadsafe STL allocation in 2.95.2
- To: "Jeff Greif" <jmg at trivida dot com>
- Subject: Re: Use of _PTHREADS for threadsafe STL allocation in 2.95.2
- From: dvv at dvv dot ru (Dima Volodin)
- Date: Tue, 28 Mar 2000 05:16:11 GMT
- Cc: <bug-gcc at gnu dot org>
- Organization: Huh?
- References: <052401bf9853$5b8c92b0$a20010ac@trivida.com>
It's allright - PTHREAD_*_INITIALIZER macros are not too clean in 2.6.
If it really annoys you, you may or may not want to use
-Wno-missing-braces
BTW, some time ago, class string in GCC STL wasn't thread safe (I'm
usgin SGI STL ever since), but it might have changed since then.
Cheers!
Dima
On Mon, 27 Mar 2000 17:17:17 -0800, you wrote:
>It's not clear to me whether this is a bug in gcc 2.95.2 or the supplied STL, or whether I'm simply using the _PTHREADS macro incorrectly. A lot of warnings are produced from this source code:
>
>#define _PTHREADS 1
>
>#include <string>
>
>std::string foo;
>
>The point of using _PTHREADS is to force the STL to use threadsafe allocators. I wondered what is the meaning of the warning about "partly bracketed initializer" and whether there is some way to suppress it, without suppressing anything else. Thanks for any clarifying info.
>
>Jeff
>
>---------------------- Details. Also see junk11.ii, junk11.s attached --------------------------
>
>~/tv/TriVida/PredictorCore/predictor# g++ -v --save-temps -D_REENTRANT -DOS_SOLARIS_2_5 -DBUILDING_PREDICTOR_LIBRARY -I/opt/ACE_wrappers.gcc -I../.. -I../../TVS_ostream -I. -g -Wall -Wpointer-arith -Wno-return-type -fPIC -O2 -c junk11.cpp
>Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
>gcc version 2.95.2 19991024 (release)
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/cpp -lang-c++ -v -I/opt/ACE_wrappers.gcc -I../.. -I../../TVS_ostream -I. -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__OPTIMIZE__ -g -Wall -Wpointer-arith -Wno-return-type -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -D_REENTRANT -DOS_SOLARIS_2_5 -DBUILDING_PREDICTOR_LIBRARY junk11.cpp junk11.ii
>GNU CPP version 2.95.2 19991024 (release) (sparc)
>#include "..." search starts here:
>#include <...> search starts here:
> /opt/ACE_wrappers.gcc
> ../..
> ../../TVS_ostream
> .
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3
> /usr/local/include
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../sparc-sun-solaris2.6/include
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include
> /usr/include
>End of search list.
>The following default directories have been omitted from the search path:
>End of omitted list.
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/cc1plus junk11.ii -quiet -dumpbase junk11.cc -g -O2 -Wall -Wpointer-arith -Wno-return-type -version -fPIC -o junk11.s
>GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.6) compiled by GNU C version 2.95.2 19991024 (release).
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/stl_alloc.h: In instantiation of `__default_alloc_template<true,0>::_S_node_allocator_lock':
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/stl_alloc.h:394: instantiated from `__default_alloc_template<true,0>::_Lock::~_Lock()'
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/stl_alloc.h:415: instantiated from `__default_alloc_template<true,0>::allocate(unsigned int)'
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/std/bastring.cc:33: instantiated from `basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >::Rep::operator new(unsigned int, unsigned int)'
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/std/bastring.cc:60: instantiated from `basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >::Rep::create(unsigned int)'
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/std/bastring.cc:71: instantiated from `basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >::Rep::clone()'
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/std/bastring.h:75: instantiated from `basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >::Rep::grab()'
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/std/bastring.h:171: instantiated from `basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >::basic_string()'
>junk11.cpp:5: instantiated from here
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/stl_alloc.h:581: warning: aggregate has a partly bracketed initializer
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/../../../../include/g++-3/stl_alloc.h:581: warning: aggregate has a partly bracketed initializer
> /usr/local/sparc-sun-solaris2.6/bin/as -V -Qy -s -K PIC -o junk11.o junk11.s
>GNU assembler version 2.9.1 (sparc-sun-solaris2.6), using BFD version 2.9.1
>
>-----------------------------------------------------------------------------------