diff -urN gcc-16.1.0-orig/gcc/c/c-decl.cc gcc-16.1.0/gcc/c/c-decl.cc
--- gcc-16.1.0-orig/gcc/c/c-decl.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/c/c-decl.cc	2026-05-07 23:36:19 +0900
@@ -4128,8 +4128,9 @@
 	}
       if (!already)
 	{
-          inform (loc, "each undeclared identifier is reported only"
-                  " once for each function it appears in");
+          inform_with_flags (loc, DI_NO_CARET,
+                             "each undeclared identifier is reported only"
+                             " once for each function it appears in");
 	  already = true;
 	}
 
diff -urN gcc-16.1.0-orig/gcc/c-family/c-opts.cc gcc-16.1.0/gcc/c-family/c-opts.cc
--- gcc-16.1.0-orig/gcc/c-family/c-opts.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/c-family/c-opts.cc	2026-05-07 23:37:13 +0900
@@ -178,12 +178,15 @@
   char *saved_prefix = pp_take_prefix (pp);
   pp_set_prefix (pp, text_output.build_indent_prefix (false));
   pp_newline (pp);
-  diagnostic_show_locus (&text_output.get_context (),
-			 text_output.get_source_printing_options (),
-			 diagnostic->m_richloc, diagnostic->m_kind, pp);
-  /* By default print macro expansion contexts in the diagnostic
-     finalizer -- for tokens resulting from macro expansion.  */
-  diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic);
+  if (!(diagnostic->flags & DI_NO_CARET))
+    {
+      diagnostic_show_locus (&text_output.get_context (),
+			     text_output.get_source_printing_options (),
+			     diagnostic->m_richloc, diagnostic->m_kind, pp);
+      /* By default print macro expansion contexts in the diagnostic
+         finalizer -- for tokens resulting from macro expansion.  */
+      diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic);
+    }
   pp_set_prefix (pp, saved_prefix);
   pp_flush (pp);
 }
diff -urN gcc-16.1.0-orig/gcc/cobol/util.cc gcc-16.1.0/gcc/cobol/util.cc
--- gcc-16.1.0-orig/gcc/cobol/util.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/cobol/util.cc	2026-05-08 00:11:44 +0900
@@ -3103,7 +3103,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, token_location);
-  /*bool ret =*/ global_dc->diagnostic_impl (&richloc, nullptr, option_zero,
+  /*bool ret =*/ global_dc->diagnostic_impl (&richloc, nullptr, option_zero, 0,
                                              gmsgid, &ap,
                                              diagnostics::kind::error);
   va_end (ap);
@@ -3159,7 +3159,7 @@
   va_list ap;                                                           \
   va_start (ap, gmsgid);                                                \
   rich_location richloc (line_table, token_location);                   \
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_zero,        \
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_zero, 0, \
                                          gmsgid, &ap,                   \
                                          diagnostics::kind::error);     \
   va_end (ap);                                                          \
@@ -3216,6 +3216,7 @@
   /*bool ret =*/ global_dc->diagnostic_impl ( &richloc,
                                               nullptr,
                                               option_zero,
+                                              0,
                                               gmsgid,
                                               &ap, diagnostics::kind::error);
   va_end (ap);
diff -urN gcc-16.1.0-orig/gcc/cp/call.cc gcc-16.1.0/gcc/cp/call.cc
--- gcc-16.1.0-orig/gcc/cp/call.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/cp/call.cc	2026-05-07 23:43:18 +0900
@@ -4075,36 +4075,43 @@
     fn = strip_inheriting_ctors (fn);
   location_t cloc = location_of (fn);
 
