Use of _PTHREADS for threadsafe STL allocation in 2.95.2

Jeff Greif jmg@trivida.com
Mon Mar 27 17:17:00 GMT 2000


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
-----------------------------------------------------------------------------------
junk11.tar.gz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: junk11.tar.gz
Type: application/x-gzip
Size: 38180 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20000327/84796979/attachment.bin>


More information about the Gcc-bugs mailing list