diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 8e244a77cf..db3283ec7f 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -586,15 +586,26 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf # define __HAVE_GENERIC_SELECTION 0 #endif -#if __GNUC_PREREQ (10, 0) /* Designates a 1-based positional argument ref-index of pointer type that can be used to access size-index elements of the pointed-to array according to access mode, or at least one element when size-index is not provided: access (access-mode, [, ]) */ -#define __attr_access(x) __attribute__ ((__access__ x)) +#if __GNUC_PREREQ (11, 0) +# define __attr_access(x) __attribute__ ((__access__ x)) +#elif __GNUC_PREREQ (10, 0) +# define __attr_access(x) __attr_access1 x +# define __attr_access1(access_mode, ...) \ + __attr_access##access_mode (__VA_ARGS__) +# define __attr_access__none__(...) +# define __attr_access__read_only__(...) \ + __attribute__ ((__access__ (__read_only__, __VA_ARGS__) +# define __attr_access__read_write__(...) \ + __attribute__ ((__access__ (__read_write__, __VA_ARGS__) +# define __attr_access__write_only__(...) \ + __attribute__ ((__access__ (__write_only__, __VA_ARGS__) #else -# define __attr_access(x) +# define __attr_access(x) #endif /* Specify that a function such as setjmp or vfork may return