From patchwork Tue Dec 2 22:24:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 4040 Received: (qmail 2392 invoked by alias); 2 Dec 2014 22:24:55 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 2377 invoked by uid 89); 2 Dec 2014 22:24:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Tue, 2 Dec 2014 22:24:48 +0000 From: Joseph Myers To: Roland McGrath CC: Subject: Re: Disable -Waddress for part of nptl/tst-mutex1.c In-Reply-To: <20141202192637.5D2172C39FE@topped-with-meat.com> Message-ID: References: <20141202192637.5D2172C39FE@topped-with-meat.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 On Tue, 2 Dec 2014, Roland McGrath wrote: > The ATTR_NULL approach seems far cleaner to me. Why disable warnings when > a code cleanup suffices? Here is a patch using ATTR_NULL. Tested for x86_64. 2014-12-02 Joseph Myers * 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. diff --git a/nptl/tst-mutex1.c b/nptl/tst-mutex1.c index 2a181e5..27ce54f 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; diff --git a/nptl/tst-mutexpi1.c b/nptl/tst-mutexpi1.c index 623ede9..d768664 100644 --- a/nptl/tst-mutexpi1.c +++ b/nptl/tst-mutexpi1.c @@ -24,4 +24,5 @@ prepare (void) #define ATTR &a +#define ATTR_NULL false #include "tst-mutex1.c" diff --git a/nptl/tst-mutexpp1.c b/nptl/tst-mutexpp1.c index 9b7d7fe..8ec4673 100644 --- a/nptl/tst-mutexpp1.c +++ b/nptl/tst-mutexpp1.c @@ -42,4 +42,5 @@ do_test_wrapper (void) #define TEST_FUNCTION do_test_wrapper () #define ATTR &a +#define ATTR_NULL false #include "tst-mutex1.c"