Re: [PATCH 1/2] Compiler Attributes: Add __access macro
From: Miguel Ojeda
Date: Wed Apr 22 2026 - 06:25:47 EST
On Tue, Apr 21, 2026 at 9:30 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> gcc-10 knows the 'access' attribute, but not the 'none' variant:
>
> echo 'int f(void *p) __attribute__((access(none, 1)));' | /home/arnd/cross/arm64/gcc-10.5.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc -xc - -o /dev/null -c
> <stdin>:1:1: error: attribute 'access' invalid mode 'none'; expected one of 'read_only', 'read_write', or 'write_only'
Which is exactly the one we use in #2, indeed.
That makes sense, thanks!
We should still change the number here, because `__has_attribute` will
pass even with GCC 10, i.e. since someone using `none` without a gate
in Kconfig or elsewhere may not realize the mistake.
So we should probably add a comment that the access mode `none` is
only available in GCC 11 -- especially so if we add the docs David
suggests, because otherwise it seems like it is supported.
Cheers,
Miguel