From patchwork Tue Dec 11 11:00:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 153430 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp475621ljp; Tue, 11 Dec 2018 03:02:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/XpF6HJRKf5zRaNktB5Rd4G6PmG1He/vLdjDeUy8RnMCnu6DsJy9e0ioGL27vVtQG/oenIP X-Received: by 2002:a63:981:: with SMTP id 123mr14246569pgj.444.1544526158947; Tue, 11 Dec 2018 03:02:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544526158; cv=none; d=google.com; s=arc-20160816; b=ABB38f6TQMzRnaIpDuYmlv8WfnAQZw1+1a4Q3Rfbs1temgh5yXisA1K78oNHJ+SEzW ZGuWsG2aBJ/B0vFy9a5A9ptX/NwF1TpIRV7d8CUG7UYbLlz8SEuO5zCH54ny7S89Il8G Z8ZIZnWndtLChA3Mv99eTC9l+K9aRjvSamozgD7EhDlBBlOKpI4O6TFGKngvF4OPtFmX 5yxN7eYQKqAEqSyu5h4rK9cUHNHkbuhApT+av5+Own6nei3oF1JMutWpBlPL5QGb1gZO pz1JeBqvqZj1uLAclSXFLf7MpjtuTtB2dEMmLMC9LzgEk/amTQRH7L+7E2kGzSwWX793 IKuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=azx+pnU1cXACJgUuzQ4P92840L9XD8VA47ps+ZrPfdo=; b=y0WxAjuyzvpEnyjBSJE5ZZ1/nlqsEasML3nZHTt7Le569t9qjUu7PndLQOgK/MQjHY z8KJ7x0UzoLQZb1XxPBEdG3OrFF/voDCK9M1gzdyrZUdsjxfKfuCZrf961kuf0T9aSS2 ouCQMCPxEKh4go4e00GM2ixbUScD3aDbzhAnCCRYoe3inruas8e9e+scYM94HwhMB1kT kJS5nvgmxOpLvqEc9I8KQTKlKi4g6V73eeq26iAF8oVW4hbka57mYU6z8twZ+JZN8yxA 7Y6iUxLOJ74d8O1kSgJhe4t4PkoLAfetla1YDJ3WJwmvfkwR430wqTihLsLUlwwE3Vm5 VjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Yi532WXo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si11840815pgg.120.2018.12.11.03.02.38; Tue, 11 Dec 2018 03:02:38 -0800 (PST) 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=pass header.i=@nifty.com header.s=dec2015msa header.b=Yi532WXo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726716AbeLKLBq (ORCPT + 31 others); Tue, 11 Dec 2018 06:01:46 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:36701 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbeLKLBn (ORCPT ); Tue, 11 Dec 2018 06:01:43 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id wBBB1C5l017210; Tue, 11 Dec 2018 20:01:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com wBBB1C5l017210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544526080; bh=azx+pnU1cXACJgUuzQ4P92840L9XD8VA47ps+ZrPfdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yi532WXoQr1Nj9YE15y7UbTWaAHCmFQLxNrYlPd1hGNIzqOnIH/bnSmFKsA5wsoMH TwS6z0h/Pl64Dm5/8NZf7Om3zuq0H6BNSNbNZZnWI2gA4ND4kVwgx2OG+JH2vIq4kk pwM7lnHJ8tZBxyKiqN60WZ1KqriEaaBukqXrrmoaP+WeLO2wlALkcHtvblpJ5R4dCU vho2rC7EfxPhfjTUxqY3EQUCmJ7XtozHjNAYNO1wevXORwI7udyblg0x+F8ocM5QR1 MzPnU54F5Ndkgc6QHFbmhAOMvZgqGuyUp/4MUAWLQlf2Q/bAnva1iE690Luf62tviM L3yAaQ1X8GYWA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ulf Magnusson , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 10/27] kconfig: remove grammatically ambiguous option_error Date: Tue, 11 Dec 2018 20:00:53 +0900 Message-Id: <1544526070-16690-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544526070-16690-1-git-send-email-yamada.masahiro@socionext.com> References: <1544526070-16690-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit decreases 6 shift/reduce conflicts, and finally achieves conflict-free parser. Since Kconfig has no terminator for a config block, detecting the end of config_stmt is not easy. For example, there are two ways for handling the error in the following code: 1 config FOO 2 = [A] Print "unknown option" error, assuming the line 2 is a part of config_option_list [B] Print "invalid statement", assuming the line 1 is reduced into a config_stmt by itself Bison actually chooses [A] because it performs the shift rather than the reduction where both are possible. However, there is no reason to choose one over the other since the code above can be written as follows: 1 config FOO 2 3 = Remove the option_error, and let it fall back to [B]. Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.y | 10 ---------- 1 file changed, 10 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index cef6123..a92f167 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -31,7 +31,6 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; static struct menu *current_menu, *current_entry; %} -%expect 6 %union { @@ -138,12 +137,6 @@ common_stmt: | assignment_stmt ; -option_error: - T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); } - | error T_EOL { zconf_error("invalid option"); } -; - - /* config/menuconfig entry */ config_entry_start: T_CONFIG nonconst_symbol T_EOL @@ -180,7 +173,6 @@ config_option_list: | config_option_list symbol_option | config_option_list depends | config_option_list help - | config_option_list option_error ; config_option: T_TYPE prompt_stmt_opt T_EOL @@ -280,7 +272,6 @@ choice_option_list: | choice_option_list choice_option | choice_option_list depends | choice_option_list help - | choice_option_list option_error ; choice_option: T_PROMPT prompt if_expr T_EOL @@ -429,7 +420,6 @@ help: help_start T_HELPTEXT depends_list: /* empty */ | depends_list depends - | depends_list option_error ; depends: T_DEPENDS T_ON expr T_EOL