[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Warning in spawn-pipe.c (create_pipe)
From: |
Bruno Haible |
Subject: |
Re: Warning in spawn-pipe.c (create_pipe) |
Date: |
Fri, 15 Dec 2017 10:49:03 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-101-generic; KDE/5.18.0; x86_64; ; ) |
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?
The macros should cater for the case the gcc and clang have different warning
options (see e.g. anytostr.c).
Also if NOWARN and NOWARN_PUSH take an argument in one case, they need to take
an argument in the #else case as well.
Bruno
- 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 <=
- Re: Warning in spawn-pipe.c (create_pipe), Tim Rühsen, 2017/12/15
- 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