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 <stdbool.h>.
[!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.
2014-12-02 Joseph Myers <joseph@codesourcery.com>
+ * nptl/tst-mutex1.c: Include <stdbool.h>.
+ [!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.
+
* posix/tst-getopt_long1.c (do_test): Cast elements of argv array
to char *.
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
+#include <stdbool.h>
#ifndef ATTR
# define ATTR NULL
+# define ATTR_NULL true
#endif
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;
return 1;
}
- if (ATTR != NULL && pthread_mutexattr_destroy (ATTR) != 0)
+ if (!ATTR_NULL && pthread_mutexattr_destroy (ATTR) != 0)
{
puts ("mutexattr_destroy failed");
return 1;
#define ATTR &a
+#define ATTR_NULL false
#include "tst-mutex1.c"
#define TEST_FUNCTION do_test_wrapper ()
#define ATTR &a
+#define ATTR_NULL false
#include "tst-mutex1.c"