Skip to content

[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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xezon
Copy link

@xezon xezon commented Jun 19, 2025

This change annotates fallthroughs in GameEngine to suppress warnings and make the intent clear.

GeneralsMD\Code\GameEngine\Source\Common\RandomValue.cpp(387): warning C26819: Unannotated fallthrough between switch labels (es.78).

@xezon xezon added this to the Code foundation build up milestone Jun 19, 2025
@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Improves the structure of the code, with negligible changes in function. labels Jun 19, 2025
@xezon xezon force-pushed the xezon/staticanalysis/001 branch from 812d386 to d88e895 Compare June 20, 2025 07:26
Copy link

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, only a few things that seem odd.

case CHINA_FRIEND:
side.set("China");
break;
case GLA_ENEMY:
isFriend = FALSE;
isFriend = FALSE;
Copy link

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.

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's a tab after it in the original line.

Comment on lines 941 to 942
case SCORESCALEUPTRANSITION_2:
case SCORESCALEUPTRANSITION_3:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised it does not warn about these cases falling through.

Comment on lines +642 to 644
FALLTHROUGH;
case 2:
break;
Copy link

Choose a reason for hiding this comment

The 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.

Comment on lines +145 to 148
FALLTHROUGH;

case FLASHTRANSITION_FADE_IN_2:
case FLASHTRANSITION_FADE_IN_3:
Copy link

Choose a reason for hiding this comment

The 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Severity: Minor < Major < Critical < Blocker Refactor Improves the structure of the code, with negligible changes in function.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants