diff options
| author | jiang <30155751@qq.com> | 2014-05-23 15:46:08 +0800 |
|---|---|---|
| committer | jiang <30155751@qq.com> | 2014-05-23 15:46:08 +0800 |
| commit | bcf60562e056265d0197bd3765a4d5256e2ca7ec (patch) | |
| tree | b1a79347a0b22878551dc69627e18536ae36029a | |
| parent | 9c78da8a32f679e3662d80d361a5eec31740cf95 (diff) | |
| download | tinycc-bcf60562e056265d0197bd3765a4d5256e2ca7ec.tar.gz tinycc-bcf60562e056265d0197bd3765a4d5256e2ca7ec.tar.bz2 | |
The number of rows to display warning is wrong
For example:
#define TOK_ASM_weak TOK_WEAK1
#define TOK_ASM_weak TOK_WEAK
Output:
C8.c:3: warning: TOK_ASM_weak redefined
| -rw-r--r-- | libtcc.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -576,12 +576,15 @@ static void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap) for (f = file; f && f->filename[0] == ':'; f = f->prev) ; if (f) { + int line_num = f->line_num; for(pf = s1->include_stack; pf < s1->include_stack_ptr; pf++) strcat_printf(buf, sizeof(buf), "In file included from %s:%d:\n", (*pf)->filename, (*pf)->line_num); - if (f->line_num > 0) { + if (line_num > 0) { + if(tok == TOK_LINEFEED) + line_num--; strcat_printf(buf, sizeof(buf), "%s:%d: ", - f->filename, f->line_num); + f->filename, line_num); } else { strcat_printf(buf, sizeof(buf), "%s: ", f->filename); |
