diff --git a/Examples/test-suite/preproc.i b/Examples/test-suite/preproc.i index e052bff28..779c41e97 100644 --- a/Examples/test-suite/preproc.i +++ b/Examples/test-suite/preproc.i @@ -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; } +%} + diff --git a/Examples/test-suite/python/preproc_runme.py b/Examples/test-suite/python/preproc_runme.py index c989294b6..3049f00ab 100644 --- a/Examples/test-suite/python/preproc_runme.py +++ b/Examples/test-suite/python/preproc_runme.py @@ -12,3 +12,5 @@ if preproc.defined != 1: if 2*preproc.one != preproc.two: raise RuntimeError +if preproc.methodX(99) != 199: + raise RuntimeError diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 1ca549703..b556bce27 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -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); }