+  diagnostic_info_flags diagnostic_flags =
+    (candidate->reason != NULL && candidate->reason->code != rr_none)
+    ? DI_NO_CARET : 0;
+
   if (identifier_p (fn))
     {
       cloc = loc;
       if (candidate->num_convs == 3)
-	inform (cloc, "%s%<%D(%T, %T, %T)%> (built-in)", msg, fn,
+	inform_with_flags (cloc, diagnostic_flags,
+		"%s%<%D(%T, %T, %T)%> (built-in)", msg, fn,
 		candidate->convs[0]->type,
 		candidate->convs[1]->type,
 		candidate->convs[2]->type);
       else if (candidate->num_convs == 2)
-	inform (cloc, "%s%<%D(%T, %T)%> (built-in)", msg, fn,
+	inform_with_flags (cloc, diagnostic_flags,
+		"%s%<%D(%T, %T)%> (built-in)", msg, fn,
 		candidate->convs[0]->type,
 		candidate->convs[1]->type);
       else
-	inform (cloc, "%s%<%D(%T)%> (built-in)", msg, fn,
+	inform_with_flags (cloc, diagnostic_flags,
+		"%s%<%D(%T)%> (built-in)", msg, fn,
 		candidate->convs[0]->type);
     }
   else if (TYPE_P (fn))
-    inform (cloc, "%s%qT (conversion)", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%qT (conversion)", msg, fn);
   else if (candidate->viable == -1)
-    inform (cloc, "%s%#qD (near match)", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%#qD (near match)", msg, fn);
   else if (ignored_candidate_p (candidate))
-    inform (cloc, "%s%#qD (ignored)", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%#qD (ignored)", msg, fn);
   else if (DECL_DELETED_FN (fn))
-    inform (cloc, "%s%#qD (deleted)", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%#qD (deleted)", msg, fn);
   else if (candidate->reversed ())
-    inform (cloc, "%s%#qD (reversed)", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%#qD (reversed)", msg, fn);
   else if (candidate->rewritten ())
-    inform (cloc, "%s%#qD (rewritten)", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%#qD (rewritten)", msg, fn);
   else
-    inform (cloc, "%s%#qD", msg, fn);
+    inform_with_flags (cloc, diagnostic_flags, "%s%#qD", msg, fn);
 
   auto_diagnostic_nesting_level sentinel;
 
diff -urN gcc-16.1.0-orig/gcc/diagnostic-core.h gcc-16.1.0/gcc/diagnostic-core.h
--- gcc-16.1.0-orig/gcc/diagnostic-core.h	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostic-core.h	2026-05-07 23:44:07 +0900
@@ -59,6 +59,13 @@
 /* Various functions for emitting diagnostics follow.
    All of these implicitly use global_dc.  */
 
+typedef unsigned int diagnostic_info_flags;
+enum
+{
+  /* Hide caret information for this diagnostic.  */
+  DI_NO_CARET  = 1 << 0,
+};
+
 /* If we haven't already defined a front-end-specific diagnostics
    style, use the generic one.  */
 #ifndef GCC_DIAG_STYLE
@@ -138,6 +145,8 @@
 extern void sorry_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern void inform_with_flags (location_t, diagnostic_info_flags, const char *, ...)
+  ATTRIBUTE_GCC_DIAG(3,4);
 extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *,
 		      const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
diff -urN gcc-16.1.0-orig/gcc/diagnostic-global-context.cc gcc-16.1.0/gcc/diagnostic-global-context.cc
--- gcc-16.1.0-orig/gcc/diagnostic-global-context.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostic-global-context.cc	2026-05-07 23:59:33 +0900
@@ -78,7 +78,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, &ap, kind);
   va_end (ap);
 
@@ -106,7 +106,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id, 0,
 					 gmsgid, &ap, kind);
   va_end (ap);
 
@@ -132,7 +132,7 @@
   auto_inc_log_depth depth_sentinel (logger);
 
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, ap, kind);
 
   if (logger)
@@ -157,7 +157,7 @@
     .log_param_string ("gmsgid", gmsgid);
   auto_inc_log_depth depth_sentinel (logger);
 
-  bool ret = global_dc->diagnostic_impl (richloc, metadata, option_id,
+  bool ret = global_dc->diagnostic_impl (richloc, metadata, option_id, 0,
 					 gmsgid, ap, kind);
 
   if (logger)
@@ -181,7 +181,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, location);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::note);
   va_end (ap);
 }
@@ -201,11 +201,26 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  global_dc->diagnostic_impl (richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::note);
   va_end (ap);
 }
 
+/* An informative note at LOCATION.  Use this for additional details on an error
+   message.  This variant accepts diagnostic_info_flags.  */
+void
+inform_with_flags (location_t location, diagnostic_info_flags flags,
+                  const char *gmsgid, ...)
+{
+  auto_diagnostic_group d;
+  va_list ap;
+  va_start (ap, gmsgid);
+  rich_location richloc (line_table, location);
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, flags, gmsgid, &ap,
+                             diagnostics::kind::note);
+  va_end (ap);
+}
+
 /* An informative note at LOCATION.  Use this for additional details on an
    error message.  */
 void
@@ -222,7 +237,7 @@
   va_start (ap, plural_gmsgid);
   auto_diagnostic_group d;
   rich_location richloc (line_table, location);
-  global_dc->diagnostic_n_impl (&richloc, nullptr, -1, n,
+  global_dc->diagnostic_n_impl (&richloc, nullptr, -1, 0, n,
 				singular_gmsgid, plural_gmsgid,
 				&ap, diagnostics::kind::note);
   va_end (ap);
@@ -244,7 +259,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, input_location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::warning);
   va_end (ap);
@@ -275,7 +290,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::warning);
   va_end (ap);
@@ -305,7 +320,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::warning);
   va_end (ap);
