Fix for enum forward declarations

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6117 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-08-23 20:10:51 +00:00
commit 4c02e7cc0e
4 changed files with 42 additions and 1 deletions

View file

@ -962,7 +962,7 @@ static void new_feature(const char *featurename, String *val, Hash *featureattri
%type <node> types_directive template_directive warn_directive ;
/* C declarations */
%type <node> c_declaration c_decl c_decl_tail c_enum_decl c_constructor_decl ;
%type <node> c_declaration c_decl c_decl_tail c_enum_decl c_enum_forward_decl c_constructor_decl ;
%type <node> enumlist edecl;
/* C++ declarations */
@ -2172,6 +2172,7 @@ c_declaration : c_decl {
}
}
| c_enum_decl { $$ = $1; }
| c_enum_forward_decl { $$ = $1; }
/* A an extern C type declaration. Does nothing, but is ignored */
@ -2296,6 +2297,21 @@ initializer : def_args {
;
/* ------------------------------------------------------------
enum Name;
------------------------------------------------------------ */
c_enum_forward_decl : storage_class ENUM ID SEMI {
SwigType *ty = 0;
$$ = new_node("enumforward");
ty = NewStringf("enum %s", $3);
Setattr($$,"name",$3);
Setattr($$,"type",ty);
Setattr($$,"sym:weak", "1");
add_symbols($$);
}
;
/* ------------------------------------------------------------
enum { ... }
* ------------------------------------------------------------ */