Malloc attribute for posix_memalign is wrong
Andreas Jaeger
aj@suse.de
Fri Jul 15 09:56:00 GMT 2005
compiling glibc on x86-64 with GCC 4.1 CVS I get warnings like:
../include/stdlib.h:99: warning: ‘__malloc__’ attribute ignored
The problem is that the malloc attribute is only defined for functions
returning memory, which memalign does only do indirectly.
Ok to submit the appended patch?
Andreas
2005-07-15 Andreas Jaeger <aj@suse.de>
* include/stdlib.h: Remove malloc attribute from __posix_memalign.
* stdlib/stdlib.h: Likewise.
============================================================
Index: include/stdlib.h
--- include/stdlib.h 7 Sep 2004 17:04:23 -0000 1.35
+++ include/stdlib.h 15 Jul 2005 09:55:57 -0000
@@ -95,8 +95,8 @@ extern int __cxa_atexit_internal (void (
extern void __cxa_finalize (void *d);
-extern int __posix_memalign (void **memptr, size_t alignment, size_t size)
- __attribute_malloc__;
+extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
+
extern void *__libc_memalign (size_t alignment, size_t size)
__attribute_malloc__;
============================================================
Index: stdlib/stdlib.h
--- stdlib/stdlib.h 13 Jul 2005 06:00:17 -0000 1.111
+++ stdlib/stdlib.h 15 Jul 2005 09:55:58 -0000
@@ -618,7 +618,7 @@ extern void *valloc (size_t __size) __TH
#ifdef __USE_XOPEN2K
/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
- __THROW __attribute_malloc__ __nonnull ((1)) __wur;
+ __THROW __nonnull ((1)) __wur;
#endif
__BEGIN_NAMESPACE_STD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20050715/7cd8ab26/attachment.sig>
-------------- next part --------------
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20050715/7cd8ab26/attachment-0001.sig>
More information about the Libc-hacker
mailing list