This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH v2] Add fallthrough attributes
- From: Joshua Watt <jpewhacker at gmail dot com>
- To: Mark Wielaard <mark at klomp dot org>, Ulf Hermann <ulf dot hermann at qt dot io>
- Cc: elfutils-devel at sourceware dot org
- Date: Fri, 09 Feb 2018 08:19:19 -0600
- Subject: Re: [PATCH v2] Add fallthrough attributes
- Authentication-results: sourceware.org; auth=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:subject:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=JDIQY1ALHbhGMz5uRP4QA2K8ZIl02HZldoEUyphR2aQ=; b=TXLx7Bcqk5KisLbXWtav1ZBZ/EA0CuHhEdpfeFxUYdc4F+rC8cSTMwL2Wc6h46/vs2 sYYmB3jiQ/JhdPiap1a1UJTILhjkTU4/GMcUJULEGEx1KebPm+cpgTIYwyt5N2njOgbe rG0lMNmK94kYONVQHHvTzA+4N2xzb6N1BHlfEX/JWl0DN+K2dS6pjHusTJCoTY9IG4Lf II32wj9fcVHJglrcYvSwZU2qUOatZwqW9krDhe8iauEZZB2pOSKFjEEq5x0arM1m98qR cClVCCPoPdjyutC2NAKLWwrWvlb+MqAo52zQawGrTgl/VO6kSbOxiZBhR/Rb0UO12x2N R3GQ==
- References: <20180208225646.12036-1-JPEWhacker@gmail.com> <20180208233010.11395-1-JPEWhacker@gmail.com> <c4582486-df50-d783-6bab-ce91c372d7c8@qt.io> <20180209092655.GB3320@wildebeest.org>
On Fri, 2018-02-09 at 10:26 +0100, Mark Wielaard wrote:
> 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.
I'm attempting to build Yocto using Icecream to do distributed
compiling. Icecream pre-processes the file before sending it to the
remote compiling node, thus removing the comments and triggering the
error.
There is a fix in Icecream to allow it to not remove comments when pre-
processing, but it will be a while before that change (which hasn't
been released yet) trickles down to all the end Icecream users. I
figured making the change here wouldn't hurt in the meantime.
>
> 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=11fdf80b21f2b4
> 0a10687b9a3d16c852b19d512c
>
> 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.
Yes, that is cleaner and makes more sense. I will change my patch to do
that.
Thanks,
Joshua Watt
>
> Cheers,
>
> Mark