-
Notifications
You must be signed in to change notification settings - Fork 74
[GEN][ZH] Annotate fallthrough between various switch case labels #1085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,8 @@ void FlashTransition::update( Int frame ) | |
} // end if | ||
|
||
} | ||
FALLTHROUGH; | ||
|
||
case FLASHTRANSITION_FADE_IN_2: | ||
case FLASHTRANSITION_FADE_IN_3: | ||
{ | ||
|
@@ -810,8 +812,8 @@ void ScaleUpTransition::update( Int frame ) | |
TheAudio->addAudioEvent( &buttonClick ); | ||
} // end if | ||
|
||
|
||
} | ||
FALLTHROUGH; | ||
|
||
case SCALEUPTRANSITION_2: | ||
case SCALEUPTRANSITION_3: | ||
|
@@ -933,8 +935,8 @@ void ScoreScaleUpTransition::update( Int frame ) | |
TheAudio->addAudioEvent( &buttonClick ); | ||
} // end if | ||
|
||
|
||
} | ||
FALLTHROUGH; | ||
|
||
case SCORESCALEUPTRANSITION_2: | ||
case SCORESCALEUPTRANSITION_3: | ||
Comment on lines
941
to
942
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am surprised it does not warn about these cases falling through. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -630,6 +630,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w | |
} | ||
|
||
state = 1; | ||
FALLTHROUGH; | ||
case 1: | ||
if ( ( ch >= 'a' && ch <= 'z') || ( ch >= 'A' && ch <='Z') || (ch >= '0' && ch <= '9') || ch == '_' ) | ||
{ | ||
|
@@ -638,6 +639,7 @@ void GameTextManager::readToEndOfQuote( File *file, Char *in, Char *out, Char *w | |
break; | ||
} | ||
state = 2; | ||
FALLTHROUGH; | ||
case 2: | ||
break; | ||
Comment on lines
+642
to
644
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. State is not used outside of this function so this seems a bit redundant, case 2 could be removed and a break added at the end of case 1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are probably right. I think the change as is is sufficient for now, so it is in line with the title of this change. |
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,8 @@ void FlashTransition::update( Int frame ) | |
} // end if | ||
|
||
} | ||
FALLTHROUGH; | ||
|
||
case FLASHTRANSITION_FADE_IN_2: | ||
case FLASHTRANSITION_FADE_IN_3: | ||
Comment on lines
+145
to
148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the score scaleup, im surprised it does not complain here, unless it just optimises away empty cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it looks like the static analyzer does not care about the fallthrough annotation when there is no body behind the switch case label. It is a very common pattern and I think fallthrough is expected implicitly in this case, so requires no annotation to be clear. |
||
{ | ||
|
@@ -810,8 +812,8 @@ void ScaleUpTransition::update( Int frame ) | |
TheAudio->addAudioEvent( &buttonClick ); | ||
} // end if | ||
|
||
|
||
} | ||
FALLTHROUGH; | ||
|
||
case SCALEUPTRANSITION_2: | ||
case SCALEUPTRANSITION_3: | ||
|
@@ -933,8 +935,8 @@ void ScoreScaleUpTransition::update( Int frame ) | |
TheAudio->addAudioEvent( &buttonClick ); | ||
} // end if | ||
|
||
|
||
} | ||
FALLTHROUGH; | ||
|
||
case SCORESCALEUPTRANSITION_2: | ||
case SCORESCALEUPTRANSITION_3: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems odd that it thinks there was a change here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a tab after it in the original line.