During the first pass of basic optimization, continue reporting errors, don't

stop at the first error.
To help prevent spurios errors, make bytecodes with errors 0 length in
bc_resolve().

svn path=/trunk/yasm/; revision=621
0.3
Peter Johnson 23 years ago
parent 58cc15c1d6
commit 4407d49d66
  1. 4
      libyasm/bytecode.c
  2. 8
      modules/optimizers/basic/basic-optimizer.c
  3. 4
      src/bytecode.c
  4. 8
      src/optimizers/basic/basic-optimizer.c

@ -493,6 +493,10 @@ bc_resolve(bytecode *bc, int save, const section *sect,
expr_delete(temp);
}
/* If we got an error somewhere along the line, clear out any calc len */
if (retval < 0)
bc->len = 0;
return retval;
}

@ -143,6 +143,7 @@ basic_optimize_resolve_label_2(symrec *sym, int withstart)
typedef struct basic_optimize_data {
/*@observer@*/ bytecode *precbc;
/*@observer@*/ const section *sect;
int saw_unknown;
} basic_optimize_data;
static int
@ -170,7 +171,8 @@ basic_optimize_bytecode_1(/*@observer@*/ bytecode *bc, void *d)
*/
if (bc_resolve(bc, 0, data->sect, basic_optimize_resolve_label) < 0) {
ErrorAt(bc->line, _("Circular reference detected."));
return -1;
data->saw_unknown = -1;
return 0;
}
bc->opt_flags = BCFLAG_DONE;
@ -187,6 +189,7 @@ basic_optimize_section_1(section *sect, /*@unused@*/ /*@null@*/ void *d)
data.precbc = NULL;
data.sect = sect;
data.saw_unknown = 0;
/* Don't even bother if we're in-progress or done. */
flags = section_get_opt_flags(sect);
@ -202,6 +205,9 @@ basic_optimize_section_1(section *sect, /*@unused@*/ /*@null@*/ void *d)
if (retval != 0)
return retval;
if (data.saw_unknown != 0)
return data.saw_unknown;
section_set_opt_flags(sect, SECTFLAG_DONE);
return 0;

@ -493,6 +493,10 @@ bc_resolve(bytecode *bc, int save, const section *sect,
expr_delete(temp);
}
/* If we got an error somewhere along the line, clear out any calc len */
if (retval < 0)
bc->len = 0;
return retval;
}

@ -143,6 +143,7 @@ basic_optimize_resolve_label_2(symrec *sym, int withstart)
typedef struct basic_optimize_data {
/*@observer@*/ bytecode *precbc;
/*@observer@*/ const section *sect;
int saw_unknown;
} basic_optimize_data;
static int
@ -170,7 +171,8 @@ basic_optimize_bytecode_1(/*@observer@*/ bytecode *bc, void *d)
*/
if (bc_resolve(bc, 0, data->sect, basic_optimize_resolve_label) < 0) {
ErrorAt(bc->line, _("Circular reference detected."));
return -1;
data->saw_unknown = -1;
return 0;
}
bc->opt_flags = BCFLAG_DONE;
@ -187,6 +189,7 @@ basic_optimize_section_1(section *sect, /*@unused@*/ /*@null@*/ void *d)
data.precbc = NULL;
data.sect = sect;
data.saw_unknown = 0;
/* Don't even bother if we're in-progress or done. */
flags = section_get_opt_flags(sect);
@ -202,6 +205,9 @@ basic_optimize_section_1(section *sect, /*@unused@*/ /*@null@*/ void *d)
if (retval != 0)
return retval;
if (data.saw_unknown != 0)
return data.saw_unknown;
section_set_opt_flags(sect, SECTFLAG_DONE);
return 0;

Loading…
Cancel
Save