Minimize <iosfwd>

Benjamin Kosnik bkoz@redhat.com
Wed Apr 11 07:31:00 GMT 2007


> Excellent. Benjamin, I just went through the headers including <iosfwd> 
> and I'm pretty sure that removing from the latter <bits/c++locale.h> is 
> ok, basically because <bits/localefwd.h> takes care of including it 
> anyway. Very worst case, one/two headers may require adjustements. 
> That's very nice, because <bits/c++locale.h> alone is about two thirds 
> of <iosfwd>.

Yes, this is very cool I agree. Thanks for checking it in detail.

> Remains to be checked <bits/functexcept.h>, which is small anyway, and 
> finally the most delicate part, <bits/postypes.h>, but we could also 
> proceed incrementally, or better said, DEcrementally ;)

For postypes.h/fposfwd.h bits that use mbstate_t, I was thinking of 
moving all the bits around like so:

config/locale/generic/mbstate_t.h

Has include of cwchar if mbstate_t exists, else has the definition in 
cwchar.h. Ie, move that logic out to this file.

config/locale/gnu/mbstate_t.h

Has the __need_mbstate_t define and the include of cwchar, appropriate 
typedefs to std::mbstate_t

Of course, fposfwd.h includes bits/mbstate_t.h

Config-side, it will work much like CLOCALE_H in GLIBCXX_ENABLE_CLOCALE 
from acinclude.m4, with the resulting symlink to the correct mbstate_t.h 
being generated in include/Makefile.am as part of the host_headers rule. 
  (ie, like os_defines.h)

I hope this is clear enough. If not, as Paolo said, this could certainly 
be done incrementally where all but the #if glibc part of fposfwd.h is 
checked in from your orig patch, and #include cwchar is used for the 
time being.

best,
benjamin




More information about the Libstdc++ mailing list