From nobody Mon Oct 6 17:09:51 2025 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAA101C2437; Sun, 20 Jul 2025 06:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752994385; cv=none; b=bvCxIWPEBRIbfKub72e/XNoXaP22bDC2Si1FaJ1o9ye+j9fcqFQgwlFfmidP/2MJK1zIyg8BStGgarJ9rW+yRiPTenH2fvCALgDuBUPJNkQn03yMRwJokg23rRHgZ3zIaSyBpVMs8Qyivl5eDkxaqi1zK2wlog25DzJo7xMwp38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752994385; c=relaxed/simple; bh=+dM1bld6YqFuWFqTeVy2M0W6B7tgTC8OPQdbIxYR2qs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U2IiYFpX82fGke3nE1OvNmiPLjbE0YC/yKB4f5jBncSTxojBXTAKKsMWh9vRnmle53FwaAG6I1a+wZC3skcjTHKXi7Er3RIAd8FFRMe4aJUhpBjNq+N7XYVGKfafgxkMB5A6GqXtTWw1jZlj56dzRNjNQFID+0NQLIn+TBW5qpI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=ZyDBDKwJ; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="ZyDBDKwJ" Received: from mail.zytor.com ([IPv6:2601:646:8081:9484:f04a:f27d:fd66:5c61]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 56K6oq0Y3555973 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 19 Jul 2025 23:51:00 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 56K6oq0Y3555973 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025062101; t=1752994264; bh=vsGxPzzTTwhbkBTwSIw4sMhUPUpWMkx20cB75uEuQgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZyDBDKwJ82kVHavnoOkwuOs1qV0y87AnM33njIS0JfpbC5KvDYtNpaF7gvZsBf0xV nVSq1R9fnrUmhCTKA1CoMUmcFc+doBbPDDA2tHj5kZmv6IcbSb6ib2YcxjMKh28I7G rKiEuAN8wWXPJWzxX1uQQLcZNbkUQOx8WJ29nOD3QSVDNWfXIaXz4tpC24uIVuq9ej oEAS2eBXkRn8ZimKfJutIoG7rn5fnjmZW+taM70aqT6aBc7FcoKRYDmXHYBg3Q2ZDS sFYPEyqjn16JROYOoPEb6WPcYXBQxczMapwNEKfsf2l6PlSWVUKL7mw/otFBLJ38Ys R0BeVUxJwySsQ== From: "H. Peter Anvin" To: Cc: "H. Peter Anvin" , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , "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@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-sparse@vger.kernel.org, virtualization@lists.linux.dev, x86@kernel.org Subject: [PATCH v2 1/7] compiler_types.h: add "auto" as a macro for "__auto_type" Date: Sat, 19 Jul 2025 23:50:38 -0700 Message-ID: <20250720065045.2859105-2-hpa@zytor.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250720065045.2859105-1-hpa@zytor.com> References: <20250720065045.2859105-1-hpa@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" "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 because that header is included in some of the tools headers, wheres is not as it has a bunch of very kernel-specific things in it. Signed-off-by: H. Peter Anvin (Intel) Acked-by: Miguel Ojeda --- include/linux/compiler_types.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 2b77d12e07b2..c8b1ee37934e 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -13,6 +13,19 @@ =20 #ifndef __ASSEMBLY__ =20 +/* + * C23 introduces "auto" as a standard way to define type-inferred + * variables, but "auto" has been a (useless) keyword even since K&R C, + * so it has always been "namespace reserved." + * + * Until at some future time we require C23 support, we need the gcc + * extension __auto_type, but there is no reason to put that elsewhere + * in the source code. + */ +#if __STDC_VERSION__ < 202311L +# define auto __auto_type +#endif + /* * Skipped when running bindgen due to a libclang issue; * see https://github.com/rust-lang/rust-bindgen/issues/2244. --=20 2.50.1