diff options
Diffstat (limited to 'lib/cdefs.h')
-rw-r--r-- | lib/cdefs.h | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/lib/cdefs.h b/lib/cdefs.h index 17a0919cd83..4dac9d264d2 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -2,16 +2,16 @@ This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public + You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ @@ -259,9 +259,7 @@ # define __attribute_const__ /* Ignore */ #endif -#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ -# define __attribute_maybe_unused__ [[__maybe_unused__]] -#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) +#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) # define __attribute_maybe_unused__ __attribute__ ((__unused__)) #else # define __attribute_maybe_unused__ /* Ignore */ @@ -320,16 +318,28 @@ #endif /* The nonnull function attribute marks pointer parameters that - must not be NULL. */ -#ifndef __nonnull + must not be NULL. This has the name __nonnull in glibc, + and __attribute_nonnull__ in files shared with Gnulib to avoid + collision with a different __nonnull in DragonFlyBSD 5.9. */ +#ifndef __attribute_nonnull__ # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) +# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) +# else +# define __attribute_nonnull__(params) +# endif +#endif +#ifndef __nonnull +# define __nonnull(params) __attribute_nonnull__ (params) +#endif + +/* The returns_nonnull function attribute marks the return type of the function + as always being non-null. */ +#ifndef __returns_nonnull +# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) +# define __returns_nonnull __attribute__ ((__returns_nonnull__)) # else -# define __nonnull(params) +# define __returns_nonnull # endif -#elif !defined __GLIBC__ -# undef __nonnull -# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params) #endif /* If fortification mode, we warn about unused results of certain @@ -485,9 +495,9 @@ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] #endif -/* The #ifndef lets Gnulib avoid including these on non-glibc - platforms, where the includes typically do not exist. */ -#ifndef __WORDSIZE +/* Gnulib avoids including these, as they don't work on non-glibc or + older glibc platforms. */ +#ifndef __GNULIB_CDEFS # include <bits/wordsize.h> # include <bits/long-double.h> #endif @@ -594,9 +604,26 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf array according to access mode, or at least one element when size-index is not provided: access (access-mode, <ref-index> [, <size-index>]) */ -#define __attr_access(x) __attribute__ ((__access__ x)) +# define __attr_access(x) __attribute__ ((__access__ x)) +# if __GNUC_PREREQ (11, 0) +# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) +# else +# define __attr_access_none(argno) +# endif #else # define __attr_access(x) +# define __attr_access_none(argno) +#endif + +#if __GNUC_PREREQ (11, 0) +/* Designates dealloc as a function to call to deallocate objects + allocated by the declared function. */ +# define __attr_dealloc(dealloc, argno) \ + __attribute__ ((__malloc__ (dealloc, argno))) +# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1) +#else +# define __attr_dealloc(dealloc, argno) +# define __attr_dealloc_free #endif /* Specify that a function such as setjmp or vfork may return |