From patchwork Tue Mar 27 05:29:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132458 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp4656524ljb; Mon, 26 Mar 2018 22:36:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELvXavtisLcrwYcz6QZ8aDqwgp+IPzV9Hw44XXmNmRbj8ZNyFsGFYoMD4KYNeglhXwPndt5j X-Received: by 10.99.109.203 with SMTP id i194mr31170125pgc.314.1522129005787; Mon, 26 Mar 2018 22:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522129005; cv=none; d=google.com; s=arc-20160816; b=JhhegtnMx/InijfSrpBAgYBo8HcqYyQEyS5kcpG5M/j3vTCWUmWpXOCt43r+l0Ewz7 EXTWPF7FLwGww0vA2/s6PuTopMwIpMpadzg/nJBQTrzLh5j5i0oUyLz1pCpKti8JP584 N7cDwtHEf6CS5U85oETxCbevaVo0IPux1Ivo7k9kqdWV9Y+TAaL5gNjCYoCPa7BNQj6J ZngUI9YHiyYPTBGcF9XYO+V2wUc/+9fPVLd2cDvXa4sP8iboz2Qr+GGKZsO1/BTVi+kB ZOuGIB9DLcj8XJQbWydSY//eHqlQAiLn3UPGv7r+FfHjkGDMCkqRALrZ93F0cgP04ko8 GtWA== 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 :arc-authentication-results; bh=DJg7hGbemINDwGQx8+jEc01G97qTOgH9soG1HjzbY7o=; b=KbSp0+yAk75vw+Jp/c0dvatHqLVuNRinjIrrCjz29E/Dzev7VBzbGkBn1neaj1Aqg9 izpsJXFdAAOCafwDVwUywQMNXYb6UQkLZYLeI7RJViZZRP5KEsrZHxW0kQ2O9aoWOM55 0Q6VwzfUPjhsaThiHDOoFB1Sc5XIgImD0dbRsJWOthWt1jeoGdLRcZckip+uOvbifG7Y m8sT7n20iLmta80OnlcPs1DO+bzDVOy3jERgnhyscxHDN55IlZfHzZqYdkni1445EWdK jgabSyDqqGL99B1gLqIdOME8lNqHpTTI7YR+S3ycJ4cicCTMiHpKgDmrp7mRSRy2nvua F8DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HCz6Rh5M; 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 r3si363813pgf.125.2018.03.26.22.36.45; Mon, 26 Mar 2018 22:36:45 -0700 (PDT) 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=HCz6Rh5M; 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 S1752547AbeC0Fga (ORCPT + 28 others); Tue, 27 Mar 2018 01:36:30 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:44598 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751838AbeC0FcA (ORCPT ); Tue, 27 Mar 2018 01:32:00 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w2R5TaLp011947; Tue, 27 Mar 2018 14:29:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w2R5TaLp011947 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1522128585; bh=DJg7hGbemINDwGQx8+jEc01G97qTOgH9soG1HjzbY7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HCz6Rh5MUbl5/X4lCrIedMGioG8qXrHxEktq/QinIMlbdbJ7sRuTEW+gvoTRubSXA g2zwFY46hOkEXofC8rbjm8qpqhRpnRUbq+wKF+Uf0F2yh8Cs8dxOxNZvbWx2xgdomR gsAXvJqXpVjmlnXrLSf5U+2J6/TpZLjmiUWv9CkGHwQwHYV2f4niUNO0Sf4I6zJPHr qF84iGodnZGKOevjHwgLA95Kei/WlpBSTcd68Cs/esyTDyuRrFMtyl0kuA6s72dreE 0uu/C3xcSPvl+4lSmrV1wHn6QvGvaGZ3S/GNBSVvLAhDQFKq8eGJsl2RiilarriL8k MJ6gr5RdvJqPg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Linus Torvalds , Arnd Bergmann , Ulf Magnusson , Kees Cook , Thomas Gleixner , Greg Kroah-Hartman , Randy Dunlap , "Luis R . Rodriguez" , Nicolas Pitre , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/21] kconfig: remove string expansion for mainmenu after yyparse() Date: Tue, 27 Mar 2018 14:29:20 +0900 Message-Id: <1522128575-5326-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> References: <1522128575-5326-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 Now that environments are expanded in the lexer, conf_parse() does not need to explicitly expand $ARCH and $KERNELVERSION in the mainmenu. The hack introduced by commit 0724a7c32a54 ("kconfig: Don't leak main menus during parsing") can go away. Signed-off-by: Masahiro Yamada --- Changes in v2: - Simplify the patch. Just remove the text expansion. scripts/kconfig/zconf.y | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) -- 2.7.4 Reviewed-by: Kees Cook Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 4ff4ac9..d8120c7 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -109,7 +109,7 @@ static struct menu *current_menu, *current_entry; %% input: nl start | start; -start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; +start: mainmenu_stmt stmt_list | stmt_list; /* mainmenu entry */ @@ -118,19 +118,6 @@ mainmenu_stmt: T_MAINMENU prompt nl menu_add_prompt(P_MENU, $2, NULL); }; -/* Default main menu, if there's no mainmenu entry */ - -no_mainmenu_stmt: /* empty */ -{ - /* - * Hack: Keep the main menu title on the heap so we can safely free it - * later regardless of whether it comes from the 'prompt' in - * mainmenu_stmt or here - */ - menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL); -}; - - stmt_list: /* empty */ | stmt_list common_stmt @@ -528,7 +515,6 @@ word_opt: /* empty */ { $$ = NULL; } void conf_parse(const char *name) { - const char *tmp; struct symbol *sym; int i; @@ -544,10 +530,10 @@ void conf_parse(const char *name) if (!modules_sym) modules_sym = sym_find( "n" ); - tmp = rootmenu.prompt->text; - rootmenu.prompt->text = _(rootmenu.prompt->text); - rootmenu.prompt->text = expand_string_value(rootmenu.prompt->text); - free((char*)tmp); + if (!menu_has_prompt(&rootmenu)) { + current_entry = &rootmenu; + menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); + } menu_finalize(&rootmenu); for_all_symbols(i, sym) {