record an expression's line number and file and sort of handle state

expressions
This commit is contained in:
Bill Currie 2001-06-26 16:23:21 +00:00
parent 3242c04798
commit d783a024b3
2 changed files with 10 additions and 3 deletions

View file

@ -25,6 +25,8 @@ typedef struct {
typedef struct expr_s {
struct expr_s *next;
expr_type type;
int line;
string_t file;
union {
label_t label;
block_t block;

View file

@ -74,7 +74,10 @@ get_type (expr_t *e)
expr_t *
new_expr (void)
{
return calloc (1, sizeof (expr_t));
expr_t *e = calloc (1, sizeof (expr_t));
e->line = pr_source_line;
e->file = s_file;
return e;
}
expr_t *
@ -843,10 +846,12 @@ emit_expr (expr_t *e)
break;
case 'c':
break;
case 's':
break;
default:
fprintf (stderr,
"%s:%d: warning: unused expression ignored\n",
strings + s_file, pr_source_line);
strings + e->file, e->line, e->e.expr.op);
}
break;
case ex_uexpr:
@ -876,7 +881,7 @@ emit_expr (expr_t *e)
case ex_vector:
case ex_quaternion:
fprintf (stderr, "%s:%d: warning: unused expression ignored\n",
strings + s_file, pr_source_line);
strings + e->file, e->line);
break;
}
}