This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Make more bad uses of fallthrough attribute into pedwarns
- From: Marek Polacek <polacek at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Nov 2019 18:27:38 -0500
- Subject: Re: Make more bad uses of fallthrough attribute into pedwarns
- References: <alpine.DEB.2.21.1911202315130.8373@digraph.polyomino.org.uk>
On Wed, Nov 20, 2019 at 11:15:56PM +0000, Joseph Myers wrote:
> Various bad uses of the [[fallthrough]] attribute are constraint
> violations in C2x, so need pedwarns rather than warnings.
>
> This patch duly turns the relevant warnings into pedwarns. The
> relevant code is not specific to C, and does not know which form the
> attribute was given in ([[fallthrough]] or [[gnu::fallthrough]] or
> __attribute__((fallthrough))), but as I understand it these usages are
> also erroneous for C++ and it seems reasonable to give a pedwarn here
> even when a form other than [[fallthrough]] is being used.
>
> The precise meaning of the standard wording about "The next statement
> that would be executed" seems a but unclear in some corner cases; the
> tests added keep to cases where it is clear whether or not the next
> statement executed is of the required form.
>
> Bootstrapped with no regressions for x86_64-pc-linux-gnu. OK to commit
> (the gimplify.c changes)?
Can't approve but as the author of the code in question, I think this is OK.
--
Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA