Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1802013rwe; Fri, 2 Sep 2022 04:12:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4p79fINIsQoiP8xcO6u+uwBL00FVkadx2wWr5RjJapFjHu1XAkmgHFBV2SajepeBrE/7Qo X-Received: by 2002:a05:6402:90d:b0:443:ef4c:480f with SMTP id g13-20020a056402090d00b00443ef4c480fmr32382102edz.128.1662117160139; Fri, 02 Sep 2022 04:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662117160; cv=none; d=google.com; s=arc-20160816; b=ZBC+A4YEe3B6Lk4evs8YNXyrI5B7zNzRdkHt1QNZshgi5VM9NZOynCL9S9r066ehxN qunso4CjKkMskQJI9gyCJ/D3P9VAGlb/JHgnfDWmtUrf7oH3q16SWZRF4rldDc0Sf1H7 ZupPeHh7g/vmGU2FHARLpd96aG0ZPJxFpl5C25S7yCrjiLqRHb+MURLK/MTrtJpOySfC 4DahGyNm8n41eXBoRTSoNskqAwiMZNr+BrBDoCWFNDTVp8inrfjvcJWiLFPYhif5Xx+X 1jjVOX2HZZE6X9nnJL9PNyppEWIBDtm62R5zKtUQwUGvSnr1YYRjVBCj7Qa7LCXBt5fg SbWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=uIeUMYU1ztcZfpBt9uDPf2VXTdjIL7v2ilk3wyHXbJc=; b=Z7AztUr1a44bWtDv8etkyCsAcWbCYnJQCvk8U40HK6L5+INwOnedIeCbXcapyrAeg5 dsvtrerAG0fh3Txq7dK7qFCBEdZ+HRhNuZa7qH0zVwUuhJ7+UsGK1BgF7A1Oe3a6H1La EnS51Ngx+ZEnanhDuSXUr5QK/Imi2CnWeQpyWg3WrovLFyY+f6vSmFGLnoDCt4z5x34n TmcqG87xUocSY5Zuf4p9UJ23fPOrKrZlUtVBORwum+fpdHnFht4pii7MtwkoGnO8JKDr 69CDyY51jVbb7YNmR+hyODv2sV5Ppr0E8txME04lRi/ctSuSBf3bvrrAz5l70BXiZad0 4dmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=1xYd1nX4; 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 q10-20020a170906388a00b007304faaafc0si1394673ejd.432.2022.09.02.04.12.15; Fri, 02 Sep 2022 04:12:40 -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=1xYd1nX4; 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 S235959AbiIBLEY (ORCPT + 99 others); Fri, 2 Sep 2022 07:04:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236063AbiIBLEL (ORCPT ); Fri, 2 Sep 2022 07:04:11 -0400 Received: from smtp-8fac.mail.infomaniak.ch (smtp-8fac.mail.infomaniak.ch [IPv6:2001:1600:4:17::8fac]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6CDD11F2 for ; Fri, 2 Sep 2022 04:04:08 -0700 (PDT) Received: from smtp-2-0001.mail.infomaniak.ch (unknown [10.5.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MJw5d5TyKzMpvhR; Fri, 2 Sep 2022 13:04:05 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-2-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4MJw5d0KwBzlh8kt; Fri, 2 Sep 2022 13:04:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1662116645; bh=2NupZEbQhzLkAmKzohlpC8jqcOh9uHWcOTqm5iFnBo4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=1xYd1nX4oRzTFfwoTyTfk4ekb+ct01DJz3FFBMRyzLRXc//Dq3/bVvsXMB9QZU0LI vPNR4/RmMqxVVeRaaFMu0vDQ4unFAMKpmEeSdSOBYesRTX9FrYVyqLKFi8kjD6wLkF 2Mt1PJyxGQYsBtwxi/XUJfL4tT3r0Xj2/vlN/Qnw= Message-ID: Date: Fri, 2 Sep 2022 13:04:04 +0200 MIME-Version: 1.0 User-Agent: Subject: Re: [RFC PATCH v1] checkpatch: Handle FILE pointer type Content-Language: en-US To: Joe Perches , Andy Whitcroft Cc: Dwaipayan Ray , Lukas Bulwahn , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Jerome Forissier References: <20220901145948.1456353-1-mic@digikod.net> <4f958a0c7c0aa2fce613371348477c002aa58e90.camel@perches.com> <026c08d9ab841ef626f80d968a532dea94a37c62.camel@perches.com> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: <026c08d9ab841ef626f80d968a532dea94a37c62.camel@perches.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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,RCVD_IN_DNSWL_NONE, 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 On 02/09/2022 12:39, Joe Perches wrote: > On Fri, 2022-09-02 at 11:04 +0200, Mickaël Salaün wrote: >> On 01/09/2022 20:22, Joe Perches wrote: >>> On Thu, 2022-09-01 at 11:49 -0400, Joe Perches wrote: >>>> On Thu, 2022-09-01 at 16:59 +0200, Mickaël Salaün wrote: >>>>> When using a "FILE *" type, checkpatch considers this an error. Fix >>>>> this by explicitly defining "FILE" as a common type. >>>> [] >>>>> Another error may be throw when we use FIXTURE_{DATA,VARIANT}() structs, >>>>> as defined in kselftest_harness.h . >>>> [] >>>>> diff --git 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 >>>>> +)}; >>>> >>>> I'm fine with this. >>>> >>>>> +# our $typeKselftestHarnessTypedefs = qr{(?x: >>>>> +# FIXTURE_(?:DATA|VARIANT)\($Ident\) >>>>> +# )}; >>>> >>>> But not this. Random userspace typedefs should likely >>>> be kept in some local version of checkpatch. >>>> >>>> Or maybe add a command line option like --additional_typedefs=. >>> >>> Oops. I forgot it already exists: >>> >>> --typedefsfile Read additional types from this file >>> >>> commit 75ad8c575a5ad105e2afc2051c68abceb9c65431 >>> Author: Jerome Forissier >>> Date: Mon May 8 15:56:00 2017 -0700 >>> >>> checkpatch: add --typedefsfile >>> >>> When using checkpatch on out-of-tree code, it may occur that some >>> project-specific types are used, which will cause spurious warnings. >>> Add the --typedefsfile option as a way to extend the known types and >>> deal with this issue. >> >> This doesn't work for the FIXTURE_DATA() case. > > checkpatch is a stupid little script. > It's not a c preprocessor nor a syntax complete compiler. > It's really easy for macros to make its output invalid. > If you feed obfuscated c to checkpatch, it'd be confused. > (Same is true for tools like coccinelle btw, though cocci is far better) > checkpatch will never be comprehensive nor perfect. > It's expected its users will use their common sense about its > output message validity. > >> And I'm not sure how >> contributors would know that they need to use this option with a >> specific file. > > --help exists > > Maybe Documentation/dev-tools/checkpatch.rst could be expanded for > --verbose mode. I was thinking about which file to use, but I understand your point. I'll send a v2 with only the "FILE" addition. FIXTURE_{DATA,VARIANT}() will just not be handled but that's OK.