Fix bug with macro invocation with empty first arg
The first argument was being dropped in this case.
This commit is contained in:
parent
866840f791
commit
f85d87a64c
4 changed files with 12 additions and 19 deletions
|
|
@ -50,9 +50,9 @@
|
||||||
%shared_ptr(Space::Bottom3)
|
%shared_ptr(Space::Bottom3)
|
||||||
|
|
||||||
%include "swiginterface.i"
|
%include "swiginterface.i"
|
||||||
SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::ABase1)
|
SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::ABase1)
|
||||||
SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::CBase1)
|
SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::CBase1)
|
||||||
SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(SWIGEMPTYHACK, Space::CBase2)
|
SWIG_SHARED_PTR_INTERFACE_TYPEMAPS(, Space::CBase2)
|
||||||
%interface_impl(Space::ABase1)
|
%interface_impl(Space::ABase1)
|
||||||
%interface_impl(Space::CBase1)
|
%interface_impl(Space::CBase1)
|
||||||
%interface_impl(Space::CBase2)
|
%interface_impl(Space::CBase2)
|
||||||
|
|
|
||||||
|
|
@ -44,18 +44,16 @@ struct SWIG_null_deleter {
|
||||||
%#define SWIG_NO_NULL_DELETER_1
|
%#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
|
// Main user macro for defining intrusive_ptr typemaps for both const and non-const pointer types
|
||||||
%define %intrusive_ptr(TYPE...)
|
%define %intrusive_ptr(TYPE...)
|
||||||
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_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)
|
SWIG_INTRUSIVE_PTR_TYPEMAPS(const, TYPE)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
%define %intrusive_ptr_no_wrap(TYPE...)
|
%define %intrusive_ptr_no_wrap(TYPE...)
|
||||||
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< 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)
|
SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(const, TYPE)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
// Main user macro for defining shared_ptr typemaps for both const and non-const pointer types
|
||||||
%define %shared_ptr(TYPE...)
|
%define %shared_ptr(TYPE...)
|
||||||
%feature("smartptr", noblock=1) TYPE { SWIG_SHARED_PTR_QNAMESPACE::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)
|
SWIG_SHARED_PTR_TYPEMAPS(const, TYPE)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -640,13 +640,8 @@ static List *find_args(String *s, int ismacro, String *macro_name) {
|
||||||
goto unterm;
|
goto unterm;
|
||||||
}
|
}
|
||||||
Chop(str);
|
Chop(str);
|
||||||
if (Len(args) || Len(str))
|
Append(args, str);
|
||||||
Append(args, str);
|
|
||||||
Delete(str);
|
Delete(str);
|
||||||
|
|
||||||
/* if (Len(str) && (c != ')'))
|
|
||||||
Append(args,str); */
|
|
||||||
|
|
||||||
if (c == ')')
|
if (c == ')')
|
||||||
return args;
|
return args;
|
||||||
c = Getc(s);
|
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().
|
/* 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
|
* 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.
|
* 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 */
|
/* If there are arguments, see if they match what we were given */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue