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

V2.6 some cppcheck fixes #595

Merged
merged 4 commits into from Jul 7, 2020
Merged

V2.6 some cppcheck fixes #595

merged 4 commits into from Jul 7, 2020

Conversation

GiovanniBussi
Copy link
Member

Description

I fixed some warnings that I obtained using cppcheck 2.1. I open a pull request so as to perform the full test set.

@gtribello one of the commits (4c25861) is a bit critical, since it might be a real bug. Can you double check? In case this is a bug, we can easily backport this change.

Target release

I would like my code to appear in release v2.6

Type of contribution
  • changes to code or doc authored by PLUMED developers
  • changes to a module not authored by you
  • new module contribution or edit of a module authored by you
Copyright
  • I agree to transfer the copyright of the code I have written to the PLUMED developers or to the author of the code I am modifying.
Tests
  • I added a new regtest or modified an existing regtest to validate my changes.
  • I verified that all regtests are passed successfully on Travis-CI. will wait for the full test set

found with cppcheck 2.1

cc: @valsson

[ves/MD_LinearExpansionPES.cpp:470] (warning) :nullPointerRedundantCheck: Either the condition 'if(coeffs_pntr)' is redundant or there is possible null pointer dereference: coeffs_pntr.
[ves/MD_LinearExpansionPES.cpp:480] (warning) :nullPointerRedundantCheck: Either the condition 'if(coeffs_pntr)' is redundant or there is possible null pointer dereference: coeffs_pntr.
found with cppcheck 2.1

[wrapper/Plumed.h:2692] (error) :uninitvar: Uninitialized variable: p
found with cppcheck 2.1

cc: @HanatoK

[drr/drrtool.cpp:207] (performance) :passedByValue: Function parameter 'a' should be passed by const reference.
[drr/drrtool.cpp:207] (performance) :passedByValue: Function parameter 'b' should be passed by const reference.
found with cppcheck 2.1

cc: @gtribello

[multicolvar/InPlaneDistances.cpp:110] (warning) :nullPointerRedundantCheck: Either the condition 'bt' is redundant or there is possible null pointer dereference: bt.

This looks like it might be a real bug! Should be checked and potentially backported if it's a bug fix.
@GiovanniBussi GiovanniBussi added this to the Version 2.6 milestone Jul 2, 2020
@valsson
Copy link
Contributor

valsson commented Jul 2, 2020

Hello @GiovanniBussi,

As I am concerned, you can even remove the "NOTE: this is always..." comment in src/ves/MD_LinearExpansionPES.cpp

Regards,
Omar

@codecov-commenter
Copy link

Codecov Report

Merging #595 into v2.6 will decrease coverage by 0.00%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             v2.6     #595      +/-   ##
==========================================
- Coverage   85.49%   85.48%   -0.01%     
==========================================
  Files         581      581              
  Lines       43271    43273       +2     
==========================================
+ Hits        36993    36994       +1     
- Misses       6278     6279       +1     
Impacted Files Coverage Δ
src/multicolvar/InPlaneDistances.cpp 19.14% <0.00%> (-0.42%) ⬇️
src/drr/drrtool.cpp 86.11% <100.00%> (ø)
src/ves/MD_LinearExpansionPES.cpp 96.75% <100.00%> (ø)
src/wrapper/Plumed.h 70.24% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7b501e...4c25861. Read the comment docs.

GiovanniBussi added a commit that referenced this pull request Jul 7, 2020
@GiovanniBussi GiovanniBussi merged commit 4c25861 into v2.6 Jul 7, 2020
@carlocamilloni carlocamilloni deleted the v2.6-some-cppcheck-fixes branch May 12, 2022 13:30
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.

None yet

5 participants