public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Joseph Myers <josmyers@redhat.com>
Cc: gcc-patches@gcc.gnu.org, David Malcolm <dmalcolm@redhat.com>
Subject: [pushed] diagnostics: unbreak 'make gcc.pot'
Date: Mon, 12 Feb 2024 21:11:05 -0500	[thread overview]
Message-ID: <20240213021105.2640329-1-dmalcolm@redhat.com> (raw)
In-Reply-To: <ed4abff-9c-1592-9fb-8d73156e2a6d@redhat.com>

On Fri, 2024-02-09 at 16:53 +0000, Joseph Myers wrote:
> On Fri, 1 Dec 2023, David Malcolm wrote:
> 
>         * diagnostic-core.h (emit_diagnostic_valist): New overload
> decl.
> 
> This has broken regeneration of gcc.pot (overloads can't have the
> message 
> extracted for translation in different argument positions).
> 
> emit_diagnostic_valist used incompatibly as both
> --keyword=emit_diagnostic_valist:4
> --flag=emit_diagnostic_valist:4:gcc-internal-format and
> --keyword=emit_diagnostic_valist:5
> --flag=emit_diagnostic_valist:5:gcc-internal-format
> 
> See commit 6c8e584430bc5dc01b4438f3c38a2a10fcba7685 for previous
> fixes for 
> this involving the same function, or 
> 40fecdd62f7d293a214dd71b81de5e0f1099bba7 and 
> db30e21cbff7b9b2acd13ab83e25e3bf52f9696f for older fixes for similar 
> issues.

Sorry about this; should be fixed by the following patch.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Verified that "make gcc.pot" succeeds with the patch.
Pushed to trunk as r14-8946-gb753ef8f0c1d9c.
 

As noted by Joseph, I broke "make gcc.pot" in r14-6057-g12b67d1e13b3cf
by adding an overloaded format API with the format string in a different
position, leading to this failure:

emit_diagnostic_valist used incompatibly as both --keyword=emit_diagnostic_valist:4
--flag=emit_diagnostic_valist:4:gcc-internal-format and --keyword=emit_diagnostic_valist:5
--flag=emit_diagnostic_valist:5:gcc-internal-format

Fix by replacing the overloaded function with one with a different name.

See also r10-6297-g6c8e584430bc5d for previous fixes for this involving
the same function, or r5-6946-g40fecdd62f7d29 and
r5-6959-gdb30e21cbff7b9 for older fixes for similar issues.

gcc/analyzer/ChangeLog:
	* pending-diagnostic.cc (diagnostic_emission_context::warn):
	Update for renaming of emit_diagnostic_valist overload to
	emit_diagnostic_valist_meta.
	(diagnostic_emission_context::inform): Likewise.

gcc/ChangeLog:
	* diagnostic-core.h (emit_diagnostic_valist): Rename overload
	to...
	(emit_diagnostic_valist_meta): ...this.
	* diagnostic.cc (emit_diagnostic_valist): Likewise, to...
	(emit_diagnostic_valist_meta): ...this.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 gcc/analyzer/pending-diagnostic.cc | 16 ++++++++--------
 gcc/diagnostic-core.h              | 12 ++++++------
 gcc/diagnostic.cc                  | 10 +++++-----
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc
index e49aaa5a6d9..b2961c21bfc 100644
--- a/gcc/analyzer/pending-diagnostic.cc
+++ b/gcc/analyzer/pending-diagnostic.cc
@@ -129,10 +129,10 @@ diagnostic_emission_context::warn (const char *gmsgid, ...)
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  const bool result = emit_diagnostic_valist (DK_WARNING,
-					      &m_rich_loc, &m_metadata,
-					      pd.get_controlling_option (),
-					      gmsgid, &ap);
+  const bool result = emit_diagnostic_valist_meta (DK_WARNING,
+						   &m_rich_loc, &m_metadata,
+						   pd.get_controlling_option (),
+						   gmsgid, &ap);
   va_end (ap);
   return result;
 }
@@ -147,10 +147,10 @@ diagnostic_emission_context::inform (const char *gmsgid, ...)
   auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  emit_diagnostic_valist (DK_NOTE,
-			  &m_rich_loc, &m_metadata,
-			  pd.get_controlling_option (),
-			  gmsgid, &ap);
+  emit_diagnostic_valist_meta (DK_NOTE,
+			       &m_rich_loc, &m_metadata,
+			       pd.get_controlling_option (),
+			       gmsgid, &ap);
   va_end (ap);
 }
 
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index 7918bd7d4a2..f5e1e500dc3 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -123,12 +123,12 @@ extern bool emit_diagnostic (diagnostic_t, rich_location *, int,
 			     const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
 extern bool emit_diagnostic_valist (diagnostic_t, location_t, int, const char *,
 				    va_list *) ATTRIBUTE_GCC_DIAG (4,0);
-extern bool emit_diagnostic_valist (diagnostic_t,
-				    rich_location *,
-				    const diagnostic_metadata *,
-				    int,
-				    const char *,
-				    va_list *) ATTRIBUTE_GCC_DIAG (5,0);
+extern bool emit_diagnostic_valist_meta (diagnostic_t,
+					 rich_location *,
+					 const diagnostic_metadata *,
+					 int,
+					 const char *,
+					 va_list *) ATTRIBUTE_GCC_DIAG (5,0);
 extern bool seen_error (void);
 
 #ifdef BUFSIZ
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index f5411b1ede0..1d143fa7498 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -1837,11 +1837,11 @@ emit_diagnostic_valist (diagnostic_t kind, location_t location, int opt,
 /* As above, but with rich_location and metadata.  */
 
 bool
-emit_diagnostic_valist (diagnostic_t kind,
-			rich_location *richloc,
-			const diagnostic_metadata *metadata,
-			int opt,
-			const char *gmsgid, va_list *ap)
+emit_diagnostic_valist_meta (diagnostic_t kind,
+			     rich_location *richloc,
+			     const diagnostic_metadata *metadata,
+			     int opt,
+			     const char *gmsgid, va_list *ap)
 {
   return diagnostic_impl (richloc, metadata, opt, gmsgid, ap, kind);
 }
-- 
2.26.3


      reply	other threads:[~2024-02-13  2:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 13:58 [pushed] docs: remove stray reference to -fanalyzer-checker=taint [PR103533] David Malcolm
2023-12-01 13:58 ` [pushed] diagnostics, analyzer: add optional per-diagnostic property bags to SARIF David Malcolm
2024-02-09 16:53   ` Joseph Myers
2024-02-13  2:11     ` David Malcolm [this message]

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=20240213021105.2640329-1-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=josmyers@redhat.com \
    /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).