Skip to content
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

Fix the few most pressing warnings reported by -Wall #797

Merged
merged 7 commits into from
Apr 19, 2024

Conversation

PhilMiller
Copy link
Contributor

@PhilMiller PhilMiller commented Apr 19, 2024

Changes

  • Fix occurrences of -Wpessimizing-move reported by either GCC or AppleClang
  • Fix a mis-use of bitwise | instead of logical ||
  • Fix range-for loop over vector<string> working on values rather than references
  • Quiet some -Wmaybe-uninitialized by setting output-argument pointer variables to nullptr
  • Fix catching polymorphic boost::bad_get by value

Testing

  1. Local testing with GCC 13
  2. Local testing with AppleClang 15
  3. CI with GCC 11
  4. CI with AppleClang 14

Notes

This gets us a large portion of the way to being able to build with -Wall for C++

  • There are a lot of un/signed comparison warnings that I think we can reasonably suppress (-Wsign-compare)
  • There are some constructor initializer list warnings about orders not matching declarations, that we should probably just fix, but aren't a big deal
  • There are a bunch of unused variables and functions that should eventually be investigated and likely deleted
  • The BMI C++ spec misses a virtual destructor, so we get warnings about that until Class Bmi has virtual member functions, but no virtual destructor csdms/bmi-cxx#11 gets addressed, and we incorporate the fix in our modules (-Wnon-virtual-dtor)

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

@PhilMiller PhilMiller force-pushed the PhilMiller/top-warnings branch from 7cddc1e to cb9c041 Compare April 19, 2024 01:33
@PhilMiller
Copy link
Contributor Author

PhilMiller commented Apr 19, 2024

If we merge this, then the actual ngen code and its tests compiles with -Werror -Wall -Wno-reorder -Wno-unused -Wno-sign-compare on GCC 13. The others are less definitively problematic.

@PhilMiller PhilMiller force-pushed the PhilMiller/top-warnings branch from 991fb8e to be50209 Compare April 19, 2024 02:12
@PhilMiller PhilMiller marked this pull request as ready for review April 19, 2024 02:23
@PhilMiller PhilMiller force-pushed the PhilMiller/top-warnings branch from be50209 to 4f42f82 Compare April 19, 2024 02:34
@PhilMiller PhilMiller force-pushed the PhilMiller/top-warnings branch from 4f42f82 to 8a1eb1c Compare April 19, 2024 05:44
@PhilMiller
Copy link
Contributor Author

The selection of flags added to CI is based on which ones are available for both GCC and AppleClang. Otherwise, the build just fails with unrecognized command line arguments.

@PhilMiller PhilMiller merged commit fca4315 into NOAA-OWP:master Apr 19, 2024
19 checks passed
@PhilMiller PhilMiller deleted the PhilMiller/top-warnings branch April 19, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants