Ignore unknown preprocessor directives which are inside an inactive

conditional (github issue #394, reported by Dan Wilcox).
Regression introduced in 3.0.3.
This commit is contained in:
Olly Betts 2015-04-30 13:40:42 +12:00
commit d26a505dad
3 changed files with 24 additions and 1 deletions

View file

@ -1771,7 +1771,10 @@ String *Preprocessor_parse(String *s) {
} else if (Equal(id, "")) {
/* Null directive */
} else {
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);
/* Ignore unknown preprocessor directives which are inside an inactive
* conditional (github issue #394). */
if (allow)
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);