]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ranger: Mark several member functions as final override
authorMartin Jambor <mjambor@suse.cz>
Wed, 25 Jun 2025 14:59:12 +0000 (16:59 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 25 Jun 2025 14:59:22 +0000 (16:59 +0200)
When GCC is built with clang, it emits warnings that several member
functions of various ranger classes override a virtual function of an
ancestor but are not marked with the override keyword.  After
inspecting the cases, I found that all these classes had other member
functions marked as final override, so I added the final keyword
everywhere too.

In some cases other such overrides were not explicitly marked as
virtual, which made formatting easier.  For that reason and also for
consistency, in such cases I removed the virtual keyword from the
functions I marked as final override too.

gcc/ChangeLog:

2025-06-24  Martin Jambor  <mjambor@suse.cz>

* range-op-mixed.h (class operator_plus): Mark member function
overflow_free_p as final override.
(class operator_minus): Likewise.
(class operator_mult): Likewise.
* range-op-ptr.cc (class pointer_plus_operator): Mark member
function lhs_op1_relation as final override.
* range-op.cc (class operator_div::): Mark member functions
op2_range and update_bitmask as final override.
(class operator_logical_and): Mark member functions fold_range,
op1_range and op2_range as final override.  Remove unnecessary
virtual.
(class operator_logical_or): Likewise.
(class operator_logical_not): Mark member functions fold_range and
op1_range as final override.  Remove unnecessary virtual.
formatting easier.
(class operator_absu): Mark member functions wi_fold as final
override.

gcc/range-op-mixed.h
gcc/range-op-ptr.cc
gcc/range-op.cc

index f8f1830690462e1065ee95d8921e65994afdd16d..567b0cdd31bb83948e6956a52dfcd66dc100c34a 100644 (file)
@@ -558,8 +558,8 @@ public:
   void update_bitmask (irange &r, const irange &lh,
                       const irange &rh) const final override;
 
-  virtual bool overflow_free_p (const irange &lh, const irange &rh,
-                               relation_trio = TRIO_VARYING) const;
+  bool overflow_free_p (const irange &lh, const irange &rh,
+                       relation_trio = TRIO_VARYING) const final override;
   // Check compatibility of all operands.
   bool operand_check_p (tree t1, tree t2, tree t3) const final override
     { return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
@@ -634,8 +634,8 @@ public:
   void update_bitmask (irange &r, const irange &lh,
                       const irange &rh) const final override;
 
-  virtual bool overflow_free_p (const irange &lh, const irange &rh,
-                               relation_trio = TRIO_VARYING) const;
+  bool overflow_free_p (const irange &lh, const irange &rh,
+                       relation_trio = TRIO_VARYING) const final override;
   // Check compatibility of all operands.
   bool operand_check_p (tree t1, tree t2, tree t3) const final override
     { return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
@@ -720,8 +720,8 @@ public:
                const REAL_VALUE_TYPE &lh_lb, const REAL_VALUE_TYPE &lh_ub,
                const REAL_VALUE_TYPE &rh_lb, const REAL_VALUE_TYPE &rh_ub,
                relation_kind kind) const final override;
-  virtual bool overflow_free_p (const irange &lh, const irange &rh,
-                               relation_trio = TRIO_VARYING) const;
+  bool overflow_free_p (const irange &lh, const irange &rh,
+                       relation_trio = TRIO_VARYING) const final override;
   // Check compatibility of all operands.
   bool operand_check_p (tree t1, tree t2, tree t3) const final override
     { return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
index 6aadc9cf2c95d4c0b4772abd0b61475fdae73caa..e0e21ad1b2a3fe10c566eca7f0f9847b80766667 100644 (file)
@@ -315,7 +315,7 @@ public:
   virtual relation_kind lhs_op1_relation (const prange &lhs,
                                          const prange &op1,
                                          const irange &op2,
-                                         relation_kind) const;
+                                         relation_kind) const final override;
   void update_bitmask (prange &r, const prange &lh, const irange &rh) const
     { update_known_bitmask (r, POINTER_PLUS_EXPR, lh, rh); }
 } op_pointer_plus;
index 0a3f0b6b56c7ec43f33ea403ea57174c5285b2df..1f91066a44e7fff6f503594c0466e03b0cc0eaa0 100644 (file)
@@ -2455,7 +2455,7 @@ class operator_div : public cross_product_operator
 public:
   operator_div (tree_code div_kind) { m_code = div_kind; }
   bool op2_range (irange &r, tree type, const irange &lhs, const irange &,
-                 relation_trio) const;
+                 relation_trio) const final override;
   virtual void wi_fold (irange &r, tree type,
                        const wide_int &lh_lb,
                        const wide_int &lh_ub,
@@ -2464,7 +2464,8 @@ public:
   virtual bool wi_op_overflows (wide_int &res, tree type,
                                const wide_int &, const wide_int &)
     const final override;
-  void update_bitmask (irange &r, const irange &lh, const irange &rh) const
+  void update_bitmask (irange &r, const irange &lh, const irange &rh)
+    const final override
     { update_known_bitmask (r, m_code, lh, rh); }
 protected:
   tree_code m_code;
@@ -3233,18 +3234,18 @@ class operator_logical_and : public range_operator
   using range_operator::op1_range;
   using range_operator::op2_range;
 public:
-  virtual bool fold_range (irange &r, tree type,
-                          const irange &lh,
-                          const irange &rh,
-                          relation_trio rel = TRIO_VARYING) const;
-  virtual bool op1_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op2,
-                         relation_trio rel = TRIO_VARYING) const;
-  virtual bool op2_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op1,
-                         relation_trio rel = TRIO_VARYING) const;
+  bool fold_range (irange &r, tree type,
+                  const irange &lh,
+                  const irange &rh,
+                  relation_trio rel = TRIO_VARYING) const final override;
+  bool op1_range (irange &r, tree type,
+                 const irange &lhs,
+                 const irange &op2,
+                 relation_trio rel = TRIO_VARYING) const final override;
+  bool op2_range (irange &r, tree type,
+                 const irange &lhs,
+                 const irange &op1,
+                 relation_trio rel = TRIO_VARYING) const final override;
   // Check compatibility of all operands.
   bool operand_check_p (tree t1, tree t2, tree t3) const final override
     { return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
@@ -3757,18 +3758,18 @@ class operator_logical_or : public range_operator
   using range_operator::op1_range;
   using range_operator::op2_range;
 public:
-  virtual bool fold_range (irange &r, tree type,
-                          const irange &lh,
-                          const irange &rh,
-                          relation_trio rel = TRIO_VARYING) const;
-  virtual bool op1_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op2,
-                         relation_trio rel = TRIO_VARYING) const;
-  virtual bool op2_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op1,
-                         relation_trio rel = TRIO_VARYING) const;
+  bool fold_range (irange &r, tree type,
+                  const irange &lh,
+                  const irange &rh,
+                  relation_trio rel = TRIO_VARYING) const final override;
+  bool op1_range (irange &r, tree type,
+                 const irange &lhs,
+                 const irange &op2,
+                 relation_trio rel = TRIO_VARYING) const final override;
+  bool op2_range (irange &r, tree type,
+                 const irange &lhs,
+                 const irange &op1,
+                 relation_trio rel = TRIO_VARYING) const final override;
   // Check compatibility of all operands.
   bool operand_check_p (tree t1, tree t2, tree t3) const final override
     { return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
@@ -4203,14 +4204,14 @@ class operator_logical_not : public range_operator
   using range_operator::fold_range;
   using range_operator::op1_range;
 public:
-  virtual bool fold_range (irange &r, tree type,
-                          const irange &lh,
-                          const irange &rh,
-                          relation_trio rel = TRIO_VARYING) const;
-  virtual bool op1_range (irange &r, tree type,
-                         const irange &lhs,
-                         const irange &op2,
-                         relation_trio rel = TRIO_VARYING) const;
+  bool fold_range (irange &r, tree type,
+                  const irange &lh,
+                  const irange &rh,
+                  relation_trio rel = TRIO_VARYING) const final override;
+  bool op1_range (irange &r, tree type,
+                 const irange &lhs,
+                 const irange &op2,
+                 relation_trio rel = TRIO_VARYING) const final override;
   // Check compatibility of LHS and op1.
   bool operand_check_p (tree t1, tree t2, tree) const final override
     { return range_compatible_p (t1, t2); }
@@ -4484,7 +4485,8 @@ class operator_absu : public range_operator
  public:
   virtual void wi_fold (irange &r, tree type,
                        const wide_int &lh_lb, const wide_int &lh_ub,
-                       const wide_int &rh_lb, const wide_int &rh_ub) const;
+                       const wide_int &rh_lb, const wide_int &rh_ub)
+    const final override;
   virtual void update_bitmask (irange &r, const irange &lh,
                               const irange &rh) const final override;
 } op_absu;