From 07acde13ba36189d9dfed7354d12459cb409f6b5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 7 Dec 2014 22:46:41 +0100 Subject: mds-kbdc: test call to undefined callables and mark the entire macro call if the macro does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/compile-layout.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mds-kbdc/compile-layout.c') diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c index 1eb1dfc..e9d16c5 100644 --- a/src/mds-kbdc/compile-layout.c +++ b/src/mds-kbdc/compile-layout.c @@ -1199,15 +1199,22 @@ static int get_macro(mds_kbdc_tree_macro_call_t* restrict macro_call, mds_kbdc_tree_macro_t** restrict macro, mds_kbdc_include_stack_t** restrict macro_include_stack) { + char* code = result->source_code->lines[macro_call->loc_line]; + char* end = code + strlen(code) - 1; + get_macro_lax(macro_call->name, macro, macro_include_stack); if (*macro == NULL) { NEW_ERROR(macro_call, ERROR, "macro ‘%s’ has not been defined yet", macro_call->name); + while (*end == ' ') + end--; + error->end = (size_t)(++end - code); macro_call->processed = PROCESS_LEVEL; return 0; } if ((*macro)->processed == PROCESS_LEVEL) *macro = NULL; + return 0; pfail: return -1; -- cgit v1.2.3-70-g09d2