Re: [PATCH] diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]

2023-11-04 Thread David Malcolm
On Sat, 2023-11-04 at 16:23 +, Sergei Trofimovich wrote:
> From: Sergei Trofimovich 
> 
> 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 *



[PATCH] diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]

2023-11-04 Thread Sergei Trofimovich
From: Sergei Trofimovich 

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