Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2181684ybi; Thu, 20 Jun 2019 10:24:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVrm/R3vfIeUbpDf5Dp9MCpomlN6u4xw9g51bvfsmYGN16R3yedEq14hIV2K4+afmOCiaD X-Received: by 2002:a17:90a:9382:: with SMTP id q2mr741414pjo.131.1561051470750; Thu, 20 Jun 2019 10:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561051470; cv=none; d=google.com; s=arc-20160816; b=Xeyz6iSEjxgEqvczm/jFYEe4oTnbb2Phvi2+lozZyMN2L8T+9tBuzsIVIuUEBiXCBv EshCm63LDT5FoREUD2UokNgULgYIIbE9IoK9INg4nHDdbiHd1HgcPYL2JdEFZfswFYKr LCwrYmmC5N253n3991wqUS6IvH1GZ3/ZYk1eR5wSMwOYnVfeSU6kSqr3KNThr6xDYEOw 1eoEIDFXQEnEgwTDHJgCadu6+B6EK6/60NXbN5Hkizau3unEjRNbRJgHATOyqZLQ1hrE T6CPwluyuXpzH05SWPuCNh1riCFrmavTzJQzBvjcEd8a6jyMQ3CngW2lbA1aZkcup+Qb sWEA== 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=Z/wLdtit6Kx7hYf0ORN5b67XEBevbtOngY+okfZFOF9A9ZhmXk9zatZbYgBQsiJ2fL MBIPlWxlD/UWSbLF3I6Lsu7JpXm0MJTBo6Wf8SY/NG69s9R/rsjBMCsfl1POaPinD9iI Mp8IODdxu4rowVODoqcgf5u1ZIERY4WNsZcS5UTF09iWoWR0udygPpmUnoYHs7X8OaE2 nSeq4fChQCy+pAFxODzsQ6spqSM9yDXUp2lma9F3FsQLHRDHdNQ+mWJ7mH7eEizNrul8 UqHb8VSG6oKr1yeVHJ6KP8wwmijOCCTr0Prt9+8yra/7Dd2SU1IWCTQnIHOFlTZSNBEI PRBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=HTK0A60n; 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 d10si246325plr.307.2019.06.20.10.24.15; Thu, 20 Jun 2019 10:24:30 -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=HTK0A60n; 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 S1732288AbfFTRXr (ORCPT + 99 others); Thu, 20 Jun 2019 13:23:47 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52648 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732193AbfFTRXV (ORCPT ); Thu, 20 Jun 2019 13:23:21 -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=HTK0A60nh3uCXftkkQ+3qJQpIO 7TAun3752TF1n0nvSSaz7jRxWp+fHj7j0Tnwln7Cp28wnW5g1/Go7x8Pe8inJnkCsIBA1sXEC377P m7utXPDz+AL+03T6yigIXfa+YeF4a+ZfMVeSDROV8CrEuk7szF0YwKn2U6Ca9zmwSWov4x52z9dVk N2yqEfEggDl+uu8boKrwom5BGG/MCtNlNFzMoBVNNGifT0yj85MHeWBRCu3DC9asAjieGZ+a3Kep6 Ww3qFyMOxyQfwGqW/hRrN8BC7Mz0MM/hPDHClACZEwdS6u5Uo/kzG2iXcWuVeac8nUlGVdYRnj2pe B9SgRGzw==; Received: from [177.97.20.138] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1he0mM-0008S6-Ii; Thu, 20 Jun 2019 17:23:18 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1he0mJ-0000Dh-UK; Thu, 20 Jun 2019 14:23:15 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , Andrew Morton , Kees Cook , Masahiro Yamada , Petr Mladek , Andy Shevchenko , Joe Lawrence , Matthew Wilcox , Tetsuo Handa , Sri Krishna chowdary , "Uladzislau Rezki (Sony)" , Changbin Du Subject: [PATCH v2 16/22] docs: Kconfig/Makefile: add a check for broken ABI files Date: Thu, 20 Jun 2019 14:23:08 -0300 Message-Id: <9ad24385565c0395e06ccb0e058184744f6e4c3b.1561050806.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: 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