bug-gnulib
[Top][All Lists]
Advanced

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

Re: Add new macro gl_WARN_ADD_MULTIPLE


From: Tim Rühsen
Subject: Re: Add new macro gl_WARN_ADD_MULTIPLE
Date: Thu, 2 May 2019 19:39:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Hi Bruno,

On 02.05.19 13:28, Bruno Haible wrote:
> Hi Tim,
> 
>> Mentioned 2 years ago (but being still too busy to make a gnulib module
>> from it); Wget2's implementation using --help=warnings is here and FSF
>> copyrighted:
>>
>> https://gitlab.com/gnuwget/wget2/blob/master/m4/wget_manywarnings.m4
>>
>> And how to use / fine-tune it can be seen in L106 of
>>
>> https://gitlab.com/gnuwget/wget2/blob/master/configure.ac
> 
> Does this implementation of manywarnings support only the case where
> you want all possible warnings except an explicitly specified set?
> Or also the case where you want only an explicitly specified set of
> warnings?

It supports the first approach only, in detail
- all warnings except a given subset
- you can add warnings, e.g. you might need -Wno-... for warnings that
are implicitly enabled. Especially with clang where '--help=warnings -Q'
isn't available. Here we use -Weverything and you have to add options to
silence some of the overly expressive warnings.

This approach benefits from new options in newer versions of gcc/clang
without maintaining lists of options in the .m4 file.

The original idea was to avoid compiler calls to reduce configure time.

It works only with gcc 4.3+.

> Or also the case where you want only an explicitly specified set of
> warnings?

If you need that, why not just set CFLAGS ? Or maybe I don't understand
exactly...


> Although I think that the first approach is the better one in the long
> run, some projects may want to use the second approach, and the gnulib
> module so far supports both approaches.
> 
>> There is gcc and clang support.
> 
> This way of detecting clang is not portable:
> 
>     case $CC in
>       *gcc*) CCNAME="gcc";;
>       *clang*) CCNAME="clang";;
>     esac
> 
> On FreeBSD, for example, $CC = "cc" is clang but you cannot know it
> by looking at the command name. You need to run the preprocessor and
> see how it processes
>   #if defined __clang__

Thanks, good to know. Our development env is a pretty up-to-date
GNU/Linux with a recent gcc and clang - that is were we use
--enable-manywarnings. Of course this macro file has to be fine-tuned
for other development environments. So anyone wanting to use the feature
on FreeBSD, Windows+MSVC or wherever is free to contribute. (But I don't
expect much from that direction.)

Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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