linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "George Spelvin" <linux@sciencehorizons.net>
To: geert@linux-m68k.org, linux@sciencehorizons.net,
	torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation
Date: 29 May 2016 15:07:12 -0400	[thread overview]
Message-ID: <20160529190712.14364.qmail@ns.sciencehorizons.net> (raw)
In-Reply-To: <20160529185355.12968.qmail@ns.sciencehorizons.net>

> But here's an alternative.  Geert, what do you think of this?

Never mind; that doesn't work.  Plain gcc-4.9 passes, it, but it's the
"-Wundef" flag that the kernel uses that triggers it.

So we're back to Geert's original suggestion.
Acked-by: George Spelvin <linux@sciencehorizons.net>

==>$ cat foo.c
#ifndef FOO
This is a test.
#elif FOO == 1
This is another test
#elif FOO + 0 == 1
who knows
#endif

==>$ gcc-6 -W -Wall -Wundef -E foo.c
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "foo.c"

This is a test.

==>$ gcc-4.9 -W -Wall -Wundef -E foo.c
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "foo.c"

foo.c:3:7: warning: "FOO" is not defined [-Wundef]
 #elif FOO == 1
       ^
foo.c:5:7: warning: "FOO" is not defined [-Wundef]
 #elif FOO + 0 == 1
       ^
This is a test.

  reply	other threads:[~2016-05-29 19:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-29 17:28 [PATCH 1/2] test/hash: Fix warning in two-dimensional array init Geert Uytterhoeven
2016-05-29 17:28 ` [PATCH 2/2] test/hash: Fix warning in preprocessor symbol evaluation Geert Uytterhoeven
2016-05-29 18:53   ` George Spelvin
2016-05-29 19:07     ` George Spelvin [this message]
2016-05-29 18:43 ` [PATCH 1/2] test/hash: Fix warning in two-dimensional array init George Spelvin

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=20160529190712.14364.qmail@ns.sciencehorizons.net \
    --to=linux@sciencehorizons.net \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 NNTP newsgroup(s).