HpMultiGrid.H: add default case to switch statements#1306
Closed
lucafedeli88 wants to merge 2 commits intoHi-PACE:developmentfrom
Closed
HpMultiGrid.H: add default case to switch statements#1306lucafedeli88 wants to merge 2 commits intoHi-PACE:developmentfrom
lucafedeli88 wants to merge 2 commits intoHi-PACE:developmentfrom
Conversation
Member
|
Here, system_type is only supposed to be 1, 2 or 3 so an amrex::Abort() would be more appropriate. The return 0 is just to get rid of compiler warnings. |
Contributor
Author
What about this solution? static constexpr int get_num_comps_acf (int system_type) {
switch (system_type) {
case 1:
return 1;
case 2:
return 2;
case 3:
return 0;
default:
amrex::Abort(std::to_string(system_type) + " is not a valid system_type!");
}
return 0; //unreachable
}
|
Contributor
Author
|
The content of this PR has been included in #1303 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the
defaultcase to the two switch statements inHpMultiGrid.H, in order to respect the followingclang-tidyrule:With this PR, almost all the checks of the
bugprone-*family inclang-tidy v20would pass, except:Of these, the first three are probably too annoying to enforce in HiPACE++, while I think that the last one can be useful.
constisconst)