On 1/20/22 03:28, Jakub Jelinek wrote:
On Thu, Jan 20, 2022 at 11:17:28AM +0100, Jakub Jelinek via Gcc-patches wrote:
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -768,6 +768,11 @@ class_key_or_enum_as_string (tree t)
      return "struct";
  }
+#if __GNUC__ >= 10
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
  /* Print out a class declaration T under the control of FLAGS,
     in the form `class foo'.  */
@@ -851,6 +856,10 @@ dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags)
                         flags & ~TFF_TEMPLATE_HEADER);
  }
+#if __GNUC__ >= 10
+#pragma GCC diagnostic pop
+#endif

Oh, and one more thing, but this time not about this source file but about
the warning.  Does it handle the gettext case?
I think -Wformat generally does, gettext has format_arg attribute.
If the warning handles
   pp_printf ("<unnamed %s>", str);
and
   pp_printf (cond ? "<unnamed %s>" : "<unnamed %s>", str);
and
   pp_printf (cond ? "<unnamed %s>" : "something %s", str);
and
   pp_printf (gettext ("<unnamed %s>"), str);
then maybe it should also handle
   pp_printf (cond ? gettext ("<unnamed %s>") : "<unnamed %s>, str);
and
   pp_printf (cond ? gettext ("<unnamed %s>") : "something %s, str);
too?

-Wformat-diag is part of -Wformat so they both should handle the same
things.  Do you see a difference between what they handle?

Martin


        Jakub


Reply via email to