Mail Archives: djgpp-workers/2012/09/11/09:16:47
On 09/11/2012 03:30 PM, Martin Strömberg wrote:
> According to Andris Pavenis:
>> -_STDC_VERSION__ is not defined in many cases any recent GCC version. It is only seems to be
>> defined in several cases depending on the command line parameter -std and for C language only
> ...
>> As the result tests used in header files like
>>
>> #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
>> || !defined(__STRICT_ANSI__)
>>
>> are invalid.
> Those tests aren't invalid. They are checking for __STDC_VERSION__ >=
> 199901L and not __STRICT_ANSI__.
>
> It's possible that old gcc was lying and claiming conformance where it
> wasn't.
>
> ...
>
>> Use of the broken test for __STDC_VERSION__ prevents libstdc++-v3 (GCC-4.8.0 development versions
>> from some last weeks) building OK due to actual contents of stdint.h being compiled out. Variant 1
> That seems to say that libstdc++-v3 requires standard comliance in the
> compiler. How about adding -std=c89/c99/whatever to libstdc++-v3's
> compile options?
>
>
> On the other hand I'm not sure I understand the problem properly so
> perhaps I'm totally wrong.
>
>
According to C standard drafts I have predefined macro __STDC_VERSION__
seems to mandatory.
It is however not defined in many cases by GCC as far as I have tested.
I do not know what would
be best way how to handle that for C
At least for C++ in last standard draft I have (I have not bought
released version document) in 16.8 is written
2 The following macro names are conditionally defined by the implementation:
_ _ STDC _ _
Whether _ _ STDC _ _ is predefined and if so, what its value is, are
implementation-defined.
_ _ STDC_MB_MIGHT_NEQ_WC _ _
The integer constant 1, intended to indicate that, in the encoding for
wchar_t, a member of the basic
character set need not have a code value equal to its value when used as
the lone character in an
ordinary character literal.
_ _ STDC_VERSION _ _
Whether _ _ STDC_VERSION _ _ is predefined and if so, what its value is,
are implementation-defined.
_ _ STDC_ISO_10646 _ _
An integer constant of the form yyyymmL (for example, 199712L). If this
symbol is defined, then every
character in the Unicode required set, when stored in an object of type
wchar_t, has the same value
as the short identifier of that character. The Unicode required set
consists of all the characters that
are defined by ISO/IEC 10646, along with all amendments and technical
corrigenda as of the specified
year and month.
That means that __STDC_VERSION__ is not required to be predefined for
C++ (if the draft is OK).
As the result I think we should include '|| defined(__cplusplus)' in
the condition
I'll check whether it fixes libstdc++ build problem in gcc-4.8.0
development versions later
Andris
- Raw text -