From 5dab0e6596af3d60186f65dac236a1a5ee0d9ece Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 10 Nov 2004 23:51:22 +0000 Subject: fix seg. fault in errors/.. and revert to previous 1.89 version git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6710 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/CParse/parser.y | 67 ++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/SWIG/Source/CParse/parser.y b/SWIG/Source/CParse/parser.y index c643d5230..89a6c8681 100644 --- a/SWIG/Source/CParse/parser.y +++ b/SWIG/Source/CParse/parser.y @@ -62,11 +62,11 @@ static int cparse_externc = 0; #define SWIG_WARN_NODE_BEGIN(Node) \ { \ - String *wrnfilter = Node ? Getattr(Node,"feature:warnfilter") : 0; \ - if (wrnfilter) Swig_warnfilter(wrnfilter,1) + String *wrn = Node ? Getattr(Node,"feature:warnfilter") : 0; \ + if (wrn) Swig_warnfilter(wrn,1) #define SWIG_WARN_NODE_END(Node) \ - if (wrnfilter) Swig_warnfilter(wrnfilter,0); \ + if (wrn) Swig_warnfilter(wrn,0); \ } @@ -332,16 +332,8 @@ static String *make_unnamed() { /* Return the node name when it requires to emit a name warning */ static String *name_warning(Node *n,String *name,SwigType *decl) { /* Return in the obvious cases */ - if (!namewarn_hash || !name || !need_name_warning(n)) { - return 0; - } else { - String *access = Getattr(n,"access"); - int is_public = !access || (Strcmp(access,"public") == 0); - if (!is_public && !need_protected(n,dirprot_mode)) { - return 0; - } - } - + if (!namewarn_hash || !name || !need_name_warning(n)) return 0; + /* Check to see if the name is in the hash */ return Swig_name_object_get(namewarn_hash,Namespaceprefix,name,decl); } @@ -2804,7 +2796,7 @@ cpp_class_decl : Classprefix = NewString($3); /* Deal with inheritance */ if ($4) { - bases = make_inherit_list($3,Getattr($4,"public")); + bases = make_inherit_list($3,$4); } if (SwigType_istemplate($3)) { String *fbase, *tbase, *prefix; @@ -2863,11 +2855,7 @@ cpp_class_decl : Setline($$,cparse_start_line); Setattr($$,"name",$3); Setattr($$,"kind",$2); - if ($4) { - Setattr($$,"baselist", Getattr($4,"public")); - Setattr($$,"protectedbaselist", Getattr($4,"protected")); - Setattr($$,"privatebaselist", Getattr($4,"private")); - } + Setattr($$,"baselist",$4); Setattr($$,"allows_typedef","1"); /* Check for pure-abstract class */ Setattr($$,"abstract", pure_abstract($7)); @@ -4999,43 +4987,34 @@ raw_inherit : COLON { inherit_list = 1; } base_list { $$ = $3; inherit_list ; base_list : base_specifier { - Hash *list = NewHash(); - Node *base = $1; - Node *name = Getattr(base,"name"); - Setattr(list,"public",NewList()); - Setattr(list,"protected",NewList()); - Setattr(list,"private",NewList()); - Append(Getattr(list,Getattr(base,"access")),name); - $$ = list; + $$ = NewList(); + if ($1) Append($$,$1); } | base_list COMMA base_specifier { - Hash *list = $1; - Node *base = $3; - Node *name = Getattr(base,"name"); - Append(Getattr(list,Getattr(base,"access")),name); - $$ = list; + $$ = $1; + if ($3) Append($$,$3); } ; base_specifier : opt_virtual idcolon { - $$ = NewHash(); - Setattr($$,"name",$2); if (last_cpptype && (Strcmp(last_cpptype,"struct") != 0)) { - Setattr($$,"access","private"); - Swig_warning(WARN_PARSE_NO_ACCESS,cparse_file,cparse_line, - "No access specifier given for base class %s (ignored).\n",$2); + Swig_warning(WARN_PARSE_NO_ACCESS,cparse_file, cparse_line,"No access specifier given for base class %s (ignored).\n",$2); + $$ = (char *) 0; } else { - Setattr($$,"access","public"); + $$ = $2; + Setfile($$,cparse_file); + Setline($$,cparse_line); } } | opt_virtual access_specifier opt_virtual idcolon { - $$ = NewHash(); - Setattr($$,"name",$4); - Setattr($$,"access",$2); - if (Strcmp($2,"public") != 0) { - Swig_warning(WARN_PARSE_PRIVATE_INHERIT, cparse_file, - cparse_line,"%s inheritance ignored.\n", $2); + $$ = 0; + if (strcmp($2,"public") == 0) { + $$ = $4; + Setfile($$, cparse_file); + Setline($$, cparse_line); + } else { + Swig_warning(WARN_PARSE_PRIVATE_INHERIT, cparse_file, cparse_line, "%s inheritance ignored.\n", $2); } } ; -- cgit v1.2.1