1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

widl: Respect u and l modifiers in expressions.

This commit is contained in:
Elizabeth Figura 2024-06-21 19:20:38 -05:00 committed by Alexandre Julliard
parent e261f187ad
commit 53c70aec87
3 changed files with 9 additions and 1 deletions

View File

@ -512,7 +512,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
case EXPR_NUM:
case EXPR_TRUEFALSE:
result.is_temporary = FALSE;
result.type = type_new_int(TYPE_BASIC_INT, 0);
result.type = type_new_int(e->u.integer.is_long ? TYPE_BASIC_LONG : TYPE_BASIC_INT, e->u.integer.is_unsigned);
break;
case EXPR_STRLIT:
result.is_temporary = TRUE;
@ -690,6 +690,10 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
fprintf(h, "0x%x", e->u.integer.value);
else
fprintf(h, "%u", e->u.integer.value);
if (e->u.integer.is_unsigned)
fprintf(h, "u");
if (e->u.integer.is_long)
fprintf(h, "l");
break;
case EXPR_DOUBLE:
fprintf(h, "%#.15g", e->u.dval);

View File

@ -158,6 +158,8 @@ static int token_num( const char *yytext, YYSTYPE *yylval, int is_hex )
{
yylval->integer.value = xstrtoul( yytext, NULL, 0 );
yylval->integer.is_hex = is_hex;
yylval->integer.is_long = !!strchr(yytext, 'l');
yylval->integer.is_unsigned = !!strchr(yytext, 'u');
return is_hex ? aHEXNUM : aNUM;
}

View File

@ -351,6 +351,8 @@ struct _attr_t {
struct integer
{
int value;
int is_unsigned;
int is_long;
int is_hex;
};