Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp511484imu; Tue, 11 Dec 2018 03:04:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/UoALr3HcYZxxHKabR5q4ZMdELsn5dQi3XudShZED4auAMnG/heF79t1aPq0VZbf2BGbLRr X-Received: by 2002:a63:5252:: with SMTP id s18mr14169404pgl.326.1544526262656; Tue, 11 Dec 2018 03:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544526262; cv=none; d=google.com; s=arc-20160816; b=sWvevY8qekoerePKwyGF6lUOIO1W5HzvkZL+YCRkj9yUyU0NqxJZZf+81p1z+uB9Yl cvhI1gT818QbtkihC3DbLj3JtgrNBG12McQgG9IrcQSuMpI2bmgwyUwL4Yi43m3dQlQ4 Fg4n/mByiScgfFk8gLsRDHAAFDrZAYBPEgDWOA7YT68Q2S3uqc5I3kWNdbbVBTaju3uI cjNtRBh9oqQi8hyIsdR9y6Y05VgDDpsrNe8Ck+uYRtSbMqaAa0mUciPnNX+YM1PKhhJc eibUn7dessQmujht0OHffQlnANrUOrTcXtUaIl/5+9NQ10Du8io2WLPhHrr6CHSlEp8f SAoQ== 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=iNmCjGIrzgz6jSnY2pvpjlrVb4D8VRpuL9G+9Lp30As=; b=sTqbXQWz1p9rnQpsE7QZRYdoGNcHcEOLE7J2SeZRexk8Hw9RpwCNk0gdtMimJB9/Ag Rbe8KVm8vTztdyNyVQpdo42CjTH/1Z8ORXyiSHIl2MfIkImwrBbn/uMa1/td+LJffC/+ BJt2bUh3uNe1U6dw+OnO2EZY3RfV3cYrA+hcDjYfTXCAXa+VLFdYwG8Pq6UxEiprs5LZ hhAyrtmUWvfIW3fnHw4+U9PLaWKVHWH+Ld8XFiM72bgOEf6IN9hR6QsTS4YnX8VWsY+V JawH7xOOhokU2cPxgRehrxJY+IWJhv6qWXFqsEEKVmgN/FNRlNxkT23fdY1WWp1qj6y2 wnUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=BrC0ZLWv; 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 x1si12284388pfn.111.2018.12.11.03.04.07; Tue, 11 Dec 2018 03:04:22 -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=BrC0ZLWv; 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 S1726687AbeLKLBo (ORCPT + 99 others); Tue, 11 Dec 2018 06:01:44 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:36639 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbeLKLBm (ORCPT ); Tue, 11 Dec 2018 06:01:42 -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 wBBB1C5k017210; Tue, 11 Dec 2018 20:01:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com wBBB1C5k017210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544526079; bh=iNmCjGIrzgz6jSnY2pvpjlrVb4D8VRpuL9G+9Lp30As=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BrC0ZLWvRAna3/LVGAwk2xylPzxljOlcd89yaJUcQgdso53UDFXQUYrBvMyarImXy edydHjjz2LO4QMZ2zNrJ8c/A2dwK6wwC+jooYlRwX9R4tFDODf6co72JODXF5W/eep PHjHTESyqBfRjXAOQkzGtn+G5lvKeywVIo++jbE6HvJ5/6e6DyL6FZ3h4cAN2cX+sH IR8FKsMFqxSXTQPjov3Y0dyqILcG6MmOMFySPW7aljn+EfPad7u7WHTnyJMbo5vgtG ERXIgVTtXLjgj6CDqpHZdAyMEbt79RzWVA3HHK3nBeDCqyEMyRNMhaCcDogqT+KesS VYKOQzzN7KK7g== 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 09/27] kconfig: remove grammatically ambiguous "unexpected option" diagnostic Date: Tue, 11 Dec 2018 20:00:52 +0900 Message-Id: <1544526070-16690-10-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 15 shift/reduce conflicts. The location of this error recovery is ambiguous. For example, there are two ways to interpret the following code: 1 config FOO 2 bool "foo" [A] Both lines are reduced together into a config_stmt. [B] The only line 1 is reduced into a config_stmt, and the line 2 matches to "option_name error T_EOL" Of course, we expect [A], but [B] could be grammatically possible. Kconfig has no terminator for a config block. So, we cannot detect its end until we see non-property keywords. People often insert a blank line between two config blocks, but it is just a coding convention. Blank lines are actually allowed anywhere in Kconfig files. The real error is when a property keyword appears right after "endif", "endchoice", "endmenu", "source", "comment", or variable assignments. Instead of fixing the grammatical ambiguity, I chose to simply remove this error recovery. The difference is unexpected option "bool" ... is turned into a more generic message: invalid statement Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.y | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 02bfc62..cef6123 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; static struct menu *current_menu, *current_entry; %} -%expect 21 +%expect 6 %union { @@ -94,7 +94,6 @@ static struct menu *current_menu, *current_entry; %type expr %type if_expr %type end -%type option_name %type if_entry menu_entry choice_entry %type symbol_option_arg word_opt assign_val @@ -127,17 +126,9 @@ stmt_list: | stmt_list menu_stmt | stmt_list end { zconf_error("unexpected end statement"); } | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } - | stmt_list option_name error T_EOL -{ - zconf_error("unexpected option \"%s\"", $2->name); -} | stmt_list error T_EOL { zconf_error("invalid statement"); } ; -option_name: - T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE -; - common_stmt: if_stmt | comment_stmt -- 2.7.4