@@ -336,7 +351,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = global_dc->diagnostic_impl (richloc, &metadata, option_id,
+  bool ret = global_dc->diagnostic_impl (richloc, &metadata, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::warning);
   va_end (ap);
@@ -367,7 +382,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, plural_gmsgid);
-  bool ret = global_dc->diagnostic_n_impl (richloc, nullptr, option_id, n,
+  bool ret = global_dc->diagnostic_n_impl (richloc, nullptr, option_id, 0, n,
 					   singular_gmsgid, plural_gmsgid,
 					   &ap, diagnostics::kind::warning);
   va_end (ap);
@@ -399,7 +414,7 @@
   va_list ap;
   va_start (ap, plural_gmsgid);
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_n_impl (&richloc, nullptr, option_id, n,
+  bool ret = global_dc->diagnostic_n_impl (&richloc, nullptr, option_id, 0, n,
 					   singular_gmsgid, plural_gmsgid,
 					   &ap, diagnostics::kind::warning);
   va_end (ap);
@@ -439,7 +454,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::pedwarn);
   va_end (ap);
@@ -469,7 +484,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::pedwarn);
   va_end (ap);
@@ -500,7 +515,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 					 diagnostics::kind::permerror);
   va_end (ap);
 
@@ -526,7 +541,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = global_dc->diagnostic_impl (richloc, nullptr, -1, gmsgid, &ap,
+  bool ret = global_dc->diagnostic_impl (richloc, nullptr, -1, 0, gmsgid, &ap,
 					 diagnostics::kind::permerror);
   va_end (ap);
 
@@ -556,7 +571,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::permerror);
   va_end (ap);
@@ -586,7 +601,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (richloc, nullptr, option_id, 0,
 					 gmsgid, &ap,
 					 diagnostics::kind::permerror);
   va_end (ap);
@@ -611,7 +626,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, input_location);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::error);
   va_end (ap);
 }
@@ -632,7 +647,7 @@
   va_list ap;
   va_start (ap, plural_gmsgid);
   rich_location richloc (line_table, location);
-  global_dc->diagnostic_n_impl (&richloc, nullptr, -1, n,
+  global_dc->diagnostic_n_impl (&richloc, nullptr, -1, 0, n,
 				singular_gmsgid, plural_gmsgid,
 				&ap, diagnostics::kind::error);
   va_end (ap);
@@ -652,7 +667,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, loc);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::error);
   va_end (ap);
 }
@@ -673,7 +688,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  global_dc->diagnostic_impl (richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::error);
   va_end (ap);
 }
@@ -695,7 +710,7 @@
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  global_dc->diagnostic_impl (richloc, &metadata, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (richloc, &metadata, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::error);
   va_end (ap);
 }
@@ -715,7 +730,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, input_location);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::sorry);
   va_end (ap);
 }
@@ -734,7 +749,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, loc);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::sorry);
   va_end (ap);
 }
