From patchwork Mon May 28 09:21:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10430299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2413260249 for ; Mon, 28 May 2018 09:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13E1F28B2C for ; Mon, 28 May 2018 09:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 070D628B59; Mon, 28 May 2018 09:29:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BEC228B2C for ; Mon, 28 May 2018 09:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754408AbeE1J3n (ORCPT ); Mon, 28 May 2018 05:29:43 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:21618 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754324AbeE1JYQ (ORCPT ); Mon, 28 May 2018 05:24:16 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4S9MInS027506; Mon, 28 May 2018 18:22:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4S9MInS027506 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1527499348; bh=vAy22p2EOlKxrkyyKFQXW4coGIYwZi29YzZ3Dr91Q+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4hCNZdbjYXxw5MXA3isYTJHKQrSyXuwKKlVGP/zKM/RrxsWnQ6IVU02m9CNx1Q4R kxwA4cFPL8fG87OqA8ieubgGC+77LPyN+v5fgNTIZl858kg1gYJ10KivDJ5bz1qg8d hRrGFT/s3xCooZcr1buySwtfm7bV/ctPcMjGFIotsRfSP/wS9Dy4CNj/Q9tYmw0NxV n9LDxAgUSl3Wry4BtPWOqoHYVCr0xjgvNzXXTJRQl2b6RTKKd0CRPApdj4DKN7XiP1 FCdmC8VKe4Rp14LRKTiLWea7DHcQ5b6K9r8G0OZtTr987qcqvS/w/EkBP1u9KBcC3N QKpR4e9MaXjIA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kees Cook , Nicholas Piggin , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Linus Torvalds , Masahiro Yamada Subject: [PATCH v5 11/31] kconfig: begin PARAM state only when seeing a command keyword Date: Mon, 28 May 2018 18:21:48 +0900 Message-Id: <1527499328-13213-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527499328-13213-1-git-send-email-yamada.masahiro@socionext.com> References: <1527499328-13213-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, any statement line starts with a keyword with TF_COMMAND flag. So, the following three lines are dead code. alloc_string(yytext, yyleng); zconflval.string = text; return T_WORD; If a T_WORD token is returned in this context, it will cause syntax error in the parser anyway. The next commit will support the assignment statement where a line starts with an arbitrary identifier. So, I want the lexer to switch to the PARAM state only when it sees a command keyword. Signed-off-by: Masahiro Yamada --- Changes in v5: None Changes in v4: None Changes in v3: - Newly added Changes in v2: None scripts/kconfig/zconf.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index b385590..9a14797 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -102,10 +102,10 @@ n [A-Za-z0-9_-] { {n}+ { const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - BEGIN(PARAM); current_pos.file = current_file; current_pos.lineno = yylineno; if (id && id->flags & TF_COMMAND) { + BEGIN(PARAM); yylval.id = id; return id->token; }