https://bugs.llvm.org/show_bug.cgi?id=51094

            Bug ID: 51094
           Summary: -Wimplicit-fallthrough needlessly warning about
                    unreachable code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangb...@nondot.org
          Reporter: keesc...@chromium.org
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

There are some places in the kernel where the "fallthrough;" annotation is used
after a portion of code that may get elided at build time:

case 1:
    if (something || !IS_ENALBED(CONFIG_SOMETHING))
        return blah;
    fallthrough;
case 2:
This looks like:

case 1:
    fallthrough;
case 2:
And a warning is generated:

warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]

But isn't a useful warning in this case, and should likely be silenced or
adjust to not warn where there was actually code there before getting elided.
At the least, this warning would be best moved to a separate flag so it can be
disabled on kernel builds (i.e. GCC does not warn about these cases).

Some specific examples:

https://github.com/ClangBuiltLinux/continuous-integration2/runs/3058126539?check_suite_focus=true#step:5:120
https://github.com/ClangBuiltLinux/continuous-integration2/runs/3058126329?check_suite_focus=true#step:5:92

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to