Code sample:
int main(int argc, char **argv)
{
switch(argc)
{
case 0:
argc = 5;
__attribute__((fallthrough));
case 1:
break;
}
}
Using gcc 6.3.0, with -std=c11
only, this code gives a warning:
<source>: In function 'main':
7 : <source>:7:3: warning: empty declaration
__attribute__((fallthrough));
^~~~~~~~~~~~~
What is the correct way to use this without eliciting a warning?
fallthrough
is described. I'm thinking it's simply not supported for 6.3. The diagnostic is because GCC doesn't simply ignore the unknown attribute, and sees it as a declaration that violates this constraint – Attica