Redo "fix line number in macro redefined message"

Smaller change to fix more cases

This reverts commit 0f36f60faa.
This commit is contained in:
grischka 2016-05-25 18:51:36 +02:00
parent bab4519617
commit 9e0e05eb4e
2 changed files with 3 additions and 6 deletions

View File

@ -753,7 +753,7 @@ static void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap)
(*pf)->filename, (*pf)->line_num); (*pf)->filename, (*pf)->line_num);
if (f->line_num > 0) { if (f->line_num > 0) {
strcat_printf(buf, sizeof(buf), "%s:%d: ", strcat_printf(buf, sizeof(buf), "%s:%d: ",
f->filename, f->line_num); f->filename, f->line_num - !!(tok_flags & TOK_FLAG_BOL));
} else { } else {
strcat_printf(buf, sizeof(buf), "%s: ", strcat_printf(buf, sizeof(buf), "%s: ",
f->filename); f->filename);

View File

@ -1262,11 +1262,8 @@ ST_INLN void define_push(int v, int macro_type, TokenString *str, Sym *first_arg
s->next = first_arg; s->next = first_arg;
table_ident[v - TOK_IDENT]->sym_define = s; table_ident[v - TOK_IDENT]->sym_define = s;
if (o && !macro_is_equal(o->d, s->d)) { if (o && !macro_is_equal(o->d, s->d))
file->line_num--; tcc_warning("%s redefined", get_tok_str(v, NULL));
tcc_warning("%s redefined", get_tok_str(v, NULL));
file->line_num++;
}
} }
/* undefined a define symbol. Its name is just set to zero */ /* undefined a define symbol. Its name is just set to zero */