linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Replace "__auto_type" with "auto"
@ 2025-07-20  6:50 H. Peter Anvin
  2025-07-20  6:50 ` [PATCH v2 1/7] compiler_types.h: add "auto" as a macro for "__auto_type" H. Peter Anvin
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: H. Peter Anvin @ 2025-07-20  6:50 UTC (permalink / raw)
  Cc: H. Peter Anvin, Eugenio Pérez, Ilpo Järvinen,
	Michael S. Tsirkin, Al Viro, Alexei Starovoitov, Alexey Dobriyan,
	Andrew Morton, Andrii Nakryiko, Arnd Bergmann, Borislav Petkov,
	Dan Williams, Daniel Borkmann, Dave Hansen, David Laight,
	David Lechner, Dinh Nguyen, Eduard Zingerman, Gatlin Newhouse,
	Hao Luo, Ingo Molnar, Linus Torvalds, Jakub Sitnicki,
	Jan Hendrik Farr, Jason Wang, Jiri Olsa, John Fastabend,
	Jonathan Cameron, Josh Poimboeuf, KP Singh, Kees Cook,
	Luc Van Oostenryck, Marc Herbert, Martin KaFai Lau, Mateusz Guzik,
	Michal Luczaj, Miguel Ojeda, Mykola Lysenko, NeilBrown,
	Peter Zijlstra, Przemek Kitszel, Sami Tolvanen, Shuah Khan,
	Song Liu, Stanislav Fomichev, Thomas Gleixner, Thorsten Blum,
	Uros Bizjak, Xuan Zhuo, Yafang Shao, Ye Bin, Yonghong Song,
	Yufeng Wang, bpf, linux-fsdevel, linux-kernel, linux-kselftest,
	linux-sparse, virtualization, x86

"auto" was defined as a keyword back in the K&R days, but as a storage
type specifier.  No one ever used it, since it was and is the default
storage type for local variables.

C++11 recycled the keyword to allow a type to be declared based on the
type of an initializer.  This was finally adopted into standard C in
C23.

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.

Changes in v2:

- Restore indentation of macro backslashes (David Laight)
- arch/nios2: Replace an adjacent typeof() with a similar "auto" construct
  (Linus Torvalds)
- fs/proc/inode.c: change "__auto_type" to "const auto" (Alexey Dobriyan)

--- 
 arch/nios2/include/asm/uaccess.h                        |  8 ++++----
 arch/x86/include/asm/bug.h                              |  2 +-
 arch/x86/include/asm/string_64.h                        |  6 +++---
 arch/x86/include/asm/uaccess_64.h                       |  2 +-
 fs/proc/inode.c                                         | 16 ++++++++--------
 include/linux/cleanup.h                                 |  6 +++---
 include/linux/compiler.h                                |  2 +-
 include/linux/compiler_types.h                          | 13 +++++++++++++
 include/linux/minmax.h                                  |  6 +++---
 tools/testing/selftests/bpf/prog_tests/socket_helpers.h |  9 +++++++--
 tools/virtio/linux/compiler.h                           |  2 +-
 11 files changed, 45 insertions(+), 27 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-07-22 16:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-20  6:50 [PATCH v2 0/7] Replace "__auto_type" with "auto" H. Peter Anvin
2025-07-20  6:50 ` [PATCH v2 1/7] compiler_types.h: add "auto" as a macro for "__auto_type" H. Peter Anvin
2025-07-20 16:36   ` Miguel Ojeda
2025-07-20  6:50 ` [PATCH v2 2/7] include/linux: change "__auto_type" to "auto" H. Peter Anvin
2025-07-20  6:50 ` [PATCH v2 3/7] fs/proc: replace "__auto_type" with "const auto" H. Peter Anvin
2025-07-20  6:58   ` [PATCH v2.1 " H. Peter Anvin
2025-07-20  6:50 ` [PATCH v2 4/7] arch/nios2: replace "__auto_type" and adjacent equivalent with "auto" H. Peter Anvin
2025-07-22 16:40   ` Dinh Nguyen
2025-07-20  6:50 ` [PATCH v2 5/7] arch/x86: replace "__auto_type" " H. Peter Anvin
2025-07-20  6:50 ` [PATCH v2 6/7] selftests/bpf: " H. Peter Anvin
2025-07-21 22:13   ` Eduard Zingerman
2025-07-20  6:50 ` [PATCH v2 7/7] tools/virtio: " H. Peter Anvin
2025-07-20 18:07 ` [PATCH v2 0/7] Replace " Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).