summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2015-01-14 16:08:08 +1300
committerOlly Betts <olly@survex.com>2015-01-14 16:08:08 +1300
commitbe4065531eb712e9536332471bec353a7b7f89b9 (patch)
tree10bc13a039249d41072e09511ba53bcc7c9a4c17
parenta2f803bb5a1805ac5c22a38dff17bf3d8bafe0bf (diff)
downloadswig-be4065531eb712e9536332471bec353a7b7f89b9.tar.gz
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.
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective2.stderr2
-rw-r--r--Source/Preprocessor/cpp.c2
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);