Joe McDonnell created IMPALA-12668:
--------------------------------------

             Summary: Turn on Clang Tidy's 
clang-diagnostic-implicit-fallthrough check
                 Key: IMPALA-12668
                 URL: https://issues.apache.org/jira/browse/IMPALA-12668
             Project: IMPALA
          Issue Type: Improvement
          Components: Backend
    Affects Versions: Impala 4.4.0
            Reporter: Joe McDonnell


Clang Tidy's clang-diagnostic-implicit-fallthrough check find locations where a 
switch's case falls through without an annotation. i.e. something like this:
{noformat}
switch (foo) {
  case 'BAR':
    statement1;
  case 'BAZ':
    statement2;
    break;
}{noformat}
If foo == BAR, then it executes both statement1 and statement2. If that is 
intended, it should be explicit and C++17 introduces [[fallthrough]] as a way 
to indicate this:
{noformat}
switch (foo) {
  case 'BAR':
    statement1;
    [[fallthrough]];
  case 'BAZ':
    statement2;
    break;
}{noformat}
This check tends to find subtle issues with switch/case statements, and we've 
had bugs around this in the past. We should enable this Clang Tidy check.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to