* [PATCH] test-skeleton.c: xmalloc, xcalloc, xrealloc are potentially unused
@ 2016-06-22 15:18 Florian Weimer
2016-06-22 15:49 ` Mike Frysinger
0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2016-06-22 15:18 UTC (permalink / raw)
To: libc-alpha
__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 <fweimer@redhat.com>
* 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] test-skeleton.c: xmalloc, xcalloc, xrealloc are potentially unused
2016-06-22 15:18 [PATCH] test-skeleton.c: xmalloc, xcalloc, xrealloc are potentially unused Florian Weimer
@ 2016-06-22 15:49 ` Mike Frysinger
0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2016-06-22 15:49 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
On 22 Jun 2016 17:18, Florian Weimer wrote:
> __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.
ok
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-22 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22 15:18 [PATCH] test-skeleton.c: xmalloc, xcalloc, xrealloc are potentially unused Florian Weimer
2016-06-22 15:49 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).