Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp829345rwe; Thu, 1 Sep 2022 08:13:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR7EPH3CjAMricZb565B0afkfef5Fp/nfkCG1mFAfzVvSMESSBYPUBZcIPNv6BZHSHvrN+tH X-Received: by 2002:a63:5d4e:0:b0:41d:2966:74e7 with SMTP id o14-20020a635d4e000000b0041d296674e7mr26041448pgm.526.1662045191845; Thu, 01 Sep 2022 08:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662045191; cv=none; d=google.com; s=arc-20160816; b=xokvnwE6zT8dAr2zYCQ2oJC6SPYMhqz+JdkPcAhElKzZ7st5v6wMw8T4fSL5VwGCDW 6q7W8owsfZ57J11tVcafkLc0Enlq7xCvivsGxJ5SujdQAZgpT7mphH8kv0zoeYIkHDtd 8yGq7OE2YQDQNmCzv9Bcy6ECNHCJKVphHMrBQS9+AzNPEgz1tjSoCuE/zKPBdFshzB64 eKAMT5b6u5nXHspWFgajNIaCROyCR8IvpS1apnzfmSuGoAjccUJAjlshpRToFtZX2zGi 4P/ymWtUMuVMWQqWwwXbekRPMf6XjSskiS8aAj0PWBcsx+6PkZ1IblYvCay+84qgysrw 7x0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ae/HTyXHjw0nPs6vfLdN6GRiHcMPunjTmQ7BjwmHlaE=; b=mRqu8LB9q15NpXdZL5ZWuwoISR6E2JuqhdXaDRblLH1enoDyVLD6iUC9fCff2x7AWy w4iBtv7rW//KRVXDK4VLhaA2LkPBr0SWMcqAA5nJvL/4UopXHYt7aw50aoLsY/i4pPVw /4JN40rFj+Hs5B2mIn+H4Ja1GCPC4TqOb8IfPCQV5uJd3Bd+79Kb40MmeypGFYXie/Is McG57qkQaQmprW6oexYqDTQl9nUxnkvMlnqvdCWWAj7cDyzCA9tsl2hh96HlKe54HHZD WO1fsCDXUmdpvNjDm7VjM9rqnNsjQR1tl8EXOyuc0wD2WdElHJyNAi+/nw4lQAEuQjNB BKzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=fDQLf6jq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a170902f64f00b0017340861a6bsi17360180plg.611.2022.09.01.08.12.59; Thu, 01 Sep 2022 08:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=fDQLf6jq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234557AbiIAPAQ (ORCPT + 99 others); Thu, 1 Sep 2022 11:00:16 -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: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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ël Salaün 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 = qr{(?x: (?:__)?(?:u|s|be|le)(?:8|16|32|64)| atomic_t )}; +our $typeStdioTypedefs = qr{(?x: + FILE +)}; +# our $typeKselftestHarnessTypedefs = qr{(?x: +# FIXTURE_(?:DATA|VARIANT)\($Ident\) +# )}; our $typeTypedefs = qr{(?x: $typeC99Typedefs\b| $typeOtherOSTypedefs\b| - $typeKernelTypedefs\b + $typeKernelTypedefs\b| + $typeStdioTypedefs\b )}; our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; base-commit: b90cb1053190353cc30f0fef0ef1f378ccc063c5 -- 2.37.2