diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 8e244a77cf..b3b5456efd 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -586,15 +586,23 @@ _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) && !defined __STRICT_ANSI__ +# define __attr_access(x) __attr_access1 x +# define __attr_access1(mode, ...) __attr_access##mode (mode, __VA_ARGS__) +# define __attr_access__none__(mode, ...) +# define __attr_access__read_only__(mode, ...) \ + __attribute__ ((__access__ (mode, __VA_ARGS__))) +# define __attr_access__read_write__ __attr_access__read_only__ +# define __attr_access__write_only__ __attr_access__read_only__ #else -# define __attr_access(x) +# define __attr_access(x) #endif /* Specify that a function such as setjmp or vfork may return