On Mon, 19 Nov 2018 18:47:11 +0800
Herbert Xu <[email protected]> wrote:
[...]
> 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!
>
Just for the record, compiling with clang (CC=clang ./configure && make)
still gives a warning:
-----------------------------------------------------------------------
CC system.o
In file included from system.c:62:
./system.h:44:2: warning: 'sigsetmask' is deprecated [-Wdeprecated-declarations]
sigsetmask(0);
^
/usr/include/signal.h:173:44: note: 'sigsetmask' has been explicitly marked
deprecated here
extern int sigsetmask (int __mask) __THROW __attribute_deprecated__;
^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:246:51: note: expanded from macro
'__attribute_deprecated__'
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
^
1 warning generated.
-----------------------------------------------------------------------
This is expected as the patch below only addresses gcc.
If there is a valid reason to keep sigsetmask() around I think we can
live with some warnings in unusual setups, but if the gain is negligible
we might as well just get rid of it.
Thank you,
Antonio
> ---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.
>
> Reported-by: Antonio Ospite <[email protected]>
> Signed-off-by: Herbert Xu <[email protected]>
>
> 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 <[email protected]>
> 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?