Re: [PATCH v2 1/7] compiler_types.h: add "auto" as a macro for "__auto_type"
From: Miguel Ojeda
Date: Sun Jul 20 2025 - 12:36:31 EST
On Sun, Jul 20, 2025 at 8:52 AM H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>
> gcc and clang provide the "__auto_type" alias keyword as an extension
> for pre-C23, however, there is no reason to pollute the bulk of the
> source base with this temporary keyword; instead define "auto" as a
> macro unless the compiler is running in C23+ mode.
>
> This macro is added in <linux/compiler_types.h> because that header is
> included in some of the tools headers, wheres <linux/compiler.h> is
> not as it has a bunch of very kernel-specific things in it.
Sounds good. I guess we could need a workaround if someone happened to
invent an attribute which requires using "auto" in it, since it is not
reserved there in C23 AFAIU. So FWIW:
Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> + * so it has always been "namespace reserved."
Not sure what this means (could we just say reserved?).
Thanks!
Relatedly, there are some proposed, further changes to `auto` for C2y:
https://www.open-std.org/jtc1/sc22/WG14/www/docs/n3579.htm
Cheers,
Miguel