From nobody Thu Apr 9 14:39:07 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AEA1ECAAD1 for ; Thu, 1 Sep 2022 15:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234572AbiIAPAS (ORCPT ); Thu, 1 Sep 2022 11:00:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233337AbiIAPAK (ORCPT ); Thu, 1 Sep 2022 11:00:10 -0400 Received: from smtp-190e.mail.infomaniak.ch (smtp-190e.mail.infomaniak.ch [IPv6:2001:1600:4:17::190e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CEDE1E3E4 for ; Thu, 1 Sep 2022 07:59:59 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MJPN96nr7zMpypf; Thu, 1 Sep 2022 16:59:53 +0200 (CEST) Received: from localhost (unknown [23.97.221.149]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MJPN93m0Fz11x; Thu, 1 Sep 2022 16:59:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1662044393; bh=icmwX+VVoTNqIidLHlNyh0r5G9YUWnEjoCgUFnQtQ88=; h=From:To:Cc:Subject:Date:From; b=fDQLf6jqFu+MDwoeXHxeqeo1ea/YACFpmZOqqSxDuLlSHelWsu6lNPMgyQU/qQj1N GFyPv3DqniceNFWKUna0pK797Jo+U5tNBBtvyqiWW4cgcJco/543kqjGsmYrDotSm7 5pDhc+gMCUzyVptiGi1XGkXSiVqzwc2Ed9NRyC3w= From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Andy Whitcroft , Joe Perches Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Dwaipayan Ray , Lukas Bulwahn , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [RFC PATCH v1] checkpatch: Handle FILE pointer type Date: Thu, 1 Sep 2022 16:59:48 +0200 Message-Id: <20220901145948.1456353-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using a "FILE *" type, checkpatch considers this an error. Fix this by explicitly defining "FILE" as a common type. This is useful for user space patches. With this patch, we now get: static void a(FILE *const b) <_>WS( ) <_>IDENT(static) <_>WS( ) <_>DECLARE(void ) <_>FUNC(a) PAREN('(') <_>DECLARE(FILE *const ) <_>IDENT(b) <_>PAREN(')') -> V <_>WS( ) 32 > . static void a(FILE *const b) 32 > EEVVVVVVVTTTTTVNTTTTTTTTTTTTVVV 32 > ______________________________ Another error may be throw when we use FIXTURE_{DATA,VARIANT}() structs, as defined in kselftest_harness.h . The commented $typeKselftestHarnessTypedefs should fix it but such definition is considered as a function instead, because of the closing parenthesis. I'd like some help to fix this as well. With $typeKselftestHarnessTypedefs added to $typeTypedefs, we get: static void c(const FIXTURE_VARIANT(d) *const e) <_>WS( ) <_>IDENT(static) <_>WS( ) <_>DECLARE(void ) <_>FUNC(c) PAREN('(') <_>MODIFIER(const) <_>WS( ) <_>FUNC(FIXTURE_VARIANT) PAREN('(') <_>IDENT(d) <_>PAREN(')') -> V <_>WS( ) <_>OPV(*) <_>MODIFIER(const) <_>WS( ) <_>IDENT(e) <_>PAREN(')') -> V <_>WS( ) 30 > . static void c(const FIXTURE_VARIANT(d) *const e) 30 > EEVVVVVVVTTTTTVNTTTTTTVVVVVVVVVVVVVVVNVVVNTTTTTTVVV 30 > ________________________________________B_________ Cc: Andy Whitcroft Cc: Dwaipayan Ray Cc: Joe Perches Cc: Lukas Bulwahn Signed-off-by: Micka=C3=ABl Sala=C3=BCn Link: https://lore.kernel.org/r/20220901145948.1456353-1-mic@digikod.net --- scripts/checkpatch.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 79e759aac543..016b47c35742 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -576,10 +576,17 @@ our $typeKernelTypedefs =3D qr{(?x: (?:__)?(?:u|s|be|le)(?:8|16|32|64)| atomic_t )}; +our $typeStdioTypedefs =3D qr{(?x: + FILE +)}; +# our $typeKselftestHarnessTypedefs =3D qr{(?x: +# FIXTURE_(?:DATA|VARIANT)\($Ident\) +# )}; our $typeTypedefs =3D qr{(?x: $typeC99Typedefs\b| $typeOtherOSTypedefs\b| - $typeKernelTypedefs\b + $typeKernelTypedefs\b| + $typeStdioTypedefs\b )}; =20 our $zero_initializer =3D qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; base-commit: b90cb1053190353cc30f0fef0ef1f378ccc063c5 --=20 2.37.2