This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: stdio.h patches for g++ -std=c++11
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: zosrothko <zosrothko at orange dot fr>
- Cc: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 09 May 2014 11:03:55 +0100
- Subject: Re: stdio.h patches for g++ -std=c++11
- Authentication-results: sourceware.org; auth=none
- References: <5363D262 dot 6070602 at orange dot fr> <20140505125426 dot GB1732 at calimero dot vinschen dot de> <536B0680 dot 10208 at orange dot fr> <20140508082253 dot GA3536 at calimero dot vinschen dot de> <536C6D0D dot 102 at orange dot fr> <20140509084304 dot GA21821 at calimero dot vinschen dot de> <536CA76D dot 4070506 at orange dot fr>
On 09/05/14 11:01, zosrothko wrote:
> Corinna
> Le 09/05/2014 10:43, Corinna Vinschen a écrit :
>> On May 9 07:52, zosrothko wrote:
>>> Hi Corinna
>>>
>>> I made a typo in my previous patch. Here the corrected one.
>> Thanks. Your patches are missing a matching ChangeLog entry, btw.
>>
>> However, on second thought I'm not sure that removing the 'i' variations
>> of the functions from "__cplusplus >= 201103L" in this way is such a
>> good idea.
>>
>> The 'i' functions are a newlib extension for embedded targets.
>>
>> They are not part of any standard, so they are certainly neither part
>> of "__cplusplus >= 201103L", nor part of "__STDC_VERSION__ >= 199901L".
>>
>> So, either we remove these functions from both standards, or we include
>> them in both standards.
>>
>> But if we remove them from both standards when will they be defined at
>> all? This should be cleared up before making this change.
>>
>> Is defining them with only
>>
>> #if !defined(__STRICT_ANSI__)
>>
>> sufficient?
> That won't work because of this
>
> $ g++ -xc++ -std=c++11 -dM -E - < /dev/null | sort | grep ANSI
> #define __STRICT_ANSI__ 1
>
> $ g++ -xc++ -std=gnu++11 -dM -E - < /dev/null | sort | grep ANSI
>
> $
>
>
> g++ with -std=gnu++11 does not define __STRICT_ANSI__ while g++ -std=c++11 does and those previous printfs functions and only those should be defined for c++11. The other traditional stdio functions should be defined only for g++11 and for traditional C.
>
> People that does not care about compliance will use the gnu++11 version while those that cares about compliance must use the c++11 version and so should be aligned the printfs series from stdio.h
>
>
> Here at http://www.cplusplus.com/reference/clibrary/ is described which functions borrowed from C are included in the new c++11 standard. I worked for now only on the stdio.h functions but all includes should be checked against the strict compliance for c++11.
> zos
>
>
GNU++11 is C++11 with extensions. I don't see a problem with having the
i functions in that case.
R.
>
>
>>
>>
>> Corinna
>>
>>
>> P.S.: For the time being, I removed the fcloseall function from this
>> declaration block and made its decalration dependent on
>> __GNU_VISIBLE.
>>
>
>