diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2013-12-07 16:04:52 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2013-12-07 16:22:44 +0000 |
commit | 67848e377adbc62cca118d382a587074edac21d6 (patch) | |
tree | 468767cfcf991ff465057795c27ada9f1b33f635 /Source | |
parent | 6d97335d946a8042e84357d80ddbb67b8118696a (diff) | |
download | swig-67848e377adbc62cca118d382a587074edac21d6.tar.gz |
Fix template partial specialization detection
Fixes template definitions that should be ignored and warnings introduced after nested changes:
../../../Examples/test-suite/refcount.i:63: Warning 318: Instantiation of template 'RCPtr< A >' is ambiguous,
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' used,
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' ignored.
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' ignored.
../../../Examples/test-suite/refcount.h:159: Warning 318: instantiation 'RCPtr< T >::RCPtr' ignored.
Different/clearer implementation of constructor detection since Classprefix is
not behaving the same since nested changes were introduced. Only accept
constructors if in extend mode or in a class.
Also remove unused "isextension" attribute on the nodes.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CParse/parser.y | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 9dfa60099..4d978a97d 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -309,9 +309,6 @@ static void add_symbols(Node *n) { int isfriend = inclass && is_friend(n); int iscdecl = Cmp(nodeType(n),"cdecl") == 0; int only_csymbol = 0; - if (extendmode) { - Setattr(n,"isextension","1"); - } if (inclass) { String *name = Getattr(n, "name"); @@ -1594,6 +1591,7 @@ swig_directive : extend_directive { $$ = $1; } extend_directive : EXTEND options idcolon LBRACE { Node *cls; String *clsname; + extendmode = 1; cplus_mode = CPLUS_PUBLIC; if (!classes) classes = NewHash(); if (!classes_typedefs) classes_typedefs = NewHash(); @@ -1619,7 +1617,6 @@ extend_directive : EXTEND options idcolon LBRACE { Note that %extend before the class typedef never worked, only %extend after the class typdef. */ prev_symtab = Swig_symbol_setscope(Getattr(cls, "symtab")); current_class = cls; - extendmode = 1; SWIG_WARN_NODE_BEGIN(cls); Swig_warning(WARN_PARSE_EXTEND_NAME, cparse_file, cparse_line, "Deprecated %%extend name used - the %s name '%s' should be used instead of the typedef name '%s'.\n", Getattr(cls, "kind"), SwigType_namestr(Getattr(cls, "name")), $3); SWIG_WARN_NODE_END(cls); @@ -1628,7 +1625,6 @@ extend_directive : EXTEND options idcolon LBRACE { /* Previous class definition. Use its symbol table */ prev_symtab = Swig_symbol_setscope(Getattr(cls,"symtab")); current_class = cls; - extendmode = 1; } Classprefix = NewString($3); Namespaceprefix= Swig_symbol_qualifiedscopename(0); @@ -4288,7 +4284,7 @@ cpp_members : cpp_member cpp_members { cpp_member : c_declaration { $$ = $1; } | cpp_constructor_decl { $$ = $1; - if (extendmode) { + if (extendmode && current_class) { String *symname; symname= make_name($$,Getattr($$,"name"), Getattr($$,"decl")); if (Strcmp(symname,Getattr($$,"name")) == 0) { @@ -4329,7 +4325,7 @@ cpp_member : c_declaration { $$ = $1; } */ cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { - if (Classprefix) { + if (inclass || extendmode) { SwigType *decl = NewStringEmpty(); $$ = new_node("constructor"); Setattr($$,"storage",$1); |