From be4065531eb712e9536332471bec353a7b7f89b9 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 14 Jan 2015 16:08:08 +1300 Subject: [PATCH] Add suggestion to check block delimiter The fix for #217 means that blocks of target code delimited by { } with '#' comments in now give errors (previously these lines were quietly discarded). The fix is generally to use %{ %} delimiters instead, so suggest this might be the issue in the error message to help users hitting this issue with wrappers which were apparently working before. --- Examples/test-suite/errors/pp_unknowndirective2.stderr | 2 +- Source/Preprocessor/cpp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/test-suite/errors/pp_unknowndirective2.stderr b/Examples/test-suite/errors/pp_unknowndirective2.stderr index 8244c7d0d..70afa670c 100644 --- a/Examples/test-suite/errors/pp_unknowndirective2.stderr +++ b/Examples/test-suite/errors/pp_unknowndirective2.stderr @@ -1 +1 @@ -pp_unknowndirective2.i:7: Error: Unknown SWIG preprocessor directive: elsif +pp_unknowndirective2.i:7: Error: Unknown SWIG preprocessor directive: elsif (if this is a block of target language code, delimit it with %{ and %}) diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 8fd30f703..ac912f49e 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -1771,7 +1771,7 @@ String *Preprocessor_parse(String *s) { } else if (Equal(id, "")) { /* Null directive */ } else { - Swig_error(Getfile(s), Getline(id), "Unknown SWIG preprocessor directive: %s\n", id); + Swig_error(Getfile(s), Getline(id), "Unknown SWIG preprocessor directive: %s (if this is a block of target language code, delimit it with %%{ and %%})\n", id); } for (i = 0; i < cpp_lines; i++) Putc('\n', ns);