Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1235361ybi; Fri, 14 Jun 2019 10:54:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/v6EtXqFfNG3P23xGTxlALGmEweHzUNhTRsPzGRdgYtzE/pw816GjqIwaNn4KRjB2o9KF X-Received: by 2002:a63:4001:: with SMTP id n1mr36188915pga.382.1560534877304; Fri, 14 Jun 2019 10:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534877; cv=none; d=google.com; s=arc-20160816; b=B27iZGEG8vQ81lAsIw2hvWdC385F/J7HlCBW1oXu2dDz8TAD6cvAU2qZPJQmFmOZ8e ChA75nci9EkeCloFmzFaxWalcWYWgMFUhb/9jKU7HL70iHwRO2YmLMSVjvb6dkEX/Fjp B7KySt4tKEt09qqbbxlAUQ2oKFtkk9xPsssjvksIZwhhN5spVpIEanG/JMho2xr3TU7E ta89yEZay3l0q3zngPOkuV9JwxhvnKr3a+MlYb9Hkra8jzUgCMiUqDa2gX13KXFRCMzl ZxM5Nzwv97bJ3CG9FnExOZVGm98bf7qT6cIdIt9DTexkf0INJZ/VbQgVs3/b0IOhE0C+ gVig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/v1AAw7om1V/odGoZszjgQFtzJKsLoAGR/3cdXZzrpw=; b=bOGFe63MC3G78oqOt+V7qj5sVawvYW4SPIT1r/G8GcKFO1k13Y6NpkjwB2hx2W8iAo qdtxSHmJ/eSRtELVIMuDf8l+gkhMMMD1kbOIRYosjX2rXAe0hEs7+c7TClmCfmwDJLSB u3X87U3u9Q9TDm9hueK0FAok9ogXkXGhbrMkjCXuhnsNRv+hwwgUF9NcOsVQA0p+dt// 3sohsdYpuz5FTcmuCXcS309321kjk9bfydqrHCvq87qRhai2I/ajKBKSEM4L3ZUDXKcO Pam0k06uIWY7lOJhKD/suCeuGmLIizf1KRZ+Vq9pP9Uuxop7TPuPp1hW0wf08kZM0/ET aj0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lTpUvIAd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si2915267pjb.92.2019.06.14.10.54.22; Fri, 14 Jun 2019 10:54:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lTpUvIAd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726838AbfFNRxg (ORCPT + 99 others); Fri, 14 Jun 2019 13:53:36 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38698 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbfFNRwf (ORCPT ); Fri, 14 Jun 2019 13:52:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/v1AAw7om1V/odGoZszjgQFtzJKsLoAGR/3cdXZzrpw=; b=lTpUvIAd/F8l4cCpDxm3Dq4sjh Ss68Yohhl2qG8EJztKjSqfoUlYBHWNDVsCiCO3BLyOn8hVpXsprhxRCYjxX8GpVMet/i1wti7MGfa qUeF3L8a8x/X3I6J32o65HqV14Qro88ua3DhEJdbd2ja0mQ8eRSwaDBdkUsEZ5HZBS7ij1B93fZ2u 2wnhL2Xs8Yhw0byrSeSlFNzIcMHaczC3W7Eh2kCxvCxjo3Sl8Hc7safqWHMuQ1QIKBhViMJo0qFCP bCwiHKtUZ85aDaMOAMwddgnCLQuHxnlWa4VRULVlFITTnbqDa4fZG9iCiwsB+SvYDGxCIO9NK938T X4RhDe3w==; Received: from 177.133.85.52.dynamic.adsl.gvt.net.br ([177.133.85.52] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbqNO-0000Pk-Sr; Fri, 14 Jun 2019 17:52:34 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hbqNM-0002PS-3h; Fri, 14 Jun 2019 14:52:32 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , Andrew Morton , Masahiro Yamada , Kees Cook , Petr Mladek , Andy Shevchenko , Matthew Wilcox , Joe Lawrence , Mikulas Patocka , Tetsuo Handa , Sri Krishna chowdary , Changbin Du Subject: [PATCH v2 16/16] docs: Kconfig/Makefile: add a check for broken ABI files Date: Fri, 14 Jun 2019 14:52:30 -0300 Message-Id: <9ad24385565c0395e06ccb0e058184744f6e4c3b.1560534648.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <3b8d7c64f887ddea01df3c4eeabc745c8ec45406.1560534648.git.mchehab+samsung@kernel.org> References: <3b8d7c64f887ddea01df3c4eeabc745c8ec45406.1560534648.git.mchehab+samsung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The files under Documentation/ABI should follow the syntax as defined at Documentation/ABI/README. Allow checking if they're following the syntax by running the ABI parser script on COMPILE_TEST. With that, when there's a problem with a file under Documentation/ABI, it would produce a warning like: Warning: file ./Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats#14: What '/sys/bus/pci/devices//aer_stats/aer_rootport_total_err_cor' doesn't have a description Warning: file ./Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats#21: What '/sys/bus/pci/devices//aer_stats/aer_rootport_total_err_fatal' doesn't have a description Signed-off-by: Mauro Carvalho Chehab --- Documentation/Kconfig | 11 +++++++++++ Documentation/Makefile | 5 +++++ lib/Kconfig.debug | 2 ++ scripts/get_abi.pl | 14 +++++++++++--- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Documentation/Kconfig diff --git a/Documentation/Kconfig b/Documentation/Kconfig new file mode 100644 index 000000000000..a8b0701c1422 --- /dev/null +++ b/Documentation/Kconfig @@ -0,0 +1,11 @@ +config WARN_ABI_ERRORS + bool "Warn if there are errors at ABI files" + depends on COMPILE_TEST + help + The files under Documentation/ABI should follow what's + described at Documentation/ABI/README. Yet, as they're manually + written, it would be possible that some of those files would + have errors that would break them for being parsed by + scripts/get_abi.pl. Add a check to verify them. + + If unsure, select 'N'. diff --git a/Documentation/Makefile b/Documentation/Makefile index e889e7cb8511..c6480ed22884 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -4,6 +4,11 @@ subdir-y := devicetree/bindings/ +# Check for broken ABI files +ifeq ($(CONFIG_WARN_ABI_ERRORS),y) +$(shell $(srctree)/scripts/get_abi.pl validate --dir $(srctree)/Documentation/ABI) +endif + # You can set these variables from the command line. SPHINXBUILD = sphinx-build SPHINXOPTS = diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index cbdfae379896..b1b7e141ca99 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2110,4 +2110,6 @@ config IO_STRICT_DEVMEM source "arch/$(SRCARCH)/Kconfig.debug" +source "Documentation/Kconfig" + endmenu # Kernel hacking diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index 774e9b809ead..25248c012eb3 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -38,7 +38,15 @@ my %data; sub parse_error($$$$) { my ($file, $ln, $msg, $data) = @_; - print STDERR "file $file#$ln: $msg at\n\t$data"; + $data =~ s/\s+$/\n/; + + print STDERR "Warning: file $file#$ln:\n\t$msg"; + + if ($data ne "") { + print STDERR ". Line\n\t\t$data"; + } else { + print STDERR "\n"; + } } # @@ -94,7 +102,7 @@ sub parse_abi { # Invalid, but it is a common mistake if ($new_tag eq "where") { - parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", $_); + parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", ""); $new_tag = "what"; } @@ -190,7 +198,7 @@ sub parse_abi { } # Everything else is error - parse_error($file, $ln, "Unexpected line:", $_); + parse_error($file, $ln, "Unexpected content", $_); } $data{$nametag}->{description} =~ s/^\n+//; close IN; -- 2.21.0