Powered by Linux
Re: [PATCH] Set __STDC_VERSION__ for std89 — Semantic Matching Tool

Re: [PATCH] Set __STDC_VERSION__ for std89

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

 



On Wed, Jul 22, 2020 at 04:53:06PM -0700, Gwendal Grignou wrote:
> When kernel is compiled with clang and smatch is used for checking,
> option -std=gnu89 is used and STDC_VERSION is not defined, causing
> the following warnings for every file checked:

GCC also doesn't define __STDC_VERSION__ for -std=c89 (or c90).
The first time __STDC_VERSION__ is defined in the standard was for
C89's first amendment, the so-called 'AMD1' or 'C94'.
 
> 
> diff --git a/lib.c b/lib.c
> index ad71f08e..4dd0c8e5 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -1229,6 +1229,7 @@ static void predefined_macros(void)
>  		break;
>  
>  	case STANDARD_GNU89:
> +		predefine("__STDC_VERSION__", 1, "199901L");

This would anyway not be correct for C89/C90: it's the value
used for c99 (1999 + 01).

-- Luc



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux