smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: dan.carpenter@oracle.com, smatch@vger.kernel.org
Subject: Re: [PATCH] Set __STDC_VERSION__ for std89
Date: Thu, 23 Jul 2020 02:11:11 +0200	[thread overview]
Message-ID: <20200723001111.lf3fp2oqrjzzb7wb@ltop.local> (raw)
In-Reply-To: <20200722235306.2970314-1-gwendal@chromium.org>

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

      reply	other threads:[~2020-07-23  0:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 23:53 [PATCH] Set __STDC_VERSION__ for std89 Gwendal Grignou
2020-07-23  0:11 ` Luc Van Oostenryck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200723001111.lf3fp2oqrjzzb7wb@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gwendal@chromium.org \
    --cc=smatch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).