Fix %varargs when used with a numerical argument, which was emitting one more optional argument than documented
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12657 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b78392832f
commit
769b26d575
4 changed files with 27 additions and 2 deletions
|
|
@ -4,6 +4,11 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
|
|
||||||
Version 2.0.4 (in progress)
|
Version 2.0.4 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
2011-05-05: wsfulton
|
||||||
|
Fix %varargs when used with a numerical argument, eg %varargs(3, char *arg = NULL).
|
||||||
|
It was possible to use one extra optional argument than document. Now the above only
|
||||||
|
generates 3 optional char * arguments. Reported by Karl Wette.
|
||||||
|
|
||||||
2011-05-05: wsfulton
|
2011-05-05: wsfulton
|
||||||
[Lua, Python, Tcl] C/C++ prototypes shown in error message when calling an overloaded
|
[Lua, Python, Tcl] C/C++ prototypes shown in error message when calling an overloaded
|
||||||
method with incorrect arguments improved to show always show fully qualified name
|
method with incorrect arguments improved to show always show fully qualified name
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,19 @@ if varargs.test_def("Hello",1) != "Hello":
|
||||||
|
|
||||||
if varargs.test_def("Hello") != "Hello":
|
if varargs.test_def("Hello") != "Hello":
|
||||||
raise RuntimeError, "Failed"
|
raise RuntimeError, "Failed"
|
||||||
|
|
||||||
|
###
|
||||||
|
if varargs.test_plenty("Hello") != "Hello":
|
||||||
|
raise RuntimeError, "Failed"
|
||||||
|
|
||||||
|
if varargs.test_plenty("Hello", 1) != "Hello":
|
||||||
|
raise RuntimeError, "Failed"
|
||||||
|
|
||||||
|
if varargs.test_plenty("Hello", 1, 2) != "Hello":
|
||||||
|
raise RuntimeError, "Failed"
|
||||||
|
|
||||||
|
try:
|
||||||
|
varargs.test_plenty("Hello", 1, 2, 3)
|
||||||
|
raise RuntimeError
|
||||||
|
except NotImplementedError:
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
%varargs(int mode = 0) test_def;
|
%varargs(int mode = 0) test_def;
|
||||||
%varargs(int mode = 0) Foo::Foo;
|
%varargs(int mode = 0) Foo::Foo;
|
||||||
%varargs(int mode = 0) Foo::statictest(const char*fmt, ...);
|
%varargs(int mode = 0) Foo::statictest(const char*fmt, ...);
|
||||||
|
%varargs(2, int mode = 0) test_plenty(const char*fmt, ...);
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
char *test(const char *fmt, ...) {
|
char *test(const char *fmt, ...) {
|
||||||
|
|
@ -36,4 +37,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *test_plenty(const char *fmt, ...) {
|
||||||
|
return fmt;
|
||||||
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -2628,8 +2628,7 @@ varargs_parms : parms { $$ = $1; }
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
} else {
|
} else {
|
||||||
$$ = Copy($3);
|
$$ = Copy($3);
|
||||||
Setattr($$,"name","VARARGS_SENTINEL");
|
for (i = 0; i < n-1; i++) {
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
p = Copy($3);
|
p = Copy($3);
|
||||||
set_nextSibling(p,$$);
|
set_nextSibling(p,$$);
|
||||||
Delete($$);
|
Delete($$);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue