diff mbox series

[8/12] fix diagnostic quoting/spelling in the middle-end

Message ID 7033b435-580c-9b63-ae72-59270c930edc@gmail.com
State New
Headers show
Series detect quoting and punctuation problems in diagnostics | expand

Commit Message

Martin Sebor May 14, 2019, 9:32 p.m. UTC
The attached patch fixes quoting, spelling, and other formatting
issues in diagnostics issued from files in middle-end files and
pointed out by the -Wformat-diag warning.

Martin

Comments

Jeff Law May 16, 2019, 7:34 p.m. UTC | #1
On 5/14/19 3:32 PM, Martin Sebor wrote:
> The attached patch fixes quoting, spelling, and other formatting
> issues in diagnostics issued from files in middle-end files and
> pointed out by the -Wformat-diag warning.
> 
> Martin
> 
> gcc-wformat-diag-midend.diff
> 
> gcc/ChangeLog:
> 
> 	* builtins.c (expand_builtin_atomic_always_lock_free): Quote
> 	identifiers, keywords, operators, and types in diagnostics.  Correct
> 	quoting, spelling, and sentence capitalization issues.
> 	(expand_builtin_atomic_is_lock_free): Same.
> 	(fold_builtin_next_arg): Same.
> 	* cfgexpand.c (expand_one_var): Same.
> 	(tree_conflicts_with_clobbers_p): Same.
> 	(expand_asm_stmt): Same.
> 	(verify_loop_structure): Same.
> 	* cgraphunit.c (process_function_and_variable_attributes): Same.
> 	* collect-utils.c (collect_execute): Same.
> 	* collect2.c (maybe_run_lto_and_relink): Same.
> 	(is_lto_object_file): Same.
> 	(scan_prog_file): Same.
> 	* convert.c (convert_to_real_1): Same.
> 	* diagnostic-core.h (GCC_DIAG_STYLE): Adjust.
> 	(GCC_DIAG_RAW_STYLE): New macro.
> 	* dwarf2out.c (dwarf2out_begin_prologue): Same.
> 	* except.c (verify_eh_tree): Same.
> 	* gcc.c (execute): Same.
> 	(eval_spec_function): Same.
> 	(run_attempt): Same.
> 	(driver::set_up_specs): Same.
> 	(compare_debug_auxbase_opt_spec_function): Same.
> 	* gcov-tool.c (unlink_gcda_file): Same.
> 	(do_merge): Same.
> 	(do_rewrite): Same.
> 	* gcse.c (gcse_or_cprop_is_too_expensive): Same.
> 	* gimplify.c (gimplify_asm_expr): Same.
> 	(gimplify_adjust_omp_clauses): Same.
> 	* hsa-gen.c (gen_hsa_addr_insns): Same.
> 	(gen_hsa_insns_for_load): Same.
> 	(gen_hsa_cmp_insn_from_gimple): Same.
> 	(gen_hsa_insns_for_operation_assignment): Same.
> 	(gen_get_level): Same.
> 	(gen_hsa_alloca): Same.
> 	(omp_simple_builtin::generate): Same.
> 	(gen_hsa_atomic_for_builtin): Same.
> 	(gen_hsa_insns_for_call): Same.
> 	* input.c (dump_location_info): Same.
> 	* ipa-devirt.c (compare_virtual_tables): Same.
> 	* ira.c (ira_setup_eliminable_regset): Same.
> 	* lra-assigns.c (lra_assign): Same.
> 	* lra-constraints.c (lra_constraints): Same.
> 	* lto-streamer-in.c (lto_input_mode_table): Same.
> 	* lto-wrapper.c (get_options_from_collect_gcc_options): Same.
> 	(merge_and_complain): Same.
> 	(compile_offload_image): Same.
> 	(compile_images_for_offload_targets): Same.
> 	(debug_objcopy): Same.
> 	(run_gcc): Same.
> 	(main): Same.
> 	* opts.c (print_specific_help): Same.
> 	(parse_no_sanitize_attribute): Same.
> 	(print_help): Same.
> 	(handle_param): Same.
> 	* passes.c (opt_pass::clone): Same.
> 	* plugin.c (add_new_plugin): Same.
> 	(parse_plugin_arg_opt): Same.
> 	(try_init_one_plugin): Same.
> 	* pretty-print.h (GCC_DIAG_RAW_STYLE): Adjust.
> 	(GCC_DIAG_RAW_STYLE): New macro.
> 	* print-rtl.c (debug_bb_n_slim): Quote identifiers, keywords,
> 	operators, and types in diagnostics.  Correct quoting and spelling
> 	issues.
> 	* read-rtl-function.c (parse_edge_flag_token): Same.
> 	(function_reader::parse_enum_value): Same.
> 	* reg-stack.c (check_asm_stack_operands): Same.
> 	* regcprop.c (validate_value_data): Same.
> 	* sched-rgn.c (make_pass_sched_fusion): Same.
> 	* stmt.c (check_unique_operand_names): Same.
> 	* targhooks.c (default_target_option_pragma_parse): Same.
> 	* tlink.c (recompile_files): Same.
> 	* toplev.c (process_options): Same.
> 	(do_compile): Same.
> 	* trans-mem.c (diagnose_tm_1): Same.
> 	(ipa_tm_scan_irr_block): Same.
> 	(ipa_tm_diagnose_transaction): Same.
> 	* tree-cfg.c (verify_address): Same.  Use get_tree_code_name to
> 	format a tree code name in a diagnostic.
> 	(verify_types_in_gimple_min_lval): Same.
> 	(verify_types_in_gimple_reference): Same.
> 	(verify_gimple_call): Same.
> 	(verify_gimple_assign_unary): Same.
> 	(verify_gimple_assign_binary): Same.
> 	(verify_gimple_assign_ternary): Same.
> 	(verify_gimple_assign_single): Same.
> 	(verify_gimple_switch): Same.
> 	(verify_gimple_label): Same.
> 	(verify_gimple_phi): Same.
> 	(verify_gimple_in_seq): Same.
> 	(verify_eh_throw_stmt_node): Same.
> 	(collect_subblocks): Same.
> 	(gimple_verify_flow_info): Same.
> 	(do_warn_unused_result): Same.
> 	* tree-inline.c (expand_call_inline): Same.
> 	* tree-into-ssa.c (update_ssa): Same.
> 	* tree.c (tree_int_cst_elt_check_failed): Same.
> 	(tree_vec_elt_check_failed): Same.
> 	(omp_clause_operand_check_failed): Same.
> 	(verify_type_variant): Same.
> 	(verify_type): Same.
> 	* value-prof.c (verify_histograms): Same.
> 	* varasm.c (assemble_start_function): Same.
> 
> 	* cfghooks.c: Disable -Wformat-diags.
> 	* cfgloop.c: Same.
> 	* cfgrtl.c: Same.
> 	* cgraph.c: Same.
> 	* diagnostic-show-locus.c: Same.
> 	* diagnostic.c: Same.
> 	* gimple-pretty-print.c: Same.
> 	* graph.c: Same.
> 	* symtab.c: Same.
> 	* tree-eh.c Same.
> 	* tree-pretty-print.c: Same.
> 	* tree-ssa.c: Same.
> 
> 	* configure: Regenerate.
> 	* configure.ac (ACX_PROG_CXX_WARNING_OPTS): Add -Wno-error=format-diag.
> 	 (ACX_PROG_CC_WARNING_OPTS): Same.
> 
> gcc/lto/ChangeLog:
> 
> 	* lto-dump.c (lto_main): Same.
> 	* lto.c (stream_out): Same.
> 
Assuming this is like the others.  OK
jeff
diff mbox series

Patch

gcc/ChangeLog:

	* builtins.c (expand_builtin_atomic_always_lock_free): Quote
	identifiers, keywords, operators, and types in diagnostics.  Correct
	quoting, spelling, and sentence capitalization issues.
	(expand_builtin_atomic_is_lock_free): Same.
	(fold_builtin_next_arg): Same.
	* cfgexpand.c (expand_one_var): Same.
	(tree_conflicts_with_clobbers_p): Same.
	(expand_asm_stmt): Same.
	(verify_loop_structure): Same.
	* cgraphunit.c (process_function_and_variable_attributes): Same.
	* collect-utils.c (collect_execute): Same.
	* collect2.c (maybe_run_lto_and_relink): Same.
	(is_lto_object_file): Same.
	(scan_prog_file): Same.
	* convert.c (convert_to_real_1): Same.
	* diagnostic-core.h (GCC_DIAG_STYLE): Adjust.
	(GCC_DIAG_RAW_STYLE): New macro.
	* dwarf2out.c (dwarf2out_begin_prologue): Same.
	* except.c (verify_eh_tree): Same.
	* gcc.c (execute): Same.
	(eval_spec_function): Same.
	(run_attempt): Same.
	(driver::set_up_specs): Same.
	(compare_debug_auxbase_opt_spec_function): Same.
	* gcov-tool.c (unlink_gcda_file): Same.
	(do_merge): Same.
	(do_rewrite): Same.
	* gcse.c (gcse_or_cprop_is_too_expensive): Same.
	* gimplify.c (gimplify_asm_expr): Same.
	(gimplify_adjust_omp_clauses): Same.
	* hsa-gen.c (gen_hsa_addr_insns): Same.
	(gen_hsa_insns_for_load): Same.
	(gen_hsa_cmp_insn_from_gimple): Same.
	(gen_hsa_insns_for_operation_assignment): Same.
	(gen_get_level): Same.
	(gen_hsa_alloca): Same.
	(omp_simple_builtin::generate): Same.
	(gen_hsa_atomic_for_builtin): Same.
	(gen_hsa_insns_for_call): Same.
	* input.c (dump_location_info): Same.
	* ipa-devirt.c (compare_virtual_tables): Same.
	* ira.c (ira_setup_eliminable_regset): Same.
	* lra-assigns.c (lra_assign): Same.
	* lra-constraints.c (lra_constraints): Same.
	* lto-streamer-in.c (lto_input_mode_table): Same.
	* lto-wrapper.c (get_options_from_collect_gcc_options): Same.
	(merge_and_complain): Same.
	(compile_offload_image): Same.
	(compile_images_for_offload_targets): Same.
	(debug_objcopy): Same.
	(run_gcc): Same.
	(main): Same.
	* opts.c (print_specific_help): Same.
	(parse_no_sanitize_attribute): Same.
	(print_help): Same.
	(handle_param): Same.
	* passes.c (opt_pass::clone): Same.
	* plugin.c (add_new_plugin): Same.
	(parse_plugin_arg_opt): Same.
	(try_init_one_plugin): Same.
	* pretty-print.h (GCC_DIAG_RAW_STYLE): Adjust.
	(GCC_DIAG_RAW_STYLE): New macro.
	* print-rtl.c (debug_bb_n_slim): Quote identifiers, keywords,
	operators, and types in diagnostics.  Correct quoting and spelling
	issues.
	* read-rtl-function.c (parse_edge_flag_token): Same.
	(function_reader::parse_enum_value): Same.
	* reg-stack.c (check_asm_stack_operands): Same.
	* regcprop.c (validate_value_data): Same.
	* sched-rgn.c (make_pass_sched_fusion): Same.
	* stmt.c (check_unique_operand_names): Same.
	* targhooks.c (default_target_option_pragma_parse): Same.
	* tlink.c (recompile_files): Same.
	* toplev.c (process_options): Same.
	(do_compile): Same.
	* trans-mem.c (diagnose_tm_1): Same.
	(ipa_tm_scan_irr_block): Same.
	(ipa_tm_diagnose_transaction): Same.
	* tree-cfg.c (verify_address): Same.  Use get_tree_code_name to
	format a tree code name in a diagnostic.
	(verify_types_in_gimple_min_lval): Same.
	(verify_types_in_gimple_reference): Same.
	(verify_gimple_call): Same.
	(verify_gimple_assign_unary): Same.
	(verify_gimple_assign_binary): Same.
	(verify_gimple_assign_ternary): Same.
	(verify_gimple_assign_single): Same.
	(verify_gimple_switch): Same.
	(verify_gimple_label): Same.
	(verify_gimple_phi): Same.
	(verify_gimple_in_seq): Same.
	(verify_eh_throw_stmt_node): Same.
	(collect_subblocks): Same.
	(gimple_verify_flow_info): Same.
	(do_warn_unused_result): Same.
	* tree-inline.c (expand_call_inline): Same.
	* tree-into-ssa.c (update_ssa): Same.
	* tree.c (tree_int_cst_elt_check_failed): Same.
	(tree_vec_elt_check_failed): Same.
	(omp_clause_operand_check_failed): Same.
	(verify_type_variant): Same.
	(verify_type): Same.
	* value-prof.c (verify_histograms): Same.
	* varasm.c (assemble_start_function): Same.

	* cfghooks.c: Disable -Wformat-diags.
	* cfgloop.c: Same.
	* cfgrtl.c: Same.
	* cgraph.c: Same.
	* diagnostic-show-locus.c: Same.
	* diagnostic.c: Same.
	* gimple-pretty-print.c: Same.
	* graph.c: Same.
	* symtab.c: Same.
	* tree-eh.c Same.
	* tree-pretty-print.c: Same.
	* tree-ssa.c: Same.

	* configure: Regenerate.
	* configure.ac (ACX_PROG_CXX_WARNING_OPTS): Add -Wno-error=format-diag.
	 (ACX_PROG_CC_WARNING_OPTS): Same.

gcc/lto/ChangeLog:

	* lto-dump.c (lto_main): Same.
	* lto.c (stream_out): Same.

diff --git a/gcc/builtins.c b/gcc/builtins.c
index d37d73fc4a0..0456a9ef646 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6784,7 +6784,7 @@  expand_builtin_atomic_always_lock_free (tree exp)
 
   if (TREE_CODE (arg0) != INTEGER_CST)
     {
-      error ("non-constant argument 1 to __atomic_always_lock_free");
+      error ("non-constant argument 1 to %qs", "__atomic_always_lock_free");
       return const0_rtx;
     }
 
