Following the glibc commit glibc-2.38~298 ("Mark various cold functions
as __COLD"), GNU grep build with -flto flag triggers a GCC warning:

sigsegv.c: In function ‘stackoverflow_deinstall_handler.part.0’:
sigsegv.c:1441:1: error: function might be candidate for attribute ‘cold’ 
[-Werror=suggest-attribute=cold]

* configure.ac (GNULIB_WARN_CFLAGS): Suppress -Wsuggest-attribute=cold.

Tiny-change: yes
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 844a259bd..b793cabde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,6 +159,11 @@ if test $gl_gcc_warnings != no; then
   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
   nw=
   nw="$nw -Wunused-macros"
+
+  # To prevent warnings in sigsegv.c if the perror function
+  # has "cold" attribute.
+  nw="$nw -Wsuggest-attribute=cold"
+
   gl_WARN_ADD([-Wno-format-nonliteral])
   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
   AC_SUBST([GNULIB_WARN_CFLAGS])
-- 
glebfm




Reply via email to