public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]
@ 2023-11-04 16:23 Sergei Trofimovich
  2023-11-04 17:36 ` David Malcolm
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Trofimovich @ 2023-11-04 16:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm, Sergei Trofimovich, Sergei Trofimovich

From: Sergei Trofimovich <siarheit@google.com>

Without the change `./configure --enable-checking=release` bootstrap
fails as:

    gcc/gcc-urlifier.cc:100:1: error: 'get_url_suffix_for_quoted_text()'
        defined but not used [-Werror=unused-function]

This happens because the helper is used only in `ASSERT` macros which
don't always get expanded to executable code.

The fix marks helper function with `ATTRIBUTE_UNUSED`.

gcc/
	PR bootstrap/112379
	* gcc-urlifier.cc (get_url_suffix_for_quoted_text): Mark as
	ATTRIBUTE_UNUSED.
---
 gcc/gcc-urlifier.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/gcc-urlifier.cc b/gcc/gcc-urlifier.cc
index 269246bc703..0dbff985313 100644
--- a/gcc/gcc-urlifier.cc
+++ b/gcc/gcc-urlifier.cc
@@ -37,7 +37,8 @@ public:
   char *get_url_for_quoted_text (const char *p, size_t sz) const final override;
 
   const char *get_url_suffix_for_quoted_text (const char *p, size_t sz) const;
-  const char *get_url_suffix_for_quoted_text (const char *p) const;
+  /* We use ATTRIBUTE_UNUSED as this helper is called only from ASSERTs.  */
+  const char *get_url_suffix_for_quoted_text (const char *p) const ATTRIBUTE_UNUSED;
 
 private:
   static char *
-- 
2.42.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]
  2023-11-04 16:23 [PATCH] diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379] Sergei Trofimovich
@ 2023-11-04 17:36 ` David Malcolm
  0 siblings, 0 replies; 2+ messages in thread
From: David Malcolm @ 2023-11-04 17:36 UTC (permalink / raw)
  To: Sergei Trofimovich, gcc-patches; +Cc: Sergei Trofimovich

On Sat, 2023-11-04 at 16:23 +0000, Sergei Trofimovich wrote:
> From: Sergei Trofimovich <siarheit@google.com>
> 
> Without the change `./configure --enable-checking=release` bootstrap
> fails as:
> 
>     gcc/gcc-urlifier.cc:100:1: error:
> 'get_url_suffix_for_quoted_text()'
>         defined but not used [-Werror=unused-function]
> 
> This happens because the helper is used only in `ASSERT` macros which
> don't always get expanded to executable code.
> 
> The fix marks helper function with `ATTRIBUTE_UNUSED`.

Sorry for the breakage.

Patch looks good to me; thanks
Dave

> 
> gcc/
>         PR bootstrap/112379
>         * gcc-urlifier.cc (get_url_suffix_for_quoted_text): Mark as
>         ATTRIBUTE_UNUSED.
> ---
>  gcc/gcc-urlifier.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/gcc-urlifier.cc b/gcc/gcc-urlifier.cc
> index 269246bc703..0dbff985313 100644
> --- a/gcc/gcc-urlifier.cc
> +++ b/gcc/gcc-urlifier.cc
> @@ -37,7 +37,8 @@ public:
>    char *get_url_for_quoted_text (const char *p, size_t sz) const
> final override;
>  
>    const char *get_url_suffix_for_quoted_text (const char *p, size_t
> sz) const;
> -  const char *get_url_suffix_for_quoted_text (const char *p) const;
> +  /* We use ATTRIBUTE_UNUSED as this helper is called only from
> ASSERTs.  */
> +  const char *get_url_suffix_for_quoted_text (const char *p) const
> ATTRIBUTE_UNUSED;
>  
>  private:
>    static char *


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-04 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-04 16:23 [PATCH] diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379] Sergei Trofimovich
2023-11-04 17:36 ` David Malcolm

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).