[Top][All Lists]

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

Re: Compilations warnings-as-errors when building from git

From: Bruno Haible
Subject: Re: Compilations warnings-as-errors when building from git
Date: Sun, 16 Jan 2022 00:23:35 +0100

> > warning: unknown warning option '-Wno-unsuffixed-float-constants' 
> > [-Wunknown-warning-option]
> > 
> > 
> > Which, I see was removed from gnulib in 2011,
> > and reinstated just now in
> > https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=0c8a563f65d44752b33aec42cceec25bd485f2d5
> This appears to be a bug in that Gnulib commit. Presumably this code in 
> m4/gnulib-common.m4:
>        #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 || (__clang_major__ + 
> (__clang_minor__ >= 9) > 3)
>        -Wno-unsuffixed-float-constants
>        #endif
> needs to be adjusted as far as Clang versions go. Do you happen to know 
> which Clang versions support that option?

Yes, the bug is precisely there. I determined that no Clang version supports
this warning, but then did a copy-and-paste mistake. Fixed through the patch

> Also, since 'configure' is already testing for which warning options 
> work by invoking the compiler directly, perhaps this part of 
> gnulib-common.m4 could leverage off that work rather than trying to 
> hardcode which compilers support which options.

On the contrary, I suggest to speed up the manywarnings.m4 logic by
including the knowledge which warning was introduced in which GCC version.
This would replace N AC_COMPILE_IFELSE invocations with a single
C preprocessor invocation. The program which tests for the availability
of a warning option in GCC and clang does not need to be maintained by
hand; we can develop a tool that maintains it as a plain-text table and
transforms it to a C program automatically.

2022-01-15  Bruno Haible  <bruno@clisp.org>

        Don't pass unknown warning option to clang.
        Reported by Assaf Gordon via Paul Eggert in
        * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Don't use
        -Wno-unsuffixed-float-constants with clang.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 3730860f6d..dbc4079614 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 71
+# gnulib-common.m4 serial 72
 dnl Copyright (C) 2007-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -952,7 +952,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
-      #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 || (__clang_major__ + 
(__clang_minor__ >= 9) > 3)
+      #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4

reply via email to

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