[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Warning in spawn-pipe.c (create_pipe)
From: |
Tim Rühsen |
Subject: |
Re: Warning in spawn-pipe.c (create_pipe) |
Date: |
Fri, 15 Dec 2017 12:17:54 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 12/15/2017 10:49 AM, Bruno Haible wrote:
> Tim Rühsen wrote:
>> It works, but... ;-)
>
> OK, I've pushed it.
>
>> Your patch disables that warning for the whole file. IMO, we should keep
>> the scope of the #pragma as narrow as possible.
>>
>> We could have a pragma.h include file with the following C99 code (I
>> leave the clang and gcc version checks to you):
>>
>> #define STRINGIFY(a) #a
>>
>> #if defined __clang__
>> # define NOWARN(a) _Pragma( STRINGIFY( clang diagnostic ignored a ) )
>> # define NOWARN_PUSH(a) \
>> _Pragma( STRINGIFY( clang diagnostic push ) ) \
>> _Pragma( STRINGIFY( clang diagnostic ignored a ) )
>> # define NOWARN_POP _Pragma( STRINGIFY( gcc diagnostic pop ) )
>> #elif defined __GNUC__
>> # define NOWARN(a) _Pragma( STRINGIFY( gcc diagnostic ignored a ) )
>> # define NOWARN_PUSH(a) \
>> _Pragma( STRINGIFY( gcc diagnostic push ) ) \
>> _Pragma( STRINGIFY( gcc diagnostic ignored a ) )
>> # define NOWARN_POP _Pragma( STRINGIFY( gcc diagnostic pop ) )
>> #else
>> # define NOWARN
>> # define NOWARN_PUSH
>> # define NOWARN_POP
>> #endif
>
> Indeed such macrology belongs in one single file. Would you like to provide
> a patch?
Attached is a quick commit with a new lib/pragmas.h. Sorry, I currently
don't have time for anything more (e.g. a module).
> The macros should cater for the case the gcc and clang have different warning
> options (see e.g. anytostr.c).
Added a pragma to silence clang on unknown options. gcc doesn't complain
anyways. So if we need two different options, just use both.
> Also if NOWARN and NOWARN_PUSH take an argument in one case, they need to take
> an argument in the #else case as well.
Fixed.
Regards, Tim
0001-lib-pragmas.h-Define-for-controlling-compiler-warnin.patch
Description: Text Data
signature.asc
Description: OpenPGP digital signature
- Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/13
- Re: Warning in spawn-pipe.c (create_pipe), Bruno Haible, 2017/12/13
- Re: Warning in spawn-pipe.c (create_pipe), Eric Blake, 2017/12/13
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/14
- Re: Warning in spawn-pipe.c (create_pipe), Bruno Haible, 2017/12/14
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Bruno Haible, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe),
Tim Rühsen <=
- Re: Warning in spawn-pipe.c (create_pipe), Gisle Vanem, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- Re: Warning in spawn-pipe.c (create_pipe), Paul Eggert, 2017/12/15
Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/14