From 42f7d3a922ec9f60ec6d23e961a8f36ac4ab3196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20I=2E=20B=C3=B6ttcher?= Date: Wed, 18 Mar 2026 12:08:39 +0100 Subject: [PATCH] strict_param_decl: dedup use after decl test --- symbol_search.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/symbol_search.cc b/symbol_search.cc index 25f8483e3..cbe307ff9 100644 --- a/symbol_search.cc +++ b/symbol_search.cc @@ -189,14 +189,14 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, } if (const NetExpr*par = scope->get_parameter(des, path_tail.name, res->type)) { - if (!gn_strict_parameter_declaration || prefix_scope - || (scope->get_parameter_lexical_pos(path_tail.name) <= lexical_pos)) { + bool decl_after_use = !prefix_scope + && !(scope->get_parameter_lexical_pos(path_tail.name) <= lexical_pos); + if (!gn_strict_parameter_declaration || !decl_after_use) { path.push_back(path_tail); res->scope = scope; res->par_val = par; res->path_head = path; - if (warn_anachronisms && !prefix_scope - && !(scope->get_parameter_lexical_pos(path_tail.name) <= lexical_pos)) { + if (warn_anachronisms && decl_after_use) { cerr << li->get_fileline() << ": warning: parameter `" << path_tail.name << "` used before declaration." << endl;