On Fri, Jul 29, 2016 at 10:58:28PM +0000, Joseph Myers wrote:
> On Fri, 22 Jul 2016, Marek Polacek wrote:
>
> > * I noticed that we don't diagnose e.g. '__attribute__((noreturn));' in
> > the C FE in certain contexts. Shouldn't be a showstopper though.
>
> Bug number? shadow_tag_warned is meant to diagnose empty declarations
> like that. (That attributes are ignored when they form the entire
> contents of the parentheses in a function declarator is a known and
> documented peculiarity.)
Actually, this was a problem in my previous version of this patch;
shadow_tag_warned indeed warns on such empty declarations. I've
fixed that now. Which means that for
if (i)
{
__attribute__((noreturn));
}
we'd issue "warning: empty declaration", with the -Wimplicit-fallthrough
patch we'd say
error: only attribute ‘fallthrough’ can be used before ‘;’
Not sure if error is appropriate here, or whether I should downgrade the
error to a warning and ignore the attribute.
With __attribute__((fallthrough)) the snippet above of course compiles
fine as this is a correct usage of the attribute on a null statement.
Marek