From: Simon Wunderlich <sw@simonwunderlich.de>
To: Philipp Psurek <philipp.psurek@gmail.com>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: suppress implicit-fallthrough compiler warning
Date: Tue, 13 Jun 2017 10:48:57 +0200 [thread overview]
Message-ID: <4393196.oYPnlPzS5o@prime> (raw)
In-Reply-To: <20170613082600.24910-3-philipp.psurek@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]
On Tuesday, June 13, 2017 10:26:00 AM CEST Philipp Psurek wrote:
> GCC 7.1.0 complains about an intended fallthrough.
> “__attribute__ ((fallthrough))” in this part of code would suppress this
> warning. Because older GCC compiler don’t understand this statement
> attribute and because there is already a comment in the source containing
> “falls?[ \t-]*thr(ough|u)” we can suppress the warning with the
> “-Wimplicit-fallthrough=2” warning option. Unintended fallthroughs without a
> comment will trigger this warning.
>
> Older GCC compiler don’t understand this warning option and exits with
> error. There has to be a compiler recognition after that only GCC =>7.1.0
> receives this option.
>
> Signed-off-by: Philipp Psurek <philipp.psurek@gmail.com>
> ---
> Makefile | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 6bebb7d..29b7e2f 100755
> --- a/Makefile
> +++ b/Makefile
> @@ -101,6 +101,11 @@ MKDIR ?= mkdir -p
> COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
> LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH)
>
> +# Check for GCC >=7
> +ifeq ($(shell $(CC) -x c++ --std=c++17 -E -P - <<< __cplusplus),201703L)
> + CFLAGS += -Wimplicit-fallthrough=2
> +endif
> +
Hmm, I don't like this one too much, since it looks cryptic and we will have
to add up new versions, which I'd like to avoid.
Did you try to change the wording? I've googled a bit and it seems a comment
containing the wording "fallthrough" will avoid it. Maybe we should just
change "fall through" to "fallthrough"?
Thanks,
Simon
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-13 8:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 17:09 [B.A.T.M.A.N.] [batctl] compiling with gcc 7.1.0: there are some notes and warnings Philipp Psurek
2017-06-01 8:34 ` Simon Wunderlich
2017-06-03 2:14 ` Philipp Psurek
2017-06-03 3:12 ` [B.A.T.M.A.N.] [PATCH] batctl: suppress implicit-fallthrough compiler warning Philipp Psurek
2017-06-03 10:13 ` Philipp Psurek
2017-06-03 10:31 ` Philipp Psurek
2017-06-03 3:40 ` [B.A.T.M.A.N.] [PATCH] batctl: change PATH_BUFF_LEN to maximal possible value Philipp Psurek
2017-06-13 8:25 ` [B.A.T.M.A.N.] [batctl] compiling with gcc 7.1.0: there are some notes and warnings Philipp Psurek
2017-06-13 8:25 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: change PATH_BUFF_LEN to maximal possible value Philipp Psurek
2017-06-13 8:49 ` Simon Wunderlich
2017-06-13 8:26 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: suppress implicit-fallthrough compiler warning Philipp Psurek
2017-06-13 8:48 ` Simon Wunderlich [this message]
2017-06-13 10:39 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: suppress implicit-fallthrough compiler Philipp Psurek
2017-06-13 10:39 ` [B.A.T.M.A.N.] [PATCH] batctl: suppress implicit-fallthrough compiler warning Philipp Psurek
2017-06-13 11:08 ` [B.A.T.M.A.N.] [PATCH 2/2] " Philipp Psurek
2017-06-13 11:08 ` [B.A.T.M.A.N.] [PATCH] " Philipp Psurek
2017-06-13 11:46 ` Simon Wunderlich
2017-06-13 11:53 ` Sven Eckelmann
2017-06-13 11:55 ` Sven Eckelmann
2017-06-13 12:25 ` Philipp Psurek
2017-06-13 8:42 ` [B.A.T.M.A.N.] [batctl] compiling with gcc 7.1.0: there are some notes and warnings Simon Wunderlich
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=4393196.oYPnlPzS5o@prime \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=philipp.psurek@gmail.com \
/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