From 75e02e93359393a52b86753c0564f9ebd5a7d5c0 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Tue, 28 Sep 2004 02:12:36 +0000 Subject: [PATCH] - Force default [in] attribute on all parameters where explicit [in] or [out] attributes aren't specified. - Force default [out] attribute on return values. --- tools/widl/parser.y | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 213bb330dde..a835a549f8a 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -280,19 +280,31 @@ args: arg arg: attributes type pident array { $$ = $3; set_type($$, $2, $4); $$->attrs = $1; + if (!is_attr($$->attrs, ATTR_OUT) && + !is_attr($$->attrs, ATTR_IN)) { + attr_t *a = make_attr(ATTR_IN); + LINK(a, $$->attrs); $$->attrs = a; + } } | type pident array { $$ = $2; set_type($$, $1, $3); + $$->attrs = make_attr(ATTR_IN); } | attributes type pident '(' m_args ')' { $$ = $3; $$->ptr_level--; set_type($$, $2, NULL); $$->attrs = $1; $$->args = $5; + if (!is_attr($$->attrs, ATTR_OUT) && + !is_attr($$->attrs, ATTR_IN)) { + attr_t *a = make_attr(ATTR_IN); + LINK(a, $$->attrs); $$->attrs = a; + } } | type pident '(' m_args ')' { $$ = $2; $$->ptr_level--; set_type($$, $1, NULL); + $$->attrs = make_attr(ATTR_IN); $$->args = $4; } ; @@ -489,6 +501,13 @@ funcdef: '(' m_args ')' { set_type($4, $2, NULL); $4->attrs = $1; $$ = make_func($4, $6); + if (is_attr($4->attrs, ATTR_IN)) { + yyerror("Inapplicatable attribute"); + } + if (!is_attr($4->attrs, ATTR_OUT)) { + attr_t *a = make_attr(ATTR_OUT); + LINK(a, $4->attrs); $4->attrs = a; + } } ; -- 2.11.4.GIT