@@ -6826,7 +6826,7 @@  expand_builtin_atomic_is_lock_free (tree exp)
 
   if (!INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
     {
-      error ("non-integer argument 1 to __atomic_is_lock_free");
+      error ("non-integer argument 1 to %qs", "__atomic_is_lock_free");
       return NULL_RTX;
     }
 
@@ -10224,7 +10224,7 @@  fold_builtin_next_arg (tree exp, bool va_start_p)
 
   if (!stdarg_p (fntype))
     {
-      error ("%<va_start%> used in function with fixed args");
+      error ("%<va_start%> used in function with fixed arguments");
       return true;
     }
 
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 3a4bd354bf9..1c2433286a5 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1702,7 +1702,7 @@  expand_one_var (tree var, bool toplevel, bool really_expand)
         {
           if (lookup_attribute ("naked",
                                 DECL_ATTRIBUTES (current_function_decl)))
-            error ("cannot allocate stack for variable %q+D, naked function.",
+            error ("cannot allocate stack for variable %q+D, naked function",
                    var);
 
           expand_one_stack_var (origvar);
@@ -2840,7 +2840,8 @@  tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs)
 
   if (overlap)
     {
-      error ("asm-specifier for variable %qE conflicts with asm clobber list",
+      error ("%<asm%>-specifier for variable %qE conflicts with "
+	     "%<asm%> clobber list",
 	     DECL_NAME (overlap));
 
       /* Reset registerness to stop multiple errors emitted for a single
@@ -3262,7 +3263,8 @@  expand_asm_stmt (gasm *stmt)
 	  if (allows_reg && TYPE_MODE (type) != BLKmode)
 	    op = force_reg (TYPE_MODE (type), op);
 	  else if (!allows_mem)
-	    warning (0, "asm operand %d probably doesn%'t match constraints",
+	    warning (0, "%<asm%> operand %d probably does not match "
+		     "constraints",
 		     i + noutputs);
 	  else if (MEM_P (op))
 	    {
@@ -3445,11 +3447,13 @@  expand_asm_stmt (gasm *stmt)
 		 tripping over the under-construction body.  */
 	      for (unsigned k = 0; k < noutputs; ++k)
 		if (reg_overlap_mentioned_p (clobbered_reg, output_rvec[k]))
-		  internal_error ("asm clobber conflict with output operand");
+		  internal_error ("%<asm%> clobber conflict with "
+				  "output operand");
 
 	      for (unsigned k = 0; k < ninputs - ninout; ++k)
 		if (reg_overlap_mentioned_p (clobbered_reg, input_rvec[k]))
-		  internal_error ("asm clobber conflict with input operand");
+		  internal_error ("%<asm%> clobber conflict with "
+				  "input operand");
 	    }
 
 	  XVECEXP (body, 0, i++) = gen_rtx_CLOBBER (VOIDmode, clobbered_reg);
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index a1d603a207e..a25441b2640 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -32,6 +32,12 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa.h"
 #include "cfgloop.h"
 
+/* Disable warnings about missing quoting in GCC diagnostics.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* A pointer to one of the hooks containers.  */
 static struct cfg_hooks *cfg_hooks;
 
@@ -1491,3 +1497,7 @@  profile_record_account_profile (profile_record *record)
       cfg_hooks->account_profile_record (bb, record);
    }
 }
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index e115de6aae2..1677f677d72 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1363,6 +1363,14 @@  cancel_loop_tree (struct loop *loop)
   cancel_loop (loop);
 }
 
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow
+   GCC diagnostic conventions and trigger an ICE in the end.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Checks that information about loops is correct
      -- sizes of loops are all right
      -- results of get_loop_body really belong to the loop
@@ -1677,7 +1685,7 @@  verify_loop_structure (void)
 
 	      if (eloops != 0)
 		{
-		  error ("wrong list of exited loops for edge  %d->%d",
+		  error ("wrong list of exited loops for edge %d->%d",
 			 e->src->index, e->dest->index);
 		  err = 1;
 		}
@@ -1712,6 +1720,10 @@  verify_loop_structure (void)
     free_dominance_info (CDI_DOMINATORS);
 }
 
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
+
 /* Returns latch edge of LOOP.  */
 edge
 loop_latch_edge (const struct loop *loop)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index e06fb8d5a40..a1ca5992c41 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -62,6 +62,12 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-pass.h"
 #include "print-rtl.h"
 
+/* Disable warnings about missing quoting in GCC diagnostics.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Holds the interesting leading and trailing notes for the function.
    Only applicable if the CFG is in cfglayout mode.  */
 static GTY(()) rtx_insn *cfg_layout_function_footer;
@@ -5191,3 +5197,7 @@  struct cfg_hooks cfg_layout_rtl_cfg_hooks = {
 };
 
 #include "gt-cfgrtl.h"
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index b1b0b4c42d5..8761c72106d 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3095,6 +3095,14 @@  cgraph_edge::verify_corresponds_to_fndecl (tree decl)
     return false;
 }
 
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow
+   GCC diagnostic conventions and trigger an ICE in the end.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Verify cgraph nodes of given cgraph node.  */
 DEBUG_FUNCTION void
 cgraph_node::verify_node (void)
@@ -3470,6 +3478,10 @@  cgraph_node::verify_cgraph_nodes (void)
     node->verify ();
 }
 
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
+
 /* Walk the alias chain to return the function cgraph_node is alias of.
    Walk through thunks, too.
    When AVAILABILITY is non-NULL, get minimal availability in the chain.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 8bfbd0bb12f..6c4173fd8f0 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -796,8 +796,8 @@  process_function_and_variable_attributes (cgraph_node *first,
 	  /* redefining extern inline function makes it DECL_UNINLINABLE.  */
 	  && !DECL_UNINLINABLE (decl))
 	warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wattributes,
-		    "always_inline function might not be inlinable");
-     
+		    "%<always_inline%> function might not be inlinable");
+
       process_common_attributes (node, decl);
     }
   for (vnode = symtab->first_variable (); vnode != first_var;
diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c
index 1b1b27c9251..228b17e319f 100644
--- a/gcc/collect-utils.c
+++ b/gcc/collect-utils.c
@@ -180,7 +180,7 @@  collect_execute (const char *prog, char **argv, const char *outname,
 
   pex = pex_init (0, "collect2", NULL);
   if (pex == NULL)
-    fatal_error (input_location, "pex_init failed: %m");
+    fatal_error (input_location, "%<pex_init%> failed: %m");
 
   errmsg = pex_run (pex, flags, argv[0], argv, outname,
 		    errname, &err);
diff --git a/gcc/collect2.c b/gcc/collect2.c
index eb84f84639b..b622eb25eea 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -701,7 +701,8 @@  maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
       size_t num_files;
 
       if (!lto_wrapper)
-	fatal_error (input_location, "COLLECT_LTO_WRAPPER must be set");
+	fatal_error (input_location, "environment variable "
+		     "%<COLLECT_LTO_WRAPPER%> must be set");
 
       num_lto_c_args++;
 
@@ -2382,7 +2383,7 @@  is_lto_object_file (const char *prog_name)
     return true;
 
   if (errmsg)
-    fatal_error (0, "%s: %s\n", errmsg, xstrerror (err));
+    fatal_error (0, "%s: %s", errmsg, xstrerror (err));
   return false;
 }
 
@@ -2448,7 +2449,7 @@  scan_prog_file (const char *prog_name, scanpass which_pass,
 
   pex = pex_init (PEX_USE_PIPES, "collect2", NULL);
   if (pex == NULL)
-    fatal_error (input_location, "pex_init failed: %m");
+    fatal_error (input_location, "%<pex_init%> failed: %m");
 
   errmsg = pex_run (pex, 0, nm_file_name, real_nm_argv, NULL, HOST_BIT_BUCKET,
 		    &err);
diff --git a/gcc/configure b/gcc/configure
index 3cab176e501..6f9080af16a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -6739,7 +6739,7 @@  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 loose_warn=
 save_CXXFLAGS="$CXXFLAGS"
-for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual $wf_opt; do
+for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag $wf_opt; do
   # Do the check with the no- prefix removed since gcc silently
   # accepts any -Wno-* option on purpose
   case $real_option in
@@ -6797,7 +6797,7 @@  ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 c_loose_warn=
 save_CFLAGS="$CFLAGS"
-for real_option in -Wstrict-prototypes -Wmissing-prototypes; do
+for real_option in -Wstrict-prototypes -Wmissing-prototypes-Wno-error=format-diag; do
   # Do the check with the no- prefix removed since gcc silently
   # accepts any -Wno-* option on purpose
   case $real_option in
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 264f36fb78a..4bdccdb8ca6 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -483,10 +483,11 @@  AS_IF([test $enable_build_format_warnings = no],
       [wf_opt=-Wno-format],[wf_opt=])
 ACX_PROG_CXX_WARNING_OPTS(
 	m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
-		       [-Wcast-qual $wf_opt])), [loose_warn])
+		       [-Wcast-qual -Wno-error=format-diag $wf_opt])),
+		       [loose_warn])
 ACX_PROG_CC_WARNING_OPTS(
-	m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])),
-	[c_loose_warn])
+	m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes],
+	 	       [-Wno-error=format-diag])), [c_loose_warn])
 ACX_PROG_CXX_WARNING_OPTS(
 	m4_quote(m4_do([-Wmissing-format-attribute ],
 		       [-Woverloaded-virtual])), [strict_warn])
diff --git a/gcc/convert.c b/gcc/convert.c
index 32d475524d7..890af0e7a7c 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -415,11 +415,11 @@  convert_to_real_1 (tree type, tree expr, bool fold_p)
 
     case POINTER_TYPE:
     case REFERENCE_TYPE:
-      error ("pointer value used where a floating point value was expected");
+      error ("pointer value used where a floating point was expected");
       return convert_to_real_1 (type, integer_zero_node, fold_p);
 
     default:
-      error ("aggregate value used where a float was expected");
+      error ("aggregate value used where a floating point was expected");
       return convert_to_real_1 (type, integer_zero_node, fold_p);
     }
 }
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index efafde4fa24..4d46fbe2a02 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -52,7 +52,10 @@  extern const char *trim_filename (const char *);
 /* If we haven't already defined a front-end-specific diagnostics
    style, use the generic one.  */
 #ifndef GCC_DIAG_STYLE
-#define GCC_DIAG_STYLE __gcc_tdiag__
+#  define GCC_DIAG_STYLE __gcc_tdiag__
+#endif
+#ifndef GCC_DIAG_RAW_STYLE
+#  define GCC_DIAG_RAW_STYLE __gcc_tdiag_raw__
 #endif
 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
    each language front end can extend them with its own set of format
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index 205ee56f409..89074beb6d1 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -39,6 +39,13 @@  along with GCC; see the file COPYING3.  If not see
 # include <sys/ioctl.h>
 #endif
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Classes for rendering source code and diagnostics, within an
    anonymous namespace.
    The work is done by "class layout", which embeds and uses
@@ -3740,3 +3747,7 @@  diagnostic_show_locus_c_tests ()
 } // namespace selftest
 
 #endif /* #if CHECKING_P */
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index be6b65722cd..4761b4349d3 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -43,6 +43,13 @@  along with GCC; see the file COPYING3.  If not see
 # include <sys/ioctl.h>
 #endif
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 #define pedantic_warning_kind(DC)			\
   ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING)
 #define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR)
@@ -1861,3 +1868,7 @@  diagnostic_c_tests ()
 } // namespace selftest
 
 #endif /* #if CHECKING_P */
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index e5d8ebc6a11..dced32950c8 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1115,7 +1115,7 @@  dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
 	 function anymore.  */
       if (personality && current_unit_personality != personality)
 	sorry ("multiple EH personalities are supported only with assemblers "
-	       "supporting .cfi_personality directive");
+	       "supporting %<.cfi_personality%> directive");
     }
 }
 
diff --git a/gcc/except.c b/gcc/except.c
index e760c4467dd..edaeeb4cfd1 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3412,7 +3412,7 @@  verify_eh_tree (struct function *fun)
 	  count_r++;
 	else
 	  {
-	    error ("region_array is corrupted for region %i", r->index);
+	    error ("%<region_array%> is corrupted for region %i", r->index);
 	    err = true;
 	  }
       }
@@ -3425,7 +3425,7 @@  verify_eh_tree (struct function *fun)
 	  count_lp++;
 	else
 	  {
-	    error ("lp_array is corrupted for lp %i", lp->index);
+	    error ("%<lp_array%> is corrupted for lp %i", lp->index);
 	    err = true;
 	  }
       }
@@ -3437,7 +3437,7 @@  verify_eh_tree (struct function *fun)
     {
       if ((*fun->eh->region_array)[r->index] != r)
 	{
-	  error ("region_array is corrupted for region %i", r->index);
+	  error ("%<region_array%> is corrupted for region %i", r->index);
 	  err = true;
 	}
       if (r->outer != outer)
@@ -3456,7 +3456,7 @@  verify_eh_tree (struct function *fun)
 	{
 	  if ((*fun->eh->lp_array)[lp->index] != lp)
 	    {
-	      error ("lp_array is corrupted for lp %i", lp->index);
+	      error ("%<lp_array%> is corrupted for lp %i", lp->index);
 	      err = true;
 	    }
 	  if (lp->region != r)
@@ -3493,19 +3493,19 @@  verify_eh_tree (struct function *fun)
     }
   if (count_r != nvisited_r)
     {
-      error ("region_array does not match region_tree");
+      error ("%<region_array%> does not match %<region_tree%>");
       err = true;
     }
   if (count_lp != nvisited_lp)
     {
-      error ("lp_array does not match region_tree");
+      error ("%<lp_array%> does not match %<region_tree%>");
       err = true;
     }
 
   if (err)
     {
       dump_eh_tree (stderr, fun);
-      internal_error ("verify_eh_tree failed");
+      internal_error ("%qs failed", __func__);
     }
 }
 
diff --git a/gcc/gcc.c b/gcc/gcc.c
index cee9d68cbee..2c2af197400 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3198,7 +3198,7 @@  execute (void)
 				   ? PEX_RECORD_TIMES : 0),
 		  progname, temp_filename);
   if (pex == NULL)
-    fatal_error (input_location, "pex_init failed: %m");
+    fatal_error (input_location, "%<pex_init%> failed: %m");
 
   for (i = 0; i < n_commands; i++)
     {
@@ -6138,7 +6138,8 @@  eval_spec_function (const char *func, const char *args,
 
   alloc_args ();
   if (do_spec_2 (args, soft_matched_part) < 0)
-    fatal_error (input_location, "error in args to spec function %qs", func);
+    fatal_error (input_location, "error in arguments to spec function %qs",
+		 func);
 
   /* argbuf_index is an index for the next argument to be inserted, and
      so contains the count of the args already inserted.  */
@@ -6923,7 +6924,7 @@  run_attempt (const char **new_argv, const char *out_temp,
 
   pex = pex_init (PEX_USE_PIPES, new_argv[0], NULL);
   if (!pex)
-    fatal_error (input_location, "pex_init failed: %m");
+    fatal_error (input_location, "%<pex_init%> failed: %m");
 
   errmsg = pex_run (pex, pex_flags, new_argv[0],
 		    CONST_CAST2 (char *const *, const char **, &new_argv[1]),
@@ -7614,7 +7615,8 @@  driver::set_up_specs () const
       && do_spec_2 (sysroot_suffix_spec, NULL) == 0)
     {
       if (argbuf.length () > 1)
-        error ("spec failure: more than one arg to SYSROOT_SUFFIX_SPEC");
+        error ("spec failure: more than one argument to "
+	       "%<SYSROOT_SUFFIX_SPEC%>");
       else if (argbuf.length () == 1)
         target_sysroot_suffix = xstrdup (argbuf.last ());
     }
@@ -7638,7 +7640,8 @@  driver::set_up_specs () const
       && do_spec_2 (sysroot_hdrs_suffix_spec, NULL) == 0)
     {
       if (argbuf.length () > 1)
-        error ("spec failure: more than one arg to SYSROOT_HEADERS_SUFFIX_SPEC");
+        error ("spec failure: more than one argument "
+	       "to %<SYSROOT_HEADERS_SUFFIX_SPEC%>");
       else if (argbuf.length () == 1)
         target_sysroot_hdrs_suffix = xstrdup (argbuf.last ());
     }
@@ -9797,7 +9800,7 @@  compare_debug_auxbase_opt_spec_function (int arg,
   len = strlen (argv[0]);
   if (len < 3 || strcmp (argv[0] + len - 3, ".gk") != 0)
     fatal_error (input_location, "argument to %%:compare-debug-auxbase-opt "
-		 "does not end in .gk");
+		 "does not end in %<.gk%>");
 
   if (debug_auxbase_opt)
     return debug_auxbase_opt;
diff --git a/gcc/gcov-tool.c b/gcc/gcov-tool.c
index 5bb1ccac6be..fec256b9f72 100644
--- a/gcc/gcov-tool.c
+++ b/gcc/gcov-tool.c
@@ -70,7 +70,7 @@  unlink_gcda_file (const char *name,
     ret = remove (name);
 
   if (ret)
-    fatal_error (input_location, "error in removing %s\n", name);
+    fatal_error (input_location, "error in removing %s", name);
 
   return ret;
 }
@@ -220,7 +220,7 @@  do_merge (int argc, char **argv)
         case 'w':
           sscanf (optarg, "%d,%d", &w1, &w2);
           if (w1 < 0 || w2 < 0)
-            fatal_error (input_location, "weights need to be non-negative\n");
+            fatal_error (input_location, "weights need to be non-negative");
           break;
         default:
           merge_usage ();
@@ -355,7 +355,7 @@  do_rewrite (int argc, char **argv)
             }
 
           if (scale < 0.0)
-            fatal_error (input_location, "scale needs to be non-negative\n");
+            fatal_error (input_location, "scale needs to be non-negative");
 
           if (normalize_val != 0)
             {
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 7fbdd675005..ff2771bdc04 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4004,7 +4004,8 @@  gcse_or_cprop_is_too_expensive (const char *pass)
   if (memory_request > MAX_GCSE_MEMORY)
     {
       warning (OPT_Wdisabled_optimization,
-	       "%s: %d basic blocks and %d registers; increase --param max-gcse-memory above %d",
+	       "%s: %d basic blocks and %d registers; "
+	       "increase %<--param max-gcse-memory%> above %d",
 	       pass, n_basic_blocks_for_fn (cfun), max_reg_num (),
 	       memory_request);
 
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 58212c4dcc1..218e652de05 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -43,6 +43,13 @@  along with GCC; see the file COPYING3.  If not see
 #include "asan.h"
 #include "cfgloop.h"
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 #define INDENT(SPACE)							\
   do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
 
@@ -2958,3 +2965,7 @@  percent_G_format (text_info *text)
   tree block = gimple_block (stmt);
   percent_K_format (text, gimple_location (stmt), block);
 }
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index b6c60855351..bc2000d4d80 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6177,7 +6177,7 @@  gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
 			    fb_lvalue | fb_mayfail);
       if (tret == GS_ERROR)
 	{
-	  error ("invalid lvalue in asm output %d", i);
+	  error ("invalid lvalue in %<asm%> output %d", i);
 	  ret = tret;
 	}
 
@@ -9835,7 +9835,7 @@  gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
 		    {
 		      warning_at (OMP_CLAUSE_LOCATION (c), 0,
 				  "incompatible data clause with reduction "
-				  "on %qE; promoting to present_or_copy",
+				  "on %qE; promoting to %<present_or_copy%>",
 				  DECL_NAME (t));
 		      OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM);
 		    }
