[v2 PATCH] system: Disable glibc warning on sigsetmask

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

 



On Tue, Nov 20, 2018 at 11:48:20PM +0100, Antonio Ospite wrote:
> 
> Just for the record, compiling with clang (CC=clang ./configure && make)
> still gives a warning:

OK, we could disable it completely unless it's gcc:

---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.

It also disables it completely for non-gcc compilers and older
gcc compilers as they may generate a warning too.

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..007952c 100644
--- a/src/system.h
+++ b/src/system.h
@@ -36,8 +36,17 @@
 
 static inline void sigclearmask(void)
 {
-#ifdef HAVE_SIGSETMASK
+#if defined(HAVE_SIGSETMASK) && \
+    (!defined(__GLIBC__) || \
+     (defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4006))
+#ifdef __GLIBC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 	sigsetmask(0);
+#ifdef __GLIBC__
+#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



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

  Powered by Linux