Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp501703rdg; Tue, 10 Oct 2023 17:46:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwJOD7jOAeEKExBCMug29T1Xl4rzgGBU//iiFh7JVDn9ZhdovDqcVjJZWdFSY6+NwE1BvK X-Received: by 2002:a05:6e02:1c08:b0:34b:ad80:61c1 with SMTP id l8-20020a056e021c0800b0034bad8061c1mr25411299ilh.26.1696985185332; Tue, 10 Oct 2023 17:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696985185; cv=none; d=google.com; s=arc-20160816; b=ecFyR5HLfrH1NDPkIpIYbeipFasOQQaBvJ3/Pq16D6eBO4MGGTGbGKiSAHQda1US7O C8SjT4lRvthd6aIkvCd1VnVLUox4DFtRINs2sLsZ0izqAT8SN2YIEc7DdJEVnObL0e0b DmwjfwtZu+70RLzTPzwhR//wGQkQBIeGaEdLbYHUSt43ovTnhZu1XoPjpDlten516WHS 0xbHwug/W8wU5cgO5sW1XydJgK3cj7D9E1mu2gJ70XcdC6GBmlX3uvcDaVrQDKK0zQO0 y3EUfeX2aFulOI7WpZMnoMiH6N/sXUrbX/CirdCF23eEeB/TDKJuwzaENgUKGBMiWehK +y3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=lXc/5p9tG5xFpLiHutsWhq1504F5bx66l85gWTMP7pY=; fh=genHoGkfuDMe8YFqjT3/Q+4IeXBGuz4DvrjumOgcQ4I=; b=nji5rh/Nh9x659JdqT1WtNnltsJbP6OK3Mc0zGGtjz/zrwWVEvly8MsohXCf8cbM2L tRy1Pcj/Y39AGfEZgXn1xzVDmrOUodUsk7tPJjPb+i8vqfxFsdBQZolhjLT7/dVVqZmH nol0Yjdrp17O9FBAineJ72qCxIGjSbh8hD8L9/lF4FDUooDTEg91yGjLsyEWjtFc0iwR NZdQvWGHDag9l4LB2KnYGdP9UpSjKyF+X2TmihrkCRY3gLmqvu/EPX9KDwlbtw/lXtG6 TnQOdXk4kV9c3fWiAamYcUunsp+dkHTk/zwQ7LbzwcZYAgVJiI8b4zD5SLig7sQSpoyK SkHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id m7-20020a634c47000000b0056c297d1644si12775435pgl.510.2023.10.10.17.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 17:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AA213831D2C7; Tue, 10 Oct 2023 17:46:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344496AbjJKAqP convert rfc822-to-8bit (ORCPT + 99 others); Tue, 10 Oct 2023 20:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344552AbjJKAqK (ORCPT ); Tue, 10 Oct 2023 20:46:10 -0400 Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1815FB; Tue, 10 Oct 2023 17:46:00 -0700 (PDT) Received: from omf08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 55698160303; Wed, 11 Oct 2023 00:45:59 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA id 0231720026; Wed, 11 Oct 2023 00:45:56 +0000 (UTC) Message-ID: Subject: Re: [PATCH v3] Documentation/process/coding-style.rst: space around const From: Joe Perches To: Max Kellermann , linux@roeck-us.net, gregkh@linuxfoundation.org, Jonathan Corbet Cc: workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 10 Oct 2023 17:45:55 -0700 In-Reply-To: <20231010125832.1002941-1-max.kellermann@ionos.com> References: <20231010125832.1002941-1-max.kellermann@ionos.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspamd-Queue-Id: 0231720026 X-Stat-Signature: ftb4aswraeg9ufnzdw15mwoboyoeo934 X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Rspamd-Server: rspamout01 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX181EpPdpemFZmpY9nkwWDJH0zZmsZ2ZaUo= X-HE-Tag: 1696985156-390945 X-HE-Meta: U2FsdGVkX184/p56Wz98aBmu/bGpEMuwN80kbPn/OzGG3c3XICAqYEdACsIuzDe2ZcHe5izk65H1HKz0dIFU+9BSRd/Xnl6fg8RjVoe+Gng81t6pZob0I15wXzBvD4hAkVAQi5rFcyaPuXzRw+cXqFReXvaNJZoE1X9+u0VQ12qlIFsDcz9jw1nTz3fZndLRI1YaB/04BRFE7NUxb56mmykOq7BrUhoPpRTo134fiJPaovV328+1p0IAPnYJs3MKKDCv+5LALwt7EYQk6hL/+ucadioG/j7W5yW4YWL+LaN8iu47kat1/018I8c8aN5R X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 17:46:22 -0700 (PDT) X-Spam-Level: ** On Tue, 2023-10-10 at 14:58 +0200, Max Kellermann wrote: > There are currently no rules on the placement of "const", but a recent > code submission revealed that there is clearly a preference for spaces > around it. > > checkpatch.pl has no check at all for this; though it does sometimes > complain, but only because it erroneously thinks that the "*" (on > local variables) is an unary dereference operator, not a pointer type. > Maybe something like this for checkpatch: --- scripts/checkpatch.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 25fdb7fda1128..48d70d0ad9a2b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4726,6 +4726,16 @@ sub process { } } +# check for const* and *const uses that should have space around const + if ($line =~ /(?:const\*|\*const)/) { + if (WARN("CONST_POINTER", + "const pointers should have spaces around const\n" . $herecurr) && + $fix) { + $fixed[$fixlinenr] =~ s/\*const\b/* const/g; + $fixed[$fixlinenr] =~ s/\bconst\*/const */g; + } + } + # check for non-global char *foo[] = {"bar", ...} declarations. if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) { WARN("STATIC_CONST_CHAR_ARRAY",