Revert 37801 because it still breaks the release build.

svn path=/trunk/; revision=37802
This commit is contained in:
Eric Kohl 2008-12-01 20:38:24 +00:00
parent 4b639a0b94
commit 371bfcc3b2
5 changed files with 342 additions and 400 deletions

File diff suppressed because it is too large Load diff

View file

@ -335,7 +335,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 179 "parser.y" #line 177 "parser.y"
typedef union YYSTYPE { typedef union YYSTYPE {
attr_t *attr; attr_t *attr;
attr_list_t *attr_list; attr_list_t *attr_list;

View file

@ -156,8 +156,6 @@ static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type); const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(func_t *func); static void add_explicit_handle_if_necessary(func_t *func);
static type_t *find_type_helper(const char *name, int t);
static void check_def(const type_t *t);
static statement_t *make_statement(enum statement_type type); static statement_t *make_statement(enum statement_type type);
static statement_t *make_statement_type_decl(type_t *type); static statement_t *make_statement_type_decl(type_t *type);
@ -841,15 +839,12 @@ int_std: tINT { $$ = make_builtin($<str>1); }
coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); } coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); }
| tCOCLASS aKNOWNTYPE { $$ = find_type($2, 0); | tCOCLASS aKNOWNTYPE { $$ = find_type($2, 0);
if ($$->kind != TKIND_COCLASS) if ($$->defined) error_loc("multiple definition error\n");
error_loc("%s was not declared a coclass at %s:%d\n", if ($$->kind != TKIND_COCLASS) error_loc("%s was not declared a coclass\n", $2);
$2, $$->loc_info.input_name,
$$->loc_info.line_number);
} }
; ;
coclasshdr: attributes coclass { $$ = $2; coclasshdr: attributes coclass { $$ = $2;
check_def($$);
$$->attrs = check_coclass_attrs($2->name, $1); $$->attrs = check_coclass_attrs($2->name, $1);
if (!parse_only && do_header) if (!parse_only && do_header)
write_coclass($$); write_coclass($$);
@ -881,7 +876,7 @@ dispinterfacehdr: attributes dispinterface { attr_t *attrs;
is_in_interface = TRUE; is_in_interface = TRUE;
is_object_interface = TRUE; is_object_interface = TRUE;
$$ = $2; $$ = $2;
check_def($$); if ($$->defined) error_loc("multiple definition error\n");
attrs = make_attr(ATTR_DISPINTERFACE); attrs = make_attr(ATTR_DISPINTERFACE);
$$->attrs = append_attr( check_dispiface_attrs($2->name, $1), attrs ); $$->attrs = append_attr( check_dispiface_attrs($2->name, $1), attrs );
$$->ref = find_type("IDispatch", 0); $$->ref = find_type("IDispatch", 0);
@ -933,7 +928,7 @@ interfacehdr: attributes interface { $$.interface = $2;
pointer_default = get_attrv($1, ATTR_POINTERDEFAULT); pointer_default = get_attrv($1, ATTR_POINTERDEFAULT);
is_object_interface = is_object($1); is_object_interface = is_object($1);
is_in_interface = TRUE; is_in_interface = TRUE;
check_def($2); if ($2->defined) error_loc("multiple definition error\n");
$2->attrs = check_iface_attrs($2->name, $1); $2->attrs = check_iface_attrs($2->name, $1);
$2->defined = TRUE; $2->defined = TRUE;
if (!parse_only && do_header) write_forward($2); if (!parse_only && do_header) write_forward($2);
@ -1059,7 +1054,6 @@ pointer_type:
structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, tsSTRUCT); structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, tsSTRUCT);
/* overwrite RPC_FC_STRUCT with a more exact type */ /* overwrite RPC_FC_STRUCT with a more exact type */
check_def($$);
$$->type = get_struct_type( $4 ); $$->type = get_struct_type( $4 );
$$->kind = TKIND_RECORD; $$->kind = TKIND_RECORD;
$$->fields_or_args = $4; $$->fields_or_args = $4;
@ -1089,7 +1083,6 @@ typedef: tTYPEDEF m_attributes decl_spec declarator_list
uniondef: tUNION t_ident '{' ne_union_fields '}' uniondef: tUNION t_ident '{' ne_union_fields '}'
{ $$ = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, $2, tsUNION); { $$ = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, $2, tsUNION);
check_def($$);
$$->kind = TKIND_UNION; $$->kind = TKIND_UNION;
$$->fields_or_args = $4; $$->fields_or_args = $4;
$$->defined = TRUE; $$->defined = TRUE;
@ -1098,7 +1091,6 @@ uniondef: tUNION t_ident '{' ne_union_fields '}'
tSWITCH '(' s_field ')' tSWITCH '(' s_field ')'
m_ident '{' cases '}' { var_t *u = $7; m_ident '{' cases '}' { var_t *u = $7;
$$ = get_typev(RPC_FC_ENCAPSULATED_UNION, $2, tsUNION); $$ = get_typev(RPC_FC_ENCAPSULATED_UNION, $2, tsUNION);
check_def($$);
$$->kind = TKIND_UNION; $$->kind = TKIND_UNION;
if (!u) u = make_var( xstrdup("tagged_union") ); if (!u) u = make_var( xstrdup("tagged_union") );
u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL); u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL);
@ -1392,7 +1384,6 @@ type_t *make_type(unsigned char type, type_t *ref)
t->tfswrite = FALSE; t->tfswrite = FALSE;
t->checked = FALSE; t->checked = FALSE;
t->typelib_idx = -1; t->typelib_idx = -1;
init_loc_info(&t->loc_info);
return t; return t;
} }
@ -1704,7 +1695,9 @@ static var_t *make_var(char *name)
v->attrs = NULL; v->attrs = NULL;
v->eval = NULL; v->eval = NULL;
v->stgclass = STG_NONE; v->stgclass = STG_NONE;
init_loc_info(&v->loc_info); v->loc_info.input_name = input_name ? input_name : "stdin";
v->loc_info.line_number = line_number;
v->loc_info.near_text = parser_text;
return v; return v;
} }
@ -1895,12 +1888,6 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
if (name->name) { if (name->name) {
type_t *cur; type_t *cur;
cur = find_type_helper(name->name, 0);
if (cur)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
cur->name, cur->loc_info.input_name,
cur->loc_info.line_number);
/* set the attributes to allow set_type to do some checks on them */ /* set the attributes to allow set_type to do some checks on them */
name->attrs = attrs; name->attrs = attrs;
set_type(name, decl_spec, decl, 0); set_type(name, decl_spec, decl, 0);
@ -2903,17 +2890,3 @@ static func_list_t *append_func_from_statement(func_list_t *list, statement_t *s
} }
return list; return list;
} }
void init_loc_info(loc_info_t *i)
{
i->input_name = input_name ? input_name : "stdin";
i->line_number = line_number;
i->near_text = parser_text;
}
static void check_def(const type_t *t)
{
if (t->defined)
error_loc("%s: redefinition error; original definition was at %s:%d\n",
t->name, t->loc_info.input_name, t->loc_info.line_number);
}

View file

@ -69,7 +69,6 @@ type_t *alias(type_t *t, const char *name)
a->kind = TKIND_ALIAS; a->kind = TKIND_ALIAS;
a->attrs = NULL; a->attrs = NULL;
a->declarray = FALSE; a->declarray = FALSE;
init_loc_info(&a->loc_info);
return a; return a;
} }

View file

@ -283,7 +283,6 @@ struct _type_t {
unsigned int typestring_offset; unsigned int typestring_offset;
unsigned int ptrdesc; /* used for complex structs */ unsigned int ptrdesc; /* used for complex structs */
int typelib_idx; int typelib_idx;
loc_info_t loc_info;
unsigned int declarray : 1; /* if declared as an array */ unsigned int declarray : 1; /* if declared as an array */
unsigned int ignore : 1; unsigned int ignore : 1;
unsigned int defined : 1; unsigned int defined : 1;
@ -420,8 +419,6 @@ var_t *find_const(const char *name, int f);
type_t *find_type(const char *name, int t); type_t *find_type(const char *name, int t);
type_t *make_type(unsigned char type, type_t *ref); type_t *make_type(unsigned char type, type_t *ref);
void init_loc_info(loc_info_t *);
static inline type_t *get_func_return_type(const func_t *func) static inline type_t *get_func_return_type(const func_t *func)
{ {
return func->def->type->ref; return func->def->type->ref;