From 4e0b901601038c863b97e68b18ae50a82e10a157 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 2 Dec 2014 22:33:57 +0000 Subject: Fix -Waddress warnings in nptl/tst-mutex1.c. This patch fixes -Waddress warnings in nptl/tst-mutex1.c from comparing the address of an object with NULL (ATTR may either be NULL, or the address of an object when included from other tests, and the warning arises in the latter case). A macro ATTR_NULL is defined alongside ATTR and used for the tests. Tested for x86_64. * nptl/tst-mutex1.c: Include . [!ATTR] (ATTR_NULL): New macro. (do_test): Test !ATTR_NULL instead of ATTR != NULL. * nptl/tst-mutexpi1.c (ATTR_NULL): New macro. * nptl/tst-mutexpp1.c (ATTR_NULL): New macro. --- nptl/tst-mutex1.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nptl/tst-mutex1.c') diff --git a/nptl/tst-mutex1.c b/nptl/tst-mutex1.c index 2a181e587e..27ce54f33a 100644 --- a/nptl/tst-mutex1.c +++ b/nptl/tst-mutex1.c @@ -19,10 +19,12 @@ #include #include #include +#include #ifndef ATTR # define ATTR NULL +# define ATTR_NULL true #endif @@ -32,7 +34,7 @@ do_test (void) pthread_mutex_t m; int e = pthread_mutex_init (&m, ATTR); - if (ATTR != NULL && e == ENOTSUP) + if (!ATTR_NULL && e == ENOTSUP) { puts ("cannot support selected type of mutexes"); return 0; @@ -43,7 +45,7 @@ do_test (void) return 1; } - if (ATTR != NULL && pthread_mutexattr_destroy (ATTR) != 0) + if (!ATTR_NULL && pthread_mutexattr_destroy (ATTR) != 0) { puts ("mutexattr_destroy failed"); return 1; -- cgit v1.2.3