Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp258761pxx; Thu, 29 Oct 2020 01:45:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvufdi+CZmZC3HCwnafGKO/y4UJs6RO1uJJy0y9BiEbzAyWPY/kBBfn6h7WR1hyQvaiMES X-Received: by 2002:a17:907:9604:: with SMTP id gb4mr3069892ejc.336.1603961109727; Thu, 29 Oct 2020 01:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603961109; cv=none; d=google.com; s=arc-20160816; b=SJ22Zi6yiyurC4NqAFWeJT3OWSkq2ZPn6tI/v1q31i6nlLvs+8o0HfI32WHPDWLomp r8PaNwXnyPkaey8GlI2DWoVfuI8ypKPaoVpGDeh9rAShvSSnMqlnQUNqO7qZjZUs9M2f O4dPY9vLSa9qDjVYL508tWG2p9R1oV9XjD8clPpZ9BP8RyzCLjr9qN5+DCoSQghvUnLa S6QFkkE+iAxZ7A9NtaUWxPqW09N2Qnx7K/hZuBL1WFEvukGJeaa93BjZVskWa5if5ZPM VVTg1FoI2thtB2T23HehbhNjWpcAsA5io/f+LKVje8gxGBrnwqz7Sbo3LZDJSbr2acnD x3Sg== 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=FOSHnq4xkaEdKQiRyMXQrYXihk7U58+xXqnL6+cr4Tk=; b=upgMZZldRLo5vSZ1Q2/8LHUVW18RHSK1d1Hm82knGd1u743AJohUqYWNDOzcUDUsIM rK6nkxArAOZiVprvY7bAFEMQhMGXdBp95YYG8CVMFQ2Q84qM+R4SUwE4c+lP29tInODx XSVXNKESvEeYY1YRq0bImizYlZ+IzJRI+VCm8C2+R4NG3Uu8P1bOjgbQK6/QfRluBp0M o1wfZ2PRBb4mNeSo/cuaKCF2xVBDymzb/KBr2kEJi+ENO1Hz5FvY4xC25EFrDEt81x6Z QcDayRYwatjWg7jLdX4brS9ttIS1XTLcZOPTur8AYJxm6f4b4g10qj1k9KGb7g4Gkl0V HVPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bpoeatvN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si1956224eds.337.2020.10.29.01.44.48; Thu, 29 Oct 2020 01:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bpoeatvN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730818AbgJ2BBt (ORCPT + 99 others); Wed, 28 Oct 2020 21:01:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:60470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731485AbgJ1WRX (ORCPT ); Wed, 28 Oct 2020 18:17:23 -0400 Received: from mail.kernel.org (ip5f5ad5b2.dynamic.kabel-deutschland.de [95.90.213.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95DF8247BF; Wed, 28 Oct 2020 14:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603895015; bh=YqWvLG/HlVMMTDoxlArrGqJGoB3hGxiNvQNMWzmgHsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpoeatvNSyNRCdqK1dq4YsN5UKoiMHbM/HVm4w394g+4AUxwntJqDbxhLLheG8E+5 0hcyBUk6PSRUb3JT9SfETt3lqxxFWl66r9w0cCvBJ/MsvSFPhymuG4tN3xdzw9MBkd 9YLd/DGT3edQaadPcfTBM+j0eKAbgQWy3Iwga0Uo= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kXmMP-003hls-E5; Wed, 28 Oct 2020 15:23:33 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , "Mauro Carvalho Chehab" , "peterz@infradead.org" , Andrew Morton , Changbin Du , Krzysztof Kozlowski , Masahiro Yamada , Peter Enderborg , Randy Dunlap , linux-kernel@vger.kernel.org Subject: [PATCH 25/33] docs: Kconfig/Makefile: add a check for broken ABI files Date: Wed, 28 Oct 2020 15:23:23 +0100 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab 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 Signed-off-by: Mauro Carvalho Chehab --- Documentation/Kconfig | 10 ++++++++++ Documentation/Makefile | 5 +++++ lib/Kconfig.debug | 2 ++ scripts/get_abi.pl | 14 +++++++++++--- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Documentation/Kconfig b/Documentation/Kconfig index 66046fa1c341..e549a61f4d96 100644 --- a/Documentation/Kconfig +++ b/Documentation/Kconfig @@ -10,4 +10,14 @@ config WARN_MISSING_DOCUMENTS If unsure, select 'N'. +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 4e47dff8b315..61a7310b49e0 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -10,6 +10,11 @@ ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y) $(shell $(srctree)/scripts/documentation-file-ref-check --warn) endif +# 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 d7a7bc3b6098..c789b39ed527 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2446,4 +2446,6 @@ config HYPERV_TESTING endmenu # "Kernel Testing and Coverage" +source "Documentation/Kconfig" + endmenu # Kernel hacking diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index 3cff7cdf1397..413349789145 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -50,7 +50,15 @@ my %symbols; 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"; + } } # @@ -110,7 +118,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"; } @@ -225,7 +233,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+// if ($data{$nametag}->{description}); if ($what) { -- 2.26.2