From 870069c5fe7031fa25511ecfcfe596abba678f03 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 30 Mar 2010 20:53:57 +0300 Subject: [PATCH] acc: print #error with message --- main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index c772da9..44a0a11 100644 --- a/main.c +++ b/main.c @@ -566,8 +566,16 @@ static struct pp_token *pp_tokenize(const char *c, unsigned int nr_c, struct pos j++; directive_end = j; - if (directive_end - directive_start == sizeof(_error) / sizeof(_error[0]) && memcmp(&c[directive_start], _error, sizeof(_error)) == 0) - error_exit(&_pos[sharp_start], "%s", ""); + if (directive_end - directive_start == sizeof(_error) / sizeof(_error[0]) && memcmp(&c[directive_start], _error, sizeof(_error)) == 0) { + unsigned int error_start, error_end; + + j = whitespace_end(c, nr_c, j); + error_start = j; + while (j < nr_c && c[j] != '\n') + j++; + error_end = j; + error_exit(&_pos[sharp_start], "%.*s", error_end - error_start, &c[error_start]); + } error_exit(&_pos[sharp_start], "unknown preprocessor directive"); } -- 2.11.4.GIT