This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Malloc attribute for posix_memalign is wrong


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

Attachment: pgp00000.pgp
Description: PGP signature

-- 
 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

Attachment: pgp00001.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]