]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: update signature of some callbacks
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 8 Aug 2025 20:55:44 +0000 (16:55 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 8 Aug 2025 20:55:44 +0000 (16:55 -0400)
No functional change intended.

gcc/cp/ChangeLog:
* error.cc (cp_adjust_diagnostic_info): Convert "context" arg from
ptr to const &.

gcc/ChangeLog:
* diagnostics/context.cc (context::get_any_inlining_info): Convert
"context" arg of m_set_locations_cb from ptr to const &.
(context::report_diagnostic): Convert "context" arg of
m_adjust_diagnostic_info from ptr to const &.
* diagnostics/context.h (context::set_locations_callback_t):
Likewise.
(context::set_adjust_diagnostic_info_callback): Likewise.
(context::m_adjust_diagnostic_info): Likewise.
* tree-diagnostic.cc (set_inlining_locations): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/cp/error.cc
gcc/diagnostics/context.cc
gcc/diagnostics/context.h
gcc/tree-diagnostic.cc

index c427163d28347c69b60b15d3050482976f28f9a0..cd35c7ae0415cbb82a326425a98b9961abe727da 100644 (file)
@@ -250,7 +250,7 @@ erroneous_templates_t *erroneous_templates;
    issue an error if we later need to instantiate the template.  */
 
 static void
-cp_adjust_diagnostic_info (diagnostics::context *context,
+cp_adjust_diagnostic_info (const diagnostics::context &context,
                           diagnostics::diagnostic_info *diagnostic)
 {
   if (diagnostic->m_kind == diagnostics::kind::error)
@@ -258,7 +258,7 @@ cp_adjust_diagnostic_info (diagnostics::context *context,
       {
        diagnostic->m_option_id = OPT_Wtemplate_body;
 
-       if (context->m_permissive)
+       if (context.m_permissive)
          diagnostic->m_kind = diagnostics::kind::warning;
 
        bool existed;
index b05e078794284e36fbbc846190fbfa07de062bef..a8ccbf60ded2a72766d21449777974c3017c9457 100644 (file)
@@ -1108,7 +1108,7 @@ context::get_any_inlining_info (diagnostic_info *diagnostic)
     /* Retrieve the locations into which the expression about to be
        diagnosed has been inlined, including those of all the callers
        all the way down the inlining stack.  */
-    m_set_locations_cb (this, diagnostic);
+    m_set_locations_cb (*this, diagnostic);
   else
     {
       /* When there's no callback use just the one location provided
@@ -1259,7 +1259,7 @@ context::report_diagnostic (diagnostic_info *diagnostic)
     }
 
   if (m_adjust_diagnostic_info)
-    m_adjust_diagnostic_info (this, diagnostic);
+    m_adjust_diagnostic_info (*this, diagnostic);
 
   if (diagnostic->m_kind == kind::pedwarn)
     {
index 961a87299e8ab9fe73964ea09dcdfede63b31846..df44a9b0212eca464af74cc702bd05ab50a42718 100644 (file)
@@ -264,7 +264,7 @@ public:
   friend class text_sink;
   friend class buffer;
 
-  typedef void (*set_locations_callback_t) (context *,
+  typedef void (*set_locations_callback_t) (const context &,
                                            diagnostic_info *);
 
   void initialize (int n_opts);
@@ -571,7 +571,7 @@ public:
   }
 
   void
-  set_adjust_diagnostic_info_callback (void (*cb) (context *,
+  set_adjust_diagnostic_info_callback (void (*cb) (const context &,
                                                   diagnostic_info *))
   {
     m_adjust_diagnostic_info = cb;
@@ -710,7 +710,7 @@ private:
 
   /* Client hook to adjust properties of the given diagnostic that we're
      about to issue, such as its kind.  */
-  void (*m_adjust_diagnostic_info)(context *, diagnostic_info *);
+  void (*m_adjust_diagnostic_info)(const context &, diagnostic_info *);
 
   /* Owned by the context; this would be a std::unique_ptr if
      context had a proper ctor.  */
index 3761fc099e6094f384d5bc2f7cdbbb4cba7c6cfb..20183c8bceda1dde59a9f4d193692f37c2aa0389 100644 (file)
@@ -110,7 +110,7 @@ default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
    to the DIAGNOSTIC location.  */
 
 static void
-set_inlining_locations (diagnostics::context *,
+set_inlining_locations (const diagnostics::context &,
                        diagnostics::diagnostic_info *diagnostic)
 {
   location_t loc = diagnostic_location (diagnostic);