]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: fix gcc-urlifier.cc bootstrap failure [PR112379]
authorSergei Trofimovich <siarheit@google.com>
Sat, 4 Nov 2023 16:18:02 +0000 (16:18 +0000)
committerSergei Trofimovich <siarheit@google.com>
Sat, 4 Nov 2023 18:21:54 +0000 (18:21 +0000)
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

index 269246bc7035c78866ea36f15439f5083c4c0174..0dbff9853132dbee0221a5658489202d6dba0164 100644 (file)
@@ -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 *