Commit 1c56d293 authored by Michael Karcher's avatar Michael Karcher Committed by Alexandre Julliard

widl: Dereference operator in expr works on any declared pointer.

parent f80e4aa9
......@@ -227,6 +227,23 @@ s_sum_conf_array(int x[], int n)
}
int
s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2)
{
int i;
int sum = 0;
if(n1 == 0)
return 0;
for(i = 1; i < n1; ++i)
sum += n2_then_x1[i];
for(i = 0; i < *n2_then_x1; ++i)
sum += x2[i];
return sum;
}
int
s_sum_unique_conf_array(int x[], int n)
{
return s_sum_conf_array(x, n);
......@@ -1127,6 +1144,7 @@ array_tests(void)
{{1, -2, 3, -4}, {2, 3, 5, 7}, {-4, -1, -14, 4114}}
};
int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int c2[] = {10, 100, 200};
vector_t vs[2] = {{1, -2, 3}, {4, -5, -6}};
cps_t cps;
cpsc_t cpsc;
......@@ -1147,6 +1165,11 @@ array_tests(void)
ok(sum_conf_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
ok(sum_conf_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
ok(sum_conf_ptr_by_conf_ptr(1, c2, c) == 45, "RPC sum_conf_ptr_by_conf_ptr");
ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 345, "RPC sum_conf_ptr_by_conf_ptr");
c2[0] = 0;
ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 300, "RPC sum_conf_ptr_by_conf_ptr");
ok(sum_unique_conf_array(ca, 4) == -2, "RPC sum_unique_conf_array\n");
ok(sum_unique_conf_ptr(ca, 5) == 3, "RPC sum_unique_conf_array\n");
ok(sum_unique_conf_ptr(NULL, 10) == 0, "RPC sum_unique_conf_array\n");
......
......@@ -121,6 +121,7 @@ cpp_quote("#endif")
int test_list_length(test_list_t *ls);
int sum_fixed_int_3d(int m[2][3][4]);
int sum_conf_array([size_is(n)] int x[], int n);
int sum_conf_ptr_by_conf_ptr(int n1, [size_is(n1)] int *n2_then_x1, [size_is(*n2_then_x1)] int *x2);
int sum_unique_conf_array([size_is(n), unique] int x[], int n);
int sum_unique_conf_ptr([size_is(n), unique] int *x, int n);
int sum_var_array([length_is(n)] int x[20], int n);
......
......@@ -470,6 +470,9 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
result = resolve_expression(expr_loc, cont_type, e->ref);
if (result.type && is_ptr(result.type))
result.type = type_pointer_get_ref(result.type);
else if(result.type && is_array(result.type)
&& !result.type->declarray)
result.type = type_array_get_element(result.type);
else
error_loc_info(&expr_loc->v->loc_info, "dereference operator applied to non-pointer type in expression%s%s\n",
expr_loc->attr ? " for attribute " : "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment