widl: The lval member of var_t is essentially a duplicate of eval->cval.
- Generate eval's for enums that don't explicitly have one. This means that enums written in header files won't match exactly what has been put into the IDL file, but the numeric constat is the same and MIDL does a similar thing. - Replace constant lookups with eval->cval instead of lval.
This commit is contained in:
parent
4edcf2de35
commit
4cd506b8fd
|
@ -436,7 +436,6 @@ case: tCASE expr ':' field { attr_t *a = make_attrp(ATTR_CASE, $2);
|
|||
constdef: tCONST type ident '=' expr_const { $$ = reg_const($3);
|
||||
set_type($$, $2, NULL);
|
||||
$$->eval = $5;
|
||||
$$->lval = $5->cval;
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -445,20 +444,20 @@ enums: { $$ = NULL; }
|
|||
| enum_list
|
||||
;
|
||||
|
||||
enum_list: enum
|
||||
enum_list: enum { if (!$$->eval)
|
||||
$$->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */);
|
||||
}
|
||||
| enum_list ',' enum { LINK($3, $1); $$ = $3;
|
||||
if ($1 && !$3->eval)
|
||||
$3->lval = $1->lval + 1;
|
||||
if (!$$->eval)
|
||||
$$->eval = make_exprl(EXPR_NUM, $1->eval->cval + 1);
|
||||
}
|
||||
;
|
||||
|
||||
enum: ident '=' expr_const { $$ = reg_const($1);
|
||||
$$->eval = $3;
|
||||
$$->lval = $3->cval;
|
||||
$$->type = make_type(RPC_FC_LONG, &std_int);
|
||||
}
|
||||
| ident { $$ = reg_const($1);
|
||||
$$->lval = 0; /* default for first enum entry */
|
||||
$$->type = make_type(RPC_FC_LONG, &std_int);
|
||||
}
|
||||
;
|
||||
|
@ -875,7 +874,7 @@ static expr_t *make_exprs(enum expr_type type, char *val)
|
|||
e->u.sval = c->name;
|
||||
free(val);
|
||||
e->is_const = TRUE;
|
||||
e->cval = c->lval;
|
||||
e->cval = c->eval->cval;
|
||||
}
|
||||
}
|
||||
return e;
|
||||
|
@ -1101,7 +1100,6 @@ static var_t *make_var(char *name)
|
|||
v->attrs = NULL;
|
||||
v->array = NULL;
|
||||
v->eval = NULL;
|
||||
v->lval = 0;
|
||||
INIT_LINK(v);
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -216,7 +216,6 @@ struct _var_t {
|
|||
const char *tname;
|
||||
attr_t *attrs;
|
||||
expr_t *eval;
|
||||
long lval;
|
||||
|
||||
/* parser-internal */
|
||||
DECL_LINK(var_t)
|
||||
|
|
|
@ -1559,7 +1559,7 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
|
|||
|
||||
switch(typeinfo->typeinfo->typekind & 0xf) {
|
||||
case TKIND_ENUM:
|
||||
write_value(typeinfo->typelib, &typedata[4], VT_I4, &var->lval);
|
||||
write_value(typeinfo->typelib, &typedata[4], VT_I4, &var->eval->cval);
|
||||
var_kind = 2; /* VAR_CONST */
|
||||
var_type_size += 16; /* sizeof(VARIANT) */
|
||||
typeinfo->datawidth = var_datawidth;
|
||||
|
|
Loading…
Reference in New Issue