From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Elia Pinto <gitter.spiros@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Fixes compile warning with -Wimplicit-fallthrough CFLAGS
Date: Tue, 23 Jan 2018 13:37:31 -0500 [thread overview]
Message-ID: <20180123183731.GA18333@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqd120ifvu.fsf@gitster.mtv.corp.google.com>
On Tue, Jan 23, 2018 at 10:33:57AM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> >> diff --git a/apply.c b/apply.c
> >> index 321a9fa68..a22fb2881 100644
> >> --- a/apply.c
> >> +++ b/apply.c
> >> @@ -1450,7 +1450,7 @@ static void recount_diff(const char *line, int size, struct fragment *fragment)
> >> switch (*line) {
> >> case ' ': case '\n':
> >> newlines++;
> >> - /* fall through */
> >> + GIT_FALLTHROUGH;
> >
> > Ugh, the semi-colon there makes it look like it's actual code. If we go
> > this route, I wonder if it's worth hiding it inside the macro.
>
> What? You mean to shout in all caps without even terminating the
> line with any punctuation? Please don't---I am sure it will break
> auto indentation people rely on from their editors.
True, that may be even worse. I just wonder if we can do something to
make it look more obviously like a non-code attribute. The actual syntax
is something like:
[[fallthrough]];
which is pretty horrid, but at least a bit easier to see. gcc also
provides "__attribute__((fallthrough))", but I don't think it works with
clang.
I vastly prefer the comment approach if we can use it. Apparently clang
doesn't support it, but I have also not managed to get clang (either
version 4, 6, or the upcoming 7) to actually report anything via
-Wimplicit-fallthrough, either. Maybe I'm holding it wrong.
-Peff
next prev parent reply other threads:[~2018-01-23 18:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 23:51 [PATCH] Fixes compile warning with -Wimplicit-fallthrough CFLAGS Elia Pinto
2018-01-23 0:07 ` Jeff King
2018-01-23 18:33 ` Junio C Hamano
2018-01-23 18:37 ` Jeff King [this message]
2018-01-23 0:54 ` Eric Sunshine
2018-01-23 0:59 ` Jeff King
2018-01-23 6:31 ` Jacob Keller
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180123183731.GA18333@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=gitter.spiros@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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).