SF #3127633 Fix infinite loop in recursive typedef resolution.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12433 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f4c74bc500
commit
4f616b5942
5 changed files with 17 additions and 1 deletions
|
|
@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 2.0.2 (in progress)
|
||||
===========================
|
||||
|
||||
2011-02-05: wsfulton
|
||||
SF #3127633 Fix infinite loop in recursive typedef resolution.
|
||||
|
||||
2011-02-04: wsfulton
|
||||
[R] SF #3168676 Fix %rename not working for member variables and methods.
|
||||
|
||||
|
|
|
|||
4
Examples/test-suite/errors/cpp_recursive_typedef.i
Normal file
4
Examples/test-suite/errors/cpp_recursive_typedef.i
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
%module cpp_recursive_typedef
|
||||
|
||||
typedef std::set<pds> pds;
|
||||
|
||||
|
|
@ -281,6 +281,9 @@ cpp_nobase.i:6: Warning 401: Maybe you forgot to instantiate 'Bar< int >' using
|
|||
cpp_private_inherit.i:6: Warning 309: private inheritance from base 'Foo' (ignored).
|
||||
cpp_private_inherit.i:9: Warning 309: protected inheritance from base 'Foo' (ignored).
|
||||
|
||||
:::::::::::::::::::::::::::::::: cpp_recursive_typedef.i :::::::::::::::::::::::::::::::::::
|
||||
:1: Error: Recursive typedef detected resolving 'pds *' to 'std::set< pds > *' to 'std::set< std::set< pds > > *' and so on...
|
||||
|
||||
:::::::::::::::::::::::::::::::: cpp_shared_ptr.i :::::::::::::::::::::::::::::::::::
|
||||
cpp_shared_ptr.i:20: Warning 520: Base class 'A' of 'C' is not similarly marked as a smart pointer.
|
||||
cpp_shared_ptr.i:24: Warning 520: Derived class 'D' of 'C' is not similarly marked as a smart pointer.
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ cpp_nobase
|
|||
cpp_overload
|
||||
cpp_private_defvalue
|
||||
cpp_private_inherit
|
||||
cpp_recursive_typedef
|
||||
cpp_shared_ptr
|
||||
cpp_template_argname
|
||||
cpp_template_nargs
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ static Typetab *global_scope = 0; /* The global scope
|
|||
static Hash *scopes = 0; /* Hash table containing fully qualified scopes */
|
||||
|
||||
/* Performance optimization */
|
||||
#define SWIG_TYPEDEF_RESOLVE_CACHE
|
||||
#define SWIG_TYPEDEF_RESOLVE_CACHE
|
||||
static Hash *typedef_resolve_cache = 0;
|
||||
static Hash *typedef_all_cache = 0;
|
||||
static Hash *typedef_qualified_cache = 0;
|
||||
|
|
@ -809,6 +809,7 @@ return_result:
|
|||
SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
|
||||
SwigType *n;
|
||||
SwigType *r;
|
||||
int count = 0;
|
||||
|
||||
/* Check to see if the typedef resolve has been done before by checking the cache */
|
||||
if (!typedef_all_cache) {
|
||||
|
|
@ -824,6 +825,10 @@ SwigType *SwigType_typedef_resolve_all(const SwigType *t) {
|
|||
while ((n = SwigType_typedef_resolve(r))) {
|
||||
Delete(r);
|
||||
r = n;
|
||||
if (++count >= 512) {
|
||||
Swig_error(Getfile(t), Getline(t), "Recursive typedef detected resolving '%s' to '%s' to '%s' and so on...\n", SwigType_str(t, 0), SwigType_str(SwigType_typedef_resolve(t), 0), SwigType_str(SwigType_typedef_resolve(SwigType_typedef_resolve(t)), 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the typedef to the cache for next time it is looked up */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue