diff options
author | Martin Liska <mliska@suse.cz> | 2019-06-10 09:42:22 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-06-10 07:42:22 +0000 |
commit | 3bb0dcb6c02661bed2f8dd00052145fde3bbdecc (patch) | |
tree | 3bc1bb2c9b037c135bc71c7e925f270cf1325ad6 /include/ansidecl.h | |
parent | 74ac8f1fe98b5126b291b2693e25d99b52f68c58 (diff) | |
download | gcc-3bb0dcb6c02661bed2f8dd00052145fde3bbdecc.zip gcc-3bb0dcb6c02661bed2f8dd00052145fde3bbdecc.tar.gz gcc-3bb0dcb6c02661bed2f8dd00052145fde3bbdecc.tar.bz2 |
Add alloc_size for libiberty memory allocation functions.
2019-06-10 Martin Liska <mliska@suse.cz>
* ansidecl.h:
(ATTRIBUTE_RESULT_SIZE_1): Define new macro.
(ATTRIBUTE_RESULT_SIZE_2): Likewise.
(ATTRIBUTE_RESULT_SIZE_1_2): Likewise.
* libiberty.h (xmalloc): Add RESULT_SIZE attribute.
(xrealloc): Likewise.
(xcalloc): Likewise.
From-SVN: r272109
Diffstat (limited to 'include/ansidecl.h')
-rw-r--r-- | include/ansidecl.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/ansidecl.h b/include/ansidecl.h index 0395c4d..3035c33 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -292,6 +292,31 @@ So instead we use the macro below and test it against specific values. */ # endif #endif +/* Attribute `alloc_size' was valid as of gcc 4.3. */ +#ifndef ATTRIBUTE_RESULT_SIZE_1 +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_RESULT_SIZE_1 __attribute__ ((alloc_size (1))) +# else +# define ATTRIBUTE_RESULT_SIZE_1 +#endif +#endif + +#ifndef ATTRIBUTE_RESULT_SIZE_2 +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_RESULT_SIZE_2 __attribute__ ((alloc_size (2))) +# else +# define ATTRIBUTE_RESULT_SIZE_2 +#endif +#endif + +#ifndef ATTRIBUTE_RESULT_SIZE_1_2 +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_RESULT_SIZE_1_2 __attribute__ ((alloc_size (1, 2))) +# else +# define ATTRIBUTE_RESULT_SIZE_1_2 +#endif +#endif + /* We use __extension__ in some places to suppress -pedantic warnings about GCC extensions. This feature didn't work properly before gcc 2.8. */ |