diff --git a/gcc/graph.c b/gcc/graph.c
index 89b20312968..4858b259d80 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -57,6 +57,13 @@  open_graph_file (const char *base, const char *mode)
   return fp;
 }
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Draw a basic block BB belonging to the function with FUNCDEF_NO
    as its unique number.  */
 static void
@@ -381,3 +388,7 @@  finish_graph_dump_file (const char *base)
   end_graph_dump (fp);
   fclose (fp);
 }
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index edcec10f49f..f52c49c3fa2 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -2264,7 +2264,7 @@  gen_hsa_addr_insns (tree val, hsa_op_reg *dest, hsa_bb *hbb)
     {
       HSA_SORRY_ATV (EXPR_LOCATION (val), "support for HSA does "
 		     "not implement taking addresses of complex "
-		     "CONST_DECLs such as %E", val);
+		     "%<CONST_DECL%> such as %E", val);
       return;
     }
 
@@ -2449,7 +2449,7 @@  gen_hsa_insns_for_load (hsa_op_reg *dest, tree rhs, tree type, hsa_bb *hbb)
 	    {
 	      HSA_SORRY_ATV (EXPR_LOCATION (rhs),
 			     "support for HSA does not implement conversion "
-			     "of %E to the requested non-pointer type.", rhs);
+			     "of %E to the requested non-pointer type", rhs);
 	      return;
 	    }
 
@@ -3012,7 +3012,7 @@  gen_hsa_cmp_insn_from_gimple (enum tree_code code, tree lhs, tree rhs,
     default:
       HSA_SORRY_ATV (EXPR_LOCATION (lhs),
 		     "support for HSA does not implement comparison tree "
-		     "code %s\n", get_tree_code_name (code));
+		     "code %s", get_tree_code_name (code));
       return;
     }
 
@@ -3162,8 +3162,8 @@  gen_hsa_insns_for_operation_assignment (gimple *assign, hsa_bb *hbb)
     case FLOOR_DIV_EXPR:
     case ROUND_DIV_EXPR:
       HSA_SORRY_AT (gimple_location (assign),
-		    "support for HSA does not implement CEIL_DIV_EXPR, "
-		    "FLOOR_DIV_EXPR or ROUND_DIV_EXPR");
+		    "support for HSA does not implement %<CEIL_DIV_EXPR%>, "
+		    "%<FLOOR_DIV_EXPR%> or %<ROUND_DIV_EXPR%>");
       return;
     case TRUNC_MOD_EXPR:
       opcode = BRIG_OPCODE_REM;
@@ -3172,8 +3172,8 @@  gen_hsa_insns_for_operation_assignment (gimple *assign, hsa_bb *hbb)
     case FLOOR_MOD_EXPR:
     case ROUND_MOD_EXPR:
       HSA_SORRY_AT (gimple_location (assign),
-		    "support for HSA does not implement CEIL_MOD_EXPR, "
-		    "FLOOR_MOD_EXPR or ROUND_MOD_EXPR");
+		    "support for HSA does not implement %<CEIL_MOD_EXPR%>, "
+		    "%<FLOOR_MOD_EXPR%> or %<ROUND_MOD_EXPR%>");
       return;
     case NEGATE_EXPR:
       opcode = BRIG_OPCODE_NEG;
@@ -4188,8 +4188,8 @@  gen_get_level (gimple *stmt, hsa_bb *hbb)
   if (shadow_reg_ptr == NULL)
     {
       HSA_SORRY_AT (gimple_location (stmt),
-		    "support for HSA does not implement omp_get_level called "
-		    "from a function not being inlined within a kernel");
+		    "support for HSA does not implement %<omp_get_level%> "
+		    "called from a function not being inlined within a kernel");
       return;
     }
 
@@ -4230,7 +4230,8 @@  gen_hsa_alloca (gcall *call, hsa_bb *hbb)
   if (lhs == NULL_TREE)
     return;
 
-  built_in_function fn = DECL_FUNCTION_CODE (gimple_call_fndecl (call));
+  tree fndecl = gimple_call_fndecl (call);
+  built_in_function fn = DECL_FUNCTION_CODE (fndecl);
 
   gcc_checking_assert (ALLOCA_FUNCTION_CODE_P (fn));
 
@@ -4243,8 +4244,8 @@  gen_hsa_alloca (gcall *call, hsa_bb *hbb)
 	{
 	  HSA_SORRY_ATV (gimple_location (call),
 			 "support for HSA does not implement "
-			 "__builtin_alloca_with_align with a non-constant "
-			 "alignment: %E", alignment_tree);
+			 "%qD with a non-constant alignment %E",
+			 fndecl, alignment_tree);
 	}
 
       bit_alignment = tree_to_uhwi (alignment_tree);
@@ -4548,7 +4549,7 @@  omp_simple_builtin::generate (gimple *stmt, hsa_bb *hbb)
 	HSA_SORRY_AT (gimple_location (stmt), m_warning_message);
       else
 	HSA_SORRY_ATV (gimple_location (stmt),
-		       "Support for HSA does not implement calls to %s\n",
+		       "support for HSA does not implement calls to %qs",
 		       m_name);
     }
   else if (m_warning_message != NULL)
@@ -5049,7 +5050,7 @@  gen_hsa_atomic_for_builtin (bool ret_orig, enum BrigAtomicOperation acode,
 	{
 	  HSA_SORRY_ATV (gimple_location (stmt),
 			 "support for HSA does not implement memory model for "
-			 "ATOMIC_ST: %s", mmname);
+			 "%<ATOMIC_ST%>: %s", mmname);
 	  return;
 	}
     }
@@ -5314,8 +5315,8 @@  gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
 	gen_hsa_insns_for_direct_call (stmt, hbb);
       else if (!gen_hsa_insns_for_known_library_call (stmt, hbb))
 	HSA_SORRY_AT (gimple_location (stmt),
-		      "HSA supports only calls of functions marked with pragma "
-		      "omp declare target");
+		      "HSA supports only calls of functions marked with "
+		      "%<#pragma omp declare target%>");
       return;
     }
 
@@ -5625,7 +5626,7 @@  gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
     case BUILT_IN_GOMP_PARALLEL:
       HSA_SORRY_AT (gimple_location (stmt),
 		    "support for HSA does not implement non-gridified "
-		    "OpenMP parallel constructs.");
+		    "OpenMP parallel constructs");
       break;
 
     case BUILT_IN_OMP_GET_THREAD_NUM:
diff --git a/gcc/input.c b/gcc/input.c
index c589d70c2bb..1e84d2ee2d1 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -1215,7 +1215,8 @@  dump_location_info (FILE *stream)
 	  if (x == y)
 	    {
 	      if (x < MAP_START_LOCATION (map))
-		inform (x, "token %u has x-location == y-location == %u", i, x);
+		inform (x, "token %u has %<x-location == y-location == %u%>",
+			i, x);
 	      else
 		fprintf (stream,
 			 "x-location == y-location == %u encodes token # %u\n",
@@ -1223,8 +1224,8 @@  dump_location_info (FILE *stream)
 		}
 	  else
 	    {
-	      inform (x, "token %u has x-location == %u", i, x);
-	      inform (x, "token %u has y-location == %u", i, y);
+	      inform (x, "token %u has %<x-location == %u%>", i, x);
+	      inform (x, "token %u has %<y-location == %u%>", i, y);
 	    }
 	}
       fprintf (stream, "\n");
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 3e040e27305..a51b1517422 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -947,7 +947,7 @@  compare_virtual_tables (varpool_node *prevailing, varpool_node *vtable)
       if (warning_at (DECL_SOURCE_LOCATION
 			(TYPE_NAME (DECL_CONTEXT (vtable->decl))), OPT_Wodr,
 		      "virtual table of type %qD violates "
-		      "one definition rule  ",
+		      "one definition rule",
 		      DECL_CONTEXT (vtable->decl)))
 	{
 	  if (TREE_CODE (ref1->referred->decl) == FUNCTION_DECL)
diff --git a/gcc/ira.c b/gcc/ira.c
index fd481d6e0e2..4a14fb31583 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2326,7 +2326,7 @@  ira_setup_eliminable_regset (void)
 	      SET_HARD_REG_BIT (ira_no_alloc_regs, eliminables[i].from);
 	}
       else if (cannot_elim)
-	error ("%s cannot be used in asm here",
+	error ("%s cannot be used in %<asm%> here",
 	       reg_names[eliminables[i].from]);
       else
 	df_set_regs_ever_live (eliminables[i].from, true);
@@ -2340,7 +2340,7 @@  ira_setup_eliminable_regset (void)
 	    SET_HARD_REG_BIT (ira_no_alloc_regs, HARD_FRAME_POINTER_REGNUM);
 	}
       else if (frame_pointer_needed)
-	error ("%s cannot be used in asm here",
+	error ("%s cannot be used in %<asm%> here",
 	       reg_names[HARD_FRAME_POINTER_REGNUM]);
       else
 	df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true);
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index 8b56b58fb2e..609feec48ae 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -1692,7 +1692,7 @@  lra_assign (bool &fails_p)
       && (lra_assignment_iter_after_spill
 	  > LRA_MAX_ASSIGNMENT_ITERATION_NUMBER))
     internal_error
-      ("Maximum number of LRA assignment passes is achieved (%d)\n",
+      ("maximum number of LRA assignment passes is achieved (%d)",
        LRA_MAX_ASSIGNMENT_ITERATION_NUMBER);
   return no_spills_p;
 }
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index cf33da8013e..d1d99e01cde 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -4898,7 +4898,7 @@  lra_constraints (bool first_p)
 	}
       if (new_insns_num > MAX_RELOAD_INSNS_NUMBER)
 	internal_error
-	  ("Max. number of generated reload insns per insn is achieved (%d)\n",
+	  ("maximum number of generated reload insns per insn achieved (%d)",
 	   MAX_RELOAD_INSNS_NUMBER);
       new_insns_num++;
       if (DEBUG_INSN_P (curr_insn))
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 7727b9be760..b78b7cb1ad2 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1700,7 +1700,7 @@  lto_input_mode_table (struct lto_file_decl_data *file_data)
 		}
 	      /* FALLTHRU */
 	    default:
-	      fatal_error (UNKNOWN_LOCATION, "unsupported mode %s\n", mname);
+	      fatal_error (UNKNOWN_LOCATION, "unsupported mode %qs", mname);
 	      break;
 	    }
 	}
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index ac971494054..9eff9fd8570 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -155,7 +155,8 @@  get_options_from_collect_gcc_options (const char *collect_gcc,
 	  do
 	    {
 	      if (argv_storage[j] == '\0')
-		fatal_error (input_location, "malformed COLLECT_GCC_OPTIONS");
+		fatal_error (input_location,
+			     "malformed %<COLLECT_GCC_OPTIONS%>");
 	      else if (strncmp (&argv_storage[j], "'\\''", 4) == 0)
 		{
 		  argv_storage[k++] = '\'';
@@ -310,7 +311,7 @@  merge_and_complain (struct cl_decoded_option **decoded_options,
 	    append_option (decoded_options, decoded_options_count, foption);
 	  else if (strcmp ((*decoded_options)[j].arg, foption->arg))
 	    fatal_error (input_location,
-			 "Option %s with different values",
+			 "option %s with different values",
 			 foption->orig_option_with_args_text);
 	  break;
 
@@ -394,7 +395,7 @@  merge_and_complain (struct cl_decoded_option **decoded_options,
 	    append_option (decoded_options, decoded_options_count, foption);
 	  else if (foption->value != (*decoded_options)[j].value)
 	    fatal_error (input_location,
-			 "Option %s not used consistently in all LTO input"
+			 "option %s not used consistently in all LTO input"
 			 " files", foption->orig_option_with_args_text);
 	  break;
 
@@ -822,7 +823,7 @@  compile_offload_image (const char *target, const char *compiler_path,
 
   if (!compiler)
     fatal_error (input_location,
-		 "could not find %s in %s (consider using %<-B%>)\n",
+		 "could not find %s in %s (consider using %<-B%>)",
 		 suffix + 1, compiler_path);
 
   /* Generate temporary output file name.  */
@@ -903,7 +904,7 @@  compile_images_for_offload_targets (unsigned in_argc, char *in_argv[],
 				 linker_opts, linker_opt_count);
       if (!offload_names[next_name_entry])
 	fatal_error (input_location,
-		     "problem with building target image for %s\n", names[i]);
+		     "problem with building target image for %s", names[i]);
       next_name_entry++;
     }
 
@@ -1072,7 +1073,7 @@  debug_objcopy (const char *infile, bool rename)
 				  &off, &len, &errmsg, &err) != 1)
     {
       if (errmsg)
-	fatal_error (0, "%s: %s\n", errmsg, xstrerror (err));
+	fatal_error (0, "%s: %s", errmsg, xstrerror (err));
 
       simple_object_release_read (inobj);
       close (infd);
@@ -1092,7 +1093,7 @@  debug_objcopy (const char *infile, bool rename)
   if (errmsg)
     {
       unlink_if_ordinary (outfile);
-      fatal_error (0, "%s: %s\n", errmsg, xstrerror (err));
+      fatal_error (0, "%s: %s", errmsg, xstrerror (err));
     }
 
   simple_object_release_read (inobj);
@@ -1144,11 +1145,11 @@  run_gcc (unsigned argc, char *argv[])
   collect_gcc = getenv ("COLLECT_GCC");
   if (!collect_gcc)
     fatal_error (input_location,
-		 "environment variable COLLECT_GCC must be set");
+		 "environment variable %<COLLECT_GCC%> must be set");
   collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");
   if (!collect_gcc_options)
     fatal_error (input_location,
-		 "environment variable COLLECT_GCC_OPTIONS must be set");
+		 "environment variable %<COLLECT_GCC_OPTIONS%> must be set");
   get_options_from_collect_gcc_options (collect_gcc, collect_gcc_options,
 					CL_LANG_ALL,
 					&decoded_options,
@@ -1548,7 +1549,7 @@  cont1:
       int priority;
 
       if (!stream)
-	fatal_error (input_location, "fopen: %s: %m", ltrans_output_file);
+	fatal_error (input_location, "%<fopen%>: %s: %m", ltrans_output_file);
 
       /* Parse the list of LTRANS inputs from the WPA stage.  */
       obstack_init (&env_obstack);
@@ -1565,7 +1566,7 @@  cont1:
 	    {
 	      if (!feof (stream))
 	        fatal_error (input_location,
-		             "Corrupted ltrans output file %s",
+		             "corrupted ltrans output file %s",
 			     ltrans_output_file);
 	      break;
 	    }
@@ -1754,7 +1755,7 @@  main (int argc, char *argv[])
   diagnostic_initialize (global_dc, 0);
 
   if (atexit (lto_wrapper_cleanup) != 0)
-    fatal_error (input_location, "atexit failed");
+    fatal_error (input_location, "%<atexit%> failed");
 
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, fatal_signal);
diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c
index 39b442335f6..691d109ff34 100644
--- a/gcc/lto/lto-dump.c
+++ b/gcc/lto/lto-dump.c
@@ -320,7 +320,8 @@  lto_main (void)
 	node->get_untransformed_body ();
       if (!GATHER_STATISTICS)
 	warning_at (input_location, 0,
-		    "Not configured with --enable-gather-detailed-mem-stats.");
+		    "Not configured with "
+		    "%<--enable-gather-detailed-mem-stats%>.");
       else
 	dump_gimple_statistics ();
     }
