From: Eric Gallager <egall@gwmail.gwu.edu>
To: David Malcolm <dmalcolm@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 00/10] Add 'final' and 'override' where missing
Date: Tue, 24 May 2022 23:29:55 -0400 [thread overview]
Message-ID: <CAMfHzOs0Qa-D6Zfh7=KKB30GcbYPqDqYDb3pCTbr5CFy5TwF_g@mail.gmail.com> (raw)
In-Reply-To: <20220523192834.3785673-1-dmalcolm@redhat.com>
On Mon, May 23, 2022 at 3:32 PM David Malcolm via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> With C++11 we can add "final" and "override" to the decls of vfuncs
> in derived classes, which documents to both human and automated readers
> of the code that a decl is intended to override a vfunc in a base class,
> and can help catch mistakes where we intended to override a vfunc, but
> messed up the prototypes.
>
> The following patch kit adds "final" and "override" specifiers to the
> decls of vfunc implementations throughout the source tree.
>
> I added "final override" everywhere where this was possible, or just
> "override" for the places where the overridden vfunc gets further
> overridden.
>
> I also removed "virtual" from such decls, since this isn't required
> when overriding an existing vfunc, and the "final override" better
> implies the intent of the code.
>
> I temporarily hacked -Werror=suggest-override into the Makefile whilst
> I was creating the patches, but I skipped the following:
>
> (a) gcc/d/dmd/ ...since these sources are copied from an upstream
> (b) gcc/go/gofrontend/ ...likewise
> (c) gcc/range.op.cc: as I believe this code is under heavy development
> (d) target-specific passes other than i386 (for ease of testing); I can
> do these in a followup, if desired.
>
> I didn't attempt to add -Wsuggest-override into our compile flags
> "properly".
Have you tried clang's -Winconsistent-missing-override flag for
comparison? I noticed some warnings from it when doing a build of gcc
trunk with clang just now.
>
> No functional changes intended.
>
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
>
> I split them up into separate patches by topic for ease of review, and
> for ease of writing the ChangeLog entries.
>
> Worth an update to https://gcc.gnu.org/codingconventions.html ?
>
> OK for trunk?
> Dave
>
> David Malcolm (10):
> Add 'final' and 'override' to opt_pass vfunc impls
> Add 'final' and 'override' on dom_walker vfunc impls
> expr.cc: use final/override on op_by_pieces_d vfuncs
> tree-switch-conversion.h: use final/override for cluster vfunc impls
> d: add 'final' and 'override' to gcc/d/*.cc 'visit' impls
> ipa: add 'final' and 'override' to call_summary_base vfunc impls
> value-relation.h: add 'final' and 'override' to relation_oracle vfunc
> impls
> i386: add 'final' and 'override' to scalar_chain vfunc impls
> tree-vect-slp-patterns.cc: add 'final' and 'override' to
> vect_pattern::build impls
> Add 'final' and 'override' in various places
>
> gcc/adjust-alignment.cc | 2 +-
> gcc/asan.cc | 19 ++++++---
> gcc/auto-inc-dec.cc | 4 +-
> gcc/auto-profile.cc | 8 ++--
> gcc/bb-reorder.cc | 12 +++---
> gcc/cfgcleanup.cc | 8 ++--
> gcc/cfgexpand.cc | 2 +-
> gcc/cfgrtl.cc | 6 +--
> gcc/cgraphbuild.cc | 13 +++---
> gcc/combine-stack-adj.cc | 4 +-
> gcc/combine.cc | 4 +-
> gcc/compare-elim.cc | 6 +--
> gcc/config/i386/i386-features.cc | 20 ++++-----
> gcc/config/i386/i386-features.h | 16 +++----
> gcc/coroutine-passes.cc | 8 ++--
> gcc/cp/cxx-pretty-print.h | 38 ++++++++---------
> gcc/cp/module.cc | 4 +-
> gcc/cprop.cc | 9 ++--
> gcc/cse.cc | 18 +++++---
> gcc/d/decl.cc | 36 ++++++++--------
> gcc/d/expr.cc | 2 +-
> gcc/d/toir.cc | 64 ++++++++++++++--------------
> gcc/d/typeinfo.cc | 34 +++++++--------
> gcc/d/types.cc | 30 ++++++-------
> gcc/dce.cc | 8 ++--
> gcc/df-core.cc | 10 ++---
> gcc/dse.cc | 14 ++++--
> gcc/dwarf2cfi.cc | 7 ++-
> gcc/early-remat.cc | 4 +-
> gcc/except.cc | 6 +--
> gcc/expr.cc | 14 +++---
> gcc/final.cc | 14 ++++--
> gcc/function.cc | 10 ++---
> gcc/fwprop.cc | 8 ++--
> gcc/gcse.cc | 14 ++++--
> gcc/genmatch.cc | 22 +++++-----
> gcc/gensupport.cc | 2 +-
> gcc/gimple-harden-conditionals.cc | 20 ++++++---
> gcc/gimple-if-to-switch.cc | 4 +-
> gcc/gimple-isel.cc | 4 +-
> gcc/gimple-laddress.cc | 6 +--
> gcc/gimple-loop-interchange.cc | 6 +--
> gcc/gimple-loop-jam.cc | 4 +-
> gcc/gimple-loop-versioning.cc | 7 ++-
> gcc/gimple-low.cc | 5 ++-
> gcc/gimple-range-cache.h | 4 +-
> gcc/gimple-ssa-backprop.cc | 6 +--
> gcc/gimple-ssa-evrp.cc | 6 +--
> gcc/gimple-ssa-isolate-paths.cc | 9 ++--
> gcc/gimple-ssa-nonnull-compare.cc | 4 +-
> gcc/gimple-ssa-split-paths.cc | 9 ++--
> gcc/gimple-ssa-store-merging.cc | 10 ++---
> gcc/gimple-ssa-strength-reduction.cc | 6 +--
> gcc/gimple-ssa-warn-access.cc | 8 ++--
> gcc/gimple-ssa-warn-alloca.cc | 8 ++--
> gcc/gimple-ssa-warn-restrict.cc | 4 +-
> gcc/gimple-warn-recursion.cc | 4 +-
> gcc/graphite.cc | 9 ++--
> gcc/ifcvt.cc | 12 +++---
> gcc/init-regs.cc | 4 +-
> gcc/ipa-comdats.cc | 4 +-
> gcc/ipa-cp.cc | 10 ++---
> gcc/ipa-devirt.cc | 8 ++--
> gcc/ipa-fnsummary.cc | 20 ++++++---
> gcc/ipa-fnsummary.h | 21 ++++-----
> gcc/ipa-free-lang-data.cc | 2 +-
> gcc/ipa-icf-gimple.h | 6 ++-
> gcc/ipa-icf.cc | 4 +-
> gcc/ipa-icf.h | 36 +++++++++-------
> gcc/ipa-inline.cc | 4 +-
> gcc/ipa-modref.cc | 48 ++++++++++-----------
> gcc/ipa-param-manipulation.cc | 8 ++--
> gcc/ipa-profile.cc | 10 ++---
> gcc/ipa-prop.cc | 4 +-
> gcc/ipa-prop.h | 26 +++++------
> gcc/ipa-pure-const.cc | 34 +++++++++------
> gcc/ipa-reference.cc | 14 +++---
> gcc/ipa-split.cc | 8 ++--
> gcc/ipa-sra.cc | 21 +++++----
> gcc/ipa-visibility.cc | 6 +--
> gcc/ipa.cc | 9 ++--
> gcc/ira.cc | 8 ++--
> gcc/jump.cc | 5 ++-
> gcc/loop-init.cc | 18 ++++----
> gcc/lower-subreg.cc | 16 ++++---
> gcc/lto/lto-dump.cc | 8 ++--
> gcc/mode-switching.cc | 6 +--
> gcc/modulo-sched.cc | 4 +-
> gcc/multiple_target.cc | 7 ++-
> gcc/omp-expand.cc | 14 ++++--
> gcc/omp-low.cc | 9 ++--
> gcc/omp-oacc-kernels-decompose.cc | 4 +-
> gcc/omp-oacc-neuter-broadcast.cc | 4 +-
> gcc/omp-offload.cc | 16 +++----
> gcc/omp-simd-clone.cc | 7 ++-
> gcc/passes.cc | 34 +++++++++------
> gcc/postreload-gcse.cc | 7 ++-
> gcc/postreload.cc | 7 ++-
> gcc/predict.cc | 13 +++---
> gcc/read-md.h | 2 +-
> gcc/read-rtl-function.cc | 6 +--
> gcc/recog.cc | 32 ++++++++------
> gcc/ree.cc | 7 ++-
> gcc/reg-stack.cc | 4 +-
> gcc/regcprop.cc | 4 +-
> gcc/reginfo.cc | 2 +-
> gcc/regrename.cc | 7 ++-
> gcc/reorg.cc | 8 ++--
> gcc/rtl-ssa/blocks.cc | 4 +-
> gcc/sancov.cc | 10 ++---
> gcc/sanopt.cc | 4 +-
> gcc/sched-rgn.cc | 19 +++++----
> gcc/stack-ptr-mod.cc | 2 +-
> gcc/store-motion.cc | 4 +-
> gcc/symbol-summary.h | 8 ++--
> gcc/symtab-thunks.cc | 8 ++--
> gcc/tracer.cc | 4 +-
> gcc/trans-mem.cc | 34 ++++++++++-----
> gcc/tree-call-cdce.cc | 4 +-
> gcc/tree-cfg.cc | 28 ++++++++----
> gcc/tree-cfgcleanup.cc | 6 +--
> gcc/tree-complex.cc | 14 ++++--
> gcc/tree-eh.cc | 23 +++++-----
> gcc/tree-emutls.cc | 7 ++-
> gcc/tree-if-conv.cc | 4 +-
> gcc/tree-into-ssa.cc | 14 +++---
> gcc/tree-loop-distribution.cc | 4 +-
> gcc/tree-nrv.cc | 6 +--
> gcc/tree-object-size.cc | 6 +--
> gcc/tree-parloops.cc | 11 +++--
> gcc/tree-predcom.cc | 8 ++--
> gcc/tree-profile.cc | 4 +-
> gcc/tree-sra.cc | 11 +++--
> gcc/tree-ssa-ccp.cc | 21 +++++----
> gcc/tree-ssa-copy.cc | 9 ++--
> gcc/tree-ssa-dce.cc | 14 +++---
> gcc/tree-ssa-dom.cc | 12 +++---
> gcc/tree-ssa-dse.cc | 6 +--
> gcc/tree-ssa-forwprop.cc | 6 +--
> gcc/tree-ssa-ifcombine.cc | 2 +-
> gcc/tree-ssa-loop-ch.cc | 14 +++---
> gcc/tree-ssa-loop-im.cc | 6 +--
> gcc/tree-ssa-loop-ivcanon.cc | 10 ++---
> gcc/tree-ssa-loop-prefetch.cc | 7 ++-
> gcc/tree-ssa-loop-split.cc | 4 +-
> gcc/tree-ssa-loop-unswitch.cc | 4 +-
> gcc/tree-ssa-loop.cc | 27 ++++++------
> gcc/tree-ssa-math-opts.cc | 17 +++++---
> gcc/tree-ssa-phiopt.cc | 19 +++++----
> gcc/tree-ssa-phiprop.cc | 4 +-
> gcc/tree-ssa-pre.cc | 4 +-
> gcc/tree-ssa-propagate.cc | 4 +-
> gcc/tree-ssa-reassoc.cc | 8 ++--
> gcc/tree-ssa-sccvn.cc | 16 +++----
> gcc/tree-ssa-sink.cc | 8 ++--
> gcc/tree-ssa-strlen.cc | 14 +++---
> gcc/tree-ssa-structalias.cc | 13 +++---
> gcc/tree-ssa-uncprop.cc | 10 ++---
> gcc/tree-ssa-uninit.cc | 13 +++---
> gcc/tree-ssanames.cc | 2 +-
> gcc/tree-stdarg.cc | 8 ++--
> gcc/tree-switch-conversion.cc | 15 ++++---
> gcc/tree-switch-conversion.h | 32 +++++++-------
> gcc/tree-tailcall.cc | 16 ++++---
> gcc/tree-vect-generic.cc | 11 +++--
> gcc/tree-vect-slp-patterns.cc | 12 +++---
> gcc/tree-vectorizer.cc | 26 ++++++-----
> gcc/tree-vrp.cc | 8 ++--
> gcc/tsan.cc | 10 ++---
> gcc/ubsan.cc | 4 +-
> gcc/value-relation.h | 38 +++++++++--------
> gcc/var-tracking.cc | 4 +-
> gcc/vtable-verify.cc | 4 +-
> gcc/web.cc | 4 +-
> 174 files changed, 1082 insertions(+), 852 deletions(-)
>
> --
> 2.26.3
>
prev parent reply other threads:[~2022-05-25 3:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 19:28 David Malcolm
2022-05-23 19:28 ` [PATCH 01/10] Add 'final' and 'override' to opt_pass vfunc impls David Malcolm
2022-06-13 18:22 ` PING: " David Malcolm
2022-06-24 18:08 ` PING^2: " David Malcolm
2022-06-24 18:45 ` Jeff Law
2022-06-27 21:16 ` David Malcolm
2022-05-23 19:28 ` [PATCH 02/10] Add 'final' and 'override' on dom_walker " David Malcolm
2022-06-13 18:23 ` PING " David Malcolm
2022-06-24 18:10 ` PING^2 " David Malcolm
2022-05-23 19:28 ` [PATCH 03/10] expr.cc: use final/override on op_by_pieces_d vfuncs David Malcolm
2022-06-13 18:25 ` PING: " David Malcolm
2022-06-24 18:12 ` PING^2 : " David Malcolm
2022-05-23 19:28 ` [PATCH 04/10] tree-switch-conversion.h: use final/override for cluster vfunc impls David Malcolm
2022-06-13 18:26 ` PING " David Malcolm
2022-06-24 18:14 ` PING^2 : " David Malcolm
2022-05-23 19:28 ` [PATCH 05/10] d: add 'final' and 'override' to gcc/d/*.cc 'visit' impls David Malcolm
2022-05-24 12:56 ` Iain Buclaw
2022-05-24 13:15 ` David Malcolm
2022-05-24 15:11 ` Iain Buclaw
2022-05-23 19:28 ` [PATCH 06/10] ipa: add 'final' and 'override' to call_summary_base vfunc impls David Malcolm
2022-05-24 7:36 ` Martin Liška
2022-05-23 19:28 ` [PATCH 07/10] value-relation.h: add 'final' and 'override' to relation_oracle " David Malcolm
2022-06-13 18:28 ` PING " David Malcolm
2022-06-14 0:45 ` Aldy Hernandez
2022-06-14 1:24 ` David Malcolm
2022-06-15 13:33 ` Andrew MacLeod
2022-06-15 21:58 ` David Malcolm
2022-05-23 19:28 ` [PATCH 08/10] i386: add 'final' and 'override' to scalar_chain " David Malcolm
2022-06-13 18:30 ` PING: " David Malcolm
2022-06-24 18:19 ` PING^2 : " David Malcolm
2022-06-24 20:58 ` Uros Bizjak
2022-06-27 21:25 ` David Malcolm
2022-08-16 8:55 ` [PATCH][pushed] i386: add 'final' and 'override' to scalar_chain Martin Liška
2022-05-23 19:28 ` [PATCH 09/10] tree-vect-slp-patterns.cc: add 'final' and 'override' to vect_pattern::build impls David Malcolm
2022-05-24 6:44 ` Richard Biener
2022-05-23 19:28 ` [PATCH 10/10] Add 'final' and 'override' in various places David Malcolm
2022-06-13 18:30 ` PING " David Malcolm
2022-06-24 18:20 ` PING^2: " David Malcolm
2022-05-25 3:29 ` Eric Gallager [this message]
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='CAMfHzOs0Qa-D6Zfh7=KKB30GcbYPqDqYDb3pCTbr5CFy5TwF_g@mail.gmail.com' \
--to=egall@gwmail.gwu.edu \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@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).