Re: [PATCH] Set __STDC_VERSION__ for std89
Luc Van Oostenryck <[email protected]>
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <[email protected]> |
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