Hi,

When compiling diagnostic-path-output.cc with clang, it warns that
path_label::get_effects should be marked as override.  That looks like
a good idea and from a brief look I also believe it should be marked
as final (the other override in the class is marked as both), so this
patch does that.

Likewise for html_output_format::after_diagnostic in
diagnostic-format-html.cc which also already has quite a few member
functions marked as final override.

Bootstrapped and tested on x86_64-linx.  OK for master?

Alternatively, as with all of these clang warning issues, I'm
perfectly happy to add an entry to contrib/filter-clang-warnings.py to
ignore the warning(s) instead.

Thanks,

Martin


gcc/ChangeLog:

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

        * diagnostic-path-output.cc (path_label::get_effects): Mark as
        final override.
        * diagnostic-format-html.cc
        (html_output_format::after_diagnostic): Likewise.
---
 gcc/diagnostic-format-html.cc | 2 +-
 gcc/diagnostic-path-output.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/diagnostic-format-html.cc b/gcc/diagnostic-format-html.cc
index 45d088150dd..b2c7214d7f1 100644
--- a/gcc/diagnostic-format-html.cc
+++ b/gcc/diagnostic-format-html.cc
@@ -1201,7 +1201,7 @@ public:
   {
     m_builder.emit_diagram (diagram);
   }
-  void after_diagnostic (const diagnostic_info &)
+  void after_diagnostic (const diagnostic_info &) final override
   {
     /* No-op, but perhaps could show paths here.  */
   }
diff --git a/gcc/diagnostic-path-output.cc b/gcc/diagnostic-path-output.cc
index bae24bf01a7..4bec3a66267 100644
--- a/gcc/diagnostic-path-output.cc
+++ b/gcc/diagnostic-path-output.cc
@@ -135,7 +135,7 @@ class path_label : public range_label
     return result;
   }
 
-  const label_effects *get_effects (unsigned /*range_idx*/) const
+  const label_effects *get_effects (unsigned /*range_idx*/) const final 
override
   {
     return &m_effects;
   }
-- 
2.49.0

Reply via email to