Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
759a3bf3
Commit
759a3bf3
authored
Jan 29, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Check function return values for additional prototype types.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c68b5eb8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
72 deletions
+71
-72
header.c
tools/widl/header.c
+65
-70
parser.y
tools/widl/parser.y
+5
-1
widltypes.h
tools/widl/widltypes.h
+1
-1
No files found.
tools/widl/header.c
View file @
759a3bf3
...
...
@@ -637,82 +637,77 @@ unsigned int get_generic_handle_offset( const type_t *type )
/* check for types which require additional prototypes to be generated in the
* header */
void
check_for_additional_prototype_types
(
const
var_list_t
*
list
)
{
const
var_t
*
v
;
if
(
!
list
)
return
;
LIST_FOR_EACH_ENTRY
(
v
,
list
,
const
var_t
,
entry
)
{
type_t
*
type
=
v
->
type
;
if
(
!
type
)
continue
;
for
(;;)
{
const
char
*
name
=
type
->
name
;
if
(
type
->
user_types_registered
)
break
;
type
->
user_types_registered
=
1
;
if
(
is_attr
(
type
->
attrs
,
ATTR_CONTEXTHANDLE
))
{
if
(
!
context_handle_registered
(
name
))
{
context_handle_t
*
ch
=
xmalloc
(
sizeof
(
*
ch
));
ch
->
name
=
xstrdup
(
name
);
list_add_tail
(
&
context_handle_list
,
&
ch
->
entry
);
}
/* don't carry on parsing fields within this type */
break
;
}
if
((
type_get_type
(
type
)
!=
TYPE_BASIC
||
type_basic_get_type
(
type
)
!=
TYPE_BASIC_HANDLE
)
&&
is_attr
(
type
->
attrs
,
ATTR_HANDLE
))
{
if
(
!
generic_handle_registered
(
name
))
{
generic_handle_t
*
gh
=
xmalloc
(
sizeof
(
*
gh
));
gh
->
name
=
xstrdup
(
name
);
list_add_tail
(
&
generic_handle_list
,
&
gh
->
entry
);
}
/* don't carry on parsing fields within this type */
break
;
void
check_for_additional_prototype_types
(
type_t
*
type
)
{
if
(
!
type
)
return
;
for
(;;)
{
const
char
*
name
=
type
->
name
;
if
(
type
->
user_types_registered
)
break
;
type
->
user_types_registered
=
1
;
if
(
is_attr
(
type
->
attrs
,
ATTR_CONTEXTHANDLE
))
{
if
(
!
context_handle_registered
(
name
))
{
context_handle_t
*
ch
=
xmalloc
(
sizeof
(
*
ch
));
ch
->
name
=
xstrdup
(
name
);
list_add_tail
(
&
context_handle_list
,
&
ch
->
entry
);
}
if
(
is_attr
(
type
->
attrs
,
ATTR_WIREMARSHAL
))
{
if
(
!
user_type_registered
(
name
))
{
user_type_t
*
ut
=
xmalloc
(
sizeof
*
ut
);
ut
->
name
=
xstrdup
(
name
);
list_add_tail
(
&
user_type_list
,
&
ut
->
entry
);
}
/* don't carry on parsing fields within this type as we are already
* using a wire marshaled type */
break
;
/* don't carry on parsing fields within this type */
break
;
}
if
((
type_get_type
(
type
)
!=
TYPE_BASIC
||
type_basic_get_type
(
type
)
!=
TYPE_BASIC_HANDLE
)
&&
is_attr
(
type
->
attrs
,
ATTR_HANDLE
))
{
if
(
!
generic_handle_registered
(
name
))
{
generic_handle_t
*
gh
=
xmalloc
(
sizeof
(
*
gh
));
gh
->
name
=
xstrdup
(
name
);
list_add_tail
(
&
generic_handle_list
,
&
gh
->
entry
);
}
else
if
(
type_is_complete
(
type
))
/* don't carry on parsing fields within this type */
break
;
}
if
(
is_attr
(
type
->
attrs
,
ATTR_WIREMARSHAL
))
{
if
(
!
user_type_registered
(
name
))
{
var_list_t
*
vars
;
switch
(
type_get_type_detect_alias
(
type
))
{
case
TYPE_ENUM
:
vars
=
type_enum_get_values
(
type
);
break
;
case
TYPE_STRUCT
:
vars
=
type_struct_get_fields
(
type
);
break
;
case
TYPE_UNION
:
vars
=
type_union_get_cases
(
type
);
break
;
default:
vars
=
NULL
;
break
;
}
check_for_additional_prototype_types
(
vars
);
user_type_t
*
ut
=
xmalloc
(
sizeof
*
ut
);
ut
->
name
=
xstrdup
(
name
);
list_add_tail
(
&
user_type_list
,
&
ut
->
entry
);
}
if
(
type_is_alias
(
type
))
type
=
type_alias_get_aliasee
(
type
);
else
if
(
is_ptr
(
type
))
type
=
type_pointer_get_ref
(
type
);
else
if
(
is_array
(
type
))
type
=
type_array_get_element
(
type
);
else
/* don't carry on parsing fields within this type as we are already
* using a wire marshaled type */
break
;
}
else
if
(
type_is_complete
(
type
))
{
var_list_t
*
vars
;
const
var_t
*
v
;
switch
(
type_get_type_detect_alias
(
type
))
{
case
TYPE_ENUM
:
vars
=
type_enum_get_values
(
type
);
break
;
case
TYPE_STRUCT
:
vars
=
type_struct_get_fields
(
type
);
break
;
case
TYPE_UNION
:
vars
=
type_union_get_cases
(
type
);
break
;
default:
vars
=
NULL
;
break
;
}
if
(
vars
)
LIST_FOR_EACH_ENTRY
(
v
,
vars
,
const
var_t
,
entry
)
check_for_additional_prototype_types
(
v
->
type
);
}
if
(
type_is_alias
(
type
))
type
=
type_alias_get_aliasee
(
type
);
else
if
(
is_ptr
(
type
))
type
=
type_pointer_get_ref
(
type
);
else
if
(
is_array
(
type
))
type
=
type_array_get_element
(
type
);
else
break
;
}
}
...
...
tools/widl/parser.y
View file @
759a3bf3
...
...
@@ -2911,6 +2911,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
static void check_all_user_types(const statement_list_t *stmts)
{
const statement_t *stmt;
const var_t *v;
if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
{
...
...
@@ -2922,7 +2923,10 @@ static void check_all_user_types(const statement_list_t *stmts)
const statement_t *stmt_func;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
const var_t *func = stmt_func->u.var;
check_for_additional_prototype_types(func->type->details.function->args);
if (func->type->details.function->args)
LIST_FOR_EACH_ENTRY( v, func->type->details.function->args, const var_t, entry )
check_for_additional_prototype_types(v->type);
check_for_additional_prototype_types(type_function_get_rettype(func->type));
}
}
}
...
...
tools/widl/widltypes.h
View file @
759a3bf3
...
...
@@ -556,7 +556,7 @@ typedef enum {
extern
user_type_list_t
user_type_list
;
extern
context_handle_list_t
context_handle_list
;
extern
generic_handle_list_t
generic_handle_list
;
void
check_for_additional_prototype_types
(
const
var_list_t
*
list
);
void
check_for_additional_prototype_types
(
type_t
*
type
);
void
init_types
(
void
);
type_t
*
alloc_type
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment