diff --git a/CHANGES.current b/CHANGES.current index 8b087c75b..ad26146fc 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -4,6 +4,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.4 (in progress) =========================== +2011-04-13: szager + Fixed bug 3286333: infite recursion with mutual 'using namespace' clauses. + 2011-04-12: szager Fixed bug 1163440: vararg typemaps. diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 9f15df50f..5b2500e03 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -425,6 +425,7 @@ CPP_TEST_CASES += \ using_extend \ using_inherit \ using_namespace \ + using_namespace_loop \ using_pointers \ using_private \ using_protected \ diff --git a/Examples/test-suite/using_namespace_loop.i b/Examples/test-suite/using_namespace_loop.i new file mode 100644 index 000000000..9fddca8e6 --- /dev/null +++ b/Examples/test-suite/using_namespace_loop.i @@ -0,0 +1,14 @@ +%module using_namespace_loop + +%inline { +namespace A {} + +namespace B { +using namespace A; +} + +namespace A { +using namespace B; +typedef Foo Bar; +} +} diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index b16573606..0dc47c48c 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -960,6 +960,7 @@ static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (No Delete(dname); if (n) return n; + Setmark(symtab, 1); } inherit = Getattr(symtab, "inherit"); diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index 153bbbace..f13c84a84 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -415,9 +415,14 @@ void SwigType_print_scope(void) { static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) { Typetab *ss; + Typetab *s_orig = s; String *nnameprefix = 0; 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); */ if (SwigType_istemplate(nameprefix)) { @@ -443,6 +448,7 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) { if (s) { if (nnameprefix) Delete(nnameprefix); + Setmark(s_orig, 0); return s; } if (!s) { @@ -462,6 +468,7 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) { if (s) { if (nnameprefix) Delete(nnameprefix); + Setmark(s_orig, 0); return s; } } @@ -473,6 +480,7 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) { } if (nnameprefix) Delete(nnameprefix); + Setmark(s_orig, 0); return 0; }