From 9e0e05eb4ed18950b02f25efbf79ed27781fb568 Mon Sep 17 00:00:00 2001 From: grischka Date: Wed, 25 May 2016 18:51:36 +0200 Subject: [PATCH] Redo "fix line number in macro redefined message" Smaller change to fix more cases This reverts commit 0f36f60faa05da7e250a4b4eebd4b534e8a2b537. --- libtcc.c | 2 +- tccpp.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libtcc.c b/libtcc.c index a39bd5f..12ee171 100644 --- a/libtcc.c +++ b/libtcc.c @@ -753,7 +753,7 @@ static void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap) (*pf)->filename, (*pf)->line_num); if (f->line_num > 0) { strcat_printf(buf, sizeof(buf), "%s:%d: ", - f->filename, f->line_num); + f->filename, f->line_num - !!(tok_flags & TOK_FLAG_BOL)); } else { strcat_printf(buf, sizeof(buf), "%s: ", f->filename); diff --git a/tccpp.c b/tccpp.c index 60f807b..024f9de 100644 --- a/tccpp.c +++ b/tccpp.c @@ -1262,11 +1262,8 @@ ST_INLN void define_push(int v, int macro_type, TokenString *str, Sym *first_arg s->next = first_arg; table_ident[v - TOK_IDENT]->sym_define = s; - if (o && !macro_is_equal(o->d, s->d)) { - file->line_num--; - tcc_warning("%s redefined", get_tok_str(v, NULL)); - file->line_num++; - } + if (o && !macro_is_equal(o->d, s->d)) + tcc_warning("%s redefined", get_tok_str(v, NULL)); } /* undefined a define symbol. Its name is just set to zero */