Re: [PATCH 7/7] teach sparse about C17

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

 




On 28/11/2019 20:42, Luc Van Oostenryck wrote:
> No real support is done here (or is needed) but the __STDC_VERSION__
> will return the correct value.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  lib.c | 13 +++++++++++++
>  lib.h |  2 ++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/lib.c b/lib.c
> index 7f7ca846b..8fddae450 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -1079,6 +1079,15 @@ static char **handle_switch_s(const char *arg, char **next)
>  		else if (!strcmp(arg, "gnu11"))
>  			standard = STANDARD_GNU11;
>  
> +		else if (!strcmp(arg, "c17") ||
> +			 !strcmp(arg, "c18") ||
> +			 !strcmp(arg, "iso9899:2017") ||
> +			 !strcmp(arg, "iso9899:2018"))
> +			standard = STANDARD_C17;
> +		else if (!strcmp(arg, "gnu17") ||
> +			 !strcmp(arg, "gnu18"))
> +			standard = STANDARD_GNU17;
> +

Yes, I knew about C17, but out of nowhere I started hearing
about C18! ;-) As far as I can tell, this is just C17, but
because it crept into 2018 before final approval, come people
are starting to call it C18. However, the __STDC_VERSION__
value is still 201710L, right?

ATB,
Ramsay Jones

>  		else
>  			die ("Unsupported C dialect");
>  	}
> @@ -1421,6 +1430,10 @@ static void predefined_macros(void)
>  	case STANDARD_GNU11:
>  		predefine("__STDC_VERSION__", 1, "201112L");
>  		break;
> +	case STANDARD_C17:
> +	case STANDARD_GNU17:
> +		predefine("__STDC_VERSION__", 1, "201710L");
> +		break;
>  	}
>  	if (!(standard & STANDARD_GNU) & (standard != STANDARD_NONE))
>  		predefine("__STRICT_ANSI__", 1, "1");
> diff --git a/lib.h b/lib.h
> index 7958359c1..3e565c6fd 100644
> --- a/lib.h
> +++ b/lib.h
> @@ -235,6 +235,8 @@ enum standard {
>  	STANDARD_GNU99 = STANDARD_C99 | STANDARD_GNU,
>  	STANDARD_C11,
>  	STANDARD_GNU11 = STANDARD_C11 | STANDARD_GNU,
> +	STANDARD_C17,
> +	STANDARD_GNU17 = STANDARD_C17 | STANDARD_GNU,
>  };
>  extern enum standard standard;
>  
> 



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux