]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix -Werror=format-diag with RTL checking
authorMartin Liska <mliska@suse.cz>
Thu, 20 Jan 2022 08:28:42 +0000 (09:28 +0100)
committerMartin Liska <mliska@suse.cz>
Thu, 20 Jan 2022 11:03:06 +0000 (12:03 +0100)
PR bootstrap/104135

gcc/ChangeLog:

* emit-rtl.cc (make_insn_raw): Fix -Wformat-diag warnings.
* rtl.cc: Partially disable -Wformat-diag for RTL checking
error messages.

gcc/emit-rtl.cc
gcc/rtl.cc

index 3260ca8c3fa556fa4b8c131ad6b94145dd469959..a26bcb0fa2d0f4a5ff5b0bebb77e20214aecfe15 100644 (file)
@@ -3997,7 +3997,7 @@ make_insn_raw (rtx pattern)
          || (GET_CODE (insn) == SET
              && SET_DEST (insn) == pc_rtx)))
     {
-      warning (0, "ICE: emit_insn used where emit_jump_insn needed:\n");
+      warning (0, "ICE: %<emit_insn%> used where %<emit_jump_insn%> needed:");
       debug_rtx (insn);
     }
 #endif
index 02dd25547285567b7de3f913336d553412d72e56..f17474bfee1966db48334ceab9c7bde54c77c2d9 100644 (file)
@@ -870,6 +870,15 @@ dump_rtx_statistics (void)
 }
 \f
 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
+
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the internal_error calls.  Their format strings deliberately don't
+   follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 void
 rtl_check_failed_bounds (const_rtx r, int n, const char *file, int line,
                         const char *func)
@@ -945,6 +954,10 @@ rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, machine_mode mode,
                  func, trim_filename (file), line);
 }
 
+#if __GNUC__ >= 10
+#pragma GCC diagnostic pop
+#endif
+
 /* Report that line LINE of FILE tried to access the block symbol fields
    of a non-block symbol.  FUNC is the function that contains the line.  */