coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building from the git repository fails with "alias_table defined but


From: Bruno Haible
Subject: Re: Building from the git repository fails with "alias_table defined but not used"
Date: Wed, 02 Oct 2024 14:52:39 +0200

> On 02/10/2024 01:54, Yuri Kanivetsky wrote:
> > Hi,
> > 
> > https://gist.github.com/x-yuri/883efd92dff6a1ee77b14cff41c4fb12

This has:

  CC       lib/libcoreutils_a-localcharset.o
lib/localcharset.c:93:33: error: 'alias_table' defined but not used 
[-Werror=unused-const-variable=]
   93 | static const struct table_entry alias_table[] =
      |                                 ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:15556: lib/libcoreutils_a-localcharset.o] Error 1

localcharset.c is gnulib code.

Compiling gnulib code with -Werror is unsupported. This has been stated
several times on this mailing list. (We try to avoid warnings on systems
with the newest glibc and the newest gcc and just -Wall, but that is only
because we want to see as few warnings as possible in our own manual builds.)

For most packages that use Gnulib, gnulib-tool creates, in the directory
that contains the Gnulib sources, a Makefile.am that uses
  $(GL_CFLAG_GNULIB_WARNINGS)
and that is supposed to get rid of pointless warnings. In coreutils,
gnulib-tool does not create a Makefile.am but a file 'lib/gnulib.mk',
and that uses $(GL_CFLAG_GNULIB_WARNINGS) as well.

This warning, in particular, is pointless because it is just noise from
the compiler: "hey look, I am able to eliminate this const array, look
how good a compiler I am!". Just like -Wunused-function warnings that we
already eliminate through GL_CFLAG_GNULIB_WARNINGS. Done through the
patch below.


2024-10-02  Bruno Haible  <bruno@clisp.org>

        Silence -Wunused-const-variable warnings in Gnulib code.
        Reported by Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
        via Pádraig Brady in
        <https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00007.html>.
        * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Add
        -Wno-unused-const-variable whenever it is supported.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index e40bb9ddc4..1fec5c5ce1 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
 # gnulib-common.m4
-# serial 104
+# serial 105
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -1380,6 +1380,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS]
     dnl -Wno-type-limits                      >= 4.3          >= 3.9
     dnl -Wno-undef                            >= 3            >= 3.9
     dnl -Wno-unsuffixed-float-constants       >= 4.5
+    dnl -Wno-unused-const-variable            >= 4.4          >= 3.9
     dnl -Wno-unused-function                  >= 3            >= 3.9
     dnl -Wno-unused-parameter                 >= 3            >= 3.9
     dnl
@@ -1409,6 +1410,9 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS]
       -Wno-sign-conversion
       -Wno-type-limits
       #endif
+      #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || 
(__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wno-unused-const-variable
+      #endif
       #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
       -Wno-unsuffixed-float-constants
       #endif






reply via email to

[Prev in Thread] Current Thread [Next in Thread]