public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112373] New: cppcheck: libcpp/charset.cc: 3 * obvious performance issue
@ 2023-11-03 19:40 dcb314 at hotmail dot com
2023-11-03 20:03 ` [Bug c/112373] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: dcb314 at hotmail dot com @ 2023-11-03 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112373
Bug ID: 112373
Summary: cppcheck: libcpp/charset.cc: 3 * obvious performance
issue
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
A recent run of static analyser cppcheck over the source code
of gcc trunk produces the following:
libcpp/charset.cc:1908:56: performance: Function parameter 'cvt' should be
passed by const reference. [passedByValue]
libcpp/charset.cc:1962:55: performance: Function parameter 'cvt' should be
passed by const reference. [passedByValue]
libcpp/charset.cc:2063:55: performance: Function parameter 'cvt' should be
passed by const reference. [passedByValue]
The first one is
tatic void
emit_numeric_escape (cpp_reader *pfile, cppchar_t n,
struct _cpp_strbuf *tbuf, struct cset_converter cvt)
Suggest code rework.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/112373] cppcheck: libcpp/charset.cc: 3 * obvious performance issue
2023-11-03 19:40 [Bug c/112373] New: cppcheck: libcpp/charset.cc: 3 * obvious performance issue dcb314 at hotmail dot com
@ 2023-11-03 20:03 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-03 20:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112373
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-11-03
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The struct is:
struct cset_converter
{
convert_f func;
iconv_t cd;
int width;
const char* from;
const char* to;
};
So it's not too expensive to copy, but const cset_converter& would indeed be
cheaper.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-03 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03 19:40 [Bug c/112373] New: cppcheck: libcpp/charset.cc: 3 * obvious performance issue dcb314 at hotmail dot com
2023-11-03 20:03 ` [Bug c/112373] " redi 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).