Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp612733ybd; Sat, 22 Jun 2019 10:32:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCYFWk1D8vDUr7XaDitN6AdHYUsjI/6WJNqsnVuJjzxo/FF6kb/Du5YpTVfiZMXk0v1nni X-Received: by 2002:a17:902:4aa3:: with SMTP id x32mr16160515pld.119.1561224758752; Sat, 22 Jun 2019 10:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561224758; cv=none; d=google.com; s=arc-20160816; b=ED+gsvknAYCfm4DWvwECWibRjdIm+3t5agiZrs/EQwTvYFTdumhV3NwxPASxclPUWP E1iZChEAX+AQZ3sOH0zFW86H+nJvW6eBvb8MxsbkY9OKg4NWOnY2MLMDQpmhIQ7P6woj YIO3zVTKXxsGP90gwobcAjv9fKsTUXjedZI/5tkNXAsP0epyxSWRCknxub53f4oH5JRo caSb+SFRynVItPoH/wWbmcvT2B2PtHNuC94tKFWCfw2OVI1ATVx6fYkKlfnuIRVeXtYm nfmTm4iyPC5yN80jsvJ4EONftfHKWyajVr6zpThm0VBIniPIz5H4gwGiRLKU2Jl8imXq mRXg== 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=tXaUwavLjb5FMZy0r4sjUs7pPA8ZvPk8NuSb/WMjWQ4=; b=HwfX5BEPT2XFzO/HXeh+G3Z2YizKqjoLEU1E6lnNWfYBQitERp7rpJEpFuykEchgLa RZmbaSxQuln3Vt8YlgV4sMuLtAcDMuwLmglLpYUaIFwHooROf7+IJKOkp4gCxG2jPbJr nEcx5EJmos4iv7valcY5BbtqcuLGPkzpR8uA16kcEKKNW8M2DjAY9qSKRQnHguNCUtpV yYEETNH+efzEyRE2NGzpIGWDAje+EDD+ZDCSp4VK4sSOMCUv8FD2RNXcuwn2hkFKNbjs xVVNd2mRSOKnrS79FX6/tTcQTWkbv40+ugOAK70EAntxvoIP+EdcwVyrpGgU25HDwFpr +iRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=JpnNwXML; 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 f3si5430043pgs.135.2019.06.22.10.32.13; Sat, 22 Jun 2019 10:32:38 -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=JpnNwXML; 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 S1726525AbfFVRcE (ORCPT + 99 others); Sat, 22 Jun 2019 13:32:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45132 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfFVRcA (ORCPT ); Sat, 22 Jun 2019 13:32:00 -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=tXaUwavLjb5FMZy0r4sjUs7pPA8ZvPk8NuSb/WMjWQ4=; b=JpnNwXMLG+pEZMablXGUeyKK9F CUZr2jlySceS/MVogCKhI2hucejij+SBm1waQTA4L8aFIeUfr4T7TY4P3mwqL4h4zxqe7ZhY9CBOC JZ16lwyoscJ6ZKPNGOOE5DjQiZhdwNA3wM5ZAVAKPmZuhCk2F7mV8qMNwjr1qXPERB7U6QTQa7UDD fcqUIXastk2/1aDOd2KimstukzMWS5FGoxK+TCZagtQRKbSpYe8afE/J1jAgxpynhK5dpJloEev1v 2z9IlJp29tVSPf1IeaakMVyzT/WNKXaDRCqcHZ4DIuNBN1OnKnTq1F5fkGD1Zmr6zUSMpFH6u+DIW +5EODSqA==; Received: from [179.95.45.115] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hejrs-00076m-9i; Sat, 22 Jun 2019 17:32:00 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hejrq-0001Hg-CE; Sat, 22 Jun 2019 14:31:58 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , gregkh@linuxfoundation.org Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [RFC v2 8/8] docs: Kconfig/Makefile: add a check for broken ABI files Date: Sat, 22 Jun 2019 14:31:56 -0300 Message-Id: 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 6a4d387ebf3b..e80f9ab2ed26 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -47,7 +47,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"; + } } # @@ -104,7 +112,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"; } @@ -205,7 +213,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