From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796237146; b=0H1+eN3kfpFLeB+Nw/r33Z9VvpKpd+Mzv6maia5YhDwLw5crd10xW2SuXokegZ+Ez3St ymrr0RO6lyUemqG8kKiXs4eYts0bwyjMjCQXOW+9oZydTHIj5j8BaJSRreHYJG6XM1Cmp HTQXnfM/M2u9ANSsIfv97gkXBeq3CNAcUtVLiy6rOSfKIq9jCSBfr21QaZOisdc07Dbjl Bn6K8/8aAteHJU8uoPufdT69KCUIJf0mQykId8vLpblUmGdZlxTkJPmWJ8BsFGKqRuhHF OcocPMjs97MbZ12onV8MPd7vCbEWvklvJYXYZCKkDHUhLoIMn7TwOX0JNqFH0ZmFaWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796237146; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=t9ml9kPfMAOf6SQeJdQ0Xu5v0pgkfzvzFirQMFwmBF0=; b=JxzGT/xCVT+TzJqMjz3rkP3B4juZeHrrRHTQExIB+98AdDbfAhn5DCbdEJmIQBknyQs5 CIiS6znTLVMvUNoo/SDEg/m5bDsec+n44vSWhA4GmLxGiy2VuEyrVZGUf2CCPHVF1KFSx +oqNv/IOhTkIuEDzKz0+Elop0Z4dFR2xT1uo9ObJ0Hw+IliiTSKa4dsrUYLj4KCYBKO8P 8SZfNIbg8AmwTB8MOCQcQDpgBKDiTGzhqQZqCiHDLmt3mxkvR2YWNHxFoPQmzLY+yFpUT SdfCMU6v01ds1iUq9BfvT20I0XRGU0Ya5PnG67zQogCbn2ydT0sW26uORmqmm0i6r0w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=PL7KROF9; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 750F0606A682 for ; Wed, 2 Dec 2026 18:45:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=PL7KROF9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEBCE1F000C1; Wed, 2 Dec 2026 18:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796237146; bh=t9ml9kPfMAOf6SQeJdQ0Xu5v0pgkfzvzFirQMFwmBF0=; h=Date:To:From:In-Reply-To:References:Subject; b=PL7KROF9zwwzQ7zTB1F3V0r7SvO/no27+mthQK2wml8S16scRf2arE04KodFnKv7i IBYNouU20VwAEVxnaR6KR2YLjXMda87JWwnu1TRn3KaH7/tW+HVvV6uNYk4SLFddcm IQyZgPhNpuYGybCqwDdHg4jWxLtFpPb6aAeAQpxo= Date: Wed, 02 Dec 2026 10:45:45 -0800 To: mm-commits@vger.kernel.org,joe@perches.com,apw@canonical.com, elsk@google.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261118193921.683813-1-elsk@google.com> References: <20261118193921.683813-1-elsk@google.com> Subject: + checkpatch-externalize-function-like-type-macros.patch added to mm-nonmm-unstable branch Message-Id: <20261202184545.DEBCE1F000C1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: checkpatch: externalize function-like type macros has been added to the -mm mm-nonmm-unstable branch. Its filename is checkpatch-externalize-function-like-type-macros.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/checkpatch-externalize-function-like-type-macros.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: HONG Yifan Subject: checkpatch: externalize function-like type macros Date: Wed, 18 Nov 2026 19:39:19 +0000 tools/testing/selftests/kselftest_harness.h defines FIXTURE_DATA() and FIXTURE_VARIANT() to expand to struct type specifiers ("struct _test_data_##datatype_name" and "struct _fixture_variant_##fixture_name"). Because checkpatch.pl does not recognize these function-like macros in $NonptrType or $NonptrTypeWithAttr, annotate_values() parses them as function calls and tags a following '*' as a binary multiplication operator instead of a pointer declarator. This triggers false-positive errors across kselftests whenever helper functions take pointers to fixture data or variants (over 150 sites in tools/testing/selftests/), for example on commit d2b82fa39fda ("selftests/mm: add a GUP selftest"): ERROR:SPACING: need consistent spacing around '*' (ctx:WxV) #319: FILE: tools/testing/selftests/mm/gup.c:191: + FIXTURE_DATA(gup_test) *self, Following scripts/const_structs.checkpatch in commit bf1fa1dae68e ("checkpatch: externalize the structs that should be const"), read additional function-like type macro names from a new companion file scripts/type_macros.checkpatch into $type_macros (named to mirror $const_structs/$conststructsfile and initialized with the built-in typeof and __typeof__ keywords) and use $type_macros in $NonptrType and $NonptrTypeWithAttr. Seed scripts/type_macros.checkpatch with FIXTURE_DATA and FIXTURE_VARIANT, and list scripts/*.checkpatch under CHECKPATCH in MAINTAINERS. Valid pointer declarations and casts no longer emit false SPACING errors, while malformed pointer placement (such as "FIXTURE_DATA(foo)* p" or "(FIXTURE_DATA(foo)*)p") is flagged by POINTER_LOCATION. Keep typeof and __typeof__ built-in as C/GCC language operators so $type_macros is never empty and typeof() keeps working when scripts/type_macros.checkpatch is missing or empty. Link: https://patch.msgid.link/20261118193921.683813-1-elsk@google.com Signed-off-by: HONG Yifan Signed-off-by: Andrew Morton Acked-by: Joe Perches MAINTAINERS | 1 + scripts/checkpatch.pl | 9 +++++++-- scripts/type_macros.checkpatch | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) --- a/MAINTAINERS~checkpatch-externalize-function-like-type-macros +++ a/MAINTAINERS @@ -6265,6 +6265,7 @@ CHECKPATCH M: Andy Whitcroft M: Joe Perches S: Maintained +F: scripts/*.checkpatch F: scripts/checkpatch.pl CHECKPATCH DOCUMENTATION --- a/scripts/checkpatch.pl~checkpatch-externalize-function-like-type-macros +++ a/scripts/checkpatch.pl @@ -71,6 +71,7 @@ my $codespell = 0; my $codespellfile = "/usr/share/codespell/dictionary.txt"; my $user_codespellfile = ""; my $conststructsfile = "$D/const_structs.checkpatch"; +my $typemacrosfile = "$D/type_macros.checkpatch"; my $docsfile = "$D/../Documentation/dev-tools/checkpatch.rst"; my $typedefsfile; my $color = "auto"; @@ -1053,6 +1054,10 @@ if (defined($typedefsfile)) { $typeTypedefs .= '|' . $typeOtherTypedefs if (defined $typeOtherTypedefs); } +my $type_macros = "typeof|__typeof__"; +read_words(\$type_macros, $typemacrosfile) + or warn "No additional type macros will be considered - file '$typemacrosfile': $!\n"; + sub build_types { my $mods = "(?x: \n" . join("|\n ", (@modifierList, @modifierListFile)) . "\n)"; my $all = "(?x: \n" . join("|\n ", (@typeList, @typeListFile)) . "\n)"; @@ -1066,7 +1071,7 @@ sub build_types { $NonptrType = qr{ (?:$Modifier\s+|const\s+)* (?: - (?:typeof|__typeof__)\s*\([^\)]*\)| + (?:$type_macros)\s*\([^\)]*\)| (?:$typeTypedefs\b)| (?:${all}\b) ) @@ -1082,7 +1087,7 @@ sub build_types { $NonptrTypeWithAttr = qr{ (?:$Modifier\s+|const\s+)* (?: - (?:typeof|__typeof__)\s*\([^\)]*\)| + (?:$type_macros)\s*\([^\)]*\)| (?:$typeTypedefs\b)| (?:${allWithAttr}\b) ) diff --git a/scripts/type_macros.checkpatch a/scripts/type_macros.checkpatch new file mode 100644 --- /dev/null +++ a/scripts/type_macros.checkpatch @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Function-like macros that expand to type specifiers (for example, +# struct types) and take parenthesized arguments. +FIXTURE_DATA +FIXTURE_VARIANT _ Patches currently in -mm which might be from elsk@google.com are checkpatch-externalize-function-like-type-macros.patch