c++/4594: g++ warning with strings and threads
ufm@hnc.com
ufm@hnc.com
Wed Oct 17 11:36:00 GMT 2001
>Number: 4594
>Category: c++
>Synopsis: g++ warning with strings and threads
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 17 11:36:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Uwe F. Mayer
>Release: 3.0.2 20011007 (prerelease)
>Organization:
>Environment:
System: SunOS hydra 5.6 Generic_105181-16 sun4u sparc SUNW,Ultra-2
Architecture: sun4
host: sparc-sun-solaris2.6
build: sparc-sun-solaris2.6
target: sparc-sun-solaris2.6
configured with: ../gcc-20011007/configure --prefix=/work/hyd01/td/sw/gcc-20011007-test --disable-nls --enable-threads=posix --disable-shared
>Description:
If any C++ program uses strings, then if compiled with -Wall several
warnings are issued about a partially bracketed initializer in some of g++'s
header files. This can be avoided, if g++ is configured with
"--disable-threads", but then the javalib does not compile. My first
attempt was to accept the threads default (i.e. no --enable-threads
or --disable-threads statement during configuration), and then I tried
single threads, and lastly posix threads. The warnings occur if threads
are anything but single during configuration.
Here is sample output of a compilation:
hydra:src$ g++ -Wall -c void.cc
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/stl_alloc.h: In instantiation of `std::_STL_mutex_lock std::__default_alloc_template<true, 0>::_S_node_allocator_lock':
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/stl_alloc.h:316: instantiated from `std::__default_alloc_template<threads, inst>::_Lock::_Lock() [with bool threads = true, int inst = 0]'
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/stl_alloc.h:365: instantiated from `static void std::__default_alloc_template<threads, inst>::deallocate(void*, unsigned int) [with bool threads = true, int inst = 0]'
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/stl_alloc.h:588: instantiated from `void std::allocator<_Alloc>::deallocate(_Tp*, unsigned int) [with _Tp = char]'
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/basic_string.tcc:256: instantiated from `void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_destroy(const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/basic_string.h:180: instantiated from `void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_dispose(const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/basic_string.h:344: instantiated from `void std::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
void.cc:4: instantiated from here
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/stl_alloc.h:523: warning: aggregate
has a partly bracketed initializer
/work/hyd01/td/sw/gcc-20011007-test/include/g++-v3/bits/stl_alloc.h:523: warning: aggregate
has a partly bracketed initializer
>How-To-Repeat:
g++ -c -Wall void.cc
The file void.cc:
#include <string>
using namespace std;
int main () {
string s;
}
>Fix:
Disable threads during configuration, or don't use -Wall ...
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list