Fix use of preprocessor null directive

This was broken recently in commit 255c929c56
for issue #217
This commit is contained in:
William S Fulton 2014-12-20 16:56:31 +00:00
commit 93d58cd3ed
3 changed files with 21 additions and 0 deletions

View file

@ -346,3 +346,20 @@ int method(struct TypeNameTraits tnt) {
return tnt.val;
}
%}
/* Null directive */
# /* comment 1 */
# // comment 2
# /** comment 3 */
# /* comment 4 */ /*comment 5*/
# /** comment 6
#
# more comment 6 */
#
#
#
int methodX(int x);
%{
int methodX(int x) { return x+100; }
%}

View file

@ -12,3 +12,5 @@ if preproc.defined != 1:
if 2*preproc.one != preproc.two:
raise RuntimeError
if preproc.methodX(99) != 199:
raise RuntimeError

View file

@ -1768,6 +1768,8 @@ String *Preprocessor_parse(String *s) {
}
} else if (Equal(id, kpp_level)) {
Swig_error(Getfile(s), Getline(id), "cpp debug: level = %d, startlevel = %d\n", level, start_level);
} else if (Equal(id, "")) {
/* Null directive */
} else {
Swig_error(Getfile(s), Getline(id), "Unknown SWIG preprocessor directive: %s\n", id);
}