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: Christian Jullien
Subject: Re: [Tinycc-devel] Add max_align_t to stddef.h and C11
Date: Tue, 8 Jan 2019 14:35:38 +0100

IMHO,

The right solution is to start to implement C11 features and surround them
with right #if _STDC_VERSION >= xxx.
This is how gcc/Linux handle differences between C/C++/POSIX/...

Even gcc is not totally fair when it claims it supports a given version.

I spent several hours to figure out why my -std=c++11 regexp always returned
false with gcc 4.8.2 until I discovered that <regexp> and all API was
present ... BUT NOT IMPLEMENTED and all calls where returning error!!!

I personally vote in favor of -std=c11 new option which supports ... only
what is actually implemented (without complex for instance).

What other maintainers think about by opinion?

C.

-----Original Message-----
From: Tinycc-devel [mailto:address@hidden
On Behalf Of Petr Skocík
Sent: mardi 8 janvier 2019 12:38
To: address@hidden
Subject: Re: [Tinycc-devel] Add max_align_t to stddef.h and C11

Hi,

adding that one line was bad snap judgment on my part. I didn't realize
max_align_t was C11 and since C99 doesn't appear to properly reserve all
*_t names (out of C99, only {,u}int*_t names are reserved (by
stdint.h)), let's revert it.

tinycc supports some C11 features like _Generic, but since _Generic is a
reserved word in all contexts, there are no name conflicts. max_align_t
is conflicting, IMO.

I've reverted the patch.
Thanks.

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
> 


_______________________________________________
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]