[Bug analyzer/94433] enhancement: 12 * constify some parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433 David Malcolm changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |FIXED --- Comment #6 from David Malcolm --- Thanks. I took another look through the output, and nothing struck me as serious, so I'm going to close this one out.
[Bug analyzer/94433] enhancement: 12 * constify some parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433 --- Comment #5 from David Binderman --- (In reply to David Malcolm from comment #4) > However I'm confused by the "can be declared with const [constParameter]" > warnings in comment #0 - they look const to me. What are these messages > trying to tell me, and how would I fix them? (could they be false > positives?) > > Any ideas? If the tool is telling you they can be declared with const and they are already const, then that looks like a false positive to me. cppcheck isn't perfect. I checked diagnostic-manager.cc and exploded-graph.h and I think they are false positives.
[Bug analyzer/94433] enhancement: 12 * constify some parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433 David Malcolm changed: What|Removed |Added Status|ASSIGNED|WAITING --- Comment #4 from David Malcolm --- Thanks again for your help with getting cppcheck running. I found some issues with cppcheck and committed these fixes: g:20d16d61dd22a9bfb66d5c4a383d193037e8f16d (unused field) g:c0ed6afef7897f32dc199da9a5430664fcbb61bb (missing "final override" on some vfuncs) However I'm confused by the "can be declared with const [constParameter]" warnings in comment #0 - they look const to me. What are these messages trying to tell me, and how would I fix them? (could they be false positives?) Any ideas?
[Bug analyzer/94433] enhancement: 12 * constify some parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433 David Malcolm changed: What|Removed |Added Last reconfirmed||2020-09-28 Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 --- Comment #3 from David Malcolm --- Thanks - with that I can reproduce the warnings from comment #0.
[Bug analyzer/94433] enhancement: 12 * constify some parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433 --- Comment #2 from David Binderman --- I use something like cppcheck --enable=all --language=c++ trunk.git/gcc/analyzer/*.{h,cc} This seems to work to me, although my copy of cppcheck is a hand tweeked version of their development code.
[Bug analyzer/94433] enhancement: 12 * constify some parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433 --- Comment #1 from David Malcolm --- Thanks for filing this. I've been attempting to reproduce this, but I'm not getting any warnings out of cppcheck. That said, looking at git show a96f1c38a787fbc847cb014d4b094e2787d539a7:gcc/analyzer/diagnostic-manager.cc (to get the version for the bug was filed) the first few warnings in comment #0 seem to be on class dedupe_hash_map_traits: 289 │ static inline hashval_t hash (const key_type ) 291 │ { 292 │ return v->hash (); 293 │ } 294 │ static inline bool equal_keys (const key_type , const key_type ) 295 │ { 296 │ return *k1 == *k2; 297 │ } where key_type is: 286 │ typedef const dedupe_key *key_type; and I don't think the above code has changed since then. Is there a good way to invoke cppcheck on GCC? I'm naively trying "cppcheck gcc/analyzer" and passing in -I options, and am not getting any warnings.