c++/3363: Missing stl_config.h inclusion in stl_alloc.h

Grant Gould ggould@intouchsys.com
Fri Jun 22 06:26:00 GMT 2001


>Number:         3363
>Category:       c++
>Synopsis:       stl_alloc.h does not include stl_config.h, causing parse errors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 06:26:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Grant Gould
>Release:        3.0
>Organization:
Comverse Voice Solutions
>Environment:
System: SunOS curley.intouchsys.com 5.7 Generic_106541-15 sun4m sparc SUNW,SPARCstation-5
Architecture: sun4

	
host: sparc-sun-solaris2.7
build: sparc-sun-solaris2.7
target: sparc-sun-solaris2.7
configured with: ../gcc-3.0/configure 
>Description:
stl_alloc.h does not #include <bits/stl_config.h> and as a result does
not have the macro __STL_VOLATILE available to it.  This causes a
parse error at compile time for legal code which uses the STL.

>How-To-Repeat:

iostream.h is a good example of a header whose inclusion triggers the
problem.  With a newly-bootstrapped gcc, I compile hworld2.cpp:

#include <stdio.h>
#include <iostream.h>
int main(int argc, char **argv)
{
printf("Hello, World!\n");
}

As with many parse problems I get a huge pile of errors, the first and
only relevant of which is:

In file included from /usr/local/include/g++-v3/bits/std_memory.h:21,
                 from /usr/local/include/g++-v3/bits/std_string.h:43,
                 from /usr/local/include/g++-v3/bits/localefwd.h:42,
                 from /usr/local/include/g++-v3/bits/std_ios.h:43,
                 from /usr/local/include/g++-v3/bits/std_ostream.h:39,
                 from /usr/local/include/g++-v3/bits/std_iostream.h:40,
                 from /usr/local/include/g++-v3/backward/iostream.h:32,
                 from hworld2.cpp:2:
/usr/local/include/g++-v3/bits/stl_alloc.h:259: parse error before `[' token

(I get one of these for every appearance of the __STL_VOLATILE macro in
stl_alloc.h)

>Fix:

This is trivially fixed by adding:

#include <bits/stl_config.h>

near the beginning of stl_alloc.h; with this change, my hworld2.cpp
compiles and runs perfectly.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list