bug-gnulib
[Top][All Lists]
Advanced

[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 09:51:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 12/15/2017 12:28 AM, Bruno Haible wrote:
Hi Bruno,

>>> Or through an in-file pragma that specifically documents that we are
>>> intentionally ignoring the warning.
>>
>> I vote for this.
> 
> Does this patch eliminate the warning?
> 
> I couldn't reproduce the issue with clang 3.9.1 on Linux, therefore I have
> to ask you to test it.

It works, but... ;-)

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

Now we could include that file where needed and make use of the defines like

NOWARN("-Wconditional-uninitialized")

or to narrow the scope

NOWARN_PUSH("-Wconditional-uninitialized")
... code ...
NOWARN_POP


WDYT ?

Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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