@@ -763,7 +778,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, loc);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::fatal);
   va_end (ap);
 
@@ -784,7 +799,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, input_location);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::ice);
   va_end (ap);
 
@@ -806,7 +821,7 @@
   va_list ap;
   va_start (ap, gmsgid);
   rich_location richloc (line_table, input_location);
-  global_dc->diagnostic_impl (&richloc, nullptr, -1, gmsgid, &ap,
+  global_dc->diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, &ap,
 			      diagnostics::kind::ice_nobt);
   va_end (ap);
 
diff -urN gcc-16.1.0-orig/gcc/diagnostics/context.cc gcc-16.1.0/gcc/diagnostics/context.cc
--- gcc-16.1.0-orig/gcc/diagnostics/context.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostics/context.cc	2026-05-08 00:05:36 +0900
@@ -694,6 +694,7 @@
   diagnostic->m_metadata = nullptr;
   diagnostic->m_kind = kind;
   diagnostic->m_option_id = 0;
+  diagnostic->flags = 0;
 }
 
 /* Initialize DIAGNOSTIC, where the message GMSGID has not yet been
@@ -1340,7 +1341,7 @@
 {
   begin_group ();
 
-  bool ret = diagnostic_impl (&richloc, metadata, opt_id,
+  bool ret = diagnostic_impl (&richloc, metadata, opt_id, 0,
 			      gmsgid, ap, kind);
 
   end_group ();
@@ -1658,6 +1659,7 @@
 context::diagnostic_impl (rich_location *richloc,
 			  const metadata *metadata,
 			  option_id opt_id,
+			  diagnostic_info_flags flags,
 			  const char *gmsgid,
 			  va_list *ap, enum kind kind)
 {
@@ -1685,6 +1687,7 @@
 	diagnostic.m_option_id = opt_id;
     }
   diagnostic.m_metadata = metadata;
+  diagnostic.flags = flags;
 
   bool ret = report_diagnostic (&diagnostic);
   if (m_logger)
@@ -1698,6 +1701,7 @@
 context::diagnostic_n_impl (rich_location *richloc,
 			    const metadata *metadata,
 			    option_id opt_id,
+			    diagnostic_info_flags flags,
 			    unsigned HOST_WIDE_INT n,
 			    const char *singular_gmsgid,
 			    const char *plural_gmsgid,
@@ -1726,6 +1730,7 @@
   if (kind == diagnostics::kind::warning)
     diagnostic.m_option_id = opt_id;
   diagnostic.m_metadata = metadata;
+  diagnostic.flags = flags;
 
   bool ret = report_diagnostic (&diagnostic);
   if (m_logger)
diff -urN gcc-16.1.0-orig/gcc/diagnostics/context.h gcc-16.1.0/gcc/diagnostics/context.h
--- gcc-16.1.0-orig/gcc/diagnostics/context.h	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostics/context.h	2026-05-08 00:08:32 +0900
@@ -513,12 +513,12 @@
   }
 
   bool diagnostic_impl (rich_location *, const metadata *,
-			option_id, const char *,
-			va_list *, enum kind) ATTRIBUTE_GCC_DIAG(5,0);
+			option_id, diagnostic_info_flags, const char *,
+			va_list *, enum kind) ATTRIBUTE_GCC_DIAG(6,0);
   bool diagnostic_n_impl (rich_location *, const metadata *,
-			  option_id, unsigned HOST_WIDE_INT,
+			  option_id, diagnostic_info_flags, unsigned HOST_WIDE_INT,
 			  const char *, const char *, va_list *,
-			  enum kind) ATTRIBUTE_GCC_DIAG(7,0);
+			  enum kind) ATTRIBUTE_GCC_DIAG(8,0);
 
   int get_diagnostic_nesting_level () const
   {
diff -urN gcc-16.1.0-orig/gcc/diagnostics/diagnostic-info.h gcc-16.1.0/gcc/diagnostics/diagnostic-info.h
--- gcc-16.1.0-orig/gcc/diagnostics/diagnostic-info.h	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostics/diagnostic-info.h	2026-05-08 00:07:53 +0900
@@ -56,6 +56,8 @@
   kind m_kind;
   /* Which OPT_* directly controls this diagnostic.  */
   option_id m_option_id;
