public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-5530] diagnostics: make m_lang_mask private
Date: Thu, 16 Nov 2023 13:34:04 +0000 (GMT)	[thread overview]
Message-ID: <20231116133404.95D543858D20@sourceware.org> (raw)

https://gcc.gnu.org/g:4547c271c455dcf54ce9c4bb820acdd3b6193f6d

commit r14-5530-g4547c271c455dcf54ce9c4bb820acdd3b6193f6d
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Nov 16 08:29:19 2023 -0500

    diagnostics: make m_lang_mask private
    
    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>

Diff:
---
 gcc/diagnostic.cc  |  4 +++-
 gcc/diagnostic.h   | 16 +++++++++++-----
 gcc/lto-wrapper.cc |  3 ++-
 gcc/toplev.cc      |  6 +++---
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index eb0df689056..b4ebcd29457 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -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
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index db61b0e2747..dbf972d2587 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -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;
diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 7c76635ef21..7b01ecc2d88 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -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");
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index ae2f3d52602..8c3fcd337be 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -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)

                 reply	other threads:[~2023-11-16 13:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231116133404.95D543858D20@sourceware.org \
    --to=dmalcolm@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).