@@ -329,7 +330,8 @@  lto_main (void)
       /* Dump tree statistics.  */
       if (!GATHER_STATISTICS)
 	warning_at (input_location, 0,
-		    "Not configured with --enable-gather-detailed-mem-stats.");
+		    "Not configured with "
+		    "%<--enable-gather-detailed-mem-stats%>.");
       else
 	{
 	  printf ("Tree Statistics\n");
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index bf790209701..814f03a1777 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -159,7 +159,7 @@  stream_out (char *temp_filename, lto_symtab_encoder_t encoder, int part)
 {
   lto_file *file = lto_obj_file_open (temp_filename, true);
   if (!file)
-    fatal_error (input_location, "lto_obj_file_open() failed");
+    fatal_error (input_location, "%<lto_obj_file_open()%> failed");
   lto_set_current_out_file (file);
 
   gcc_assert (!dump_file);
diff --git a/gcc/opts.c b/gcc/opts.c
index 71adc21cb26..879ab17c362 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1671,7 +1671,8 @@  print_specific_help (unsigned int include_flags,
 	    description = _("The following options take joined arguments");
 	  else
 	    {
-	      internal_error ("unrecognized include_flags 0x%x passed to print_specific_help",
+	      internal_error ("unrecognized %<include_flags 0x%x%> passed "
+			      "to %<print_specific_help%>",
 			      include_flags);
 	      return;
 	    }
@@ -1982,7 +1983,7 @@  parse_no_sanitize_attribute (char *value)
 
       if (sanitizer_opts[i].name == NULL)
 	warning (OPT_Wattributes,
-		 "%<%s%> attribute directive ignored", q);
+		 "%qs attribute directive ignored", q);
 
       q = strtok (NULL, ",");
     }
@@ -2165,7 +2166,7 @@  print_help (struct gcc_options *opts, unsigned int lang_mask)
 		*pflags |= lang_flag;
 	      else
 		warning (0,
-			 "--help argument %q.*s is ambiguous, "
+			 "%<--help%> argument %q.*s is ambiguous, "
 			 "please be more specific",
 			 len, a);
 	    }
@@ -2174,7 +2175,7 @@  print_help (struct gcc_options *opts, unsigned int lang_mask)
 	*pflags |= lang_flag;
       else
 	warning (0,
-		 "unrecognized argument to --help= option: %q.*s",
+		 "unrecognized argument to %<--help=%> option: %q.*s",
 		 len, a);
 
       if (comma == NULL)
@@ -2831,8 +2832,8 @@  handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
   arg = xstrdup (carg);
   equal = strchr (arg, '=');
   if (!equal)
-    error_at (loc, "%s: --param arguments should be of the form NAME=VALUE",
-	      arg);
+    error_at (loc, "%s: %qs arguments should be of the form NAME=VALUE",
+	      arg, "--param");
   else
     {
       *equal = '\0';
@@ -2842,10 +2843,10 @@  handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
 	{
 	  const char *suggestion = find_param_fuzzy (arg);
 	  if (suggestion)
-	    error_at (loc, "invalid --param name %qs; did you mean %qs?",
-		      arg, suggestion);
+	    error_at (loc, "invalid %qs name %qs; did you mean %qs?",
+		      "--param", arg, suggestion);
 	  else
-	    error_at (loc, "invalid --param name %qs", arg);
+	    error_at (loc, "invalid %qs name %qs", "--param", arg);
 	}
       else
 	{
@@ -2853,7 +2854,7 @@  handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
 	    value = integral_argument (equal + 1);
 
 	  if (value == -1)
-	    error_at (loc, "invalid --param value %qs", equal + 1);
+	    error_at (loc, "invalid %qs value %qs", "--param", equal + 1);
 	  else
 	    set_param_value (arg, value,
 			     opts->x_param_values, opts_set->x_param_values);
diff --git a/gcc/passes.c b/gcc/passes.c
index a9c22889d71..c6331cbc49d 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -87,8 +87,8 @@  opt_pass::clone ()
 void
 opt_pass::set_pass_param (unsigned int, bool)
 {
-  internal_error ("pass %s needs a set_pass_param implementation to handle the"
-		  " extra argument in NEXT_PASS", name);
+  internal_error ("pass %s needs a %<set_pass_param%> implementation "
+		  "to handle the extra argument in %<NEXT_PASS%>", name);
 }
 
 bool
diff --git a/gcc/plugin.c b/gcc/plugin.c
index 2896c6a9392..f3079760236 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -231,7 +231,7 @@  add_new_plugin (const char* plugin_name)
     {
       plugin = (struct plugin_name_args *) *slot;
       if (strcmp (plugin->full_name, plugin_name))
-        error ("plugin %s was specified with different paths:\n%s\n%s",
+        error ("plugin %qs was specified with different paths: %qs and %qs",
                plugin->base_name, plugin->full_name, plugin_name);
       return;
     }
@@ -290,7 +290,8 @@  parse_plugin_arg_opt (const char *arg)
 
   if (!key_start)
     {
-      error ("malformed option %<-fplugin-arg-%s%> (missing -<key>[=<value>])",
+      error ("malformed option %<-fplugin-arg-%s%>: "
+	     "missing %<-<key>[=<value>]%>",
              arg);
       return;
     }
@@ -700,7 +701,7 @@  try_init_one_plugin (struct plugin_name_args *plugin)
   dl_handle = dlopen (plugin->full_name, RTLD_NOW | RTLD_GLOBAL);
   if (!dl_handle)
     {
-      error ("cannot load plugin %s\n%s", plugin->full_name, dlerror ());
+      error ("cannot load plugin %s: %s", plugin->full_name, dlerror ());
       return false;
     }
 
@@ -710,7 +711,7 @@  try_init_one_plugin (struct plugin_name_args *plugin)
   /* Check the plugin license.  */
   if (dlsym (dl_handle, str_license) == NULL)
     fatal_error (input_location,
-		 "plugin %s is not licensed under a GPL-compatible license\n"
+		 "plugin %s is not licensed under a GPL-compatible license"
 		 "%s", plugin->full_name, dlerror ());
 
   PTR_UNION_AS_VOID_PTR (plugin_init_union) =
@@ -720,7 +721,7 @@  try_init_one_plugin (struct plugin_name_args *plugin)
   if ((err = dlerror ()) != NULL)
     {
       dlclose(dl_handle);
-      error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name,
+      error ("cannot find %s in plugin %s: %s", str_plugin_init_func_name,
              plugin->full_name, err);
       return false;
     }
@@ -729,7 +730,7 @@  try_init_one_plugin (struct plugin_name_args *plugin)
   if ((*plugin_init) (plugin, &gcc_version))
     {
       dlclose(dl_handle);
-      error ("fail to initialize plugin %s", plugin->full_name);
+      error ("failed to initialize plugin %s", plugin->full_name);
       return false;
     }
   /* leak dl_handle on purpose to ensure the plugin is loaded for the
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index e4df6590719..71726bd0b88 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -355,11 +355,12 @@  extern void pp_newline_and_indent (pretty_printer *, int);
 extern void pp_separate_with (pretty_printer *, char);
 
 /* If we haven't already defined a front-end-specific diagnostics
-   style, use the generic one.  */
-#ifdef GCC_DIAG_STYLE
-#define GCC_PPDIAG_STYLE GCC_DIAG_STYLE
+   style, use the generic one for "raw" formatting (i.e., with no
+   checking of punctuation and quoting issues in the format string).  */
+#ifdef GCC_DIAG_RAW_STYLE
+#define GCC_PPDIAG_STYLE   GCC_DIAG_RAW_STYLE
 #else
-#define GCC_PPDIAG_STYLE __gcc_diag__
+#define GCC_PPDIAG_STYLE __gcc_diag_raw__
 #endif
 
 /* This header may be included before diagnostics-core.h, hence the duplicate
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index fbb108568b3..10948efddd9 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -54,6 +54,13 @@  along with GCC; see the file COPYING3.  If not see
 #include "print-rtl.h"
 #include "rtl-iter.h"
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* String printed at beginning of each RTL when it is dumped.
    This string is set to ASM_COMMENT_START when the RTL is dumped in
    the assembly output file.  */
@@ -2142,3 +2149,7 @@  debug_bb_n_slim (int n)
 }
 
 #endif
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c
index 53f7a94c188..3cf34ba99a8 100644
--- a/gcc/read-rtl-function.c
+++ b/gcc/read-rtl-function.c
@@ -707,7 +707,7 @@  parse_edge_flag_token (const char *tok)
   } while (0);
 #include "cfg-flags.def"
 #undef DEF_EDGE_FLAG
-  error ("unrecognized edge flag: '%s'", tok);
+  error ("unrecognized edge flag: %qs", tok);
   return 0;
 }
 
@@ -978,7 +978,7 @@  function_reader::parse_enum_value (int num_values, const char *const *strings)
       if (strcmp (name.string, strings[i]) == 0)
 	return i;
     }
-  error ("unrecognized enum value: '%s'", name.string);
+  error ("unrecognized enum value: %qs", name.string);
   return 0;
 }
 
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 033c978a12f..8c934aaf936 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -545,7 +545,8 @@  check_asm_stack_operands (rtx_insn *insn)
 	    for (j = 0; j < n_clobbers; j++)
 	      if (REGNO (recog_data.operand[i]) == REGNO (clobber_reg[j]))
 		{
-		  error_for_asm (insn, "output constraint %d cannot be specified together with \"%s\" clobber",
+		  error_for_asm (insn, "output constraint %d cannot be "
+				 "specified together with %qs clobber",
 				 i, reg_names [REGNO (clobber_reg[j])]);
 		  malformed_asm = 1;
 		  break;
@@ -568,7 +569,7 @@  check_asm_stack_operands (rtx_insn *insn)
 
   if (i != LAST_STACK_REG + 1)
     {
-      error_for_asm (insn, "output regs must be grouped at top of stack");
+      error_for_asm (insn, "output registers must be grouped at top of stack");
       malformed_asm = 1;
     }
 
@@ -608,7 +609,8 @@  check_asm_stack_operands (rtx_insn *insn)
   if (i != LAST_STACK_REG + 1)
     {
       error_for_asm (insn,
-		     "implicitly popped regs must be grouped at top of stack");
+		     "implicitly popped registers must be grouped "
+		     "at top of stack");
       malformed_asm = 1;
     }
 
@@ -625,7 +627,8 @@  check_asm_stack_operands (rtx_insn *insn)
   if (i != LAST_STACK_REG + 1)
     {
       error_for_asm (insn,
-		     "explicitly used regs must be grouped at top of stack");
+		     "explicitly used registers must be grouped "
+		     "at top of stack");
       malformed_asm = 1;
     }
 
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 4842ce922bc..a18c24f4797 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1216,8 +1216,8 @@  validate_value_data (struct value_data *vd)
 	if (vd->e[i].mode == VOIDmode)
 	  {
 	    if (vd->e[i].next_regno != INVALID_REGNUM)
-	      internal_error ("validate_value_data: [%u] Bad next_regno for empty chain (%u)",
-			      i, vd->e[i].next_regno);
+	      internal_error ("%qs: [%u] bad %<next_regno%> for empty chain (%u)",
+			      __func__, i, vd->e[i].next_regno);
 	    continue;
 	  }
 
@@ -1228,11 +1228,11 @@  validate_value_data (struct value_data *vd)
 	     j = vd->e[j].next_regno)
 	  {
 	    if (TEST_HARD_REG_BIT (set, j))
-	      internal_error ("validate_value_data: Loop in regno chain (%u)",
-			      j);
+	      internal_error ("%qs: loop in %<next_regno%> chain (%u)",
+			      __func__, j);
 	    if (vd->e[j].oldest_regno != i)
-	      internal_error ("validate_value_data: [%u] Bad oldest_regno (%u)",
-			      j, vd->e[j].oldest_regno);
+	      internal_error ("%qs: [%u] bad %<oldest_regno%> (%u)",
+			      __func__, j, vd->e[j].oldest_regno);
 
 	    SET_HARD_REG_BIT (set, j);
 	  }
@@ -1243,8 +1243,9 @@  validate_value_data (struct value_data *vd)
 	&& (vd->e[i].mode != VOIDmode
 	    || vd->e[i].oldest_regno != i
 	    || vd->e[i].next_regno != INVALID_REGNUM))
-      internal_error ("validate_value_data: [%u] Non-empty reg in chain (%s %u %i)",
-		      i, GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno,
+      internal_error ("%qs: [%u] non-empty register in chain (%s %u %i)",
+		      __func__, i,
+		      GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno,
 		      vd->e[i].next_regno);
 }
 
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 83688b3c9c4..d4001300a4b 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -67,6 +67,13 @@  along with GCC; see the file COPYING3.  If not see
 #include "pretty-print.h"
 #include "print-rtl.h"
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 #ifdef INSN_SCHEDULING
 
 /* Some accessor macros for h_i_d members only used within this file.  */
