diff --git a/Examples/test-suite/multiple_inheritance_shared_ptr.i b/Examples/test-suite/multiple_inheritance_shared_ptr.i index 5a08e5e6e..3c061e1a9 100644 --- a/Examples/test-suite/multiple_inheritance_shared_ptr.i +++ b/Examples/test-suite/multiple_inheritance_shared_ptr.i @@ -50,9 +50,9 @@ %shared_ptr(Space::Bottom3) %include "swiginterface.i" -SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::ABase1) -SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::CBase1) -SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::CBase2) +SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::ABase1) +SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::CBase1) +SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::CBase2) %interface_impl(Space::ABase1) %interface_impl(Space::CBase1) %interface_impl(Space::CBase2) diff --git a/Lib/intrusive_ptr.i b/Lib/intrusive_ptr.i index ceaeaf0bb..621a701f9 100644 --- a/Lib/intrusive_ptr.i +++ b/Lib/intrusive_ptr.i @@ -44,18 +44,16 @@ struct SWIG_null_deleter { %#define SWIG_NO_NULL_DELETER_1 } -// Workaround empty first macro argument bug -#define SWIGEMPTYHACK // Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types %define %intrusive_ptr(TYPE...) %feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > } -SWIG_INTRUSIVE_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE) +SWIG_INTRUSIVE_PTR_TYPEMAPS(, TYPE) SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE) %enddef %define %intrusive_ptr_no_wrap(TYPE...) %feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > } -SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(SWIGEMPTYHACK, TYPE) +SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(, TYPE) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE) %enddef diff --git a/Lib/shared_ptr.i b/Lib/shared_ptr.i index 2975b0628..eada0b9e7 100644 --- a/Lib/shared_ptr.i +++ b/Lib/shared_ptr.i @@ -49,12 +49,10 @@ struct SWIG_null_deleter { } -// Workaround empty first macro argument bug -#define SWIGEMPTYHACK // Main user macro for defining shared_ptr typemaps for both const and non-const pointer types %define %shared_ptr(TYPE...) %feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > } -SWIG_SHARED_PTR_TYPEMAPS(SWIGEMPTYHACK, TYPE) +SWIG_SHARED_PTR_TYPEMAPS(, TYPE) SWIG_SHARED_PTR_TYPEMAPS(const, TYPE) %enddef diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 47dc53b6b..a8d386cea 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -640,13 +640,8 @@ static List *find_args(String *s, int ismacro, String *macro_name) { goto unterm; } Chop(str); - if (Len(args) || Len(str)) - Append(args, str); + Append(args, str); Delete(str); - - /* if (Len(str) && (c != ')')) - Append(args,str); */ - if (c == ')') return args; c = Getc(s); @@ -818,14 +813,16 @@ static String *expand_macro(String *name, List *args, String *line_file) { } } - if (args && margs && Len(margs) == 1 && Len(args) == 0) { + if (args && margs && Len(margs) == 0 && Len(args) == 1 && Len(Getitem(args, 0)) == 0) { /* FOO() can invoke a macro defined as FOO(X) as well as one defined FOO(). - * Handle this by adding an empty argument to args. + * + * Handle this by removing the only argument if it's empty and the macro + * expects no arguments. * * We don't need to worry about varargs here - a varargs macro will always have * Len(margs) >= 1, since the varargs are put in the final macro argument. */ - Append(args, NewStringEmpty()); + Delitem(args, 0); } /* If there are arguments, see if they match what we were given */