From 964c7550679dd5e725b76113acb9fbfacd4662a3 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 20 Feb 2002 08:05:10 +0000 Subject: [PATCH] Indicate actual line number of circular reference error. svn path=/trunk/yasm/; revision=472 --- modules/optimizers/basic/basic-optimizer.c | 8 ++++---- src/optimizers/basic/basic-optimizer.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/optimizers/basic/basic-optimizer.c b/modules/optimizers/basic/basic-optimizer.c index 39f45f42..9a3921b0 100644 --- a/modules/optimizers/basic/basic-optimizer.c +++ b/modules/optimizers/basic/basic-optimizer.c @@ -99,8 +99,10 @@ basic_optimize_bytecode_1(bytecode *bc, void *d) * is minimum or not, and just check for indeterminate length (indicative * of circular reference). */ - if (bc_calc_len(bc, basic_optimize_resolve_label) < 0) + if (bc_calc_len(bc, basic_optimize_resolve_label) < 0) { + ErrorAt(bc->line, _("Circular reference detected.")); return -1; + } bc->opt_flags = BCFLAG_DONE; @@ -166,10 +168,8 @@ basic_optimize(sectionhead *sections) * - not strictly top->bottom scanning; we scan through a section and * hop to other sections as necessary. */ - if (sections_traverse(sections, NULL, basic_optimize_section_1) < 0) { - ErrorAt(1, "circular reference"); + if (sections_traverse(sections, NULL, basic_optimize_section_1) < 0) return; - } /* Pass 2: * Resolve (compute value of) forward references. diff --git a/src/optimizers/basic/basic-optimizer.c b/src/optimizers/basic/basic-optimizer.c index 39f45f42..9a3921b0 100644 --- a/src/optimizers/basic/basic-optimizer.c +++ b/src/optimizers/basic/basic-optimizer.c @@ -99,8 +99,10 @@ basic_optimize_bytecode_1(bytecode *bc, void *d) * is minimum or not, and just check for indeterminate length (indicative * of circular reference). */ - if (bc_calc_len(bc, basic_optimize_resolve_label) < 0) + if (bc_calc_len(bc, basic_optimize_resolve_label) < 0) { + ErrorAt(bc->line, _("Circular reference detected.")); return -1; + } bc->opt_flags = BCFLAG_DONE; @@ -166,10 +168,8 @@ basic_optimize(sectionhead *sections) * - not strictly top->bottom scanning; we scan through a section and * hop to other sections as necessary. */ - if (sections_traverse(sections, NULL, basic_optimize_section_1) < 0) { - ErrorAt(1, "circular reference"); + if (sections_traverse(sections, NULL, basic_optimize_section_1) < 0) return; - } /* Pass 2: * Resolve (compute value of) forward references. -- 2.40.0