https://gcc.gnu.org/g:2670d11b029eca33774acb28ad7c87c3d14c9643

commit r16-1681-g2670d11b029eca33774acb28ad7c87c3d14c9643
Author: Martin Jambor <mjam...@suse.cz>
Date:   Wed Jun 25 17:02:10 2025 +0200

    tree-ssa-propagate.h: Mark two functions as override
    
    When tree-ssa-propagate.h is compiled with clang, it complains that
    member functions functions value_of_expr and range_of_expr of class
    substitute_and_fold_engine are not marked as override even though they
    do override virtual functions of the ancestor class.  This patch
    merely adds the keyword to silence the warning and for consistency's
    sake.
    
    I did not make this part of the previous patch because I wanted to
    point out that the first case is quite unusual, a virtual function
    with a functional body (range_query::value_of_expr) is being
    overridden with a pure virtual function.  I assume it was a conscious
    decision but adding the override keyword seems even more important
    then.
    
    gcc/ChangeLog:
    
    2025-06-24  Martin Jambor  <mjam...@suse.cz>
    
            * tree-ssa-propagate.h (class substitute_and_fold_engine): Mark
            member functions value_of_expr and range_of_expr as override.

Diff:
---
 gcc/tree-ssa-propagate.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h
index 8429e38f40e4..200fc7320796 100644
--- a/gcc/tree-ssa-propagate.h
+++ b/gcc/tree-ssa-propagate.h
@@ -102,10 +102,10 @@ class substitute_and_fold_engine : public range_query
   substitute_and_fold_engine (bool fold_all_stmts = false)
     : fold_all_stmts (fold_all_stmts) { }
 
-  virtual tree value_of_expr (tree expr, gimple * = NULL) = 0;
+  virtual tree value_of_expr (tree expr, gimple * = NULL) override = 0;
   virtual tree value_on_edge (edge, tree expr) override;
   virtual tree value_of_stmt (gimple *, tree name = NULL) override;
-  virtual bool range_of_expr (vrange &r, tree expr, gimple * = NULL);
+  virtual bool range_of_expr (vrange &r, tree expr, gimple * = NULL) override;
 
   virtual ~substitute_and_fold_engine (void) { }
   virtual bool fold_stmt (gimple_stmt_iterator *) { return false; }

Reply via email to