From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) by sourceware.org (Postfix) with ESMTPS id A6C1F3857BBB for ; Wed, 25 May 2022 03:30:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A6C1F3857BBB Received: by mail-vs1-xe2e.google.com with SMTP id m2so20141456vsr.8 for ; Tue, 24 May 2022 20:30:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FyXGxGMV6dd1axwiTeLt6XvTtH5F4dDrLzjFaU75wy0=; b=6TqxA4WEHjtFZGjz9G34sXWiUIeG3cGg4cI9t/MwQQ5NlmFGPH9h8PeFsn0gcmiVtD BBadPt0gc3U+8sIKpGghjv/z6cpTXefsdFNiCDSfUxtytnU+EOrRo61mtD0lSR+XND0x aZe47TsaZpCvNHsGSXKMqSARmcEgdlEafx/kF4bJnkXmp1yN4AZe7kUYGEGpMLCCwzFn rzc9+0wbNjdjgjAMGykX2e5N3xeCHSS62VBxLeP71v3zWP+Y6xcrBMBqU4wSdS0Ep2PH MfBEqPZOLKYIlqN9MSNBuByxc3fsH0WjReCsmqjrNdoSIcyrbsmFkDKdG7d9Vp61ZBVU qUGQ== X-Gm-Message-State: AOAM533j1nwVjivNgsnzqGvapIpWQR1S3ug8nX0u9UsLvgK6gDSjTr8V l2YNzp01+kT2d1j4gTl7wMceidRIyISnD1hQcMnaVQ== X-Google-Smtp-Source: ABdhPJz+rYt6b8TxvdQlohldSJnkHWBMWlRemS+8I1II0Toa70KOsrc+68eWXFMw1oCkSVGa/BdXYfauEiuyKQ0f2Mg= X-Received: by 2002:a05:6102:9d1:b0:32c:be9e:11bb with SMTP id g17-20020a05610209d100b0032cbe9e11bbmr11762317vsi.28.1653449407032; Tue, 24 May 2022 20:30:07 -0700 (PDT) MIME-Version: 1.0 References: <20220523192834.3785673-1-dmalcolm@redhat.com> In-Reply-To: <20220523192834.3785673-1-dmalcolm@redhat.com> From: Eric Gallager Date: Tue, 24 May 2022 23:29:55 -0400 Message-ID: Subject: Re: [PATCH 00/10] Add 'final' and 'override' where missing To: David Malcolm Cc: gcc-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2022 03:30:10 -0000 On Mon, May 23, 2022 at 3:32 PM David Malcolm via Gcc-patches 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 >