Re: system: Disable gcc warning on sigsetmask

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

 



On Mon, 19 Nov 2018 18:47:11 +0800
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:

> Jilles Tjoelker <jilles@xxxxxxxx> wrote:
> >
> > The git history starts (in 2005) after HAVE_SIGSETMASK was added, but I
> > expect it was done this way to save a few bytes in the executable. With
> > ProPolice, the effect may be a bit more since a local variable of type
> > sigset_t often contains an array and may cause functions to be compiled
> > with stack protection when they otherwise wouldn't (note that
> > sigclearmask() is inline).
> > 
> > Both FreeBSD and NetBSD simply changed the sigsetmask() call to a
> > sigprocmask() call very early on (1995-1996).
> > 
> > Personally, I think clean code that compiles without warnings is more
> > important than making the executable as small as possible, but the
> > maintainer may not agree.
> 
> I agree with getting rid of the warning, and this seems to work
> for me.  Please let me know if you still a get warning on some
> other platform.  Thanks!
> 
> ---8<---
> As sigsetmask is set as deprecated in glibc this patch adds the
> pragmas to disable the warning in gcc around our one and only use
> of sigsetmask.
>

Hi Herbert,

this would work for me, thank you.

Just to double check: you prefer to keep sigsetmask() around as an
optimization and NOT for compatibility reasons, right?

If so, it might be useful to mention in the commit message why you
opted for masking the warning instead of removing the usage of the
deprecated function.

Without context future readers might argue that it would have been
possible to remove sigsetmask() without sacrificing compatibility, as
sigprocmask() and friends are already used in src/trap.c too anyway.

Ciao,
   Antonio

> Reported-by: Antonio Ospite <ao2@xxxxxx>
> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> 
> diff --git a/src/system.h b/src/system.h
> index a8d09b3..f3aa930 100644
> --- a/src/system.h
> +++ b/src/system.h
> @@ -37,7 +37,14 @@
>  static inline void sigclearmask(void)
>  {
>  #ifdef HAVE_SIGSETMASK
> +#if defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4006
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
> +#endif
>  	sigsetmask(0);
> +#if defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4006
> +#pragma GCC diagnostic pop
> +#endif
>  #else
>  	sigset_t set;
>  	sigemptyset(&set);
> -- 
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux