public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/106569] New: enhancement: use STL algorithm instead of a raw loop
Date: Tue, 09 Aug 2022 07:43:09 +0000	[thread overview]
Message-ID: <bug-106569-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106569

            Bug ID: 106569
           Summary: enhancement: use STL algorithm instead of a raw loop
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Static analyser cppcheck can produce these style messages for gcc trunk source
code:

$ fgrep useStlAlgorithm cppcheck.20220809.out
trunk.git/gcc/analyzer/call-string.cc:169:9: style: Consider using
std::count_if algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/analyzer/constraint-manager.cc:2454:0: style: Consider using
std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/analyzer/region-model-manager.cc:1230:0: style: Consider using
std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/analyzer/region.cc:1245:0: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/cp/constexpr.cc:348:0: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/cp/constexpr.cc:5965:8: style: Consider using std::find_if
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/cp/constexpr.cc:8991:0: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/rtl-ssa/change-utils.h:28:0: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/rtl-ssa/blocks.cc:347:0: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/rtl-ssa/accesses.cc:1507:7: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/gcc/rtl-ssa/member-fns.inl:854:0: style: Consider using std::any_of
algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/libsanitizer/hwasan/hwasan_thread_list.h:120:20: style: Consider
using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
trunk.git/libsanitizer/hwasan/hwasan_report.cpp:293:0: style: Consider using
std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
$ 

None, some or all of these might be worth fixing.

I suspect it would not be worthwhile to implement this style warning in gcc.

             reply	other threads:[~2022-08-09  7:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  7:43 dcb314 at hotmail dot com [this message]
2022-08-09 13:50 ` [Bug c/106569] " rguenth at gcc dot gnu.org
2022-08-09 14:07 ` dcb314 at hotmail dot com
2022-08-09 18:23 ` marxin at gcc dot gnu.org
2022-08-09 18:57 ` dcb314 at hotmail dot com
2022-08-12 21:43 ` redi at gcc dot gnu.org
2022-08-12 21:44 ` redi at gcc dot gnu.org
2022-08-12 21:48 ` redi at gcc dot gnu.org
2022-08-12 22:28 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106569-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).