@@ -3947,3 +3954,7 @@  make_pass_sched_fusion (gcc::context *ctxt)
 {
   return new pass_sched_fusion (ctxt);
 }
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/stmt.c b/gcc/stmt.c
index b69d7c4f2ba..8ed3bf5aa2f 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -521,7 +521,7 @@  check_unique_operand_names (tree outputs, tree inputs, tree labels)
   return true;
 
  failure:
-  error ("duplicate asm operand name %qs", TREE_STRING_POINTER (i_name));
+  error ("duplicate %<asm%> operand name %qs", TREE_STRING_POINTER (i_name));
   return false;
 }
 
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 4bf37a18171..9d0b28bc717 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1002,6 +1002,14 @@  symtab_node::debug (void)
 
 /* Verify common part of symtab nodes.  */
 
+#if __GNUC__ >= 10
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow
+   GCC diagnostic conventions and trigger an ICE in the end.  */
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 DEBUG_FUNCTION bool
 symtab_node::verify_base (void)
 {
@@ -1288,6 +1296,10 @@  symtab_node::verify_symtab_nodes (void)
     }
 }
 
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
+
 /* Make DECL local.  FIXME: We shouldn't need to mess with rtl this early,
    but other code such as notice_global_symbol generates rtl.  */
 
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 02b9dc59611..577e373c578 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1600,7 +1600,7 @@  default_target_option_pragma_parse (tree ARG_UNUSED (args),
      do not have the "target" pragma.  */
   if (args)
     warning (OPT_Wpragmas,
-	     "#pragma GCC target is not supported for this machine");
+	     "%<#pragma GCC target%> is not supported for this machine");
 
   return false;
 }
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-11.c b/gcc/testsuite/gcc.dg/format/gcc_diag-11.c
new file mode 100644
index 00000000000..a716c8de7ef
diff --git a/gcc/testsuite/gcc.dg/gcc_diag-11.c b/gcc/testsuite/gcc.dg/gcc_diag-11.c
new file mode 100644
index 00000000000..c359989f481
diff --git a/gcc/tlink.c b/gcc/tlink.c
index 16a7b152d4d..485000b5466 100644
--- a/gcc/tlink.c
+++ b/gcc/tlink.c
@@ -484,9 +484,11 @@  recompile_files (void)
 	 the new file name already exists.  Therefore, we explicitly
 	 remove the old file first.  */
       if (remove (f->key) == -1)
-	fatal_error (input_location, "removing .rpo file: %m");
+	fatal_error (input_location,
+		     "removing repository file %qs: %m", f->key);
       if (rename (outname, f->key) == -1)
-	fatal_error (input_location, "renaming .rpo file: %m");
+	fatal_error (input_location, "renaming repository file from "
+		     "%qs to %qs: %m", outname, f->key);
 
       if (!f->args)
 	{
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 397a164068d..2103d74a0b5 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1737,7 +1737,7 @@  process_options (void)
     {
       warning_at (UNKNOWN_LOCATION, 0,
 		  "%<-fstack-check=%> and %<-fstack-clash_protection%> are "
-		  "mutually exclusive.  Disabling %<-fstack-check=%>");
+		  "mutually exclusive; disabling %<-fstack-check=%>");
       flag_stack_check = NO_STACK_CHECK;
     }
 
@@ -2180,7 +2180,7 @@  do_compile ()
 	 on the squared numbers.  */
       if (mpfr_set_emin (2 * (min_exp - 1))
 	  || mpfr_set_emax (2 * (max_exp + 1)))
-	sorry ("mpfr not configured to handle all float modes");
+	sorry ("mpfr not configured to handle all floating modes");
 
       /* Set up the back-end if requested.  */
       if (!no_backend)
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 0581aae2d69..d16f5f9cad1 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -754,10 +754,10 @@  diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	 Either that or get the language spec to resurrect __tm_waiver.  */
       if (d->block_flags & DIAG_TM_SAFE)
 	error_at (gimple_location (stmt),
-		  "asm not allowed in atomic transaction");
+		  "%<asm%> not allowed in atomic transaction");
       else if (d->func_flags & DIAG_TM_SAFE)
 	error_at (gimple_location (stmt),
-		  "asm not allowed in %<transaction_safe%> function");
+		  "%<asm%> not allowed in %<transaction_safe%> function");
       break;
 
     case GIMPLE_TRANSACTION:
@@ -4414,7 +4414,8 @@  ipa_tm_scan_irr_block (basic_block bb)
 	    {
 	      tree t = build1 (NOP_EXPR, void_type_node, size_zero_node);
 	      SET_EXPR_LOCATION (t, gimple_location (stmt));
-	      error ("%Kasm not allowed in %<transaction_safe%> function", t);
+	      error ("%K%<asm%> not allowed in %<transaction_safe%> function",
+		     t);
 	    }
 	  return true;
 
@@ -4788,7 +4789,7 @@  ipa_tm_diagnose_transaction (struct cgraph_node *node,
 	      if (gimple_code (stmt) == GIMPLE_ASM)
 		{
 		  error_at (gimple_location (stmt),
-			    "asm not allowed in atomic transaction");
+			    "%<asm%> not allowed in atomic transaction");
 		  continue;
 		}
 
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 966ce5a373c..7c73d7adbde 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2961,12 +2961,12 @@  verify_address (tree t, bool verify_addressable)
 
   if (old_constant != new_constant)
     {
-      error ("constant not recomputed when ADDR_EXPR changed");
+      error ("constant not recomputed when %<ADDR_EXPR%> changed");
       return true;
     }
   if (old_side_effects != new_side_effects)
     {
-      error ("side effects not recomputed when ADDR_EXPR changed");
+      error ("side effects not recomputed when %<ADDR_EXPR%> changed");
       return true;
     }
 
@@ -2981,13 +2981,13 @@  verify_address (tree t, bool verify_addressable)
 
   if (DECL_GIMPLE_REG_P (base))
     {
-      error ("DECL_GIMPLE_REG_P set on a variable with address taken");
+      error ("%<DECL_GIMPLE_REG_P%> set on a variable with address taken");
       return true;
     }
 
   if (verify_addressable && !TREE_ADDRESSABLE (base))
     {
-      error ("address taken, but ADDRESSABLE bit not set");
+      error ("address taken but %<TREE_ADDRESSABLE%> bit not set");
       return true;
     }
 
@@ -3036,6 +3036,8 @@  verify_types_in_gimple_min_lval (tree expr)
 static bool
 verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 {
+  const char *code_name = get_tree_code_name (TREE_CODE (expr));
+
   if (TREE_CODE (expr) == REALPART_EXPR
       || TREE_CODE (expr) == IMAGPART_EXPR
       || TREE_CODE (expr) == BIT_FIELD_REF)
@@ -3043,7 +3045,7 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
       tree op = TREE_OPERAND (expr, 0);
       if (!is_gimple_reg_type (TREE_TYPE (expr)))
 	{
-	  error ("non-scalar BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR");
+	  error ("non-scalar %qs", code_name);
 	  return true;
 	}
 
@@ -3057,14 +3059,14 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	      || !types_compatible_p (bitsizetype, TREE_TYPE (t1))
 	      || !types_compatible_p (bitsizetype, TREE_TYPE (t2)))
 	    {
-	      error ("invalid position or size operand to BIT_FIELD_REF");
+	      error ("invalid position or size operand to %qs", code_name);
 	      return true;
 	    }
 	  if (INTEGRAL_TYPE_P (TREE_TYPE (expr))
 	      && maybe_ne (TYPE_PRECISION (TREE_TYPE (expr)), size))
 	    {
 	      error ("integral result type precision does not match "
-		     "field size of BIT_FIELD_REF");
+		     "field size of %qs", code_name);
 	      return true;
 	    }
 	  else if (!INTEGRAL_TYPE_P (TREE_TYPE (expr))
@@ -3073,13 +3075,14 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 				size))
 	    {
 	      error ("mode size of non-integral result does not "
-		     "match field size of BIT_FIELD_REF");
+		     "match field size of %qs",
+		     code_name);
 	      return true;
 	    }
 	  if (INTEGRAL_TYPE_P (TREE_TYPE (op))
 	      && !type_has_mode_precision_p (TREE_TYPE (op)))
 	    {
-	      error ("BIT_FIELD_REF of non-mode-precision operand");
+	      error ("%qs of non-mode-precision operand", code_name);
 	      return true;
 	    }
 	  if (!AGGREGATE_TYPE_P (TREE_TYPE (op))
@@ -3087,7 +3090,7 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 			   tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (op)))))
 	    {
 	      error ("position plus size exceeds size of referenced object in "
-		     "BIT_FIELD_REF");
+		     "%qs", code_name);
 	      return true;
 	    }
 	}
@@ -3097,7 +3100,7 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	  && !useless_type_conversion_p (TREE_TYPE (expr),
 					 TREE_TYPE (TREE_TYPE (op))))
 	{
-	  error ("type mismatch in real/imagpart reference");
+	  error ("type mismatch in %qs reference", code_name);
 	  debug_generic_stmt (TREE_TYPE (expr));
 	  debug_generic_stmt (TREE_TYPE (TREE_TYPE (op)));
 	  return true;
@@ -3107,11 +3110,13 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 
   while (handled_component_p (expr))
     {
+      code_name = get_tree_code_name (TREE_CODE (expr));
+
       if (TREE_CODE (expr) == REALPART_EXPR
 	  || TREE_CODE (expr) == IMAGPART_EXPR
 	  || TREE_CODE (expr) == BIT_FIELD_REF)
 	{
-	  error ("non-top-level BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR");
+	  error ("non-top-level %qs", code_name);
 	  return true;
 	}
 
@@ -3126,7 +3131,7 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	      || (TREE_OPERAND (expr, 3)
 		  && !is_gimple_val (TREE_OPERAND (expr, 3))))
 	    {
-	      error ("invalid operands to array reference");
+	      error ("invalid operands to %qs", code_name);
 	      debug_generic_stmt (expr);
 	      return true;
 	    }
@@ -3137,7 +3142,7 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	  && !useless_type_conversion_p (TREE_TYPE (expr),
 					 TREE_TYPE (TREE_TYPE (op))))
 	{
-	  error ("type mismatch in array reference");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_stmt (TREE_TYPE (expr));
 	  debug_generic_stmt (TREE_TYPE (TREE_TYPE (op)));
 	  return true;
@@ -3146,7 +3151,7 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	  && !useless_type_conversion_p (TREE_TYPE (TREE_TYPE (expr)),
 					 TREE_TYPE (TREE_TYPE (op))))
 	{
-	  error ("type mismatch in array range reference");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_stmt (TREE_TYPE (TREE_TYPE (expr)));
 	  debug_generic_stmt (TREE_TYPE (TREE_TYPE (op)));
 	  return true;
@@ -3157,13 +3162,13 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	  if (TREE_OPERAND (expr, 2)
 	      && !is_gimple_val (TREE_OPERAND (expr, 2)))
 	    {
-	      error ("invalid COMPONENT_REF offset operator");
+	      error ("invalid %qs offset operator", code_name);
 	      return true;
 	    }
 	  if (!useless_type_conversion_p (TREE_TYPE (expr),
 					  TREE_TYPE (TREE_OPERAND (expr, 1))))
 	    {
-	      error ("type mismatch in component reference");
+	      error ("type mismatch in %qs", code_name);
 	      debug_generic_stmt (TREE_TYPE (expr));
 	      debug_generic_stmt (TREE_TYPE (TREE_OPERAND (expr, 1)));
 	      return true;
@@ -3181,14 +3186,16 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	      && (TREE_CODE (op) == SSA_NAME
 		  || is_gimple_min_invariant (op)))
 	    {
-	      error ("conversion of an SSA_NAME on the left hand side");
+	      error ("conversion of an %qs on the left hand side of %qs",
+		     get_tree_code_name (TREE_CODE (op)), code_name);
 	      debug_generic_stmt (expr);
 	      return true;
 	    }
 	  else if (TREE_CODE (op) == SSA_NAME
 		   && TYPE_SIZE (TREE_TYPE (expr)) != TYPE_SIZE (TREE_TYPE (op)))
 	    {
-	      error ("conversion of register to a different size");
+	      error ("conversion of register to a different size in %qs",
+		     code_name);
 	      debug_generic_stmt (expr);
 	      return true;
 	    }
@@ -3199,20 +3206,22 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
       expr = op;
     }
 
+  code_name = get_tree_code_name (TREE_CODE (expr));
+
   if (TREE_CODE (expr) == MEM_REF)
     {
       if (!is_gimple_mem_ref_addr (TREE_OPERAND (expr, 0))
 	  || (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR
 	      && verify_address (TREE_OPERAND (expr, 0), false)))
 	{
-	  error ("invalid address operand in MEM_REF");
+	  error ("invalid address operand in %qs", code_name);
 	  debug_generic_stmt (expr);
 	  return true;
 	}
       if (!poly_int_tree_p (TREE_OPERAND (expr, 1))
 	  || !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 1))))
 	{
-	  error ("invalid offset operand in MEM_REF");
+	  error ("invalid offset operand in %qs", code_name);
 	  debug_generic_stmt (expr);
 	  return true;
 	}
@@ -3224,21 +3233,21 @@  verify_types_in_gimple_reference (tree expr, bool require_lvalue)
 	  || (TREE_CODE (TMR_BASE (expr)) == ADDR_EXPR
 	      && verify_address (TMR_BASE (expr), false)))
 	{
-	  error ("invalid address operand in TARGET_MEM_REF");
+	  error ("invalid address operand in %qs", code_name);
 	  return true;
 	}
       if (!TMR_OFFSET (expr)
 	  || !poly_int_tree_p (TMR_OFFSET (expr))
 	  || !POINTER_TYPE_P (TREE_TYPE (TMR_OFFSET (expr))))
 	{
-	  error ("invalid offset operand in TARGET_MEM_REF");
+	  error ("invalid offset operand in %qs", code_name);
 	  debug_generic_stmt (expr);
 	  return true;
 	}
     }
   else if (TREE_CODE (expr) == INDIRECT_REF)
     {
-      error ("INDIRECT_REF in gimple IL");
+      error ("%qs in gimple IL", code_name);
       debug_generic_stmt (expr);
       return true;
     }
@@ -3345,7 +3354,7 @@  verify_gimple_call (gcall *stmt)
       && gimple_call_noreturn_p (stmt)
       && should_remove_lhs_p (lhs))
     {
-      error ("LHS in noreturn call");
+      error ("LHS in %<noreturn%> call");
       return true;
     }
 
@@ -3536,6 +3545,8 @@  verify_gimple_assign_unary (gassign *stmt)
       return true;
     }
 
+  const char* const code_name = get_tree_code_name (rhs_code);
+
   /* First handle conversions.  */
   switch (rhs_code)
     {
@@ -3663,7 +3674,7 @@  verify_gimple_assign_unary (gassign *stmt)
 	  || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (lhs_type),
 		       TYPE_VECTOR_SUBPARTS (rhs1_type)))
 	{
-	  error ("type mismatch in vector unpack expression");
+	  error ("type mismatch in %qs expression", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  return true;
@@ -3685,7 +3696,7 @@  verify_gimple_assign_unary (gassign *stmt)
 	  || TYPE_UNSIGNED (rhs1_type)
 	  || element_precision (lhs_type) != element_precision (rhs1_type))
 	{
-	  error ("invalid types for ABSU_EXPR");
+	  error ("invalid types for %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  return true;
@@ -3696,7 +3707,7 @@  verify_gimple_assign_unary (gassign *stmt)
       if (TREE_CODE (lhs_type) != VECTOR_TYPE
 	  || !useless_type_conversion_p (TREE_TYPE (lhs_type), rhs1_type))
 	{
-	  error ("vec_duplicate should be from a scalar to a like vector");
+	  error ("%qs should be from a scalar to a like vector", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  return true;
@@ -3746,6 +3757,8 @@  verify_gimple_assign_binary (gassign *stmt)
       return true;
     }
 
+  const char* const code_name = get_tree_code_name (rhs_code);
+
   /* First handle operations that involve different types.  */
   switch (rhs_code)
     {
@@ -3757,7 +3770,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || !(INTEGRAL_TYPE_P (rhs2_type)
 	         || SCALAR_FLOAT_TYPE_P (rhs2_type)))
 	  {
-	    error ("type mismatch in complex expression");
+	    error ("type mismatch in %qs", code_name);
 	    debug_generic_expr (lhs_type);
 	    debug_generic_expr (rhs1_type);
 	    debug_generic_expr (rhs2_type);
@@ -3786,7 +3799,7 @@  verify_gimple_assign_binary (gassign *stmt)
 		     && INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type))))
 	    || !useless_type_conversion_p (lhs_type, rhs1_type))
 	  {
-	    error ("type mismatch in shift expression");
+	    error ("type mismatch in %qs", code_name);
 	    debug_generic_expr (lhs_type);
 	    debug_generic_expr (rhs1_type);
 	    debug_generic_expr (rhs2_type);
@@ -3803,7 +3816,7 @@  verify_gimple_assign_binary (gassign *stmt)
             || TREE_CODE (rhs2) != INTEGER_CST
             || (2 * TYPE_PRECISION (rhs1_type) > TYPE_PRECISION (lhs_type)))
           {
-            error ("type mismatch in widening vector shift expression");
+            error ("type mismatch in %qs", code_name);
             debug_generic_expr (lhs_type);
             debug_generic_expr (rhs1_type);
             debug_generic_expr (rhs2_type);
@@ -3824,7 +3837,7 @@  verify_gimple_assign_binary (gassign *stmt)
             || (2 * TYPE_PRECISION (TREE_TYPE (rhs1_type))
                 > TYPE_PRECISION (TREE_TYPE (lhs_type))))
           {
-            error ("type mismatch in widening vector shift expression");
+            error ("type mismatch in %qs", code_name);
             debug_generic_expr (lhs_type);
             debug_generic_expr (rhs1_type);
             debug_generic_expr (rhs2_type);
@@ -3845,7 +3858,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    if (TREE_CODE (rhs1_type) != VECTOR_TYPE
 		|| TREE_CODE (rhs2_type) != VECTOR_TYPE)
 	      {
-		error ("invalid non-vector operands to vector valued plus");
+		error ("invalid non-vector operands to %qs", code_name);
 		return true;
 	      }
 	    lhs_etype = TREE_TYPE (lhs_type);
@@ -3856,7 +3869,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || POINTER_TYPE_P (rhs1_etype)
 	    || POINTER_TYPE_P (rhs2_etype))
 	  {
-	    error ("invalid (pointer) operands to plus/minus");
+	    error ("invalid (pointer) operands %qs", code_name);
 	    return true;
 	  }
 
@@ -3870,7 +3883,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || !useless_type_conversion_p (lhs_type, rhs1_type)
 	    || !ptrofftype_p (rhs2_type))
 	  {
-	    error ("type mismatch in pointer plus expression");
+	    error ("type mismatch in %qs", code_name);
 	    debug_generic_stmt (lhs_type);
 	    debug_generic_stmt (rhs1_type);
 	    debug_generic_stmt (rhs2_type);
@@ -3891,7 +3904,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || TYPE_UNSIGNED (lhs_type)
 	    || TYPE_PRECISION (lhs_type) != TYPE_PRECISION (rhs1_type))
 	  {
-	    error ("type mismatch in pointer diff expression");
+	    error ("type mismatch in %qs", code_name);
 	    debug_generic_stmt (lhs_type);
 	    debug_generic_stmt (rhs1_type);
 	    debug_generic_stmt (rhs2_type);
@@ -3945,7 +3958,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || maybe_lt (GET_MODE_SIZE (element_mode (rhs2_type)),
 			 2 * GET_MODE_SIZE (element_mode (rhs1_type))))
           {
-            error ("type mismatch in widening sum reduction");
+            error ("type mismatch in %qs", code_name);
             debug_generic_expr (lhs_type);
             debug_generic_expr (rhs1_type);
             debug_generic_expr (rhs2_type);
@@ -3965,7 +3978,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || maybe_ne (GET_MODE_SIZE (element_mode (lhs_type)),
 			 2 * GET_MODE_SIZE (element_mode (rhs1_type))))
           {
-            error ("type mismatch in vector widening multiplication");
+            error ("type mismatch in %qs", code_name);
             debug_generic_expr (lhs_type);
             debug_generic_expr (rhs1_type);
             debug_generic_expr (rhs2_type);
@@ -4001,7 +4014,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	    || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (rhs1_type),
 			 TYPE_VECTOR_SUBPARTS (lhs_type)))
           {
-            error ("type mismatch in vector pack expression");
+            error ("type mismatch in %qs", code_name);
             debug_generic_expr (lhs_type);
             debug_generic_expr (rhs1_type);
             debug_generic_expr (rhs2_type);
@@ -4022,7 +4035,7 @@  verify_gimple_assign_binary (gassign *stmt)
 	  || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (rhs1_type),
 		       TYPE_VECTOR_SUBPARTS (lhs_type)))
 	{
-	  error ("type mismatch in vector pack expression");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4054,7 +4067,7 @@  verify_gimple_assign_binary (gassign *stmt)
     case VEC_SERIES_EXPR:
       if (!useless_type_conversion_p (rhs1_type, rhs2_type))
 	{
-	  error ("type mismatch in series expression");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
 	  return true;
@@ -4062,7 +4075,7 @@  verify_gimple_assign_binary (gassign *stmt)
       if (TREE_CODE (lhs_type) != VECTOR_TYPE
 	  || !useless_type_conversion_p (TREE_TYPE (lhs_type), rhs1_type))
 	{
-	  error ("vector type expected in series expression");
+	  error ("vector type expected in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  return true;
 	}
@@ -4116,6 +4129,8 @@  verify_gimple_assign_ternary (gassign *stmt)
       return true;
     }
 
+  const char* const code_name = get_tree_code_name (rhs_code);
+
   /* First handle operations that involve different types.  */
   switch (rhs_code)
     {
@@ -4128,7 +4143,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || 2 * TYPE_PRECISION (rhs1_type) > TYPE_PRECISION (lhs_type)
 	  || TYPE_PRECISION (rhs1_type) != TYPE_PRECISION (rhs2_type))
 	{
-	  error ("type mismatch in widening multiply-accumulate expression");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4142,9 +4157,9 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (rhs1_type),
 		       TYPE_VECTOR_SUBPARTS (lhs_type)))
 	{
-	  error ("the first argument of a VEC_COND_EXPR must be of a "
+	  error ("the first argument of a %qs must be of a "
 		 "boolean vector type of the same number of elements "
-		 "as the result");
+		 "as the result", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  return true;
@@ -4160,7 +4175,7 @@  verify_gimple_assign_ternary (gassign *stmt)
       if (!useless_type_conversion_p (lhs_type, rhs2_type)
 	  || !useless_type_conversion_p (lhs_type, rhs3_type))
 	{
-	  error ("type mismatch in conditional expression");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs2_type);
 	  debug_generic_expr (rhs3_type);
@@ -4172,7 +4187,7 @@  verify_gimple_assign_ternary (gassign *stmt)
       if (!useless_type_conversion_p (lhs_type, rhs1_type)
 	  || !useless_type_conversion_p (lhs_type, rhs2_type))
 	{
-	  error ("type mismatch in vector permute expression");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4184,7 +4199,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || TREE_CODE (rhs2_type) != VECTOR_TYPE
 	  || TREE_CODE (rhs3_type) != VECTOR_TYPE)
 	{
-	  error ("vector types expected in vector permute expression");
+	  error ("vector types expected in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4199,8 +4214,8 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || maybe_ne (TYPE_VECTOR_SUBPARTS (rhs3_type),
 		       TYPE_VECTOR_SUBPARTS (lhs_type)))
 	{
-	  error ("vectors with different element number found "
-		 "in vector permute expression");
+	  error ("vectors with different element number found in %qs",
+		 code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4215,7 +4230,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 		  != GET_MODE_BITSIZE (SCALAR_TYPE_MODE
 				       (TREE_TYPE (rhs1_type))))))
 	{
-	  error ("invalid mask type in vector permute expression");
+	  error ("invalid mask type in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4231,7 +4246,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || 2 * GET_MODE_UNIT_BITSIZE (TYPE_MODE (TREE_TYPE (rhs1_type)))
 	       > GET_MODE_UNIT_BITSIZE (TYPE_MODE (TREE_TYPE (lhs_type))))
 	{
-	  error ("type mismatch in sad expression");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4243,7 +4258,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || TREE_CODE (rhs2_type) != VECTOR_TYPE
 	  || TREE_CODE (rhs3_type) != VECTOR_TYPE)
 	{
-	  error ("vector types expected in sad expression");
+	  error ("vector types expected in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
@@ -4256,7 +4271,7 @@  verify_gimple_assign_ternary (gassign *stmt)
     case BIT_INSERT_EXPR:
       if (! useless_type_conversion_p (lhs_type, rhs1_type))
 	{
-	  error ("type mismatch in BIT_INSERT_EXPR");
+	  error ("type mismatch in %qs", code_name);
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  return true;
@@ -4266,7 +4281,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	     || (VECTOR_TYPE_P (rhs1_type)
 		 && types_compatible_p (TREE_TYPE (rhs1_type), rhs2_type))))
 	{
-	  error ("not allowed type combination in BIT_INSERT_EXPR");
+	  error ("not allowed type combination in %qs", code_name);
 	  debug_generic_expr (rhs1_type);
 	  debug_generic_expr (rhs2_type);
 	  return true;
@@ -4275,13 +4290,13 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  || ! types_compatible_p (bitsizetype, TREE_TYPE (rhs3))
 	  || ! tree_fits_uhwi_p (TYPE_SIZE (rhs2_type)))
 	{
-	  error ("invalid position or size in BIT_INSERT_EXPR");
+	  error ("invalid position or size in %qs", code_name);
 	  return true;
 	}
       if (INTEGRAL_TYPE_P (rhs1_type)
 	  && !type_has_mode_precision_p (rhs1_type))
 	{
-	  error ("BIT_INSERT_EXPR into non-mode-precision operand");
+	  error ("%qs into non-mode-precision operand", code_name);
 	  return true;
 	}
       if (INTEGRAL_TYPE_P (rhs1_type))
@@ -4291,7 +4306,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	      || (bitpos + TYPE_PRECISION (rhs2_type)
 		  > TYPE_PRECISION (rhs1_type)))
 	    {
-	      error ("insertion out of range in BIT_INSERT_EXPR");
+	      error ("insertion out of range in %qs", code_name);
 	      return true;
 	    }
 	}
@@ -4301,7 +4316,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	  unsigned HOST_WIDE_INT bitsize = tree_to_uhwi (TYPE_SIZE (rhs2_type));
 	  if (bitpos % bitsize != 0)
 	    {
-	      error ("vector insertion not at element boundary");
+	      error ("%qs not at element boundary", code_name);
 	      return true;
 	    }
 	}
@@ -4320,7 +4335,7 @@  verify_gimple_assign_ternary (gassign *stmt)
 	    || maybe_lt (GET_MODE_SIZE (element_mode (rhs3_type)),
 			 2 * GET_MODE_SIZE (element_mode (rhs1_type))))
           {
-            error ("type mismatch in dot product reduction");
+            error ("type mismatch in %qs", code_name);
             debug_generic_expr (lhs_type);
             debug_generic_expr (rhs1_type);
             debug_generic_expr (rhs2_type);
@@ -4352,9 +4367,11 @@  verify_gimple_assign_single (gassign *stmt)
   tree rhs1_type = TREE_TYPE (rhs1);
   bool res = false;
 
+  const char* const code_name = get_tree_code_name (rhs_code);
+
   if (!useless_type_conversion_p (lhs_type, rhs1_type))
     {
-      error ("non-trivial conversion at assignment");
+      error ("non-trivial conversion in %qs", code_name);
       debug_generic_expr (lhs_type);
       debug_generic_expr (rhs1_type);
       return true;
@@ -4363,7 +4380,8 @@  verify_gimple_assign_single (gassign *stmt)
   if (gimple_clobber_p (stmt)
       && !(DECL_P (lhs) || TREE_CODE (lhs) == MEM_REF))
     {
-      error ("non-decl/MEM_REF LHS in clobber statement");
+      error ("%qs LHS in clobber statement",
+	     get_tree_code_name (TREE_CODE (lhs)));
       debug_generic_expr (lhs);
       return true;
     }
@@ -4381,7 +4399,7 @@  verify_gimple_assign_single (gassign *stmt)
 	tree op = TREE_OPERAND (rhs1, 0);
 	if (!is_gimple_addressable (op))
 	  {
-	    error ("invalid operand in unary expression");
+	    error ("invalid operand in %qs", code_name);
 	    return true;
 	  }
 
@@ -4395,7 +4413,7 @@  verify_gimple_assign_single (gassign *stmt)
 	    && !one_pointer_to_useless_type_conversion_p (TREE_TYPE (rhs1),
 							  TREE_TYPE (op)))
 	  {
-	    error ("type mismatch in address expression");
+	    error ("type mismatch in %qs", code_name);
 	    debug_generic_stmt (TREE_TYPE (rhs1));
 	    debug_generic_stmt (TREE_TYPE (op));
 	    return true;
@@ -4407,7 +4425,7 @@  verify_gimple_assign_single (gassign *stmt)
 
     /* tcc_reference  */
     case INDIRECT_REF:
-      error ("INDIRECT_REF in gimple IL");
+      error ("%qs in gimple IL", code_name);
       return true;
 
     case COMPONENT_REF:
@@ -4422,7 +4440,7 @@  verify_gimple_assign_single (gassign *stmt)
       if (!is_gimple_reg (lhs)
 	  && is_gimple_reg_type (TREE_TYPE (lhs)))
 	{
-	  error ("invalid rhs for gimple memory store");
+	  error ("invalid RHS for gimple memory store: %qs", code_name);
 	  debug_generic_stmt (lhs);
 	  debug_generic_stmt (rhs1);
 	  return true;
@@ -4448,7 +4466,7 @@  verify_gimple_assign_single (gassign *stmt)
 	  && !is_gimple_reg (rhs1)
 	  && is_gimple_reg_type (TREE_TYPE (lhs)))
 	{
-	  error ("invalid rhs for gimple memory store");
+	  error ("invalid RHS for gimple memory store: %qs", code_name);
 	  debug_generic_stmt (lhs);
 	  debug_generic_stmt (rhs1);
 	  return true;
@@ -4482,8 +4500,8 @@  verify_gimple_assign_single (gassign *stmt)
 		      if (!useless_type_conversion_p (TREE_TYPE (rhs1_type),
 						      TREE_TYPE (elt_t)))
 			{
-			  error ("incorrect type of vector CONSTRUCTOR"
-				 " elements");
+			  error ("incorrect type of vector %qs elements",
+				 code_name);
 			  debug_generic_stmt (rhs1);
 			  return true;
 			}
@@ -4491,8 +4509,8 @@  verify_gimple_assign_single (gassign *stmt)
 					 * TYPE_VECTOR_SUBPARTS (elt_t),
 					 TYPE_VECTOR_SUBPARTS (rhs1_type)))
 			{
-			  error ("incorrect number of vector CONSTRUCTOR"
-				 " elements");
+			  error ("incorrect number of vector %qs elements",
+				 code_name);
 			  debug_generic_stmt (rhs1);
 			  return true;
 			}
@@ -4500,14 +4518,16 @@  verify_gimple_assign_single (gassign *stmt)
 		  else if (!useless_type_conversion_p (TREE_TYPE (rhs1_type),
 						       elt_t))
 		    {
-		      error ("incorrect type of vector CONSTRUCTOR elements");
+		      error ("incorrect type of vector %qs elements",
+			     code_name);
 		      debug_generic_stmt (rhs1);
 		      return true;
 		    }
 		  else if (maybe_gt (CONSTRUCTOR_NELTS (rhs1),
 				     TYPE_VECTOR_SUBPARTS (rhs1_type)))
 		    {
-		      error ("incorrect number of vector CONSTRUCTOR elements");
+		      error ("incorrect number of vector %qs elements",
+			     code_name);
 		      debug_generic_stmt (rhs1);
 		      return true;
 		    }
@@ -4523,13 +4543,15 @@  verify_gimple_assign_single (gassign *stmt)
 		      || TREE_CODE (elt_i) != INTEGER_CST
 		      || compare_tree_int (elt_i, i) != 0))
 		{
-		  error ("vector CONSTRUCTOR with non-NULL element index");
+		  error ("vector %qs with non-NULL element index",
+			 code_name);
 		  debug_generic_stmt (rhs1);
 		  return true;
 		}
 	      if (!is_gimple_val (elt_v))
 		{
-		  error ("vector CONSTRUCTOR element is not a GIMPLE value");
+		  error ("vector %qs element is not a GIMPLE value",
+			 code_name);
 		  debug_generic_stmt (rhs1);
 		  return true;
 		}