+  /* Flags that allow more fine-tuning of diagnostics.  */
+  diagnostic_info_flags flags;
 
   /* Inlining context containing locations for each call site along
      the inlining stack.  */
diff -urN gcc-16.1.0-orig/gcc/diagnostics/output-spec.h gcc-16.1.0/gcc/diagnostics/output-spec.h
--- gcc-16.1.0-orig/gcc/diagnostics/output-spec.h	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostics/output-spec.h	2026-05-08 00:10:20 +0900
@@ -183,7 +183,7 @@
   {
     m_dc.begin_group ();
     rich_location richloc (m_control_location_mgr, m_loc);
-    m_dc.diagnostic_impl (&richloc, nullptr, -1, gmsgid, ap, kind::error);
+    m_dc.diagnostic_impl (&richloc, nullptr, -1, 0, gmsgid, ap, kind::error);
     m_dc.end_group ();
   }
 
diff -urN gcc-16.1.0-orig/gcc/diagnostics/selftest-context.cc gcc-16.1.0/gcc/diagnostics/selftest-context.cc
--- gcc-16.1.0-orig/gcc/diagnostics/selftest-context.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostics/selftest-context.cc	2026-05-08 00:10:36 +0900
@@ -79,7 +79,7 @@
   va_list ap;
   va_start (ap, fmt);
   begin_group ();
-  bool result = diagnostic_impl (&richloc, metadata_, opt_id, fmt, &ap, kind);
+  bool result = diagnostic_impl (&richloc, metadata_, opt_id, 0, fmt, &ap, kind);
   end_group ();
   va_end (ap);
   return result;
diff -urN gcc-16.1.0-orig/gcc/diagnostics/text-sink.cc gcc-16.1.0/gcc/diagnostics/text-sink.cc
--- gcc-16.1.0-orig/gcc/diagnostics/text-sink.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/diagnostics/text-sink.cc	2026-05-07 23:55:20 +0900
@@ -721,9 +721,10 @@
   char *saved_prefix = pp_take_prefix (pp);
   pp_set_prefix (pp, nullptr);
   pp_newline (pp);
-  diagnostic_show_locus (&text_output.get_context (),
-			 text_output.get_source_printing_options (),
-			 diagnostic->m_richloc, diagnostic->m_kind, pp);
+  if (!(diagnostic->flags & DI_NO_CARET))
+    diagnostic_show_locus (&text_output.get_context (),
+			   text_output.get_source_printing_options (),
+			   diagnostic->m_richloc, diagnostic->m_kind, pp);
   pp_set_prefix (pp, saved_prefix);
   pp_flush (pp);
 }
diff -urN gcc-16.1.0-orig/gcc/fortran/error.cc gcc-16.1.0/gcc/fortran/error.cc
--- gcc-16.1.0-orig/gcc/fortran/error.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/fortran/error.cc	2026-05-08 00:09:20 +0900
@@ -575,6 +575,7 @@
     : gfc_diagnostic_build_locus_prefix (loc_policy, s1, s2, colorize);
 
   if (!context->get_source_printing_options ().enabled
+      || (diagnostic->flags & DI_NO_CARET)
       || diagnostic_location (diagnostic, 0) <= BUILTINS_LOCATION
       || diagnostic_location (diagnostic, 0) == context->m_last_location)
     {
diff -urN gcc-16.1.0-orig/gcc/json-diagnostic.cc gcc-16.1.0/gcc/json-diagnostic.cc
--- gcc-16.1.0-orig/gcc/json-diagnostic.cc	2026-04-30 17:33:20 +0900
+++ gcc-16.1.0/gcc/json-diagnostic.cc	2026-05-08 00:10:53 +0900
@@ -308,7 +308,7 @@
   text_starter (global_dc) = json_text_starter;
   text_finalizer (global_dc) = diagnostics::default_text_finalizer;
 
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
+  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id, 0,
 					 gmsgid, ap, kind);
 
   // Restore old text and client data hooks:
