From 5beb5dc5dff25e3bd6752ae723c46de78a52cef1 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 18 Nov 2004 00:25:23 +0000 Subject: [PATCH] fix macro with empy args git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6751 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/preproc.i | 2 +- SWIG/Examples/test-suite/python/preproc_runme.py | 4 ++++ SWIG/Source/Preprocessor/cpp.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SWIG/Examples/test-suite/preproc.i b/SWIG/Examples/test-suite/preproc.i index 4d5040dcb..ad0839fb3 100644 --- a/SWIG/Examples/test-suite/preproc.i +++ b/SWIG/Examples/test-suite/preproc.i @@ -266,7 +266,7 @@ inline const char* mangle ## #@__VA_ARGS__ () { #define THREE(FOO) 3 #define one ONE -#define two TWO +#define two TWO() #define three THREE(42) diff --git a/SWIG/Examples/test-suite/python/preproc_runme.py b/SWIG/Examples/test-suite/python/preproc_runme.py index 3bf9ece09..c989294b6 100644 --- a/SWIG/Examples/test-suite/python/preproc_runme.py +++ b/SWIG/Examples/test-suite/python/preproc_runme.py @@ -8,3 +8,7 @@ if preproc.define != 1: if preproc.defined != 1: raise RuntimeError + +if 2*preproc.one != preproc.two: + raise RuntimeError + diff --git a/SWIG/Source/Preprocessor/cpp.c b/SWIG/Source/Preprocessor/cpp.c index 414694059..070cfc3a5 100644 --- a/SWIG/Source/Preprocessor/cpp.c +++ b/SWIG/Source/Preprocessor/cpp.c @@ -618,7 +618,7 @@ expand_macro(String_or_char *name, List *args) } /* If the macro expects arguments, but none were supplied, we leave it in place */ - if (!args && (margs)) { + if (!args && (margs) && Len(margs) > 0) { return NewString(name); }