about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-26 20:54:16 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-26 20:54:16 +0000
commit8915eacef88eb25ac94e6bb37b473adb326e9d1b (patch)
treecb431216b6925c65f721537f7370830938b9b79d /include
parentf1a5a0e3c3d32bb800a0a63a0cfcd1b25a8e3d4d (diff)
downloadglibc-8915eacef88eb25ac94e6bb37b473adb326e9d1b.tar.gz
glibc-8915eacef88eb25ac94e6bb37b473adb326e9d1b.tar.xz
glibc-8915eacef88eb25ac94e6bb37b473adb326e9d1b.zip
Avoid warnings for unused results in nscd/connections.c.
This patch avoids warnings for unused results of setuid and setgid in
nscd/connections.c using an ignore_value macro along the lines
suggested by Paul in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00733.html>.

Tested for x86_64.

	* include/libc-internal.h (ignore_value): New macro.
	* nscd/connections.c (restart): Wrap calls to setuid and setgid
	with ignore_value.
Diffstat (limited to 'include')
-rw-r--r--include/libc-internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/libc-internal.h b/include/libc-internal.h
index 78f82da58a..2ced1c17d3 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -70,4 +70,10 @@ extern void __init_misc (int, char **, char **);
 #define PTR_ALIGN_UP(base, size) \
   ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
 
+/* Ignore the value of an expression when a cast to void does not
+   suffice (in particular, for a call to a function declared with
+   attribute warn_unused_result).  */
+#define ignore_value(x) \
+  ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
+
 #endif /* _LIBC_INTERNAL  */