From patchwork Fri Feb 2 15:58:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 195942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp537936dyc; Fri, 2 Feb 2024 08:20:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoGTmC3mE/ZeRCp0nNlKMkoHYiiGWCse5vrLTdoYiuRkBnEpHk8/LI2Mu/mltfRXXIagaU X-Received: by 2002:a05:6358:278f:b0:178:71c0:b27f with SMTP id l15-20020a056358278f00b0017871c0b27fmr6258509rwb.28.1706890818357; Fri, 02 Feb 2024 08:20:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706890818; cv=pass; d=google.com; s=arc-20160816; b=JHOCkCCMMLULoEIhiBRY8RfYEUS75LDQdDDTLD0ViqxVA22ZmvXd/JVuI2z3T04skf fO3evrfIXK0bBJTy0xW4glL0+gs/bSOlb+IqEdZBM/A/zqjH6c6dlvSoAhj0BSp7aeJP TO6Z8Ta1r4hqTsRaOES1UIUk0TkrWxLv3BOvwsQGXOtp8eAmgIKkC/YhXyH2vcTYyeAS LOx4U6UXN9IjaDvoWFQnBHM1EnJcVCCdn1xtrLYcOvKqU/YC2dODEYc7p1LW+t+aAtM4 a38lGluEKYwnSdBNC0E1+ZgFpKT/xNlXZhMMXmL8WOy5ag9KC744hDMGxEKpjbQI/sQD 3rJw== 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=AGuz+NfzjKtq/JN/Kz8Trwc+4jC4oRk7bdjwacx2PfE=; fh=3sn6zj9yzEQWe01CTpOPJXU5qZZBcL84oi+zH9hOvhw=; b=a8vixeQJli2Eg1BJC3NKJWTFJK52HmTbzX0uILZixYWs4Ayd245uvTLylWs1hNZYM3 YzTsts/vZkyl+CrSX/xRuavbEDCXgkL950SGpesBl8mbOQTzdwWxbS5hBctXfJM9nx3/ c12UTtnpnMJ8xG2nylEhRWQ8GjNPbjurTlZusH8dtam6t3VSY4BAXOleYNKjEC3di3iu Okv4RQeNhGpzMRbo7It+iJ6Z6NzGsC3xDR3pxr8F1zAddlsP4XDOVGWFQ+5uzGn2BNns t+8N736A5YVjKERURvcfGtiqE/PfsRgMcmFzoafhBX+LFm4AS65dwQ2fk8Lo3lq6mPN6 inQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hyfdaKcq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50071-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50071-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUIe1yi41kWZEddo0wB7sCzrIJm2SO3aQM295Oj+GRNGplqUQSk9cIMkxmlLYwC3PkgCLUuRs3N2W9JZmK3nFKsMZcYBQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 20-20020a630c54000000b005cf58862d6asi1863240pgm.223.2024.02.02.08.20.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 08:20:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50071-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hyfdaKcq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50071-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50071-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1A922B270DB for ; Fri, 2 Feb 2024 16:02:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47C5114AD34; Fri, 2 Feb 2024 15:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hyfdaKcq" 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 4D60C14AD07; Fri, 2 Feb 2024 15:58:42 +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=1706889523; cv=none; b=RvoqhVaLgtpxkO14FFwlM3hFVPcgLzquhcEMX/gT0FeY8cBxOZdgMUc160bv3DgjKPGfhD3deaXXkPf6IusVOM+MOw19cXQZcexYIeYAHjsEDvU80Ae52iQsounXydxIVPRHmABQoHTUFYHq6B1rxcczP4tDL63s57nZOvMnoVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706889523; c=relaxed/simple; bh=wpEp8jr15Z5cgoxaTgBZwBu3BqThuXxxzR4c/RRAaAI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BzuiSEDWgeThtnFb5yPm2h4Xp98YztDWMXFTOp7W1vvzEWP4r/jSBDO6H8GBat0w4TqfWkPrx/+tD8nRk27Y/B8T5YZBErjeVZvvVlVV8ebqbn2sFzVa6H5grAiw7sX9XXrcl9Jy8fr14zTPI//KI7nOAxEAziwOdOmeaBFC/sA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hyfdaKcq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14412C43394; Fri, 2 Feb 2024 15:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706889522; bh=wpEp8jr15Z5cgoxaTgBZwBu3BqThuXxxzR4c/RRAaAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyfdaKcqQxLrNJo8GO3fCAQwWA2hLH6RKVOD9Yek0w0JvBTyi0Wr6x8T0I/GBZnVl M3G+Sn7WXe1yuNQVzLl7zOEDh7l4xyJBBFL9Gj3VSZu+SFEfw9lq8h3VUCKZWjABzM GYRyLDk2OgBcQOLV6qxx34vA3S8c/8UcrF6k4hqYXKl0bhFtKPp4n1E44Up2/PBsfD vSqH8WQ8jMxgVZqnvoEnwWjTdaUDUGmQeGVDlVZifUCQHPMteja/qqEpnA/MFGlyg+ 4Hqa6qLughKdhv8jbpdZA9VK1Zi5xh4jkmBJRkjNdpL8nwgUVF6JZ5FYYylyFXFQ2U YA/LanjiXGH/A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 11/27] kconfig: associate struct menu with file name directly Date: Sat, 3 Feb 2024 00:58:09 +0900 Message-Id: <20240202155825.314567-12-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240202155825.314567-1-masahiroy@kernel.org> References: <20240202155825.314567-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789804746511485112 X-GMAIL-MSGID: 1789804746511485112 struct menu is linked to struct file for diagnostic purposes. It is always used to retrieve the file name through menu->file->name. Associate struct menu with the file name directly. Signed-off-by: Masahiro Yamada --- scripts/kconfig/expr.h | 2 +- scripts/kconfig/menu.c | 6 +++--- scripts/kconfig/parser.y | 6 +++--- scripts/kconfig/qconf.cc | 2 +- scripts/kconfig/symbol.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index e0d866569155..e8fc85d98cdd 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -256,7 +256,7 @@ struct menu { char *help; /* The location where the menu node appears in the Kconfig files */ - struct file *file; + const char *filename; int lineno; /* For use by front ends that need to store auxiliary data */ diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index ddca95879631..5ad4d2b9fb82 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -23,7 +23,7 @@ void menu_warn(struct menu *menu, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); + fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); @@ -53,7 +53,7 @@ void menu_add_entry(struct symbol *sym) memset(menu, 0, sizeof(*menu)); menu->sym = sym; menu->parent = current_menu; - menu->file = current_file; + menu->filename = cur_filename; menu->lineno = cur_lineno; *last_entry_ptr = menu; @@ -676,7 +676,7 @@ struct menu *menu_get_parent_menu(struct menu *menu) static void get_def_str(struct gstr *r, struct menu *menu) { str_printf(r, "Defined at %s:%d\n", - menu->file->name, menu->lineno); + menu->filename, menu->lineno); } static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index b9d7e26fc160..d1d05c8cd89d 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -101,7 +101,7 @@ struct menu *current_menu, *current_entry; %destructor { fprintf(stderr, "%s:%d: missing end statement for this entry\n", - $$->file->name, $$->lineno); + $$->filename, $$->lineno); if (current_menu == $$) menu_end_menu(); } if_entry menu_entry choice_entry @@ -527,11 +527,11 @@ static bool zconf_endtoken(const char *tokenname, yynerrs++; return false; } - if (current_menu->file != current_file) { + if (strcmp(current_menu->filename, cur_filename)) { zconf_error("'%s' in different file than '%s'", tokenname, expected_tokenname); fprintf(stderr, "%s:%d: location of the '%s'\n", - current_menu->file->name, current_menu->lineno, + current_menu->filename, current_menu->lineno, expected_tokenname); yynerrs++; return false; diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 620a3527c767..c6c42c0f4e5d 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1058,7 +1058,7 @@ void ConfigInfoView::menuInfo(void) stream << "

"; } - stream << "defined at " << _menu->file->name << ":" + stream << "defined at " << _menu->filename << ":" << _menu->lineno << "

"; } } diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index e9e9fb8d8674..7647e3e87cd5 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -1045,12 +1045,12 @@ static void sym_check_print_recursive(struct symbol *last_sym) if (sym_is_choice(sym)) { fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", - menu->file->name, menu->lineno, + menu->filename, menu->lineno, sym->name ? sym->name : "", next_sym->name ? next_sym->name : ""); } else if (sym_is_choice_value(sym)) { fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", - menu->file->name, menu->lineno, + menu->filename, menu->lineno, sym->name ? sym->name : "", next_sym->name ? next_sym->name : ""); } else if (stack->expr == &sym->dir_dep.expr) {