From patchwork Wed Jun 22 15:18:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 13304 Received: (qmail 39007 invoked by alias); 22 Jun 2016 15:18:46 -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 38943 invoked by uid 89); 22 Jun 2016 15:18:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1058 X-HELO: mx1.redhat.com Date: Wed, 22 Jun 2016 17:18:41 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] test-skeleton.c: xmalloc, xcalloc, xrealloc are potentially unused User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20160622151841.6E28E41C3910C@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) __attribute__ ((used)) means that the function has to be emitted in assembly because it is referenced in ways the compiler cannot detect (such as asm statements, or some post-processing on the generated assembly). The unused attribute needs to come first, otherwise it is applied to the return type and not the function definition. 2016-06-22 Florian Weimer * test-skeleton.c (xmalloc, xcalloc, xrealloc): Mark as potentially unused. diff --git a/test-skeleton.c b/test-skeleton.c index 49808b3..0be4af1 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -78,8 +78,8 @@ oom_error (const char *fn, size_t size) } /* Allocate N bytes of memory dynamically, with error checking. */ +__attribute__ ((unused)) static void * -__attribute__ ((used)) xmalloc (size_t n) { void *p; @@ -91,8 +91,8 @@ xmalloc (size_t n) } /* Allocate memory for N elements of S bytes, with error checking. */ +__attribute__ ((unused)) static void * -__attribute__ ((used)) xcalloc (size_t n, size_t s) { void *p; @@ -105,8 +105,8 @@ xcalloc (size_t n, size_t s) /* Change the size of an allocated block of memory P to N bytes, with error checking. */ +__attribute__ ((unused)) static void * -__attribute__ ((used)) xrealloc (void *p, size_t n) { p = realloc (p, n);