Fix for bug 3286333: infinite recursion with mutual "using namespace" clauses.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12640 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Stefan Zager 2011-04-14 04:22:03 +00:00
commit 5fbcb711eb
5 changed files with 27 additions and 0 deletions

View file

@ -4,6 +4,9 @@ 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-04-13: szager
Fixed bug 3286333: infite recursion with mutual 'using namespace' clauses.
2011-04-12: szager 2011-04-12: szager
Fixed bug 1163440: vararg typemaps. Fixed bug 1163440: vararg typemaps.

View file

@ -425,6 +425,7 @@ CPP_TEST_CASES += \
using_extend \ using_extend \
using_inherit \ using_inherit \
using_namespace \ using_namespace \
using_namespace_loop \
using_pointers \ using_pointers \
using_private \ using_private \
using_protected \ using_protected \

View file

@ -0,0 +1,14 @@
%module using_namespace_loop
%inline {
namespace A {}
namespace B {
using namespace A;
}
namespace A {
using namespace B;
typedef Foo Bar;
}
}

View file

@ -960,6 +960,7 @@ static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (No
Delete(dname); Delete(dname);
if (n) if (n)
return n; return n;
Setmark(symtab, 1);
} }
inherit = Getattr(symtab, "inherit"); inherit = Getattr(symtab, "inherit");

View file

@ -415,9 +415,14 @@ void SwigType_print_scope(void) {
static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) { static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
Typetab *ss; Typetab *ss;
Typetab *s_orig = s;
String *nnameprefix = 0; String *nnameprefix = 0;
static int check_parent = 1; static int check_parent = 1;
if (Getmark(s))
return 0;
Setmark(s, 1);
/* Printf(stdout,"find_scope: %x(%s) '%s'\n", s, Getattr(s,"name"), nameprefix); */ /* Printf(stdout,"find_scope: %x(%s) '%s'\n", s, Getattr(s,"name"), nameprefix); */
if (SwigType_istemplate(nameprefix)) { if (SwigType_istemplate(nameprefix)) {
@ -443,6 +448,7 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
if (s) { if (s) {
if (nnameprefix) if (nnameprefix)
Delete(nnameprefix); Delete(nnameprefix);
Setmark(s_orig, 0);
return s; return s;
} }
if (!s) { if (!s) {
@ -462,6 +468,7 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
if (s) { if (s) {
if (nnameprefix) if (nnameprefix)
Delete(nnameprefix); Delete(nnameprefix);
Setmark(s_orig, 0);
return s; return s;
} }
} }
@ -473,6 +480,7 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
} }
if (nnameprefix) if (nnameprefix)
Delete(nnameprefix); Delete(nnameprefix);
Setmark(s_orig, 0);
return 0; return 0;
} }