public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Ulf Hermann <ulf.hermann@qt.io>
Cc: elfutils-devel@sourceware.org, jpewhacker@gmail.com
Subject: Re: [PATCH v2] Add fallthrough attributes
Date: Fri, 09 Feb 2018 09:27:00 -0000	[thread overview]
Message-ID: <20180209092655.GB3320@wildebeest.org> (raw)
In-Reply-To: <c4582486-df50-d783-6bab-ce91c372d7c8@qt.io>

On Fri, Feb 09, 2018 at 10:08:09AM +0100, Ulf Hermann wrote:
> > [...]
> > +#ifdef HAVE_FALLTHROUGH
> > +      __attribute__ ((fallthrough));
> > +#endif
> > [...]
> 
> I would like to see this stanza wrapped in a macro, so that we only have one "#ifdef HAVE_FALLTHROUGH" in the code, not another one in every place we want to fall through. See the "internal_function" macro defined in lib/eu-config.h for a similar case.

Agreed. Having 4 lines for a fallthrough instead of 1 is really too
much. Also could you explain a bit more why you would like this?
The advantage of the comments really is that they should work
everywhere.

If the comment really doesn't work in your situation maybe we could do
like gnulib did:
http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=11fdf80b21f2b40a10687b9a3d16c852b19d512c

The idea is that those versions of GCC that support
-Wimplicit-fallthrough also have support for the __attribute__
((fallthrough)) statement. So they can always be used together.

Cheers,

Mark

  reply	other threads:[~2018-02-09  9:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 22:57 [PATCH] " Joshua Watt
2018-02-08 23:30 ` [PATCH v2] " Joshua Watt
2018-02-09  9:08   ` Ulf Hermann
2018-02-09  9:27     ` Mark Wielaard [this message]
2018-02-09 14:19       ` Joshua Watt
2018-02-09 16:27   ` [PATCH v3] Use fallthrough attribute Joshua Watt
2018-02-10  2:26     ` Mark Wielaard
2018-02-10  3:36       ` Frank Ch. Eigler
2018-02-10 12:39         ` ChangeLog entries (Was: [PATCH v3] Use fallthrough attribute) Mark Wielaard
2018-02-12  9:34           ` Ulf Hermann

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=20180209092655.GB3320@wildebeest.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=jpewhacker@gmail.com \
    --cc=ulf.hermann@qt.io \
    /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).