]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: make m_lang_mask private
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 Nov 2023 13:29:19 +0000 (08:29 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 Nov 2023 13:29:19 +0000 (08:29 -0500)
No functional change intended.

gcc/ChangeLog:
* diagnostic.cc (diagnostic_context::set_option_hooks): Add
"lang_mask" param.
* diagnostic.h (diagnostic_context::option_enabled_p): Update for
move of m_lang_mask.
(diagnostic_context::set_option_hooks): Add "lang_mask" param.
(diagnostic_context::get_lang_mask): New.
(diagnostic_context::m_lang_mask): Move into m_option_callbacks,
thus making private.
* lto-wrapper.cc (main): Update for new lang_mask param of
set_option_hooks.
* toplev.cc (init_asm_output): Use get_lang_mask.
(general_init): Move initialization of global_dc's lang_mask to
new lang_mask param of set_option_hooks.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic.cc
gcc/diagnostic.h
gcc/lto-wrapper.cc
gcc/toplev.cc

index eb0df6890564685e4e9e1b824eaefc0b1bc2f33b..b4ebcd29457c67aef075c747792947827df20f68 100644 (file)
@@ -423,12 +423,14 @@ diagnostic_context::
 set_option_hooks (diagnostic_option_enabled_cb option_enabled_cb,
                  void *option_state,
                  diagnostic_make_option_name_cb make_option_name_cb,
-                 diagnostic_make_option_url_cb make_option_url_cb)
+                 diagnostic_make_option_url_cb make_option_url_cb,
+                 unsigned lang_mask)
 {
   m_option_callbacks.m_option_enabled_cb = option_enabled_cb;
   m_option_callbacks.m_option_state = option_state;
   m_option_callbacks.m_make_option_name_cb = make_option_name_cb;
   m_option_callbacks.m_make_option_url_cb = make_option_url_cb;
+  m_option_callbacks.m_lang_mask = lang_mask;
 }
 
 void
index db61b0e274771d68e27826bfb393914276df3e8c..dbf972d25875091d346f8ae4a80f0645ff65d07f 100644 (file)
@@ -506,7 +506,7 @@ public:
       return true;
     return m_option_callbacks.m_option_enabled_cb
       (option_index,
-       m_lang_mask,
+       m_option_callbacks.m_lang_mask,
        m_option_callbacks.m_option_state);
   }
 
@@ -532,7 +532,13 @@ public:
   set_option_hooks (diagnostic_option_enabled_cb option_enabled_cb,
                    void *option_state,
                    diagnostic_make_option_name_cb make_option_name_cb,
-                   diagnostic_make_option_url_cb make_option_url_cb);
+                   diagnostic_make_option_url_cb make_option_url_cb,
+                   unsigned lang_mask);
+
+  unsigned get_lang_mask () const
+  {
+    return m_option_callbacks.m_lang_mask;
+  }
 
 private:
   bool includes_seen_p (const line_map_ordinary *map);
@@ -673,6 +679,9 @@ private:
        is available.  May be passed 0 as well as the index of a
        particular option.  */
     diagnostic_make_option_url_cb m_make_option_url_cb;
+
+    /* A copy of lang_hooks.option_lang_mask ().  */
+    unsigned m_lang_mask;
   } m_option_callbacks;
 
   /* An optional hook for adding URLs to quoted text strings in
@@ -698,9 +707,6 @@ private:
   int m_lock;
 
 public:
-  /* A copy of lang_hooks.option_lang_mask ().  */
-  unsigned m_lang_mask;
-
   bool m_inhibit_notes_p;
 
   diagnostic_source_printing_options m_source_printing;
index 7c76635ef213e2871b5580f580a0b35373c064db..7b01ecc2d88915e7e436707c252c7f77cfbe0ab6 100644 (file)
@@ -2149,7 +2149,8 @@ main (int argc, char *argv[])
   global_dc->set_option_hooks (nullptr,
                               nullptr,
                               nullptr,
-                              get_option_url);
+                              get_option_url,
+                              0);
 
   if (atexit (lto_wrapper_cleanup) != 0)
     fatal_error (input_location, "%<atexit%> failed");
index ae2f3d52602b4d1fc3cb8643403bb2865cbbe8ce..8c3fcd337beee93904aca13fd14e1750ca74524c 100644 (file)
@@ -715,7 +715,7 @@ init_asm_output (const char *name)
                     "cannot open %qs for writing: %m", asm_file_name);
     }
 
-  if (!flag_syntax_only && !(global_dc->m_lang_mask & CL_LTODump))
+  if (!flag_syntax_only && !(global_dc->get_lang_mask () & CL_LTODump))
     {
       targetm.asm_out.file_start ();
 
@@ -1020,7 +1020,6 @@ general_init (const char *argv0, bool init_signals)
   /* Initialize the diagnostics reporting machinery, so option parsing
      can give warnings and errors.  */
   diagnostic_initialize (global_dc, N_OPTS);
-  global_dc->m_lang_mask = lang_hooks.option_lang_mask ();
   /* Set a default printer.  Language specific initializations will
      override it later.  */
   tree_diagnostics_defaults (global_dc);
@@ -1048,7 +1047,8 @@ general_init (const char *argv0, bool init_signals)
   global_dc->set_option_hooks (option_enabled,
                               &global_options,
                               option_name,
-                              get_option_url);
+                              get_option_url,
+                              lang_hooks.option_lang_mask ());
   global_dc->set_urlifier (make_gcc_urlifier ());
 
   if (init_signals)