On Fri, 11 Oct 2024, Jakub Jelinek wrote:

> On Fri, Oct 11, 2024 at 02:19:08PM +0000, Joseph Myers wrote:
> > There should definitely be a test that -std=c23 -pedantic-errors gives 
> > errors for these constructs (I'd say also test that -std=c23 
> > -pedantic-errors -Wno-c23-c2y-compat doesn't diagnose them, while -std=c2y 
> > -Wc23-c2y-compat does).  Not yet reviewed the rest of the patch.
> 
> Added those now.  I've additionally added a testcase to make sure
> /* FALLTHRU */ comments don't break it (thankfully they don't, in that
> case just a flag is set on the label), but that revealed that there was
> a -Wunused-value warning if some labels are just used to name loops and
> used in break/continue statement and nowhere else.  And another test
> to make sure [[fallthrough]]; does break it, the labels before that aren't
> in the same labeled-statement anymore.

What happens with a statement attribute on the iteration or switch 
statement?

  label: [[]] for (;;) break label;

There are no standard statement attributes (and the only non-OMP one we 
handle is musttail, which isn't applicable on such statements) so this 
example uses [[]].  The wording in the paper about "is an iteration or 
switch statement" isn't wonderfully clear about the case of an iteration 
or switch statement with attributes on it (and while we discussed the 
pragma case in WG14, the attribute case wasn't mentioned).  Whatever we 
do, there should be an associated test.

>  /* Parse a statement, other than a labeled statement.  CHAIN is a vector
> @@ -7662,6 +7706,7 @@ c_parser_statement (c_parser *parser, bo
>  
>  static void
>  c_parser_statement_after_labels (c_parser *parser, bool *if_p,
> +                              tree before_labels,
>                                vec<tree> *chain, attr_state astate)

Should update the comment on this function to mention the new parameter.  
Likewise all other functions with this parameter added.

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to