@@ -4537,7 +4559,7 @@  verify_gimple_assign_single (gassign *stmt)
 	}
       else if (CONSTRUCTOR_NELTS (rhs1) != 0)
 	{
-	  error ("non-vector CONSTRUCTOR with elements");
+	  error ("non-vector %qs with elements", code_name);
 	  debug_generic_stmt (rhs1);
 	  return true;
 	}
@@ -4548,7 +4570,7 @@  verify_gimple_assign_single (gassign *stmt)
       rhs1 = fold (ASSERT_EXPR_COND (rhs1));
       if (rhs1 == boolean_false_node)
 	{
-	  error ("ASSERT_EXPR with an always-false condition");
+	  error ("%qs with an always-false condition", code_name);
 	  debug_generic_stmt (rhs1);
 	  return true;
 	}
@@ -4695,7 +4717,7 @@  verify_gimple_switch (gswitch *stmt)
 
       if (CASE_CHAIN (elt))
 	{
-	  error ("invalid CASE_CHAIN");
+	  error ("invalid %<CASE_CHAIN%>");
 	  debug_generic_expr (elt);
 	  return true;
 	}
@@ -4789,7 +4811,7 @@  verify_gimple_label (glabel *stmt)
       && (uid == -1
 	  || (*label_to_block_map_for_fn (cfun))[uid] != gimple_bb (stmt)))
     {
-      error ("incorrect entry in label_to_block_map");
+      error ("incorrect entry in %<label_to_block_map%>");
       err |= true;
     }
 
@@ -4906,7 +4928,7 @@  verify_gimple_phi (gphi *phi)
 
   if (!phi_result)
     {
-      error ("invalid PHI result");
+      error ("invalid %<PHI%> result");
       return true;
     }
 
@@ -4915,7 +4937,7 @@  verify_gimple_phi (gphi *phi)
       || (virtual_p
 	  && SSA_NAME_VAR (phi_result) != gimple_vop (cfun)))
     {
-      error ("invalid PHI result");
+      error ("invalid %<PHI%> result");
       err = true;
     }
 
@@ -4925,7 +4947,7 @@  verify_gimple_phi (gphi *phi)
 
       if (!t)
 	{
-	  error ("missing PHI def");
+	  error ("missing %<PHI%> def");
 	  err |= true;
 	  continue;
 	}
@@ -4939,14 +4961,14 @@  verify_gimple_phi (gphi *phi)
 	       || (!virtual_p
 		   && !is_gimple_val (t)))
 	{
-	  error ("invalid PHI argument");
+	  error ("invalid %<PHI%> argument");
 	  debug_generic_expr (t);
 	  err |= true;
 	}
 #ifdef ENABLE_TYPES_CHECKING
       if (!useless_type_conversion_p (TREE_TYPE (phi_result), TREE_TYPE (t)))
 	{
-	  error ("incompatible types in PHI argument %u", i);
+	  error ("incompatible types in %<PHI%> argument %u", i);
 	  debug_generic_stmt (TREE_TYPE (phi_result));
 	  debug_generic_stmt (TREE_TYPE (t));
 	  err |= true;
@@ -5044,7 +5066,7 @@  verify_gimple_in_seq (gimple_seq stmts)
 {
   timevar_push (TV_TREE_STMT_VERIFY);
   if (verify_gimple_in_seq_2 (stmts))
-    internal_error ("verify_gimple failed");
+    internal_error ("%<verify_gimple%> failed");
   timevar_pop (TV_TREE_STMT_VERIFY);
 }
 
@@ -5101,7 +5123,7 @@  verify_eh_throw_stmt_node (gimple *const &stmt, const int &,
 {
   if (!visited->contains (stmt))
     {
-      error ("dead STMT in EH table");
+      error ("dead statement in EH table");
       debug_gimple_stmt (stmt);
       eh_error_found = true;
     }
@@ -5225,6 +5247,14 @@  collect_subblocks (hash_set<tree> *blocks, tree block)
     }
 }
 
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow
+   GCC diagnostic conventions and trigger an ICE in the end.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Verify the GIMPLE statements in the CFG of FN.  */
 
 DEBUG_FUNCTION void
@@ -5702,6 +5732,9 @@  gimple_verify_flow_info (void)
   return err;
 }
 
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
 
 /* Updates phi nodes after creating a forwarder block joined
    by edge FALLTHRU.  */
@@ -9404,13 +9437,13 @@  do_warn_unused_result (gimple_seq seq)
 
 	      if (fdecl)
 		warning_at (loc, OPT_Wunused_result,
-			    "ignoring return value of %qD, "
-			    "declared with attribute warn_unused_result",
+			    "ignoring return value of %qD "
+			    "declared with attribute %<warn_unused_result%>",
 			    fdecl);
 	      else
 		warning_at (loc, OPT_Wunused_result,
 			    "ignoring return value of function "
-			    "declared with attribute warn_unused_result");
+			    "declared with attribute %<warn_unused_result%>");
 	    }
 	  break;
 
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index c8063486f2d..f7a1ded80ab 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -4728,6 +4728,14 @@  make_pass_cleanup_eh (gcc::context *ctxt)
   return new pass_cleanup_eh (ctxt);
 }
 
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow
+   GCC diagnostic conventions and trigger an ICE in the end.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Verify that BB containing STMT as the last statement, has precisely the
    edge that make_eh_edges would create.  */
 
@@ -4874,3 +4882,7 @@  verify_eh_dispatch_edge (geh_dispatch *stmt)
 
   return false;
 }
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 35c005ee989..7598674f39c 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4615,7 +4615,7 @@  expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
 	  /* PR 20090218-1_0.c. Body can be provided by another module. */
 	  && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto))
 	{
-	  error ("inlining failed in call to always_inline %q+F: %s", fn,
+	  error ("inlining failed in call to %<always_inline%> %q+F: %s", fn,
 		 cgraph_inline_failed_string (reason));
 	  if (gimple_location (stmt) != UNKNOWN_LOCATION)
 	    inform (gimple_location (stmt), "called from here");
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 061521d20d5..254836f5eb0 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -3304,7 +3304,7 @@  update_ssa (unsigned update_flags)
 
 		  if (SSA_NAME_IN_FREE_LIST (use))
 		    {
-		      error ("statement uses released SSA name:");
+		      error ("statement uses released SSA name");
 		      debug_gimple_stmt (stmt);
 		      fprintf (stderr, "The use of ");
 		      print_generic_expr (stderr, use);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index ae0a6c12072..56895478b41 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -35,6 +35,13 @@  along with GCC; see the file COPYING3.  If not see
 #include "gomp-constants.h"
 #include "gimple.h"
 
+/* Disable warnings about quoting issues in the pp_xxx calls below
+   that (intentionally) don't follow GCC diagnostic conventions.  */
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Local functions, macros and variables.  */
 static const char *op_symbol (const_tree);
 static void pretty_print_string (pretty_printer *, const char*, unsigned);
@@ -4210,3 +4217,7 @@  pp_double_int (pretty_printer *pp, double_int d, bool uns)
       pp_string (pp, pp_buffer (pp)->digit_buffer);
     }
 }
+
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 489f6dc1501..e145dcd32df 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -627,6 +627,14 @@  release_defs_bitset (bitmap toremove)
 
 }
 
+/* Disable warnings about missing quoting in GCC diagnostics for
+   the verification errors.  Their format strings don't follow
+   GCC diagnostic conventions and trigger an ICE in the end.  */
+#if __GNUC__ >= 9   // FIXME: change me to 10
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
+
 /* Verify virtual SSA form.  */
 
 bool
@@ -1193,6 +1201,9 @@  err:
   internal_error ("verify_ssa failed");
 }
 
+#if __GNUC__ >= 10
+#  pragma GCC diagnostic pop
+#endif
 
 /* Initialize global DFA and SSA structures.  */
 
diff --git a/gcc/tree.c b/gcc/tree.c
index 73102c4e75b..ecf98af964d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10009,8 +10009,9 @@  void
 omp_clause_check_failed (const_tree node, const char *file, int line,
                          const char *function, enum omp_clause_code code)
 {
-  internal_error ("tree check: expected omp_clause %s, have %s in %s, at %s:%d",
-		  omp_clause_code_name[code], get_tree_code_name (TREE_CODE (node)),
+  internal_error ("tree check: expected %<omp_clause %s%>, have %qk "
+		  "in %s, at %s:%d",
+		  omp_clause_code_name[code], TREE_CODE (node),
 		  function, trim_filename (file), line);
 }
 
@@ -10083,7 +10084,8 @@  tree_int_cst_elt_check_failed (int idx, int len, const char *file, int line,
 			       const char *function)
 {
   internal_error
-    ("tree check: accessed elt %d of tree_int_cst with %d elts in %s, at %s:%d",
+    ("tree check: accessed elt %d of %<tree_int_cst%> with %d elts in %s, "
+     "at %s:%d",
      idx + 1, len, function, trim_filename (file), line);
 }
 
@@ -10095,7 +10097,7 @@  tree_vec_elt_check_failed (int idx, int len, const char *file, int line,
 			   const char *function)
 {
   internal_error
-    ("tree check: accessed elt %d of tree_vec with %d elts in %s, at %s:%d",
+    ("tree check: accessed elt %d of %<tree_vec%> with %d elts in %s, at %s:%d",
      idx + 1, len, function, trim_filename (file), line);
 }
 
@@ -10121,7 +10123,7 @@  omp_clause_operand_check_failed (int idx, const_tree t, const char *file,
 			         int line, const char *function)
 {
   internal_error
-    ("tree check: accessed operand %d of omp_clause %s with %d operands "
+    ("tree check: accessed operand %d of %<omp_clause %s%> with %d operands "
      "in %s, at %s:%d", idx + 1, omp_clause_code_name[OMP_CLAUSE_CODE (t)],
      omp_clause_num_ops [OMP_CLAUSE_CODE (t)], function,
      trim_filename (file), line);
@@ -13853,11 +13855,11 @@  verify_type_variant (const_tree t, tree tv)
 	{
 	  gcc_assert (!operand_equal_p (TYPE_SIZE_UNIT (t),
 					TYPE_SIZE_UNIT (tv), 0));
-	  error ("type variant has different TYPE_SIZE_UNIT");
+	  error ("type variant has different %<TYPE_SIZE_UNIT%>");
 	  debug_tree (tv);
-	  error ("type variant%'s TYPE_SIZE_UNIT");
+	  error ("type variant%'s %<TYPE_SIZE_UNIT%>");
 	  debug_tree (TYPE_SIZE_UNIT (tv));
-	  error ("type%'s TYPE_SIZE_UNIT");
+	  error ("type%'s %<TYPE_SIZE_UNIT%>");
 	  debug_tree (TYPE_SIZE_UNIT (t));
 	  return false;
 	}
@@ -13877,7 +13879,7 @@  verify_type_variant (const_tree t, tree tv)
   verify_variant_match (TYPE_STRING_FLAG);
   if (TYPE_ALIAS_SET_KNOWN_P (t))
     {
-      error ("type variant with TYPE_ALIAS_SET_KNOWN_P");
+      error ("type variant with %<TYPE_ALIAS_SET_KNOWN_P%>");
       debug_tree (tv);
       return false;
     }
@@ -13890,7 +13892,7 @@  verify_type_variant (const_tree t, tree tv)
       && (in_lto_p || !TYPE_VFIELD (tv)
 	  || TREE_CODE (TYPE_VFIELD (tv)) != TREE_LIST))
     {
-      error ("type variant has different TYPE_VFIELD");
+      error ("type variant has different %<TYPE_VFIELD%>");
       debug_tree (tv);
       return false;
     }
@@ -13926,11 +13928,11 @@  verify_type_variant (const_tree t, tree tv)
 	 at LTO time only.  */
       && (in_lto_p && odr_type_p (t)))
     {
-      error ("type variant has different TYPE_BINFO");
+      error ("type variant has different %<TYPE_BINFO%>");
       debug_tree (tv);
-      error ("type variant%'s TYPE_BINFO");
+      error ("type variant%'s %<TYPE_BINFO%>");
       debug_tree (TYPE_BINFO (tv));
-      error ("type%'s TYPE_BINFO");
+      error ("type%'s %<TYPE_BINFO%>");
       debug_tree (TYPE_BINFO (t));
       return false;
     }
@@ -13969,7 +13971,7 @@  verify_type_variant (const_tree t, tree tv)
 	  break;
       if (f1 || f2)
 	{
-	  error ("type variant has different TYPE_FIELDS");
+	  error ("type variant has different %<TYPE_FIELDS%>");
 	  debug_tree (tv);
 	  error ("first mismatch is field");
 	  debug_tree (f1);
@@ -13990,11 +13992,11 @@  verify_type_variant (const_tree t, tree tv)
 	  || TYPE_MAIN_VARIANT (TREE_TYPE (t))
 	     != TYPE_MAIN_VARIANT (TREE_TYPE (tv))))
     {
-      error ("type variant has different TREE_TYPE");
+      error ("type variant has different %<TREE_TYPE%>");
       debug_tree (tv);
-      error ("type variant%'s TREE_TYPE");
+      error ("type variant%'s %<TREE_TYPE%>");
       debug_tree (TREE_TYPE (tv));
-      error ("type%'s TREE_TYPE");
+      error ("type%'s %<TREE_TYPE%>");
       debug_tree (TREE_TYPE (t));
       return false;
     }
@@ -14003,9 +14005,9 @@  verify_type_variant (const_tree t, tree tv)
     {
       error ("type is not compatible with its variant");
       debug_tree (tv);
-      error ("type variant%'s TREE_TYPE");
+      error ("type variant%'s %<TREE_TYPE%>");
       debug_tree (TREE_TYPE (tv));
-      error ("type%'s TREE_TYPE");
+      error ("type%'s %<TREE_TYPE%>");
       debug_tree (TREE_TYPE (t));
       return false;
     }
@@ -14304,12 +14306,12 @@  verify_type (const_tree t)
   tree mv = TYPE_MAIN_VARIANT (t);
   if (!mv)
     {
-      error ("Main variant is not defined");
+      error ("main variant is not defined");
       error_found = true;
     }
   else if (mv != TYPE_MAIN_VARIANT (mv))
     {
-      error ("TYPE_MAIN_VARIANT has different TYPE_MAIN_VARIANT");
+      error ("%<TYPE_MAIN_VARIANT%> has different %<TYPE_MAIN_VARIANT%>");
       debug_tree (mv);
       error_found = true;
     }
@@ -14321,7 +14323,7 @@  verify_type (const_tree t)
     ;
   else if (TYPE_CANONICAL (t) != ct)
     {
-      error ("TYPE_CANONICAL has different TYPE_CANONICAL");
+      error ("%<TYPE_CANONICAL%> has different %<TYPE_CANONICAL%>");
       debug_tree (ct);
       error_found = true;
     }
@@ -14340,7 +14342,7 @@  verify_type (const_tree t)
 	   && !gimple_canonical_types_compatible_p (t, ct, false)
 	   && COMPLETE_TYPE_P (t))
     {
-      error ("TYPE_CANONICAL is not compatible");
+      error ("%<TYPE_CANONICAL%> is not compatible");
       debug_tree (ct);
       error_found = true;
     }
@@ -14348,13 +14350,13 @@  verify_type (const_tree t)
   if (COMPLETE_TYPE_P (t) && TYPE_CANONICAL (t)
       && TYPE_MODE (t) != TYPE_MODE (TYPE_CANONICAL (t)))
     {
-      error ("TYPE_MODE of TYPE_CANONICAL is not compatible");
+      error ("%<TYPE_MODE%> of %<TYPE_CANONICAL%> is not compatible");
       debug_tree (ct);
       error_found = true;
     }
   if (TYPE_MAIN_VARIANT (t) == t && ct && TYPE_MAIN_VARIANT (ct) != ct)
    {
-      error ("TYPE_CANONICAL of main variant is not main variant");
+      error ("%<TYPE_CANONICAL%> of main variant is not main variant");
       debug_tree (ct);
       debug_tree (TYPE_MAIN_VARIANT (ct));
       error_found = true;
@@ -14370,7 +14372,7 @@  verify_type (const_tree t)
 	  && TREE_CODE (TYPE_VFIELD (t)) != FIELD_DECL
 	  && TREE_CODE (TYPE_VFIELD (t)) != TREE_LIST)
 	{
-	  error ("TYPE_VFIELD is not FIELD_DECL nor TREE_LIST");
+	  error ("%<TYPE_VFIELD%> is not %<FIELD_DECL%> nor %<TREE_LIST%>");
 	  debug_tree (TYPE_VFIELD (t));
 	  error_found = true;
 	}
@@ -14380,7 +14382,7 @@  verify_type (const_tree t)
       if (TYPE_NEXT_PTR_TO (t)
 	  && TREE_CODE (TYPE_NEXT_PTR_TO (t)) != POINTER_TYPE)
 	{
-	  error ("TYPE_NEXT_PTR_TO is not POINTER_TYPE");
+	  error ("%<TYPE_NEXT_PTR_TO%> is not %<POINTER_TYPE%>");
 	  debug_tree (TYPE_NEXT_PTR_TO (t));
 	  error_found = true;
 	}
@@ -14390,7 +14392,7 @@  verify_type (const_tree t)
       if (TYPE_NEXT_REF_TO (t)
 	  && TREE_CODE (TYPE_NEXT_REF_TO (t)) != REFERENCE_TYPE)
 	{
-	  error ("TYPE_NEXT_REF_TO is not REFERENCE_TYPE");
+	  error ("%<TYPE_NEXT_REF_TO%> is not %<REFERENCE_TYPE%>");
 	  debug_tree (TYPE_NEXT_REF_TO (t));
 	  error_found = true;
 	}
@@ -14411,13 +14413,13 @@  verify_type (const_tree t)
 	;
       else if (TREE_CODE (TYPE_BINFO (t)) != TREE_BINFO)
 	{
-	  error ("TYPE_BINFO is not TREE_BINFO");
+	  error ("%<TYPE_BINFO%> is not %<TREE_BINFO%>");
 	  debug_tree (TYPE_BINFO (t));
 	  error_found = true;
 	}
       else if (TREE_TYPE (TYPE_BINFO (t)) != TYPE_MAIN_VARIANT (t))
 	{
-	  error ("TYPE_BINFO type is not TYPE_MAIN_VARIANT");
+	  error ("%<TYPE_BINFO%> type is not %<TYPE_MAIN_VARIANT%>");
 	  debug_tree (TREE_TYPE (TYPE_BINFO (t)));
 	  error_found = true;
 	}
@@ -14428,7 +14430,7 @@  verify_type (const_tree t)
 	  && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != RECORD_TYPE
 	  && TREE_CODE (TYPE_METHOD_BASETYPE (t)) != UNION_TYPE)
 	{
-	  error ("TYPE_METHOD_BASETYPE is not record nor union");
+	  error ("%<TYPE_METHOD_BASETYPE%> is not record nor union");
 	  debug_tree (TYPE_METHOD_BASETYPE (t));
 	  error_found = true;
 	}
@@ -14439,7 +14441,7 @@  verify_type (const_tree t)
 	  && TREE_CODE (TYPE_OFFSET_BASETYPE (t)) != RECORD_TYPE
 	  && TREE_CODE (TYPE_OFFSET_BASETYPE (t)) != UNION_TYPE)
 	{
-	  error ("TYPE_OFFSET_BASETYPE is not record nor union");
+	  error ("%<TYPE_OFFSET_BASETYPE%> is not record nor union");
 	  debug_tree (TYPE_OFFSET_BASETYPE (t));
 	  error_found = true;
 	}
@@ -14457,21 +14459,21 @@  verify_type (const_tree t)
       if (TYPE_ARRAY_MAX_SIZE (t)
 	  && TREE_CODE (TYPE_ARRAY_MAX_SIZE (t)) != INTEGER_CST)
         {
-	  error ("TYPE_ARRAY_MAX_SIZE not INTEGER_CST");
+	  error ("%<TYPE_ARRAY_MAX_SIZE%> not %<INTEGER_CST%>");
 	  debug_tree (TYPE_ARRAY_MAX_SIZE (t));
 	  error_found = true;
         } 
     }
   else if (TYPE_MAX_VALUE_RAW (t))
     {
-      error ("TYPE_MAX_VALUE_RAW non-NULL");
+      error ("%<TYPE_MAX_VALUE_RAW%> non-NULL");
       debug_tree (TYPE_MAX_VALUE_RAW (t));
       error_found = true;
     }
 
   if (TYPE_LANG_SLOT_1 (t) && in_lto_p)
     {
-      error ("TYPE_LANG_SLOT_1 (binfo) field is non-NULL");
+      error ("%<TYPE_LANG_SLOT_1 (binfo)%> field is non-NULL");
       debug_tree (TYPE_LANG_SLOT_1 (t));
       error_found = true;
     }
@@ -14487,7 +14489,7 @@  verify_type (const_tree t)
  	   CONST_DECL of ENUMERAL TYPE.  */
 	if (TREE_CODE (value) != INTEGER_CST && TREE_CODE (value) != CONST_DECL)
 	  {
-	    error ("Enum value is not CONST_DECL or INTEGER_CST");
+	    error ("enum value is not %<CONST_DECL%> or %<INTEGER_CST%>");
 	    debug_tree (value);
 	    debug_tree (name);
 	    error_found = true;
@@ -14495,14 +14497,15 @@  verify_type (const_tree t)
 	if (TREE_CODE (TREE_TYPE (value)) != INTEGER_TYPE
 	    && !useless_type_conversion_p (const_cast <tree> (t), TREE_TYPE (value)))
 	  {
-	    error ("Enum value type is not INTEGER_TYPE nor convertible to the enum");
+	    error ("enum value type is not %<INTEGER_TYPE%> nor convertible "
+		   "to the enum");
 	    debug_tree (value);
 	    debug_tree (name);
 	    error_found = true;
 	  }
 	if (TREE_CODE (name) != IDENTIFIER_NODE)
 	  {
-	    error ("Enum value name is not IDENTIFIER_NODE");
+	    error ("enum value name is not %<IDENTIFIER_NODE%>");
 	    debug_tree (value);
 	    debug_tree (name);
 	    error_found = true;
@@ -14512,7 +14515,7 @@  verify_type (const_tree t)
     {
       if (TYPE_DOMAIN (t) && TREE_CODE (TYPE_DOMAIN (t)) != INTEGER_TYPE)
 	{
-	  error ("Array TYPE_DOMAIN is not integer type");
+	  error ("array %<TYPE_DOMAIN%> is not integer type");
 	  debug_tree (TYPE_DOMAIN (t));
 	  error_found = true;
 	}
@@ -14521,7 +14524,7 @@  verify_type (const_tree t)
     {
       if (TYPE_FIELDS (t) && !COMPLETE_TYPE_P (t) && in_lto_p)
 	{
-	  error ("TYPE_FIELDS defined in incomplete type");
+	  error ("%<TYPE_FIELDS%> defined in incomplete type");
 	  error_found = true;
 	}
       for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld))
@@ -14543,7 +14546,7 @@  verify_type (const_tree t)
 	    ;
 	  else
 	    {
-	      error ("Wrong tree in TYPE_FIELDS list");
+	      error ("wrong tree in %<TYPE_FIELDS%> list");
 	      debug_tree (fld);
 	      error_found = true;
 	    }
@@ -14558,13 +14561,14 @@  verify_type (const_tree t)
     {
       if (TYPE_CACHED_VALUES_P (t) != (TYPE_CACHED_VALUES (t) != NULL))
 	{
-	  error ("TYPE_CACHED_VALUES_P is %i while TYPE_CACHED_VALUES is %p",
+	  error ("%<TYPE_CACHED_VALUES_P%> is %i while %<TYPE_CACHED_VALUES%> "
+		 "is %p",
 		 TYPE_CACHED_VALUES_P (t), (void *)TYPE_CACHED_VALUES (t));
 	  error_found = true;
 	}
       else if (TYPE_CACHED_VALUES_P (t) && TREE_CODE (TYPE_CACHED_VALUES (t)) != TREE_VEC)
 	{
-	  error ("TYPE_CACHED_VALUES is not TREE_VEC");
+	  error ("%<TYPE_CACHED_VALUES%> is not %<TREE_VEC%>");
 	  debug_tree (TYPE_CACHED_VALUES (t));
 	  error_found = true;
 	}
@@ -14577,7 +14581,7 @@  verify_type (const_tree t)
 	    if (TREE_VEC_ELT (TYPE_CACHED_VALUES (t), i)
 		&& TREE_TYPE (TREE_VEC_ELT (TYPE_CACHED_VALUES (t), i)) != t)
 	      {
-		error ("wrong TYPE_CACHED_VALUES entry");
+		error ("wrong %<TYPE_CACHED_VALUES%> entry");
 		debug_tree (TREE_VEC_ELT (TYPE_CACHED_VALUES (t), i));
 		error_found = true;
 		break;
@@ -14590,20 +14594,20 @@  verify_type (const_tree t)
 	/* C++ FE uses TREE_PURPOSE to store initial values.  */
 	if (TREE_PURPOSE (l) && in_lto_p)
 	  {
-	    error ("TREE_PURPOSE is non-NULL in TYPE_ARG_TYPES list");
+	    error ("%<TREE_PURPOSE%> is non-NULL in %<TYPE_ARG_TYPES%> list");
 	    debug_tree (l);
 	    error_found = true;
 	  }
 	if (!TYPE_P (TREE_VALUE (l)))
 	  {
-	    error ("Wrong entry in TYPE_ARG_TYPES list");
+	    error ("wrong entry in %<TYPE_ARG_TYPES%> list");
 	    debug_tree (l);
 	    error_found = true;
 	  }
       }
   else if (!is_lang_specific (t) && TYPE_VALUES_RAW (t))
     {
-      error ("TYPE_VALUES_RAW field is non-NULL");
+      error ("%<TYPE_VALUES_RAW%> field is non-NULL");
       debug_tree (TYPE_VALUES_RAW (t));
       error_found = true;
     }
@@ -14615,13 +14619,13 @@  verify_type (const_tree t)
       && TREE_CODE (t) != POINTER_TYPE
       && TYPE_CACHED_VALUES_P (t))
     {
-      error ("TYPE_CACHED_VALUES_P is set while it should not");
+      error ("%<TYPE_CACHED_VALUES_P%> is set while it should not be");
       error_found = true;
     }
   if (TYPE_STRING_FLAG (t)
       && TREE_CODE (t) != ARRAY_TYPE && TREE_CODE (t) != INTEGER_TYPE)
     {
-      error ("TYPE_STRING_FLAG is set on wrong type code");
+      error ("%<TYPE_STRING_FLAG%> is set on wrong type code");
       error_found = true;
     }
   
@@ -14631,14 +14635,14 @@  verify_type (const_tree t)
   if (TREE_CODE (t) == METHOD_TYPE
       && TYPE_MAIN_VARIANT (TYPE_METHOD_BASETYPE (t)) != TYPE_METHOD_BASETYPE (t))
     {
-	error ("TYPE_METHOD_BASETYPE is not main variant");
+	error ("%<TYPE_METHOD_BASETYPE%> is not main variant");
 	error_found = true;
     }
 
   if (error_found)
     {
       debug_tree (const_cast <tree> (t));
-      internal_error ("verify_type failed");
+      internal_error ("%qs failed", __func__);
     }
 }
 
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 5013956cf86..d34d2ab7685 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -535,7 +535,7 @@  verify_histograms (void)
 	  {
 	    if (hist->hvalue.stmt != stmt)
 	      {
-		error ("Histogram value statement does not correspond to "
+		error ("histogram value statement does not correspond to "
 		       "the statement it is associated with");
 		debug_gimple_stmt (stmt);
 		dump_histogram_value (stderr, hist);
@@ -547,7 +547,7 @@  verify_histograms (void)
   if (VALUE_HISTOGRAMS (cfun))
     htab_traverse (VALUE_HISTOGRAMS (cfun), visit_hist, &visited_hists);
   if (error_found)
-    internal_error ("verify_histograms failed");
+    internal_error ("%qs failed", __func__);
 }
 
 /* Helper function for verify_histograms.  For each histogram reachable via htab
diff --git a/gcc/varasm.c b/gcc/varasm.c
index cb43248ec49..9397152dbce 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1878,7 +1878,9 @@  assemble_start_function (tree decl, const char *fnname)
   if (patch_area_entry > patch_area_size)
     {
       if (patch_area_size > 0)
-	warning (OPT_Wattributes, "patchable function entry > size");
+	warning (OPT_Wattributes,
+		 "patchable function entry %wu exceeds size %wu",
+		 patch_area_entry, patch_area_size);
       patch_area_entry = 0;
     }