]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include: [c.h]: add unused attribute to ignore_result()
authorKarel Zak <kzak@redhat.com>
Wed, 9 Feb 2011 19:37:08 +0000 (20:37 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 9 Feb 2011 19:40:06 +0000 (20:40 +0100)
unfortunately, gcc 4.6

void fn (void) {
int foo;
foo = bar ();
}

evaluates that foo is never used. The __attribute__((unused)) is
necessary...

Signed-off-by: Karel Zak <kzak@redhat.com>
include/c.h

index 4bb28875889755a2afdcefded03d620a723d1d84..e52514345b8c2d230998b4316825e8b081744369 100644 (file)
@@ -25,7 +25,9 @@
 # define __must_be_array(a) \
        BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
 
-# define ignore_result(x) ({ typeof(x) __dummy = (x); (void) __dummy; })
+# define ignore_result(x) ({ \
+       typeof(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \
+})
 
 #else /* !__GNUC__ */
 # define __must_be_array(a)    0