Skip to content

CppCheck: Fix remaining warnings#11562

Merged
mitchute merged 18 commits intodevelopfrom
cppcheck_final
May 5, 2026
Merged

CppCheck: Fix remaining warnings#11562
mitchute merged 18 commits intodevelopfrom
cppcheck_final

Conversation

@dareumnam
Copy link
Copy Markdown
Collaborator

@dareumnam dareumnam commented May 1, 2026

Pull request overview

  • Fix the following CppCheck warnings:
    • unpreciseMathCall
    • uninitvar
    • constVariablePointer
    • duplicateCondition
    • cstyleCast
    • redundantAssignment
    • redundantInitialization
    • useInitializationList
    • unmatchedSuppression
    • stlIfStrFind
    • arrayIndexThenCheck
    • uselessAssignmentArg
    • noExplicitConstructor
    • shadowVariable
    • constVariablePointer
    • unreadVariable and etc

Description of the purpose of this PR

Pull Request Author

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies
  • If adding/removing any output files (e.g., eplustbl.*)
    • Update ..\scripts\Epl-run.bat
    • Update ..\scripts\RunEPlus.bat
    • Update ..\src\EPLaunch\ MainModule.bas, epl-ui.frm, and epl.vbp (VersionComments)
    • Update ...github\workflows\energyplus.py

Reviewer

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@dareumnam dareumnam added the DoNotPublish Includes changes that shouldn't be reported in the changelog label May 1, 2026
auto &vrfTU = state.dataHVACVarRefFlow->VRFTU(TUIndex);
if (vrfTU.CoolCoilIndex > 0) {
DXCoilCap = DXCoils::GetCoilCapacityByIndexType(state, vrfTU.CoolCoilIndex, vrfTU.coolCoilType, errFlag);
auto &vrfTUIndex = state.dataHVACVarRefFlow->VRFTU(TUIndex);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why? the variable is a terminal unit object, not a terminal unit index.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This was addressed here: 3ea96c6

@dareumnam dareumnam marked this pull request as draft May 1, 2026 14:52
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

⚠️ Regressions detected on macos-14 for commit 5d18b95

Regression Summary
  • ESO Small Diffs: 258
  • EIO: 205
  • MTR Small Diffs: 211
  • Table Small Diffs: 150
  • Table String Diffs: 23
  • JSON Small Diffs: 1
  • Table Big Diffs: 8
  • ERR: 6
  • MTR Big Diffs: 1
  • EDD: 2
  • ESO Big Diffs: 2
  • JSON Big Diffs: 1

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

⚠️ Regressions detected on ubuntu-24.04 for commit 5d18b95

Regression Summary
  • ESO Small Diffs: 256
  • EIO: 201
  • MTR Small Diffs: 209
  • Table Small Diffs: 147
  • Table String Diffs: 26
  • JSON Small Diffs: 2
  • Table Big Diffs: 9
  • ERR: 6
  • MTR Big Diffs: 1
  • EDD: 1
  • ESO Big Diffs: 3

@mitchute
Copy link
Copy Markdown
Collaborator

mitchute commented May 5, 2026

@dareumnam I reverted the std::log1p and std::expm1 changes. From my local testing, these appear to be what is causing the diffs. I think they should be equivalent to what you did, so I don't have an explanation for the behavior at the moment. If this comes back clean, we can just address the other review comments, and then merge it and move on.

@mitchute mitchute marked this pull request as ready for review May 5, 2026 16:08
@mitchute
Copy link
Copy Markdown
Collaborator

mitchute commented May 5, 2026

Thanks @dareumnam. This is ready to go. Merging.

@mitchute mitchute merged commit 791a77a into develop May 5, 2026
11 checks passed
@mitchute mitchute deleted the cppcheck_final branch May 5, 2026 16:09
@dareumnam
Copy link
Copy Markdown
Collaborator Author

Thanks, @mitchute. I'll double-check the rest of the issues. If any of them need to be fixed, I'll make one last follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DoNotPublish Includes changes that shouldn't be reported in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants