olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1505492-address.patch

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