From patchwork Fri Oct 27 19:41:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10030521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E05CA6034B for ; Fri, 27 Oct 2017 19:43:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D507B28FF3 for ; Fri, 27 Oct 2017 19:43:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D39552900C; Fri, 27 Oct 2017 19:43:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A61332905C for ; Fri, 27 Oct 2017 19:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932220AbdJ0TmB (ORCPT ); Fri, 27 Oct 2017 15:42:01 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:42931 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932135AbdJ0TmA (ORCPT ); Fri, 27 Oct 2017 15:42:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cRs/uEKjUq1/f5XuHdwYP9GR178gSjhDBzYndzJEzcA=; b=p/Xzwr8hOTKvjTfxoNiPGjDfg 88aVbXgZos7RHAMHgCwuZMH69EkslQ9iC9Rp5dUxjZnaKy7VqnmwZzGO53gGuWTfNVFMDFCa4/6+a 2sMeMbvdqmbVJis/LFRnOSNSnckz1n6VTjJZMl9OVLVznZ8qv5NnJngouhaS3kVhPnCL4BYJIKOaH HDLqVfyJw5is2s/xBSLFEBSM3sQXIHioO2E5dZugR/m7aI09Vxa3EivzfWaia3EqQsWyNv5sWZ03/ SqC1zYZmX8dFVUidSxFsqnUUZs2SQkgBMVDxyDtJSkDfied4jeL2tzr3q1wAhg928ZLlZHO0C7Qzg lwrlOiXgQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1e8AVz-0003qr-Rl; Fri, 27 Oct 2017 19:41:59 +0000 From: Matthew Wilcox To: Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org Cc: Matthew Wilcox Subject: [PATCH] Check all .c files for bad kernel-doc comments Date: Fri, 27 Oct 2017 12:41:49 -0700 Message-Id: <20171027194149.14328-1-willy@infradead.org> X-Mailer: git-send-email 2.9.5 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Wilcox Implement a '-none' output mode for kernel-doc which will only output warning messages, and suppresses the warning message about there being no kernel-doc in the file. Add it to the rule to build .o files from .c files, so it will check all .c files that have been modified. Adds about 1300 warnings to my build, but will hopefully discourage people from introducing more kerneldoc mistakes. Signed-off-by: Matthew Wilcox --- scripts/Makefile.build | 3 +++ scripts/kernel-doc | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 061d0c3a420a..f0f907af53c7 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -108,6 +108,8 @@ ifneq ($(KBUILD_CHECKSRC),0) endif endif +cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< ; + # Do section mismatch analysis for each module/built-in.o ifdef CONFIG_DEBUG_SECTION_MISMATCH cmd_secanalysis = ; scripts/mod/modpost $@ @@ -291,6 +293,7 @@ define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ $(call cmd_and_fixdep,cc_o_c) \ $(cmd_modversions_c) \ + $(cmd_checkdoc) \ $(call echo-cmd,objtool) $(cmd_objtool) \ $(call echo-cmd,record_mcount) $(cmd_record_mcount) endef diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 9d3eafea58f0..c69583440a44 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -58,6 +58,7 @@ Output format selection (mutually exclusive): -man Output troff manual page format. This is the default. -rst Output reStructuredText format. -text Output plain text format. + -none Do not output documentation, only warnings. Output selection (mutually exclusive): -export Only output documentation for symbols that have been @@ -532,6 +533,8 @@ while ($ARGV[0] =~ m/^-(.*)/) { $output_mode = "gnome"; @highlights = @highlights_gnome; $blankline = $blankline_gnome; + } elsif ($cmd eq "-none") { + $output_mode = "none"; } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document $modulename = shift @ARGV; } elsif ($cmd eq "-function") { # to only output specific functions @@ -2117,6 +2120,24 @@ sub output_blockhead_list(%) { } } + +## none mode output functions + +sub output_function_none(%) { +} + +sub output_enum_none(%) { +} + +sub output_typedef_none(%) { +} + +sub output_struct_none(%) { +} + +sub output_blockhead_none(%) { +} + ## # generic output function for all types (function, struct/union, typedef, enum); # calls the generated, variable output_ function name based on @@ -3136,7 +3157,9 @@ sub process_file($) { } } if ($initial_section_counter == $section_counter) { - print STDERR "${file}:1: warning: no structured comments found\n"; + if ($output_mode ne "none") { + print STDERR "${file}:1: warning: no structured comments found\n"; + } if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) { print STDERR " Was looking for '$_'.\n" for keys %function_table; }