Commit 1aab1072 authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Use error_loc instead of yyerror.

parent 90519189
...@@ -423,7 +423,7 @@ m_attributes: { $$ = NULL; } ...@@ -423,7 +423,7 @@ m_attributes: { $$ = NULL; }
attributes: attributes:
'[' attrib_list ']' { $$ = $2; '[' attrib_list ']' { $$ = $2;
if (!$$) if (!$$)
yyerror("empty attribute lists unsupported"); error_loc("empty attribute lists unsupported\n");
} }
; ;
...@@ -513,7 +513,7 @@ attribute: { $$ = NULL; } ...@@ -513,7 +513,7 @@ attribute: { $$ = NULL; }
uuid_string: uuid_string:
aUUID aUUID
| aSTRING { if (!is_valid_uuid($1)) | aSTRING { if (!is_valid_uuid($1))
yyerror("invalid UUID: %s", $1); error_loc("invalid UUID: %s\n", $1);
$$ = parse_uuid($1); } $$ = parse_uuid($1); }
; ;
...@@ -624,7 +624,7 @@ expr_list_const: expr_const { $$ = append_expr( NULL, $1 ); ...@@ -624,7 +624,7 @@ expr_list_const: expr_const { $$ = append_expr( NULL, $1 );
expr_const: expr { $$ = $1; expr_const: expr { $$ = $1;
if (!$$->is_const) if (!$$->is_const)
yyerror("expression is not constant"); error_loc("expression is not constant\n");
} }
; ;
...@@ -658,7 +658,7 @@ funcdef: ...@@ -658,7 +658,7 @@ funcdef:
free($4); free($4);
$$ = make_func(v, $6); $$ = make_func(v, $6);
if (is_attr(v->attrs, ATTR_IN)) { if (is_attr(v->attrs, ATTR_IN)) {
yyerror("inapplicable attribute [in] for function '%s'",$$->def->name); error_loc("inapplicable attribute [in] for function '%s'\n",$$->def->name);
} }
} }
; ;
...@@ -721,8 +721,8 @@ int_std: tINT { $$ = make_builtin($<str>1); } ...@@ -721,8 +721,8 @@ 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 ($$->defined) yyerror("multiple definition error"); if ($$->defined) error_loc("multiple definition error\n");
if ($$->kind != TKIND_COCLASS) yyerror("%s was not declared a coclass", $2); if ($$->kind != TKIND_COCLASS) error_loc("%s was not declared a coclass\n", $2);
} }
; ;
...@@ -755,11 +755,11 @@ dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(0, $2, 0); $$->kind = ...@@ -755,11 +755,11 @@ dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(0, $2, 0); $$->kind =
dispinterfacehdr: attributes dispinterface { attr_t *attrs; dispinterfacehdr: attributes dispinterface { attr_t *attrs;
$$ = $2; $$ = $2;
if ($$->defined) yyerror("multiple definition error"); if ($$->defined) error_loc("multiple definition error\n");
attrs = make_attr(ATTR_DISPINTERFACE); attrs = make_attr(ATTR_DISPINTERFACE);
$$->attrs = append_attr( $1, attrs ); $$->attrs = append_attr( $1, attrs );
$$->ref = find_type("IDispatch", 0); $$->ref = find_type("IDispatch", 0);
if (!$$->ref) yyerror("IDispatch is undefined"); if (!$$->ref) error_loc("IDispatch is undefined\n");
$$->defined = TRUE; $$->defined = TRUE;
if (!parse_only && do_header) write_forward($$); if (!parse_only && do_header) write_forward($$);
} }
...@@ -803,7 +803,7 @@ interfacehdr: attributes interface { $$.interface = $2; ...@@ -803,7 +803,7 @@ interfacehdr: attributes interface { $$.interface = $2;
$$.old_pointer_default = pointer_default; $$.old_pointer_default = pointer_default;
if (is_attr($1, ATTR_POINTERDEFAULT)) if (is_attr($1, ATTR_POINTERDEFAULT))
pointer_default = get_attrv($1, ATTR_POINTERDEFAULT); pointer_default = get_attrv($1, ATTR_POINTERDEFAULT);
if ($2->defined) yyerror("multiple definition error"); if ($2->defined) error_loc("multiple definition error\n");
$2->attrs = $1; $2->attrs = $1;
$2->defined = TRUE; $2->defined = TRUE;
if (!parse_only && do_header) write_forward($2); if (!parse_only && do_header) write_forward($2);
...@@ -824,7 +824,7 @@ interfacedef: interfacehdr inherit ...@@ -824,7 +824,7 @@ interfacedef: interfacehdr inherit
| interfacehdr ':' aIDENTIFIER | interfacehdr ':' aIDENTIFIER
'{' import int_statements '}' { $$ = $1.interface; '{' import int_statements '}' { $$ = $1.interface;
$$->ref = find_type2($3, 0); $$->ref = find_type2($3, 0);
if (!$$->ref) yyerror("base class '%s' not found in import", $3); if (!$$->ref) error_loc("base class '%s' not found in import\n", $3);
$$->funcs = $6; $$->funcs = $6;
compute_method_indexes($$); compute_method_indexes($$);
if (!parse_only && do_header) write_interface($$); if (!parse_only && do_header) write_interface($$);
...@@ -1584,7 +1584,7 @@ static type_t *reg_type(type_t *type, const char *name, int t) ...@@ -1584,7 +1584,7 @@ static type_t *reg_type(type_t *type, const char *name, int t)
struct rtype *nt; struct rtype *nt;
int hash; int hash;
if (!name) { if (!name) {
yyerror("registering named type without name"); error_loc("registering named type without name\n");
return type; return type;
} }
hash = hash_ident(name); hash = hash_ident(name);
...@@ -1649,7 +1649,7 @@ static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *a ...@@ -1649,7 +1649,7 @@ static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *a
if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR) if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR)
{ {
pident = LIST_ENTRY( list_head( pidents ), const pident_t, entry ); pident = LIST_ENTRY( list_head( pidents ), const pident_t, entry );
yyerror("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays", error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
pident->var->name); pident->var->name);
} }
} }
...@@ -1691,11 +1691,11 @@ static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *a ...@@ -1691,11 +1691,11 @@ static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *a
if (is_ptr(cur)) if (is_ptr(cur))
cur->type = ptr_type; cur->type = ptr_type;
else else
yyerror("'%s': pointer attribute applied to non-pointer type", error_loc("'%s': pointer attribute applied to non-pointer type\n",
cur->name); cur->name);
} }
else if (is_str && ! is_ptr(cur)) else if (is_str && ! is_ptr(cur))
yyerror("'%s': [string] attribute applied to non-pointer type", error_loc("'%s': [string] attribute applied to non-pointer type\n",
cur->name); cur->name);
if (is_incomplete(cur)) if (is_incomplete(cur))
...@@ -1712,7 +1712,7 @@ static type_t *find_type(const char *name, int t) ...@@ -1712,7 +1712,7 @@ static type_t *find_type(const char *name, int t)
while (cur && (cur->t != t || strcmp(cur->name, name))) while (cur && (cur->t != t || strcmp(cur->name, name)))
cur = cur->next; cur = cur->next;
if (!cur) { if (!cur) {
yyerror("type '%s' not found", name); error_loc("type '%s' not found\n", name);
return NULL; return NULL;
} }
return cur->type; return cur->type;
...@@ -1816,7 +1816,7 @@ static int get_struct_type(var_list_t *fields) ...@@ -1816,7 +1816,7 @@ static int get_struct_type(var_list_t *fields)
{ {
has_conformance = 1; has_conformance = 1;
if (field->type->declarray && list_next(fields, &field->entry)) if (field->type->declarray && list_next(fields, &field->entry))
yyerror("field '%s' deriving from a conformant array must be the last field in the structure", error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
field->name); field->name);
} }
if (field->type->length_is) if (field->type->length_is)
...@@ -1876,7 +1876,7 @@ static int get_struct_type(var_list_t *fields) ...@@ -1876,7 +1876,7 @@ static int get_struct_type(var_list_t *fields)
case RPC_FC_CPSTRUCT: case RPC_FC_CPSTRUCT:
has_conformance = 1; has_conformance = 1;
if (list_next( fields, &field->entry )) if (list_next( fields, &field->entry ))
yyerror("field '%s' deriving from a conformant array must be the last field in the structure", error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
field->name); field->name);
has_pointer = 1; has_pointer = 1;
break; break;
...@@ -1884,7 +1884,7 @@ static int get_struct_type(var_list_t *fields) ...@@ -1884,7 +1884,7 @@ static int get_struct_type(var_list_t *fields)
case RPC_FC_CSTRUCT: case RPC_FC_CSTRUCT:
has_conformance = 1; has_conformance = 1;
if (list_next( fields, &field->entry )) if (list_next( fields, &field->entry ))
yyerror("field '%s' deriving from a conformant array must be the last field in the structure", error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
field->name); field->name);
break; break;
...@@ -1893,8 +1893,7 @@ static int get_struct_type(var_list_t *fields) ...@@ -1893,8 +1893,7 @@ static int get_struct_type(var_list_t *fields)
break; break;
default: default:
fprintf(stderr,"Unknown struct member %s with type (0x%02x)\n", error_loc("Unknown struct member %s with type (0x%02x)\n", field->name, t->type);
field->name, t->type);
/* fallthru - treat it as complex */ /* fallthru - treat it as complex */
/* as soon as we see one of these these members, it's bogus... */ /* as soon as we see one of these these members, it's bogus... */
...@@ -1936,7 +1935,7 @@ static var_t *reg_const(var_t *var) ...@@ -1936,7 +1935,7 @@ static var_t *reg_const(var_t *var)
struct rconst *nc; struct rconst *nc;
int hash; int hash;
if (!var->name) { if (!var->name) {
yyerror("registering constant without name"); error_loc("registering constant without name\n");
return var; return var;
} }
hash = hash_ident(var->name); hash = hash_ident(var->name);
...@@ -1954,7 +1953,7 @@ static var_t *find_const(char *name, int f) ...@@ -1954,7 +1953,7 @@ static var_t *find_const(char *name, int f)
while (cur && strcmp(cur->name, name)) while (cur && strcmp(cur->name, name))
cur = cur->next; cur = cur->next;
if (!cur) { if (!cur) {
if (f) yyerror("constant '%s' not found", name); if (f) error_loc("constant '%s' not found\n", name);
return NULL; return NULL;
} }
return cur->var; return cur->var;
...@@ -2054,7 +2053,7 @@ static void check_arg(var_t *arg) ...@@ -2054,7 +2053,7 @@ static void check_arg(var_t *arg)
type_t *t = arg->type; type_t *t = arg->type;
if (t->type == 0 && ! is_var_ptr(arg)) if (t->type == 0 && ! is_var_ptr(arg))
yyerror("argument '%s' has void type", arg->name); error_loc("argument '%s' has void type\n", arg->name);
} }
static void check_all_user_types(ifref_list_t *ifrefs) static void check_all_user_types(ifref_list_t *ifrefs)
......
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