Do these two source file(i.e. include\c_std\cstdlib and include\c_global\cstdlib) serve for different purposes whereas they contain similar content?
Stephen M. Webb
stephen.webb@bregmasoft.ca
Thu Aug 13 13:59:29 GMT 2020
On 2020-08-13 09:53, Jonathan Wakely wrote:
> On 13/08/20 14:24 +0100, Jonathan Wakely wrote:
>> On 13/08/20 09:06 -0400, stephen.webb@bregmasoft.ca wrote:
>>>
>>> Quoting Jonathan Wakely via Libstdc++ <libstdc++@gcc.gnu.org>:
>>>
>>>> On 12/08/20 20:15 +0800, 孙世龙 sunshilong via Libstdc++ wrote:
>>>>> Hi, list
>>>>>
>>>>> These two source files (i.e. include\c_std\cstdlib and
>>>>> include\c_global\cstdlib) have almost same content.
>>>>> What is their own role?
>>>>> Do these two source files serve for different purposes whereas they
>>>>> contain similar content?
>>>>
>>>> You can ignore the c_std one.
>>>>
>>>> The headers in that directory are only used if you build gcc with
>>>> --enable-cheaders=c_std but nobody does that, and they aren't properly
>>>> maintained any more, and they probably don't work.
>>>
>>> To answer the first question, the c_std and c_global set up was to accommodate the fact that some target systems had
>>> C++ support in their libc system headers by putting symbols in the std:: namespace requiring their symbols to be
>>> hoisted into the global namespace in the <c...> headers (the c_std strategy), and some had only support for the C
>>> language and all their symbols were already in the global namespace (the c_global strategy). I don't believe any of
>>> the former systems (eg. Solaris 8) are supported by GCC any more.
>>
>> But if you look at the include/c_std/ headers, they all pull symbols
>> from the global namespace into namespace std ... exactly like the
>> c_global ones.
>>
>> I agree that the intended behaviour was what you describe, but I don't
>> think it ever actually worked, and I don't think any targets using
>> --enable-cheaders=c_std have ever existed.
>
> We also have the include/c/cxxx headers, which assume that the libc
> headers put the names in *both* the global namespace and namespace
> std. QNX uses that (see configure.host).
>
> We should probably deprecate the --enable-cheaders=c_std configure
> option and eventually remove those headers. We could make the
> configure option give an error for c_std unless something like
> --enable-cheaders-obsolete is also used.
Well, it did work at one time (about 20 years ago) and Solaris 8 was real. I can't account for what happened since then
but that's the background story. Also, QNX definitely hasn't put symbols in both namespaces for many many years. I have
absolutely no problem with the split-headers being backed out at this point.
--
Stephen M. Webb <stephen.webb@bregmasoft.ca>
More information about the Libstdc++
mailing list