From patchwork Fri Jun 2 21:00:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 102695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1301902vqr; Fri, 2 Jun 2023 14:08:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5w8W2NvqsJSiM3LPZk92/Mrx5lRC/ZN6LLpWRmDfg+qGux8g5K9h5SCvq+ch7QAjGSsk+X X-Received: by 2002:a17:90a:9201:b0:255:cddf:a0c8 with SMTP id m1-20020a17090a920100b00255cddfa0c8mr902674pjo.41.1685740103867; Fri, 02 Jun 2023 14:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685740103; cv=none; d=google.com; s=arc-20160816; b=Liae0NEthloc0xSAo+NdaBSN4tY8LgvnPMeDVIC02kMWWFYwNzUkl505BF9ZCpPEWo d7iwG8qzbJmzPSbNRgwzJwgJIViZ8lXrQTbE8urWsXUCmv8shqKgixHVG9SGhKTLeLNX oRXVIjcwJUKQR9+jX+S5Daro5UTXOS/VmUwZMnfwJqJlu2NGjXZpefcLQariiDmprGlB cPZB8cAQBLg2JgYTLbJWPzYZKpIVdeEoXwxUuQHLASNhcc46kClqzjNcCSaIVeqZNvpK bDbQ6Z3vv+CQYFiq6ukuhnmfqGglKTRnOygQtX97DnmcXC81XcFpRpzn7EJtDvGLrkGj VJDA== 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=qRgq5U/n9Ip9t5IBpxq+Q3tveoCjRKpwVurL75b8pPY=; b=sTUZsfwewwUr1Eg1+xwGTCcOVDIxURXS8Ch7AwhP581eO5ofinK90pf0BLlxudMx/l qh5gRwYrZSblo1h6hmDAA+nrX2Rm5RFfq0FfBNDyklsUoaITtoFRPwXVsPKLyjHxK6zW s2ywM898SNdMtY1elFkv2fZ79d2SAcWItNFjnHk0lrnyDiI6ChSpKzOAeLHz2G3zJUV4 GZ6DWG+YLT3vffyya0NtP+hPcEm7wcXSTIEbkp6gMWEzT67TIYH9MKpOZgyIQjtyHllJ YZMTmDbXu+pq7t7o6PpOOaarUmr94LjykDQrJIkdLaM+JK6S8/H5nj8zkjfk3hNIKP6i zhaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=vTqJotCK; 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; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020a17090aca1200b00235dc16de3asi3426165pjt.16.2023.06.02.14.08.08; Fri, 02 Jun 2023 14:08:23 -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=@sipsolutions.net header.s=mail header.b=vTqJotCK; 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; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236415AbjFBVAc (ORCPT + 99 others); Fri, 2 Jun 2023 17:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236010AbjFBVA3 (ORCPT ); Fri, 2 Jun 2023 17:00:29 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B85C819B; Fri, 2 Jun 2023 14:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=qRgq5U/n9Ip9t5IBpxq+Q3tveoCjRKpwVurL75b8pPY=; t=1685739626; x=1686949226; b=vTqJotCK7xpxTZoS9CJTIV358rzDwcnvSD6igpgFCaMBzRGk39c9Nravr0ETyW6xgw35CrsoBbS icIHGA0rNrUb+g1oISrYMCn3vKy+KWoonsg9jLOpTu8GT7r6BSHwwNRwvIlRZOPzwsgUsNVt14GIz eTG6uddN9cbWyGpS/gA0g4FtaEiPO9deac+a0xJ5NSqiKWpotQGKJfiQRS9sb/+rCzxFMMnZyx4OK gGZiUxYBwFYkm2Ip4cadhb5eKEyG03gLvTjEzH7H2zcf+ykLDPrvMQFjFsT6AhenZHV8vGvwr//Wq gd11Fq9D4KbqNx99EIRIXiBj+bnRRCe9HKnw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1q5Bsk-00BgEs-1p; Fri, 02 Jun 2023 23:00:22 +0200 From: Johannes Berg To: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Johannes Berg Subject: [PATCH 1/2] kernel-doc: don't let V=1 change outcome Date: Fri, 2 Jun 2023 23:00:13 +0200 Message-Id: <20230602230014.a435aab03cee.I21ab3b54eeebd638676bead3b2f87417944e44f3@changeid> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767626615253604589?= X-GMAIL-MSGID: =?utf-8?q?1767626615253604589?= From: Johannes Berg The kernel-doc script currently reports a number of issues only in "verbose" mode, but that's initialized from V=1 (via KBUILD_VERBOSE), so if you use KDOC_WERROR=1 then adding V=1 might actually break the build. This is rather unexpected. Change kernel-doc to not change its behaviour wrt. errors (or warnings) when verbose mode is enabled, but rather add separate warning flags (and -Wall) for it. Signed-off-by: Johannes Berg --- scripts/kernel-doc | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 2486689ffc7b..1eb1819fbe13 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -23,7 +23,7 @@ kernel-doc - Print formatted kernel documentation to stdout =head1 SYNOPSIS - kernel-doc [-h] [-v] [-Werror] + kernel-doc [-h] [-v] [-Werror] [-Wreturn] [-Wshort-description] [-Wcontents-before-sections] [-Wall] [ -man | -rst [-sphinx-version VERSION] [-enable-lineno] | -none @@ -133,6 +133,9 @@ my $dohighlight = ""; my $verbose = 0; my $Werror = 0; +my $Wreturn = 0; +my $Wshort_desc = 0; +my $Wcontents_before_sections = 0; my $output_mode = "rst"; my $output_preformatted = 0; my $no_doc_sections = 0; @@ -191,6 +194,24 @@ if (defined($ENV{'KDOC_WERROR'})) { $Werror = "$ENV{'KDOC_WERROR'}"; } +if (defined($ENV{'KDOC_WRETURN'})) { + $Wreturn = "$ENV{'KDOC_WRETURN'}"; +} + +if (defined($ENV{'KDOC_WSHORT_DESC'})) { + $Wshort_desc = "$ENV{'KDOC_WSHORT_DESC'}"; +} + +if (defined($ENV{'KDOC_WCONTENTS_BEFORE_SECTION'})) { + $Wcontents_before_sections = "$ENV{'KDOC_WCONTENTS_BEFORE_SECTION'}"; +} + +if (defined($ENV{'KDOC_WALL'})) { + $Wreturn = "$ENV{'KDOC_WALL'}"; + $Wshort_desc = "$ENV{'KDOC_WALL'}"; + $Wcontents_before_sections = "$ENV{'KDOC_WALL'}"; +} + # Generated docbook code is inserted in a template at a point where # docbook v3.1 requires a non-zero sequence of RefEntry's; see: # https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html @@ -318,6 +339,16 @@ while ($ARGV[0] =~ m/^--?(.*)/) { $verbose = 1; } elsif ($cmd eq "Werror") { $Werror = 1; + } elsif ($cmd eq "Wreturn") { + $Wreturn = 1; + } elsif ($cmd eq "Wshort-desc") { + $Wshort_desc = 1; + } elsif ($cmd eq "Wcontents-before-sections") { + $Wcontents_before_sections = 1; + } elsif ($cmd eq "Wall") { + $Wreturn = 1; + $Wshort_desc = 1; + $Wcontents_before_sections = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { pod2usage(-exitval => 0, -verbose => 2); } elsif ($cmd eq 'no-doc-sections') { @@ -1748,9 +1779,9 @@ sub dump_function($$) { # This check emits a lot of warnings at the moment, because many # functions don't have a 'Return' doc section. So until the number # of warnings goes sufficiently down, the check is only performed in - # verbose mode. + # -Wreturn mode. # TODO: always perform the check. - if ($verbose && !$noret) { + if ($Wreturn && !$noret) { check_return_section($file, $declaration_name, $return_type); } @@ -2054,7 +2085,7 @@ sub process_name($$) { $state = STATE_NORMAL; } - if (($declaration_purpose eq "") && $verbose) { + if (($declaration_purpose eq "") && $Wshort_desc) { emit_warning("${file}:$.", "missing initial short description on line:\n$_"); } @@ -2103,7 +2134,7 @@ sub process_body($$) { } if (($contents ne "") && ($contents ne "\n")) { - if (!$in_doc_sect && $verbose) { + if (!$in_doc_sect && $Wcontents_before_sections) { emit_warning("${file}:$.", "contents before sections\n"); } dump_section($file, $section, $contents); From patchwork Fri Jun 2 21:00:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 102694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1300807vqr; Fri, 2 Jun 2023 14:06:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60SBaHzBVUbHUyLZFL4FWkuFQc2MtnY+k07wp1Gr9kTtePq1zqth1tTxFqcCFhO90x20Bu X-Received: by 2002:a05:6a00:14cc:b0:647:e6d9:88c2 with SMTP id w12-20020a056a0014cc00b00647e6d988c2mr12421322pfu.0.1685739987560; Fri, 02 Jun 2023 14:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685739987; cv=none; d=google.com; s=arc-20160816; b=Yrn8X/SawKzVUF+SAc691jeMknAra5RH+yerCyEVl3wjc0Vfm1Hxd2jc99895P2b2D 0ZlONQG3qVPwYEzEJz5fP5+c7BiMnBKVvCj5anagoWoPzMFIT6yRg1dCUJEywLfE9MEL ClU2KkwpHasSdtZ1cELs0G9xrnbU37mQazgLhSzr7ClWXgFUsvAEhRpL8pYbUqeOSmRK YtiEHNMCsZ4H7wfZfO6qWO1rIIthDDRgtLi8/Wg0S3iraHIS9rC81esqa2VYswR5VWCL Awk4nUa17P2ZfGiBZ4BEEPgKFPf0BYv/OjTZYvxo8Q+nLEHq323o1KorGMaHPSMqNxMH MsZQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tML0IzPFBtLerBMNlD1/rTkDJlPPcitapvPwY9vPC0M=; b=FDOGopwXtBNLq1I5j8hLaiBD1NkQR9ixDMk4i74odJ7C+2pAYJTlgHp7w4p0BaAkpL KiyBlQAh9tBkfl6wyS4Zl02TXX33bDCsxW/KAu5bSzgxc3742dTI0K0WO4WDAhsLeIuv 2fV9lCFISxUl5oPerq3CabJLn1bBH8A423955+Vk7VMeF9nSh45kZnk39IPzbb65OsQz zXWMP5g5uDzaH2HG7dglJMx6LghLCQWmXG4V03ST7ETTmFTjzWsYBSDQqBIrCvVUD3lo ujTllprSkdbBLBsF9KRYXP/6tBN34SpmNdWp48CoBcmfQ2WVKZpoPjl3sfkTcglbBAtI Qp5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=j2Q4K5+P; 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; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f62-20020a623841000000b0064583a79521si1254857pfa.283.2023.06.02.14.06.11; Fri, 02 Jun 2023 14:06:27 -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=@sipsolutions.net header.s=mail header.b=j2Q4K5+P; 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; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236395AbjFBVAa (ORCPT + 99 others); Fri, 2 Jun 2023 17:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235923AbjFBVA3 (ORCPT ); Fri, 2 Jun 2023 17:00:29 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8628E44; Fri, 2 Jun 2023 14:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=tML0IzPFBtLerBMNlD1/rTkDJlPPcitapvPwY9vPC0M=; t=1685739626; x=1686949226; b=j2Q4K5+PW784UIb9ZDlEGWKuXq5F8nfShe0nNeOI1Qhj8Ks RWySFDZHTmK49Mtsr30Ghp6UJlbbq0wW8xo2PGDKJWeycREsadmODk7IZwkXIfLYkUl4Mcpm/Y/PG 9mOTkxJvqrMG+vij1jadhc/8P0nQSYc2xjTu1eTCpdTnfay/GzlTuUBcvqehiiqAuHP6wao8K2nrL /u6LReRqJ6kSnuAP0HDemNT1t6H+6dmrfujbDJgm7JEQwbTUZbSZskdmjRkvSBye4/SawDA6WQcOw FVduz9dk8BnN3KnjCUbEnGF0+ljAvfeukcoZnVUyaJRjNChCr4IPjQsfOopZctEg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1q5Bsk-00BgEs-2o; Fri, 02 Jun 2023 23:00:22 +0200 From: Johannes Berg To: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Johannes Berg Subject: [PATCH 2/2] kbuild: enable kernel-doc -Wall for W=2 Date: Fri, 2 Jun 2023 23:00:14 +0200 Message-Id: <20230602230014.ca0aede8195f.Ibd08cad396b630b68d93b2469905ad55b375af65@changeid> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230602230014.a435aab03cee.I21ab3b54eeebd638676bead3b2f87417944e44f3@changeid> References: <20230602230014.a435aab03cee.I21ab3b54eeebd638676bead3b2f87417944e44f3@changeid> MIME-Version: 1.0 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_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767626493542933996?= X-GMAIL-MSGID: =?utf-8?q?1767626493542933996?= From: Johannes Berg For W=2, we can enable more kernel-doc warnings, such as missing return value descriptions etc. Signed-off-by: Johannes Berg --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 40cd13eca82e..d77eb2474a67 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -85,6 +85,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2 +export KDOC_WALL=1 endif #