Переглянути джерело

sys/cdefs.h: add definition of __attribute_alloc_size__

Commit cee0b058fa0b4501b289a2da365182d60314d746 ("add aligned_alloc
required for latest gcc libstdc++") added the prototype of
aligned_alloc() to <stdlib.h>. This prototype contains
'__attribute_alloc_size__ ((2))', but this is not defined anywhere in
uClibc-ng.

This commit addresses that by adding the relevant definition in
<sys/cdefs.h>, borrowed from glibc.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thomas Petazzoni 7 роки тому
батько
коміт
9ff01fc11a
1 змінених файлів з 9 додано та 0 видалено
  1. 9 0
      include/sys/cdefs.h

+ 9 - 0
include/sys/cdefs.h

@@ -222,6 +222,15 @@
 # define __attribute_malloc__ /* Ignore */
 # define __attribute_malloc__ /* Ignore */
 #endif
 #endif
 
 
+/* Tell the compiler which arguments to an allocation function
+   indicate the size of the allocation.  */
+#if __GNUC_PREREQ (4, 3)
+# define __attribute_alloc_size__(params) \
+  __attribute__ ((__alloc_size__ params))
+#else
+# define __attribute_alloc_size__(params) /* Ignore.  */
+#endif
+
 /* At some point during the gcc 2.96 development the `pure' attribute
 /* At some point during the gcc 2.96 development the `pure' attribute
    for functions was introduced.  We don't want to use it unconditionally
    for functions was introduced.  We don't want to use it unconditionally
    (although this would be possible) since it generates warnings.  */
    (although this would be possible) since it generates warnings.  */