Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417AbbG0KdO (ORCPT ); Mon, 27 Jul 2015 06:33:14 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:33989 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbbG0KdM (ORCPT ); Mon, 27 Jul 2015 06:33:12 -0400 From: Valentin Rothberg To: gregkh@linuxfoundation.org, stefan.hengelein@fau.de, linux-kernel@vger.kernel.org, pebolle@tiscali.nl Cc: Valentin Rothberg Subject: [PATCH v2] scripts/checkkconfigsymbols.py: support default statements Date: Mon, 27 Jul 2015 12:33:05 +0200 Message-Id: <1437993185-114360-1-git-send-email-valentinrothberg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437833497-65801-1-git-send-email-valentinrothberg@gmail.com> References: <1437833497-65801-1-git-send-email-valentinrothberg@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2487 Lines: 59 Until now, checkkonfigsymbols.py did not check default statements for references on missing Kconfig symbols (i.e., undefined Kconfig options). Hence, add support to parse and check the Kconfig default statement. Signed-off-by: Valentin Rothberg --- Changelog: v2 (thanks to Stefan Hengelein): - update NUMERIC regex (Kconfig accepts 'X' and 'A-F') - remove mistakenly added blank line from v1 scripts/checkkconfigsymbols.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py index c89fdcaf06e8..4ce00fbede94 100755 --- a/scripts/checkkconfigsymbols.py +++ b/scripts/checkkconfigsymbols.py @@ -20,18 +20,20 @@ OPERATORS = r"&|\(|\)|\||\!" FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}" DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*" EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+" -STMT = r"^\s*(?:if|select|depends\s+on)\s+" + EXPR +DEFAULT = r"default\s+.*?(?:if\s.+){,1}" +STMT = r"^\s*(?:if|select|depends\s+on|(?:" + DEFAULT + r"))\s+" + EXPR SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")" # regex objects REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$") -REGEX_FEATURE = re.compile(r"(" + FEATURE + r")") +REGEX_FEATURE = re.compile(r'(?!\B"[^"]*)' + FEATURE + r'(?![^"]*"\B)') REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE) REGEX_KCONFIG_DEF = re.compile(DEF) REGEX_KCONFIG_EXPR = re.compile(EXPR) REGEX_KCONFIG_STMT = re.compile(STMT) REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") +REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+") def parse_options(): @@ -279,6 +281,9 @@ def parse_kconfig_file(kfile, defined_features, referenced_features): line = line.strip('\n') features.extend(get_features_in_line(line)) for feature in set(features): + if REGEX_NUMERIC.match(feature): + # ignore numeric values + continue paths = referenced_features.get(feature, set()) paths.add(kfile) referenced_features[feature] = paths -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/