From 47fc47b1c5f65dad8b9f876655c562fdd7436fe5 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 17 Jul 2025 18:23:40 -0400
Subject: [PATCH 38/41] {needs ChangeLog} rename diagnostic_option_id to
 diagnostics::option_id and move to its own header

---
 gcc/c-family/c-common.cc             |  2 +-
 gcc/c-family/c-common.h              |  2 +-
 gcc/c-family/c-cppbuiltin.cc         |  2 +-
 gcc/c-family/known-headers.cc        |  7 ++--
 gcc/c-family/known-headers.h         |  4 +--
 gcc/c/c-decl.cc                      |  2 +-
 gcc/c/c-errors.cc                    |  8 ++---
 gcc/c/c-tree.h                       |  8 ++---
 gcc/cobol/util.cc                    |  2 +-
 gcc/cp/cp-tree.h                     |  2 +-
 gcc/cp/decl.cc                       |  2 +-
 gcc/cp/error.cc                      |  2 +-
 gcc/cp/name-lookup.cc                |  2 +-
 gcc/diagnostic-core.h                | 50 +++++++++-------------------
 gcc/diagnostic-global-context.cc     | 28 ++++++++--------
 gcc/diagnostic.cc                    | 24 ++++++-------
 gcc/diagnostic.h                     | 16 ++++-----
 gcc/diagnostics/context.h            | 44 ++++++++++++------------
 gcc/diagnostics/diagnostic-info.h    |  2 +-
 gcc/diagnostics/lazy-paths.cc        | 12 +++----
 gcc/diagnostics/option-classifier.cc | 22 ++++++------
 gcc/diagnostics/option-classifier.h  | 12 +++----
 gcc/diagnostics/option-id.h          | 49 +++++++++++++++++++++++++++
 gcc/diagnostics/selftest-context.cc  |  4 +--
 gcc/diagnostics/selftest-context.h   |  2 +-
 gcc/fortran/cpp.cc                   |  2 +-
 gcc/ipa-pure-const.cc                |  2 +-
 gcc/lto-wrapper.cc                   |  4 +--
 gcc/opts-common.cc                   |  2 +-
 gcc/opts-diagnostic.h                |  6 ++--
 gcc/opts.cc                          |  4 +--
 gcc/substring-locations.cc           |  8 ++---
 gcc/substring-locations.h            |  8 ++---
 33 files changed, 188 insertions(+), 158 deletions(-)
 create mode 100644 gcc/diagnostics/option-id.h

diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 358b5493a92b..5f056402c2f9 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -7004,7 +7004,7 @@ c_parse_error (const char *gmsgid, enum cpp_ttype token_type,
 /* Return the gcc option code associated with the reason for a cpp
    message, or 0 if none.  */
 
-static diagnostic_option_id
+static diagnostics::option_id
 c_option_controlling_cpp_diagnostic (enum cpp_warning_reason reason)
 {
   const struct cpp_reason_option_codes_t *entry;
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 40b97e2d90e4..ed59801a725d 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1265,7 +1265,7 @@ extern void c_stddef_cpp_builtins (void);
 extern void fe_file_change (const line_map_ordinary *);
 extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char,
 			   rich_location *richloc);
-extern diagnostic_option_id get_option_for_builtin_define (const char *macro_name);
+extern diagnostics::option_id get_option_for_builtin_define (const char *macro_name);
 
 /* In c-ppoutput.cc  */
 extern void init_pp_output (FILE *);
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 459fd86bb39d..69ce0321ab07 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1679,7 +1679,7 @@ c_cpp_builtins (cpp_reader *pfile)
 /* Given NAME, return the command-line option that would make it be
    a builtin define, or 0 if unrecognized.  */
 
-diagnostic_option_id
+diagnostics::option_id
 get_option_for_builtin_define (const char *name)
 {
   if (!strcmp (name, "_OPENACC"))
diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc
index 7e0fa95a89d0..e3c011306399 100644
--- a/gcc/c-family/known-headers.cc
+++ b/gcc/c-family/known-headers.cc
@@ -329,9 +329,10 @@ suggest_missing_header::~suggest_missing_header ()
 
 /* suggest_missing_option's ctor.  */
 
-suggest_missing_option::suggest_missing_option (location_t loc,
-						const char *macro_name,
-						diagnostic_option_id option_id)
+suggest_missing_option::
+suggest_missing_option (location_t loc,
+			const char *macro_name,
+			diagnostics::option_id option_id)
 : deferred_diagnostic (loc), m_name_str (macro_name), m_option_id (option_id)
 {
   gcc_assert (macro_name);
diff --git a/gcc/c-family/known-headers.h b/gcc/c-family/known-headers.h
index b1da757f6035..3ffe5f364ced 100644
--- a/gcc/c-family/known-headers.h
+++ b/gcc/c-family/known-headers.h
@@ -48,12 +48,12 @@ class suggest_missing_option : public deferred_diagnostic
 {
  public:
   suggest_missing_option (location_t loc, const char *name,
-			  diagnostic_option_id option_id);
+			  diagnostics::option_id option_id);
   ~suggest_missing_option ();
 
  private:
   const char *m_name_str;
-  diagnostic_option_id m_option_id;
+  diagnostics::option_id m_option_id;
 };
 
 #endif /* GCC_KNOWN_HEADERS_H */
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index 7e1c197a7ed6..1e73dd2796b2 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -4556,7 +4556,7 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc)
   /* Next, look for exact matches for builtin defines that would have been
      defined if the user had passed a command-line option (e.g. -fopenmp
      for "_OPENMP").  */
-  diagnostic_option_id option_id
+  diagnostics::option_id option_id
     = get_option_for_builtin_define (IDENTIFIER_POINTER (name));
   if (option_id.m_idx > 0)
     return name_hint
diff --git a/gcc/c/c-errors.cc b/gcc/c/c-errors.cc
index be3ad3d5cf1e..e91cafba56be 100644
--- a/gcc/c/c-errors.cc
+++ b/gcc/c/c-errors.cc
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 
 bool
 pedwarn_c23 (location_t location,
-	     diagnostic_option_id option_id,
+	     diagnostics::option_id option_id,
 	     const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
@@ -77,7 +77,7 @@ pedwarn_c23 (location_t location,
 
 bool
 pedwarn_c11 (location_t location,
-	     diagnostic_option_id option_id,
+	     diagnostics::option_id option_id,
 	     const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
@@ -122,7 +122,7 @@ pedwarn_c11 (location_t location,
 
 bool
 pedwarn_c99 (location_t location,
-	     diagnostic_option_id option_id,
+	     diagnostics::option_id option_id,
 	     const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
@@ -164,7 +164,7 @@ pedwarn_c99 (location_t location,
 
 bool
 pedwarn_c90 (location_t location,
-	     diagnostic_option_id option_id,
+	     diagnostics::option_id option_id,
 	     const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index 27a69ae2d8ba..bb0b113754e5 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -960,13 +960,13 @@ extern void c_bind (location_t, tree, bool);
 extern bool tag_exists_p (enum tree_code, tree);
 
 /* In c-errors.cc */
-extern bool pedwarn_c90 (location_t, diagnostic_option_id, const char *, ...)
+extern bool pedwarn_c90 (location_t, diagnostics::option_id, const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,4);
-extern bool pedwarn_c99 (location_t, diagnostic_option_id, const char *, ...)
+extern bool pedwarn_c99 (location_t, diagnostics::option_id, const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,4);
-extern bool pedwarn_c11 (location_t, diagnostic_option_id, const char *, ...)
+extern bool pedwarn_c11 (location_t, diagnostics::option_id, const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,4);
-extern bool pedwarn_c23 (location_t, diagnostic_option_id, const char *, ...)
+extern bool pedwarn_c23 (location_t, diagnostics::option_id, const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,4);
 extern void add_note_about_new_keyword (location_t loc,
 					tree keyword_id);
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index c6a286fec22e..e30cd6c6f22b 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -1963,7 +1963,7 @@ verify_format( const char gmsgid[] ) {
 }
 #endif
 
-static const diagnostic_option_id option_zero;
+static const diagnostics::option_id option_zero;
 size_t parse_error_inc();
 
 void ydferror( const char gmsgid[], ... ) ATTRIBUTE_GCOBOL_DIAG(1, 2);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6242001c63d6..bcdcec769353 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7378,7 +7378,7 @@ extern void maybe_warn_variadic_templates       (void);
 extern void maybe_warn_cpp0x			(cpp0x_warn_str str,
 						 location_t = input_location);
 extern bool pedwarn_cxx98                       (location_t,
-						 diagnostic_option_id option_id,
+						 diagnostics::option_id option_id,
 						 const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
 extern location_t location_of                   (tree);
 extern void qualified_name_lookup_error		(tree, tree, tree,
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 83c8e283b56a..15497552fde0 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -11273,7 +11273,7 @@ grokfndecl (tree ctype,
 		has_errored = true;
 		emit_diagnostic (diag_kind,
 				 DECL_SOURCE_LOCATION (decl),
-				 /*diagnostic_option_id=*/0,
+				 /*diagnostics::option_id=*/0,
 				 "friend declaration of %qD specifies default "
 				 "arguments and isn%'t a definition", decl);
 	      }
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index e4cd92c5483f..f6d81e507761 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -4914,7 +4914,7 @@ maybe_warn_variadic_templates (void)
    C++0x.  */
 bool
 pedwarn_cxx98 (location_t location,
-	       diagnostic_option_id option_id,
+	       diagnostics::option_id option_id,
 	       const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
index 9aa7c16f64b4..f5b36c954e13 100644
--- a/gcc/cp/name-lookup.cc
+++ b/gcc/cp/name-lookup.cc
@@ -7195,7 +7195,7 @@ suggest_alternatives_for_1 (location_t location, tree name,
   /* Look for exact matches for builtin defines that would have been
      defined if the user had passed a command-line option (e.g. -fopenmp
      for "_OPENMP").  */
-  diagnostic_option_id option_id
+  diagnostics::option_id option_id
     = get_option_for_builtin_define (IDENTIFIER_POINTER (name));
   if (option_id.m_idx > 0)
     return name_hint
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index 0132e955e061..64377279b356 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_DIAGNOSTIC_CORE_H
 
 #include "bversion.h"
+#include "diagnostics/option-id.h"
 
 /* Constants used to discriminate diagnostics.  */
 typedef enum
@@ -65,27 +66,6 @@ namespace diagnostics {
    class metadata; /* See diagnostics/metadata.h.  */
 } // namespace diagnostics
 
-/* A class to use for the ID of an option that controls
-   a particular diagnostic.
-   This is just a wrapper around "int", but better documents
-   the intent of the code.  */
-
-struct diagnostic_option_id
-{
-  diagnostic_option_id () : m_idx (0) {}
-
-  diagnostic_option_id (int idx) : m_idx (idx) {}
-  /* Ideally we'd take an enum opt_code here, but we don't
-     want to depend on its decl.  */
-
-  bool operator== (diagnostic_option_id other) const
-  {
-    return m_idx == other.m_idx;
-  }
-
-  int m_idx;
-};
-
 extern const char *progname;
 
 extern const char *trim_filename (const char *);
@@ -111,29 +91,29 @@ extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
 extern void internal_error_no_backtrace (const char *, ...)
      ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN;
 /* Pass one of the OPT_W* from options.h as the first parameter.  */
-extern bool warning (diagnostic_option_id,
+extern bool warning (diagnostics::option_id,
 		     const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern bool warning_n (location_t,
-		       diagnostic_option_id,
+		       diagnostics::option_id,
 		       unsigned HOST_WIDE_INT,
 		       const char *, const char *, ...)
     ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6);
 extern bool warning_n (rich_location *,
-		       diagnostic_option_id,
+		       diagnostics::option_id,
 		       unsigned HOST_WIDE_INT,
 		       const char *, const char *, ...)
     ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6);
 extern bool warning_at (location_t,
-			diagnostic_option_id,
+			diagnostics::option_id,
 			const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,4);
 extern bool warning_at (rich_location *,
-			diagnostic_option_id,
+			diagnostics::option_id,
 			const char *, ...)
     ATTRIBUTE_GCC_DIAG(3,4);
 extern bool warning_meta (rich_location *,
 			  const diagnostics::metadata &,
-			  diagnostic_option_id,
+			  diagnostics::option_id,
 			  const char *, ...)
     ATTRIBUTE_GCC_DIAG(4,5);
 extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
@@ -150,22 +130,22 @@ extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
      ATTRIBUTE_NORETURN;
 /* Pass one of the OPT_W* from options.h as the second parameter.  */
 extern bool pedwarn (location_t,
-		     diagnostic_option_id,
+		     diagnostics::option_id,
 		     const char *, ...)
      ATTRIBUTE_GCC_DIAG(3,4);
 extern bool pedwarn (rich_location *,
-		     diagnostic_option_id,
+		     diagnostics::option_id,
 		     const char *, ...)
      ATTRIBUTE_GCC_DIAG(3,4);
 extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern bool permerror (rich_location *, const char *,
 				   ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern bool permerror_opt (location_t,
-			   diagnostic_option_id,
+			   diagnostics::option_id,
 			   const char *, ...)
   ATTRIBUTE_GCC_DIAG(3,4);
 extern bool permerror_opt (rich_location *,
-			   diagnostic_option_id,
+			   diagnostics::option_id,
 			   const char *, ...)
   ATTRIBUTE_GCC_DIAG(3,4);
 extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
@@ -178,21 +158,21 @@ extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *,
 extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
 extern bool emit_diagnostic (diagnostic_t,
 			     location_t,
-			     diagnostic_option_id,
+			     diagnostics::option_id,
 			     const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
 extern bool emit_diagnostic (diagnostic_t,
 			     rich_location *,
-			     diagnostic_option_id,
+			     diagnostics::option_id,
 			     const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
 extern bool emit_diagnostic_valist (diagnostic_t,
 				    location_t,
-				    diagnostic_option_id,
+				    diagnostics::option_id,
 				    const char *, va_list *)
   ATTRIBUTE_GCC_DIAG (4,0);
 extern bool emit_diagnostic_valist_meta (diagnostic_t,
 					 rich_location *,
 					 const diagnostics::metadata *,
-					 diagnostic_option_id,
+					 diagnostics::option_id,
 					 const char *,
 					 va_list *) ATTRIBUTE_GCC_DIAG (5,0);
 extern bool seen_error (void);
diff --git a/gcc/diagnostic-global-context.cc b/gcc/diagnostic-global-context.cc
index 84b606d9943f..c53af2e8c1f6 100644
--- a/gcc/diagnostic-global-context.cc
+++ b/gcc/diagnostic-global-context.cc
@@ -55,7 +55,7 @@ verbatim (const char *gmsgid, ...)
 bool
 emit_diagnostic (diagnostic_t kind,
 		 location_t location,
-		 diagnostic_option_id option_id,
+		 diagnostics::option_id option_id,
 		 const char *gmsgid, ...)
 {
   auto_diagnostic_group d;
@@ -73,7 +73,7 @@ emit_diagnostic (diagnostic_t kind,
 bool
 emit_diagnostic (diagnostic_t kind,
 		 rich_location *richloc,
-		 diagnostic_option_id option_id,
+		 diagnostics::option_id option_id,
 		 const char *gmsgid, ...)
 {
   auto_diagnostic_group d;
@@ -90,7 +90,7 @@ emit_diagnostic (diagnostic_t kind,
 bool
 emit_diagnostic_valist (diagnostic_t kind,
 			location_t location,
-			diagnostic_option_id option_id,
+			diagnostics::option_id option_id,
 			const char *gmsgid, va_list *ap)
 {
   rich_location richloc (line_table, location);
@@ -104,7 +104,7 @@ bool
 emit_diagnostic_valist_meta (diagnostic_t kind,
 			     rich_location *richloc,
 			     const diagnostics::metadata *metadata,
-			     diagnostic_option_id option_id,
+			     diagnostics::option_id option_id,
 			     const char *gmsgid, va_list *ap)
 {
   return global_dc->diagnostic_impl (richloc, metadata, option_id,
@@ -157,7 +157,7 @@ inform_n (location_t location, unsigned HOST_WIDE_INT n,
    to the relevant language specification but is likely to be buggy anyway.
    Returns true if the warning was printed, false if it was inhibited.  */
 bool
-warning (diagnostic_option_id option_id, const char *gmsgid, ...)
+warning (diagnostics::option_id option_id, const char *gmsgid, ...)
 {
   auto_diagnostic_group d;
   va_list ap;
@@ -175,7 +175,7 @@ warning (diagnostic_option_id option_id, const char *gmsgid, ...)
 
 bool
 warning_at (location_t location,
-	    diagnostic_option_id option_id,
+	    diagnostics::option_id option_id,
 	    const char *gmsgid, ...)
 {
   auto_diagnostic_group d;
@@ -192,7 +192,7 @@ warning_at (location_t location,
 
 bool
 warning_at (rich_location *richloc,
-	    diagnostic_option_id option_id,
+	    diagnostics::option_id option_id,
 	    const char *gmsgid, ...)
 {
   gcc_assert (richloc);
@@ -211,7 +211,7 @@ warning_at (rich_location *richloc,
 bool
 warning_meta (rich_location *richloc,
 	      const diagnostics::metadata &metadata,
-	      diagnostic_option_id option_id,
+	      diagnostics::option_id option_id,
 	      const char *gmsgid, ...)
 {
   gcc_assert (richloc);
@@ -229,7 +229,7 @@ warning_meta (rich_location *richloc,
 
 bool
 warning_n (rich_location *richloc,
-	   diagnostic_option_id option_id,
+	   diagnostics::option_id option_id,
 	   unsigned HOST_WIDE_INT n,
 	   const char *singular_gmsgid, const char *plural_gmsgid, ...)
 {
@@ -251,7 +251,7 @@ warning_n (rich_location *richloc,
 
 bool
 warning_n (location_t location,
-	   diagnostic_option_id option_id,
+	   diagnostics::option_id option_id,
 	   unsigned HOST_WIDE_INT n,
 	   const char *singular_gmsgid, const char *plural_gmsgid, ...)
 {
@@ -281,7 +281,7 @@ warning_n (location_t location,
 
 bool
 pedwarn (location_t location,
-	 diagnostic_option_id option_id,
+	 diagnostics::option_id option_id,
 	 const char *gmsgid, ...)
 {
   auto_diagnostic_group d;
@@ -298,7 +298,7 @@ pedwarn (location_t location,
 
 bool
 pedwarn (rich_location *richloc,
-	 diagnostic_option_id option_id,
+	 diagnostics::option_id option_id,
 	 const char *gmsgid, ...)
 {
   gcc_assert (richloc);
@@ -354,7 +354,7 @@ permerror (rich_location *richloc, const char *gmsgid, ...)
 
 bool
 permerror_opt (location_t location,
-	       diagnostic_option_id option_id,
+	       diagnostics::option_id option_id,
 	       const char *gmsgid, ...)
 {
   auto_diagnostic_group d;
@@ -371,7 +371,7 @@ permerror_opt (location_t location,
 
 bool
 permerror_opt (rich_location *richloc,
-	       diagnostic_option_id option_id,
+	       diagnostics::option_id option_id,
 	       const char *gmsgid, ...)
 {
   gcc_assert (richloc);
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 382272e63dbc..86dffdd1e320 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -1152,18 +1152,18 @@ diagnostics::context::diagnostic_enabled (diagnostic_info *diagnostic)
   return true;
 }
 
-/* Returns whether warning OPTION_ID is enabled at LOC.  */
+/* Returns whether warning OPT_ID is enabled at LOC.  */
 
 bool
 diagnostics::context::warning_enabled_at (location_t loc,
-					diagnostic_option_id option_id)
+					  diagnostics::option_id opt_id)
 {
   if (!diagnostic_report_warnings_p (this, loc))
     return false;
 
   rich_location richloc (line_table, loc);
   diagnostic_info diagnostic = {};
-  diagnostic.m_option_id = option_id;
+  diagnostic.m_option_id = opt_id;
   diagnostic.m_richloc = &richloc;
   diagnostic.m_message.m_richloc = &richloc;
   diagnostic.m_kind = DK_WARNING;
@@ -1177,14 +1177,14 @@ diagnostics::context::
 emit_diagnostic_with_group (diagnostic_t kind,
 			    rich_location &richloc,
 			    const diagnostics::metadata *metadata,
-			    diagnostic_option_id option_id,
+			    diagnostics::option_id opt_id,
 			    const char *gmsgid, ...)
 {
   begin_group ();
 
   va_list ap;
   va_start (ap, gmsgid);
-  bool ret = emit_diagnostic_with_group_va (kind, richloc, metadata, option_id,
+  bool ret = emit_diagnostic_with_group_va (kind, richloc, metadata, opt_id,
 					    gmsgid, &ap);
   va_end (ap);
 
@@ -1200,12 +1200,12 @@ diagnostics::context::
 emit_diagnostic_with_group_va (diagnostic_t kind,
 			       rich_location &richloc,
 			       const diagnostics::metadata *metadata,
-			       diagnostic_option_id option_id,
+			       diagnostics::option_id opt_id,
 			       const char *gmsgid, va_list *ap)
 {
   begin_group ();
 
-  bool ret = diagnostic_impl (&richloc, metadata, option_id,
+  bool ret = diagnostic_impl (&richloc, metadata, opt_id,
 			      gmsgid, ap, kind);
 
   end_group ();
@@ -1493,7 +1493,7 @@ trim_filename (const char *name)
 bool
 diagnostics::context::diagnostic_impl (rich_location *richloc,
 				     const diagnostics::metadata *metadata,
-				     diagnostic_option_id option_id,
+				     diagnostics::option_id opt_id,
 				     const char *gmsgid,
 				     va_list *ap, diagnostic_t kind)
 {
@@ -1502,13 +1502,13 @@ diagnostics::context::diagnostic_impl (rich_location *richloc,
     {
       diagnostic_set_info (&diagnostic, gmsgid, ap, richloc,
 			   m_permissive ? DK_WARNING : DK_ERROR);
-      diagnostic.m_option_id = (option_id.m_idx != -1 ? option_id : m_opt_permissive);
+      diagnostic.m_option_id = (opt_id.m_idx != -1 ? opt_id : m_opt_permissive);
     }
   else
     {
       diagnostic_set_info (&diagnostic, gmsgid, ap, richloc, kind);
       if (kind == DK_WARNING || kind == DK_PEDWARN)
-	diagnostic.m_option_id = option_id;
+	diagnostic.m_option_id = opt_id;
     }
   diagnostic.m_metadata = metadata;
   return report_diagnostic (&diagnostic);
@@ -1519,7 +1519,7 @@ diagnostics::context::diagnostic_impl (rich_location *richloc,
 bool
 diagnostics::context::diagnostic_n_impl (rich_location *richloc,
 				       const diagnostics::metadata *metadata,
-				       diagnostic_option_id option_id,
+				       diagnostics::option_id opt_id,
 				       unsigned HOST_WIDE_INT n,
 				       const char *singular_gmsgid,
 				       const char *plural_gmsgid,
@@ -1539,7 +1539,7 @@ diagnostics::context::diagnostic_n_impl (rich_location *richloc,
   const char *text = ngettext (singular_gmsgid, plural_gmsgid, gtn);
   diagnostic_set_info_translated (&diagnostic, text, ap, richloc, kind);
   if (kind == DK_WARNING)
-    diagnostic.m_option_id = option_id;
+    diagnostic.m_option_id = opt_id;
   diagnostic.m_metadata = metadata;
   return report_diagnostic (&diagnostic);
 }
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 76d74c80d4b3..69bc798c9b18 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -185,9 +185,9 @@ extern diagnostics::context *global_dc;
 
 inline void
 diagnostic_set_option_id (diagnostic_info *info,
-			  diagnostic_option_id option_id)
+			  diagnostics::option_id opt_id)
 {
-  info->m_option_id = option_id;
+  info->m_option_id = opt_id;
 }
 
 /* Diagnostic related functions.  */
@@ -271,11 +271,11 @@ diagnostic_initialize_input_context (diagnostics::context *context,
 /* Force diagnostics controlled by OPTIDX to be kind KIND.  */
 inline diagnostic_t
 diagnostic_classify_diagnostic (diagnostics::context *context,
-				diagnostic_option_id option_id,
+				diagnostics::option_id opt_id,
 				diagnostic_t kind,
 				location_t where)
 {
-  return context->classify_diagnostic (option_id, kind, where);
+  return context->classify_diagnostic (opt_id, kind, where);
 }
 
 inline void
@@ -389,15 +389,15 @@ extern char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
 extern int num_digits (int);
 
 inline bool
-warning_enabled_at (location_t loc, diagnostic_option_id option_id)
+warning_enabled_at (location_t loc, diagnostics::option_id opt_id)
 {
-  return global_dc->warning_enabled_at (loc, option_id);
+  return global_dc->warning_enabled_at (loc, opt_id);
 }
 
 inline bool
-option_unspecified_p (diagnostic_option_id option_id)
+option_unspecified_p (diagnostics::option_id opt_id)
 {
-  return global_dc->option_unspecified_p (option_id);
+  return global_dc->option_unspecified_p (opt_id);
 }
 
 extern char *get_cwe_url (int cwe);
diff --git a/gcc/diagnostics/context.h b/gcc/diagnostics/context.h
index 7590c3307fc8..78663cdf1e56 100644
--- a/gcc/diagnostics/context.h
+++ b/gcc/diagnostics/context.h
@@ -56,17 +56,17 @@ class option_manager
 public:
   virtual ~option_manager () {}
 
-  /* Return 1 if option OPTION_ID is enabled, 0 if it is disabled,
+  /* Return 1 if option OPT_ID is enabled, 0 if it is disabled,
      or -1 if it isn't a simple on-off switch
      (or if the value is unknown, typically set later in target).  */
-  virtual int option_enabled_p (diagnostic_option_id option_id) const = 0;
+  virtual int option_enabled_p (option_id opt_id) const = 0;
 
-  /* Return malloced memory for the name of the option OPTION_ID
+  /* Return malloced memory for the name of the option OPT_ID
      which enabled a diagnostic, originally of type ORIG_DIAG_KIND but
      possibly converted to DIAG_KIND by options such as -Werror.
      May return NULL if no name is to be printed.
      May be passed 0 as well as the index of a particular option.  */
-  virtual char *make_option_name (diagnostic_option_id option_id,
+  virtual char *make_option_name (option_id opt_id,
 				  diagnostic_t orig_diag_kind,
 				  diagnostic_t diag_kind) const = 0;
 
@@ -74,7 +74,7 @@ public:
      a diagnostic.
      May return NULL if no URL is available.
      May be passed 0 as well as the index of a particular option.  */
-  virtual char *make_option_url (diagnostic_option_id option_id) const = 0;
+  virtual char *make_option_url (option_id opt_id) const = 0;
 };
 
 /* A bundle of options relating to printing the user's source code
@@ -363,23 +363,23 @@ public:
   void push_nesting_level ();
   void pop_nesting_level ();
 
-  bool warning_enabled_at (location_t loc, diagnostic_option_id option_id);
+  bool warning_enabled_at (location_t loc, option_id opt_id);
 
-  bool option_unspecified_p (diagnostic_option_id option_id) const
+  bool option_unspecified_p (option_id opt_id) const
   {
-    return m_option_classifier.option_unspecified_p (option_id);
+    return m_option_classifier.option_unspecified_p (opt_id);
   }
 
   bool emit_diagnostic_with_group (diagnostic_t kind,
 				   rich_location &richloc,
 				   const metadata *metadata,
-				   diagnostic_option_id option_id,
+				   option_id opt_id,
 				   const char *gmsgid, ...)
     ATTRIBUTE_GCC_DIAG(6,7);
   bool emit_diagnostic_with_group_va (diagnostic_t kind,
 				      rich_location &richloc,
 				      const metadata *metadata,
-				      diagnostic_option_id option_id,
+				      option_id opt_id,
 				      const char *gmsgid, va_list *ap)
     ATTRIBUTE_GCC_DIAG(6,0);
 
@@ -392,12 +392,12 @@ public:
   report_global_digraph (const digraphs::lazy_digraph &);
 
   diagnostic_t
-  classify_diagnostic (diagnostic_option_id option_id,
+  classify_diagnostic (option_id opt_id,
 		       diagnostic_t new_kind,
 		       location_t where)
   {
     return m_option_classifier.classify_diagnostic (this,
-						    option_id,
+						    opt_id,
 						    new_kind,
 						    where);
   }
@@ -508,29 +508,29 @@ public:
   }
 
   /* Option-related member functions.  */
-  inline bool option_enabled_p (diagnostic_option_id option_id) const
+  inline bool option_enabled_p (option_id opt_id) const
   {
     if (!m_option_mgr)
       return true;
-    return m_option_mgr->option_enabled_p (option_id);
+    return m_option_mgr->option_enabled_p (opt_id);
   }
 
-  inline char *make_option_name (diagnostic_option_id option_id,
+  inline char *make_option_name (option_id opt_id,
 				 diagnostic_t orig_diag_kind,
 				 diagnostic_t diag_kind) const
   {
     if (!m_option_mgr)
       return nullptr;
-    return m_option_mgr->make_option_name (option_id,
+    return m_option_mgr->make_option_name (opt_id,
 					   orig_diag_kind,
 					   diag_kind);
   }
 
-  inline char *make_option_url (diagnostic_option_id option_id) const
+  inline char *make_option_url (option_id opt_id) const
   {
     if (!m_option_mgr)
       return nullptr;
-    return m_option_mgr->make_option_url (option_id);
+    return m_option_mgr->make_option_url (opt_id);
   }
 
   void
@@ -543,10 +543,10 @@ public:
   }
 
   bool diagnostic_impl (rich_location *, const metadata *,
-			diagnostic_option_id, const char *,
+			option_id, const char *,
 			va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
   bool diagnostic_n_impl (rich_location *, const metadata *,
-			  diagnostic_option_id, unsigned HOST_WIDE_INT,
+			  option_id, unsigned HOST_WIDE_INT,
 			  const char *, const char *, va_list *,
 			  diagnostic_t) ATTRIBUTE_GCC_DIAG(7,0);
 
@@ -612,7 +612,7 @@ public:
   void set_main_input_filename (const char *filename);
 
   void
-  set_permissive_option (diagnostic_option_id opt_permissive)
+  set_permissive_option (option_id opt_permissive)
   {
     m_opt_permissive = opt_permissive;
   }
@@ -713,7 +713,7 @@ public:
 private:
   /* The option to associate with turning permerrors into warnings,
      if any.  */
-  diagnostic_option_id m_opt_permissive;
+  option_id m_opt_permissive;
 
   /* True if errors are fatal.  */
   bool m_fatal_errors;
diff --git a/gcc/diagnostics/diagnostic-info.h b/gcc/diagnostics/diagnostic-info.h
index f8107b1b2029..621f95a856a6 100644
--- a/gcc/diagnostics/diagnostic-info.h
+++ b/gcc/diagnostics/diagnostic-info.h
@@ -55,7 +55,7 @@ struct diagnostic_info
   /* The kind of diagnostic it is about.  */
   diagnostic_t m_kind;
   /* Which OPT_* directly controls this diagnostic.  */
-  diagnostic_option_id m_option_id;
+  option_id m_option_id;
 
   /* Inlining context containing locations for each call site along
      the inlining stack.  */
diff --git a/gcc/diagnostics/lazy-paths.cc b/gcc/diagnostics/lazy-paths.cc
index 6aaae7b0f983..216ad744a3b7 100644
--- a/gcc/diagnostics/lazy-paths.cc
+++ b/gcc/diagnostics/lazy-paths.cc
@@ -127,24 +127,24 @@ test_intraprocedural_path (pretty_printer *event_pp)
 
 /* Implementation of diagnostics::option_manager for which all
    options are disabled, for use in selftests.
-   Note that this is *not* called for diagnostic_option_id (0), which
+   Note that this is *not* called for option_id (0), which
    means "always warn"  */
 
 class all_warnings_disabled : public diagnostics::option_manager
 {
 public:
-  int option_enabled_p (diagnostic_option_id) const final override
+  int option_enabled_p (diagnostics::option_id) const final override
   {
     /* Treat all options as disabled.  */
     return 0;
   }
-  char *make_option_name (diagnostic_option_id,
+  char *make_option_name (diagnostics::option_id,
 			  diagnostic_t,
 			  diagnostic_t) const final override
   {
     return nullptr;
   }
-  char *make_option_url (diagnostic_option_id) const final override
+  char *make_option_url (diagnostics::option_id) const final override
   {
     return nullptr;
   }
@@ -173,10 +173,10 @@ test_emission (pretty_printer *event_pp)
     test_rich_location rich_loc (*event_pp);
     ASSERT_FALSE (rich_loc.m_path.generated_p ());
 
-    diagnostic_option_id option_id (42); // has to be non-zero
+    diagnostics::option_id opt_id (42); // has to be non-zero
     bool emitted
       = dc.emit_diagnostic_with_group (DK_WARNING, rich_loc, nullptr,
-				       option_id,
+				       opt_id,
 				       "this warning should be skipped");
     ASSERT_FALSE (emitted);
     ASSERT_FALSE (rich_loc.m_path.generated_p ());
diff --git a/gcc/diagnostics/option-classifier.cc b/gcc/diagnostics/option-classifier.cc
index 77bce36a7302..d3f0985d4647 100644
--- a/gcc/diagnostics/option-classifier.cc
+++ b/gcc/diagnostics/option-classifier.cc
@@ -122,18 +122,18 @@ option_classifier::pop (location_t where)
 
 diagnostic_t
 option_classifier::classify_diagnostic (const context *dc,
-					diagnostic_option_id option_id,
+					option_id opt_id,
 					diagnostic_t new_kind,
 					location_t where)
 {
   diagnostic_t old_kind;
 
-  if (option_id.m_idx < 0
-      || option_id.m_idx >= m_n_opts
+  if (opt_id.m_idx < 0
+      || opt_id.m_idx >= m_n_opts
       || new_kind >= DK_LAST_DIAGNOSTIC_KIND)
     return DK_UNSPECIFIED;
 
-  old_kind = m_classify_diagnostic[option_id.m_idx];
+  old_kind = m_classify_diagnostic[opt_id.m_idx];
 
   /* Handle pragmas separately, since we need to keep track of *where*
      the pragmas were.  */
@@ -144,25 +144,25 @@ option_classifier::classify_diagnostic (const context *dc,
       /* Record the command-line status, so we can reset it back on DK_POP. */
       if (old_kind == DK_UNSPECIFIED)
 	{
-	  old_kind = (!dc->option_enabled_p (option_id)
+	  old_kind = (!dc->option_enabled_p (opt_id)
 		      ? DK_IGNORED : DK_ANY);
-	  m_classify_diagnostic[option_id.m_idx] = old_kind;
+	  m_classify_diagnostic[opt_id.m_idx] = old_kind;
 	}
 
       classification_change_t *p;
       FOR_EACH_VEC_ELT_REVERSE (m_classification_history, i, p)
-	if (p->option == option_id.m_idx)
+	if (p->option == opt_id.m_idx)
 	  {
 	    old_kind = p->kind;
 	    break;
 	  }
 
       classification_change_t v
-	= { where, option_id.m_idx, new_kind };
+	= { where, opt_id.m_idx, new_kind };
       m_classification_history.safe_push (v);
     }
   else
-    m_classify_diagnostic[option_id.m_idx] = new_kind;
+    m_classify_diagnostic[opt_id.m_idx] = new_kind;
 
   return old_kind;
 }
@@ -204,9 +204,9 @@ update_effective_level_from_pragmas (diagnostic_info *diagnostic) const
 	      continue;
 	    }
 
-	  diagnostic_option_id option = p->option;
+	  option_id opt_id = p->option;
 	  /* The option 0 is for all the diagnostics.  */
-	  if (option == 0 || option == diagnostic->m_option_id)
+	  if (opt_id == 0 || opt_id == diagnostic->m_option_id)
 	    {
 	      diagnostic_t kind = p->kind;
 	      if (kind != DK_UNSPECIFIED)
diff --git a/gcc/diagnostics/option-classifier.h b/gcc/diagnostics/option-classifier.h
index 246b56c7b4ab..6ed417fe70a8 100644
--- a/gcc/diagnostics/option-classifier.h
+++ b/gcc/diagnostics/option-classifier.h
@@ -42,20 +42,20 @@ public:
      is empty, revert to the state based on command line parameters.  */
   void pop (location_t where);
 
-  bool option_unspecified_p (diagnostic_option_id option_id) const
+  bool option_unspecified_p (option_id opt_id) const
   {
-    return get_current_override (option_id) == DK_UNSPECIFIED;
+    return get_current_override (opt_id) == DK_UNSPECIFIED;
   }
 
-  diagnostic_t get_current_override (diagnostic_option_id option_id) const
+  diagnostic_t get_current_override (option_id opt_id) const
   {
-    gcc_assert (option_id.m_idx < m_n_opts);
-    return m_classify_diagnostic[option_id.m_idx];
+    gcc_assert (opt_id.m_idx < m_n_opts);
+    return m_classify_diagnostic[opt_id.m_idx];
   }
 
   diagnostic_t
   classify_diagnostic (const context *context,
-		       diagnostic_option_id option_id,
+		       option_id opt_id,
 		       diagnostic_t new_kind,
 		       location_t where);
 
diff --git a/gcc/diagnostics/option-id.h b/gcc/diagnostics/option-id.h
new file mode 100644
index 000000000000..27524fdbac36
--- /dev/null
+++ b/gcc/diagnostics/option-id.h
@@ -0,0 +1,49 @@
+/* FIXME.
+   Copyright (C) 2024-2025 Free Software Foundation, Inc.
+   Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_DIAGNOSTICS_OPTION_ID_H
+#define GCC_DIAGNOSTICS_OPTION_ID_H
+
+namespace diagnostics {
+
+/* A class to use for the ID of an option that controls
+   a particular diagnostic.
+   This is just a wrapper around "int", but better documents
+   the intent of the code.  */
+
+struct option_id
+{
+  option_id () : m_idx (0) {}
+
+  option_id (int idx) : m_idx (idx) {}
+  /* Ideally we'd take an enum opt_code here, but we don't
+     want to depend on its decl.  */
+
+  bool operator== (option_id other) const
+  {
+    return m_idx == other.m_idx;
+  }
+
+  int m_idx;
+};
+
+} // namespace diagnostics
+
+#endif /* ! GCC_DIAGNOSTICS_OPTION_ID_H */
diff --git a/gcc/diagnostics/selftest-context.cc b/gcc/diagnostics/selftest-context.cc
index 5dd7364053be..880c169fa861 100644
--- a/gcc/diagnostics/selftest-context.cc
+++ b/gcc/diagnostics/selftest-context.cc
@@ -71,13 +71,13 @@ bool
 test_context::report (diagnostic_t kind,
 		      rich_location &richloc,
 		      const metadata *metadata_,
-		      diagnostic_option_id option,
+		      option_id opt_id,
 		      const char * fmt, ...)
 {
   va_list ap;
   va_start (ap, fmt);
   begin_group ();
-  bool result = diagnostic_impl (&richloc, metadata_, option, fmt, &ap, kind);
+  bool result = diagnostic_impl (&richloc, metadata_, opt_id, fmt, &ap, kind);
   end_group ();
   va_end (ap);
   return result;
diff --git a/gcc/diagnostics/selftest-context.h b/gcc/diagnostics/selftest-context.h
index a1193347b754..b0296d55f0d9 100644
--- a/gcc/diagnostics/selftest-context.h
+++ b/gcc/diagnostics/selftest-context.h
@@ -51,7 +51,7 @@ class test_context : public context
   report (diagnostic_t kind,
 	  rich_location &richloc,
 	  const metadata *,
-	  diagnostic_option_id option,
+	  option_id opt_id,
 	  const char * fmt, ...) ATTRIBUTE_GCC_DIAG(6,7);
 
   const char *test_show_locus (rich_location &richloc);
diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc
index 1b7042056460..3e540072a5de 100644
--- a/gcc/fortran/cpp.cc
+++ b/gcc/fortran/cpp.cc
@@ -1063,7 +1063,7 @@ cb_used_define (cpp_reader *pfile, location_t line ATTRIBUTE_UNUSED,
 /* Return the gcc option code associated with the reason for a cpp
    message, or 0 if none.  */
 
-static diagnostic_option_id
+static diagnostics::option_id
 cb_cpp_diagnostic_cpp_option (enum cpp_warning_reason reason)
 {
   const struct cpp_reason_option_codes_t *entry;
diff --git a/gcc/ipa-pure-const.cc b/gcc/ipa-pure-const.cc
index 93297ed6767a..2519fb8a03bd 100644
--- a/gcc/ipa-pure-const.cc
+++ b/gcc/ipa-pure-const.cc
@@ -200,7 +200,7 @@ function_always_visible_to_compiler_p (tree decl)
    by the function.  */
 
 static hash_set<tree> *
-suggest_attribute (diagnostic_option_id option, tree decl, bool known_finite,
+suggest_attribute (diagnostics::option_id option, tree decl, bool known_finite,
 		   hash_set<tree> *warned_about,
 		   const char * attrib_name)
 {
diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 27405e8092eb..ad204a778fd2 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -2274,11 +2274,11 @@ public:
   : gcc_diagnostic_option_manager (0 /* lang_mask */)
   {
   }
-  int option_enabled_p (diagnostic_option_id) const final override
+  int option_enabled_p (diagnostics::option_id) const final override
   {
     return true;
   }
-  char *make_option_name (diagnostic_option_id,
+  char *make_option_name (diagnostics::option_id,
 			  diagnostic_t,
 			  diagnostic_t) const final override
   {
diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
index 16486e7111cf..ebc23b4b00be 100644
--- a/gcc/opts-common.cc
+++ b/gcc/opts-common.cc
@@ -1874,7 +1874,7 @@ option_enabled (int opt_idx, unsigned lang_mask, void *opts)
 
 int
 compiler_diagnostic_option_manager::
-option_enabled_p (diagnostic_option_id opt_id) const
+option_enabled_p (diagnostics::option_id opt_id) const
 {
   return option_enabled (opt_id.m_idx, m_lang_mask, m_opts);
 }
diff --git a/gcc/opts-diagnostic.h b/gcc/opts-diagnostic.h
index 9b799e4b788a..d6382892a6b6 100644
--- a/gcc/opts-diagnostic.h
+++ b/gcc/opts-diagnostic.h
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 class gcc_diagnostic_option_manager : public diagnostics::option_manager
 {
 public:
-  char *make_option_url (diagnostic_option_id option_id) const final override;
+  char *make_option_url (diagnostics::option_id option_id) const final override;
 
 protected:
   gcc_diagnostic_option_manager (unsigned lang_mask)
@@ -49,8 +49,8 @@ public:
   {
   }
 
-  int option_enabled_p (diagnostic_option_id option_id) const final override;
-  char *make_option_name (diagnostic_option_id option_id,
+  int option_enabled_p (diagnostics::option_id option_id) const final override;
+  char *make_option_name (diagnostics::option_id option_id,
 			  diagnostic_t orig_diag_kind,
 			  diagnostic_t diag_kind) const final override;
 
diff --git a/gcc/opts.cc b/gcc/opts.cc
index 62d5f8b59ca5..3263d27764d8 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3730,7 +3730,7 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask,
 
 char *
 compiler_diagnostic_option_manager::
-make_option_name (diagnostic_option_id option_id,
+make_option_name (diagnostics::option_id option_id,
 		  diagnostic_t orig_diag_kind,
 		  diagnostic_t diag_kind) const
 {
@@ -3807,7 +3807,7 @@ get_option_url_suffix (int option_index, unsigned lang_mask)
 
 char *
 gcc_diagnostic_option_manager::
-make_option_url (diagnostic_option_id option_id) const
+make_option_url (diagnostics::option_id option_id) const
 {
   if (option_id.m_idx)
     {
diff --git a/gcc/substring-locations.cc b/gcc/substring-locations.cc
index 990a8bd79fe1..59affc60a965 100644
--- a/gcc/substring-locations.cc
+++ b/gcc/substring-locations.cc
@@ -151,7 +151,7 @@ format_string_diagnostic_t (const substring_loc &fmt_loc,
    Return true if a warning was emitted, false otherwise.  */
 
 bool
-format_string_diagnostic_t::emit_warning_n_va (diagnostic_option_id option_id,
+format_string_diagnostic_t::emit_warning_n_va (diagnostics::option_id option_id,
 					       unsigned HOST_WIDE_INT n,
 					       const char *singular_gmsgid,
 					       const char *plural_gmsgid,
@@ -248,7 +248,7 @@ format_string_diagnostic_t::emit_warning_n_va (diagnostic_option_id option_id,
 /* Singular-only version of the above.  */
 
 bool
-format_string_diagnostic_t::emit_warning_va (diagnostic_option_id option_id,
+format_string_diagnostic_t::emit_warning_va (diagnostics::option_id option_id,
 					     const char *gmsgid,
 					     va_list *ap) const
 {
@@ -258,7 +258,7 @@ format_string_diagnostic_t::emit_warning_va (diagnostic_option_id option_id,
 /* Variadic version of the above (singular only).  */
 
 bool
-format_string_diagnostic_t::emit_warning (diagnostic_option_id option_id,
+format_string_diagnostic_t::emit_warning (diagnostics::option_id option_id,
 					  const char *gmsgid,
 					  ...) const
 {
@@ -273,7 +273,7 @@ format_string_diagnostic_t::emit_warning (diagnostic_option_id option_id,
 /* Variadic version of the above (singular vs plural).  */
 
 bool
-format_string_diagnostic_t::emit_warning_n (diagnostic_option_id option_id,
+format_string_diagnostic_t::emit_warning_n (diagnostics::option_id option_id,
 					    unsigned HOST_WIDE_INT n,
 					    const char *singular_gmsgid,
 					    const char *plural_gmsgid,
diff --git a/gcc/substring-locations.h b/gcc/substring-locations.h
index fee7a8914ddd..32427dc8b8be 100644
--- a/gcc/substring-locations.h
+++ b/gcc/substring-locations.h
@@ -90,23 +90,23 @@ class format_string_diagnostic_t
 
   /* Functions for emitting a warning about a format string.  */
 
-  bool emit_warning_va (diagnostic_option_id option_id,
+  bool emit_warning_va (diagnostics::option_id option_id,
 			const char *gmsgid,
 			va_list *ap) const
     ATTRIBUTE_GCC_DIAG (3, 0);
 
-  bool emit_warning_n_va (diagnostic_option_id option_id,
+  bool emit_warning_n_va (diagnostics::option_id option_id,
 			  unsigned HOST_WIDE_INT n,
 			  const char *singular_gmsgid,
 			  const char *plural_gmsgid,
 			  va_list *ap) const
   ATTRIBUTE_GCC_DIAG (4, 0) ATTRIBUTE_GCC_DIAG (5, 0);
 
-  bool emit_warning (diagnostic_option_id option_id,
+  bool emit_warning (diagnostics::option_id option_id,
 		     const char *gmsgid, ...) const
     ATTRIBUTE_GCC_DIAG (3, 4);
 
-  bool emit_warning_n (diagnostic_option_id option_id,
+  bool emit_warning_n (diagnostics::option_id option_id,
 		       unsigned HOST_WIDE_INT n,
 		       const char *singular_gmsgid,
 		       const char *plural_gmsgid, ...) const
-- 
2.26.3

