From 4503f810e8c8c76487c6d52b0699f3a415ff77f9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 11 Feb 2010 00:06:54 -0500 Subject: Only show user string in #include error messages. --- dimension/tokenize.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dimension/tokenize.c b/dimension/tokenize.c index 7269fb4..4e499d5 100644 --- a/dimension/tokenize.c +++ b/dimension/tokenize.c @@ -191,13 +191,13 @@ dmnsn_include_buffer(int token, dmnsn_token_buffer *prev, strcat(local_include, "/"); strcat(local_include, include); free(filename_copy); - dmnsn_undef_symbol(symtable, "__include__"); FILE *file = fopen(local_include, "r"); if (!file) { dmnsn_diagnostic(llocp->first_filename, llocp->first_line, llocp->first_column, - "Couldn't open include file '%s'", local_include); + "Couldn't open include file '%s'", include); + dmnsn_undef_symbol(symtable, "__include__"); free(local_include); dmnsn_delete_token_buffer(tbuffer); return NULL; @@ -209,7 +209,8 @@ dmnsn_include_buffer(int token, dmnsn_token_buffer *prev, dmnsn_diagnostic(llocp->first_filename, llocp->first_line, llocp->first_column, "Couldn't allocate buffer for include file '%s'", - local_include); + include); + dmnsn_undef_symbol(symtable, "__include__"); fclose(file); free(local_include); dmnsn_delete_token_buffer(tbuffer); @@ -234,6 +235,7 @@ dmnsn_include_buffer(int token, dmnsn_token_buffer *prev, dmnsn_push_scope(symtable); + dmnsn_undef_symbol(symtable, "__include__"); return tbuffer; } -- cgit v1.2.3