public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/94433] New: enhancement: 12 * constify some parameters
@ 2020-04-01 8:51 dcb314 at hotmail dot com
2020-09-28 20:21 ` [Bug analyzer/94433] " dmalcolm at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-04-01 8:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
Bug ID: 94433
Summary: enhancement: 12 * constify some parameters
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
>From today's run of cppcheck over the gcc trunk source code:
$ fgrep /analyzer/ cppcheck.20200401.out | fgrep constParameter
trunk.git/gcc/analyzer/diagnostic-manager.cc:289:49: style: Parameter 'v' can
be declared with const [constParameter]
trunk.git/gcc/analyzer/diagnostic-manager.cc:293:50: style: Parameter 'k1' can
be declared with const [constParameter]
trunk.git/gcc/analyzer/diagnostic-manager.cc:293:70: style: Parameter 'k2' can
be declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:414:49: style: Parameter 'k' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:420:50: style: Parameter 'k1' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:420:70: style: Parameter 'k2' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:484:49: style: Parameter 'k' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:490:50: style: Parameter 'k1' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:490:70: style: Parameter 'k2' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:551:49: style: Parameter 'k' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:557:50: style: Parameter 'k1' can be
declared with const [constParameter]
trunk.git/gcc/analyzer/exploded-graph.h:557:70: style: Parameter 'k2' can be
declared with const [constParameter]
Might be worth tidying up.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug analyzer/94433] enhancement: 12 * constify some parameters
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
@ 2020-09-28 20:21 ` dmalcolm at gcc dot gnu.org
2020-09-28 20:30 ` dcb314 at hotmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-09-28 20:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
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 &v)
291 │ {
292 │ return v->hash ();
293 │ }
294 │ static inline bool equal_keys (const key_type &k1, const key_type
&k2)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug analyzer/94433] enhancement: 12 * constify some parameters
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
2020-09-28 20:21 ` [Bug analyzer/94433] " dmalcolm at gcc dot gnu.org
@ 2020-09-28 20:30 ` dcb314 at hotmail dot com
2020-09-28 20:42 ` dmalcolm at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-09-28 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug analyzer/94433] enhancement: 12 * constify some parameters
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
2020-09-28 20:21 ` [Bug analyzer/94433] " dmalcolm at gcc dot gnu.org
2020-09-28 20:30 ` dcb314 at hotmail dot com
@ 2020-09-28 20:42 ` dmalcolm at gcc dot gnu.org
2020-09-29 0:02 ` dmalcolm at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-09-28 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-09-28
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks - with that I can reproduce the warnings from comment #0.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug analyzer/94433] enhancement: 12 * constify some parameters
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
` (2 preceding siblings ...)
2020-09-28 20:42 ` dmalcolm at gcc dot gnu.org
@ 2020-09-29 0:02 ` dmalcolm at gcc dot gnu.org
2020-09-29 6:47 ` dcb314 at hotmail dot com
2020-09-29 14:32 ` dmalcolm at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-09-29 0:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAITING
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug analyzer/94433] enhancement: 12 * constify some parameters
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
` (3 preceding siblings ...)
2020-09-29 0:02 ` dmalcolm at gcc dot gnu.org
@ 2020-09-29 6:47 ` dcb314 at hotmail dot com
2020-09-29 14:32 ` dmalcolm at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2020-09-29 6:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
(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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug analyzer/94433] enhancement: 12 * constify some parameters
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
` (4 preceding siblings ...)
2020-09-29 6:47 ` dcb314 at hotmail dot com
@ 2020-09-29 14:32 ` dmalcolm at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-09-29 14:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94433
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks. I took another look through the output, and nothing struck me as
serious, so I'm going to close this one out.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-29 14:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 8:51 [Bug analyzer/94433] New: enhancement: 12 * constify some parameters dcb314 at hotmail dot com
2020-09-28 20:21 ` [Bug analyzer/94433] " dmalcolm at gcc dot gnu.org
2020-09-28 20:30 ` dcb314 at hotmail dot com
2020-09-28 20:42 ` dmalcolm at gcc dot gnu.org
2020-09-29 0:02 ` dmalcolm at gcc dot gnu.org
2020-09-29 6:47 ` dcb314 at hotmail dot com
2020-09-29 14:32 ` dmalcolm at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).