You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I compile with clang with -Werror=implicit-fallthrough in CFLAGS I get:
agrep.c:2710:4: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
2710 | case 'M':
| ^
agrep.c:2710:4: note: insert '__attribute__((fallthrough));' to silence this warning
2710 | case 'M':
| ^
| __attribute__((fallthrough));
agrep.c:2710:4: note: insert 'break;' to avoid fall-through
2710 | case 'M':
| ^
| break;
agrep.c:2713:4: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
2713 | case 'Z': break; /* no-op: used by glimpse */
| ^
agrep.c:2713:4: note: insert 'break;' to avoid fall-through
2713 | case 'Z': break; /* no-op: used by glimpse */
| ^
| break;
For both cases, please either add break; if its omission was unintentional or annotate the fallthrough if it was intentional (or indicate the intention in a comment in this issue so someone can submit a PR).
There are various syntaxes for how to annotate an intentional fallthrough depending on the compiler so if you are going that route you may need to define a macro for that. For example LLVM defines a macro like this (yours can probably be simpler since you can skip the C++ variants, however for older compilers you'll need to check first if __has_attribute exists):
Is the lack of
break;
in the'O'
and'M'
cases here intentional? They're undocumented (see #28) so I don't know how they're intended to function.agrep/agrep.c
Lines 2707 to 2713 in b7d180f
When I compile with clang with
-Werror=implicit-fallthrough
in CFLAGS I get:For both cases, please either add
break;
if its omission was unintentional or annotate the fallthrough if it was intentional (or indicate the intention in a comment in this issue so someone can submit a PR).There are various syntaxes for how to annotate an intentional fallthrough depending on the compiler so if you are going that route you may need to define a macro for that. For example LLVM defines a macro like this (yours can probably be simpler since you can skip the C++ variants, however for older compilers you'll need to check first if
__has_attribute
exists):The text was updated successfully, but these errors were encountered: