I wrote:
> Reminder about the other warning:
> 
>   CC       macro.o
> In function 'call_macro.part.0':
> ../../../src/macro.c:272:1: error: function might be candidate for attribute 
> 'cold' [-Werror=suggest-attribute=cold]
>   272 | call_macro (symbol *sym, int argc, token_data **argv,
>       | ^~~~~~~~~~
> 
> Which is a bogus warning as well. I cannot find it reported in the GCC bug
> tracker. But at least, it's fixed in GCC 14.

Still, why make things hard for users or CI jobs that use GCC 11, 12, or 13?

Here is a proposed patch that silences this warning as well.
It can probably be scheduled for removal in 3 or 4 years.

>From 1d739ab916d271cd2355c91b5361c086c2bee4dd Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Tue, 20 Aug 2024 10:21:41 +0200
Subject: [PATCH] maint: Avoid a gcc 13 warning that makes
 --enable-gcc-warnings break.

* src/macro.c: Disable -Wsuggest-attribute=cold warnings in this file.
---
 src/macro.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/macro.c b/src/macro.c
index 15167d68..7d7f318a 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -24,6 +24,12 @@
 
 #include "m4.h"
 
+/* Work around a bogus GCC warning
+   <https://lists.gnu.org/archive/html/bug-m4/2024-08/msg00001.html>.  */
+#if __GNUC__ >= 8
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=cold"
+#endif
+
 static void expand_macro (symbol *);
 static void expand_token (struct obstack *, token_type, token_data *, int);
 
-- 
2.34.1

Reply via email to