tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Add max_align_t to stddef.h and C11


From: Petr Skočík
Subject: Re: [Tinycc-devel] Add max_align_t to stddef.h and C11
Date: Tue, 8 Jan 2019 13:11:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

As for allowing features conditionally, there's no harm in always
allowing things like _Generic or _Alignof (always reserved identifiers).
The max_align_t could be defined and protected by an `#if
__STDC_VERSION__ >= 201101L` as long as -std= were changed so that
-std=c11 set that macro. I think there wouldn't be much harm in that
even when C11 support is incomplete, as long as users know that tinycc's
C11 support is incomplete.

One possible issue might be that somebody might do

   #if __STDC_VERSION__ >= 201101L
      //use a not yet supported C11 feature such as _Alignas
   #endif

so perhaps the macro controlling whether the max_align_t definition is
provided had better be an internal tcc macro (e.g.,
__TINYC_REQUESTED_STDC_VERSION__)  instead of the publicly known
__STDC_VERSION__.


Best regards,
Petr Skocik


On 1/8/19 7:51 AM, Christian Jullien wrote:
> Hi all,
> 
>  
> 
> Last commit made by Petr Skocik introduces definition of max_align_t
> which is ISO/IEC 9899:2011
> 
>  
> 
> p. 286
> 
> “max_align_t
> 
> which is an object type whose alignment is as great as is supported by
> the implementation in all contexts”
> 
>  
> 
> But, currently, tcc is supposed to implement C99 (ISO/IEC 9899:1999)
> 
>  
> 
>         printf("%d\n", __STDC_VERSION__); => 199901
> 
>  
> 
> Hence, it should not be defined.
> 
>  
> 
> Now the REAL question:
> 
> It is not clear to me which C version tcc implements. It’s an incomplete
> C99 implementation, it lacks for example complex.
> 
>  
> 
> As it pretend to be 199901, we should take care that “most” C99 are
> implemented.
> 
> New C11 features already implemented should be only available with a new
> flag (like –std=c11)
> 
>  
> 
> For example, here are the __STDC_ macros that a compiler C99 should use
> or test:
> 
>  
> 
>        __STDC__ macro, 6.10.8
> 
>        __STDC_CONSTANT_MACROS macro, 7.18.4
> 
>        __STDC_FORMAT_MACROS macro, 7.8.1
> 
>        __STDC_HOSTED__ macro, 6.10.8
> 
>        __STDC_IEC_559__ macro, 6.10.8, F.1
> 
>        __STDC_IEC_559_COMPLEX__ macro, 6.10.8, G.1
> 
>        __STDC_ISO_10646__ macro, 6.10.8
> 
>        __STDC_LIMIT_MACROS macro, 7.18.2, 7.18.3
> 
>        __STDC_VERSION__ macro, 6.10.8
> 
>  
> 
> When we introduce a new tcc feature we should take care for which C
> version it is and correctly protect its implementation when the right
> –std flag is set.
> 
>  
> 
> Wdyt?
> 
>  
> 
> C.
> 
> 
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]