Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp518441lqp; Tue, 11 Jun 2024 10:56:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHy3zFvB7ghLPuq5XZMoPpdOyxMxzBK9rtTyiLJSg21B3F06Jc+aZSrr5v3g+QkmXfMyQuYFk6IImalshwuEj7psD7kPfoUtsRspMMvQ== X-Google-Smtp-Source: AGHT+IGQgtoshH7rsCavnnkNW0xur1bYssnrEM8WBMItVFzAxeWPkzZsmq+BgvdlRLKJheST3pD2 X-Received: by 2002:a05:6830:18e2:b0:6f9:bf04:ec84 with SMTP id 46e09a7af769-6f9bf04f0c1mr5759239a34.24.1718128617632; Tue, 11 Jun 2024 10:56:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718128617; cv=pass; d=google.com; s=arc-20160816; b=Ga1FeGC6ddU7Glxll9B1q/AKC+nfKr/5Oodt1k6YnEeFjQgLZIb7Hq0jjNengBzQwd fQbS2BgHPbgA4XvDpELCzC4tJ0Jf+j2rOtr2KRF+1RLaw+FrXZ2bwQBQtTAM434LmpWc Led6Qh203agPgjgDQQfqNh2ANtmJu8snvOPo0BMX8cKwuoaJDtBZa04Y00AU+ZvD2ndY N7bIoqHCb5xddLrajJXNxbGIbBYjvtfEWfqNLw/ox9IPSgx9KnVy4/p/BZj7CYtTE3Ck UG13fB4FYk2i+7gIunuqz3B//5BkRz58drNaVakGFfxuOHUsYHK1eFxYkhrUF7WwYPdO Hj4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=z3UpbKo/unfcaFYeYCiemo5zQeeCXw6WStDTN9EM9+M=; fh=oQbvuNnOUeIuBT5siQdg+euUHNNdn+CeEwAg69/1RSo=; b=DFZdU8G3rB6CKT8th8j1YA2NfIw66r64Brpm/fWFAq9A5uVs0lvAnHO6phqG2mpBBm EEJ0dUdbN7P5Ea/HIAJAwLMTJhRJid++SACsLqeglDYtRHEuTNux76aVuHm1oQwTEj1f xJGLIcCHfqVH2OH7c3LNim9zeEUE6QOYhfJx6Y3Szg2P/QZFefD2CI3vgUya+E0T5ZbA FAMC3i1B0z/uEn+N3zPsmYoYBG7ToNUNyAkfdzDBe1gX+KIyGrpKoJcbLgtwbjDsCIpJ LQHuzKkrj0XYJVnj/RVW7FNVkILVNGoCswRfJ81PrXVNj4aDAsM2Iqj7+N0SjwRo8c4c NvLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gJwFIeFU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7953333bba4si1479673685a.603.2024.06.11.10.56.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 10:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gJwFIeFU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5983C1C21DD7 for ; Tue, 11 Jun 2024 17:56:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA74E78C88; Tue, 11 Jun 2024 17:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gJwFIeFU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1102762C9; Tue, 11 Jun 2024 17:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718128565; cv=none; b=m/tZUe2KHIykmyWV2/eQyiQOXtRKRNsyNiWkbP1lmBI6b0LZ1Ew97wAV4AynsQkHsn1ar6Kt21Mv0mSjEniKXaxywJMzhL4AD96o+sROhnpdXJoD4JlwC61VxIy+CCUXzYAcSzkmMm7Ec30L8y0Zg3Y0tYMx93vg4suQQeKHa4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718128565; c=relaxed/simple; bh=GdpFQ2McrR/oLioUGmh3pnwOEGIEtoCNFgyLhOS3wZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i7ZsHx7m8Ai6QASVyfW1cV5vvPJ+uMkugucbKrcQrGv2gDadlD5v/TNDADF+8jhFkGyGPHGkCiZsLBl9d6rZJnvkCFp7n4gVY1nv4kKPQzkgnZD5Ymc4kjOI4WxLjjv2YdHbQWCEUqNNn/POoBVcJzZjQ1Jx3wSfvQyIMigQVt4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gJwFIeFU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB052C2BD10; Tue, 11 Jun 2024 17:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718128565; bh=GdpFQ2McrR/oLioUGmh3pnwOEGIEtoCNFgyLhOS3wZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJwFIeFU1wi9wP5Ac6HoVINEy7rT73wDzM0Ig/EV+9dDQxsHi8caPtpkyzuZeBRd1 ZOP3oNZnBerwz7L2omev4PkxllCWNrtj93yKFwi5uX7iQwmyvXT69GbEaOdrJPToO4 W9cXfRnNDrT9HVFYIqkocek/g7mGPANigbX8rwUhxs2H7pnUygwaz3+vLVQYAxjWrZ ELw2Z59ph8XLm4G7HSZbB6H2IRY/mtr4KLPk5FWMihKoQ/D6gQAXOuw/xIbHbbZwHG 3WLAkul6HCr2X51PQJTX34fY01lto3z3zFqDZ5oEK2zYe/kaaRQ6Un534GLXUtv58H +Q3tMKkT1k18A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 04/16] kconfig: remember the current choice while parsing the choice block Date: Wed, 12 Jun 2024 02:55:13 +0900 Message-ID: <20240611175536.3518179-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240611175536.3518179-1-masahiroy@kernel.org> References: <20240611175536.3518179-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Instead of the boolean flag, it will be more useful to remember the current choice being parsed. Signed-off-by: Masahiro Yamada --- scripts/kconfig/parser.y | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index 8adb2f70121e..20538e1d3788 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -28,9 +28,7 @@ static void zconf_error(const char *err, ...); static bool zconf_endtoken(const char *tokenname, const char *expected_tokenname); -struct menu *current_menu, *current_entry; - -static bool inside_choice = false; +struct menu *current_menu, *current_entry, *current_choice; %} @@ -147,7 +145,7 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL config_stmt: config_entry_start config_option_list { - if (inside_choice) { + if (current_choice) { if (!current_entry->prompt) { fprintf(stderr, "%s:%d: error: choice member must have a prompt\n", current_entry->filename, current_entry->lineno); @@ -256,12 +254,12 @@ choice_entry: choice choice_option_list $$ = menu_add_menu(); - inside_choice = true; + current_choice = current_entry; }; choice_end: end { - inside_choice = false; + current_choice = NULL; if (zconf_endtoken($1, "choice")) { menu_end_menu(); -- 2.43.0