From 4e406750329242c6bdce86a2c2e431aa2a5a6b88 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Tue, 7 Feb 2006 12:32:57 +0100 Subject: [PATCH] widl: Make 'attrs' field of type_t const. --- tools/widl/header.c | 8 ++++---- tools/widl/header.h | 8 ++++---- tools/widl/parser.y | 9 +++++---- tools/widl/widltypes.h | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index 925301de87e..7f262335b6d 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -490,7 +490,7 @@ void write_externdef(const var_t *v) fprintf(header, ";\n\n"); } -void write_library(const char *name, attr_t *attr) { +void write_library(const char *name, const attr_t *attr) { const UUID *uuid = get_attrp(attr, ATTR_UUID); fprintf(header, "\n"); write_guid("LIBID", name, uuid); @@ -521,7 +521,7 @@ const var_t* get_explicit_handle_var(const func_t* func) /********** INTERFACES **********/ -int is_object(attr_t *a) +int is_object(const attr_t *a) { while (a) { if (a->type == ATTR_OBJECT || a->type == ATTR_ODL) return 1; @@ -530,12 +530,12 @@ int is_object(attr_t *a) return 0; } -int is_local(attr_t *a) +int is_local(const attr_t *a) { return is_attr(a, ATTR_LOCAL); } -const var_t *is_callas(attr_t *a) +const var_t *is_callas(const attr_t *a) { return get_attrp(a, ATTR_CALLAS); } diff --git a/tools/widl/header.h b/tools/widl/header.h index 63c732fc8bd..e905ae446eb 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -28,9 +28,9 @@ extern int is_void(const type_t *t, const var_t *v); extern void write_name(FILE *h, const var_t *v); extern const char* get_name(const var_t *v); extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n); -extern int is_object(attr_t *a); -extern int is_local(attr_t *a); -extern const var_t *is_callas(attr_t *a); +extern int is_object(const attr_t *a); +extern int is_local(const attr_t *a); +extern const var_t *is_callas(const attr_t *a); extern void write_args(FILE *h, var_t *arg, const char *name, int obj, int do_indent); extern void write_array(FILE *h, const expr_t *v, int field); extern void write_forward(type_t *iface); @@ -41,7 +41,7 @@ extern void write_typedef(type_t *type, const var_t *names); extern void write_expr(FILE *h, const expr_t *e, int brackets); extern void write_constdef(const var_t *v); extern void write_externdef(const var_t *v); -extern void write_library(const char *name, attr_t *attr); +extern void write_library(const char *name, const attr_t *attr); extern void write_user_types(void); extern const var_t* get_explicit_handle_var(const func_t* func); diff --git a/tools/widl/parser.y b/tools/widl/parser.y index ca890f422cd..5b24eef3568 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -623,11 +623,12 @@ dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(0, $2, 0); } | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(0, $2, 0); } ; -dispinterfacehdr: attributes dispinterface { $$ = $2; +dispinterfacehdr: attributes dispinterface { attr_t *attrs; + $$ = $2; if ($$->defined) yyerror("multiple definition error\n"); - $$->attrs = $1; - $$->attrs = make_attr(ATTR_DISPINTERFACE); - LINK($$->attrs, $1); + attrs = make_attr(ATTR_DISPINTERFACE); + LINK(attrs, $1); + $$->attrs = attrs; $$->ref = find_type("IDispatch", 0); if (!$$->ref) yyerror("IDispatch is undefined\n"); $$->defined = TRUE; diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index c578da79bb2..6af89adf0d4 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -183,7 +183,7 @@ struct _type_t { char *name; unsigned char type; struct _type_t *ref; - attr_t *attrs; + const attr_t *attrs; func_t *funcs; var_t *fields; int ignore, is_const, sign;