plumed / plumed2

Development version of plumed 2
https://www.plumed.org
GNU Lesser General Public License v3.0
324 stars 269 forks source link

Removing the should from Exception.h #1007

Closed Iximiel closed 6 months ago

Iximiel commented 6 months ago
Description

I encoundered a case i which the if (!(test)) plumed_error() << PLMD::Exception::Assertion(#test), the plumed_dbg_massert macro expansion with NDEBUG, is not optimized away, and this patch is the least invasive thing to do:

if constexpr(false) is guaranteed to be evaluated at compile time, so that the rest of the line is ignored.

I think helps in improving the code optimization after inlining a function, at least that is what I think it happened in my case

Target release

I would like my code to appear in release 2.10/2.9 (this is a single commit, it can be easily rebased on the 2.9)

Type of contribution
Copyright
Tests
codecov-commenter commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (9c3246e) 84.08% compared to head (72b139d) 84.08%. Report is 9 commits behind head on master.

:exclamation: Current head 72b139d differs from pull request most recent head 03074ed. Consider uploading reports for the commit 03074ed to get more accurate results

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1007 +/- ## ======================================= Coverage 84.08% 84.08% ======================================= Files 602 602 Lines 56246 56246 ======================================= Hits 47297 47297 Misses 8949 8949 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.