|
|
147e83 |
commit 4e0b901601038c863b97e68b18ae50a82e10a157
|
|
|
147e83 |
Author: Joseph Myers <joseph@codesourcery.com>
|
|
|
147e83 |
Date: Tue Dec 2 22:33:57 2014 +0000
|
|
|
147e83 |
|
|
|
147e83 |
Fix -Waddress warnings in nptl/tst-mutex1.c.
|
|
|
147e83 |
|
|
|
147e83 |
This patch fixes -Waddress warnings in nptl/tst-mutex1.c from
|
|
|
147e83 |
comparing the address of an object with NULL (ATTR may either be NULL,
|
|
|
147e83 |
or the address of an object when included from other tests, and the
|
|
|
147e83 |
warning arises in the latter case). A macro ATTR_NULL is defined
|
|
|
147e83 |
alongside ATTR and used for the tests.
|
|
|
147e83 |
|
|
|
147e83 |
Tested for x86_64.
|
|
|
147e83 |
|
|
|
147e83 |
* nptl/tst-mutex1.c: Include <stdbool.h>.
|
|
|
147e83 |
[!ATTR] (ATTR_NULL): New macro.
|
|
|
147e83 |
(do_test): Test !ATTR_NULL instead of ATTR != NULL.
|
|
|
147e83 |
* nptl/tst-mutexpi1.c (ATTR_NULL): New macro.
|
|
|
147e83 |
* nptl/tst-mutexpp1.c (ATTR_NULL): New macro.
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/nptl/tst-mutex1.c b/nptl/tst-mutex1.c
|
|
|
147e83 |
index 830c9d1f74076c5d..0f2ae0bf67cfa414 100644
|
|
|
147e83 |
--- a/nptl/tst-mutex1.c
|
|
|
147e83 |
+++ b/nptl/tst-mutex1.c
|
|
|
147e83 |
@@ -19,10 +19,12 @@
|
|
|
147e83 |
#include <pthread.h>
|
|
|
147e83 |
#include <stdio.h>
|
|
|
147e83 |
#include <errno.h>
|
|
|
147e83 |
+#include <stdbool.h>
|
|
|
147e83 |
|
|
|
147e83 |
|
|
|
147e83 |
#ifndef ATTR
|
|
|
147e83 |
# define ATTR NULL
|
|
|
147e83 |
+# define ATTR_NULL true
|
|
|
147e83 |
#endif
|
|
|
147e83 |
|
|
|
147e83 |
|
|
|
147e83 |
@@ -32,7 +34,7 @@ do_test (void)
|
|
|
147e83 |
pthread_mutex_t m;
|
|
|
147e83 |
|
|
|
147e83 |
int e = pthread_mutex_init (&m, ATTR);
|
|
|
147e83 |
- if (ATTR != NULL && e == ENOTSUP)
|
|
|
147e83 |
+ if (!ATTR_NULL && e == ENOTSUP)
|
|
|
147e83 |
{
|
|
|
147e83 |
puts ("cannot support selected type of mutexes");
|
|
|
147e83 |
return 0;
|
|
|
147e83 |
@@ -43,7 +45,7 @@ do_test (void)
|
|
|
147e83 |
return 1;
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
- if (ATTR != NULL && pthread_mutexattr_destroy (ATTR) != 0)
|
|
|
147e83 |
+ if (!ATTR_NULL && pthread_mutexattr_destroy (ATTR) != 0)
|
|
|
147e83 |
{
|
|
|
147e83 |
puts ("mutexattr_destroy failed");
|
|
|
147e83 |
return 1;
|
|
|
147e83 |
diff --git a/nptl/tst-mutexpi1.c b/nptl/tst-mutexpi1.c
|
|
|
147e83 |
index 623ede9fa5a2f1ca..d768664d026b047f 100644
|
|
|
147e83 |
--- a/nptl/tst-mutexpi1.c
|
|
|
147e83 |
+++ b/nptl/tst-mutexpi1.c
|
|
|
147e83 |
@@ -24,4 +24,5 @@ prepare (void)
|
|
|
147e83 |
|
|
|
147e83 |
|
|
|
147e83 |
#define ATTR &a
|
|
|
147e83 |
+#define ATTR_NULL false
|
|
|
147e83 |
#include "tst-mutex1.c"
|
|
|
147e83 |
diff --git a/nptl/tst-mutexpp1.c b/nptl/tst-mutexpp1.c
|
|
|
147e83 |
index 9b7d7fe2634a8337..8ec4673f1a8c81fe 100644
|
|
|
147e83 |
--- a/nptl/tst-mutexpp1.c
|
|
|
147e83 |
+++ b/nptl/tst-mutexpp1.c
|
|
|
147e83 |
@@ -42,4 +42,5 @@ do_test_wrapper (void)
|
|
|
147e83 |
#define TEST_FUNCTION do_test_wrapper ()
|
|
|
147e83 |
|
|
|
147e83 |
#define ATTR &a
|
|
|
147e83 |
+#define ATTR_NULL false
|
|
|
147e83 |
#include "tst-mutex1.c"
|