Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
4e22899e
Commit
4e22899e
authored
Jun 07, 2007
by
Dan Hipschman
Committed by
Alexandre Julliard
Jun 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Fix incomplete struct/union typedef bug.
parent
b186c4dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
3 deletions
+54
-3
parser.y
tools/widl/parser.y
+50
-1
typegen.c
tools/widl/typegen.c
+2
-2
widltypes.h
tools/widl/widltypes.h
+2
-0
No files found.
tools/widl/parser.y
View file @
4e22899e
...
...
@@ -65,6 +65,17 @@
# endif
#endif
typedef struct list typelist_t;
struct typenode {
type_t *type;
struct list entry;
};
typelist_t incomplete_types = LIST_INIT(incomplete_types);
static void add_incomplete(type_t *t);
static void fix_incomplete(void);
static str_list_t *append_str(str_list_t *list, char *str);
static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
static attr_t *make_attr(enum attr_type type);
...
...
@@ -263,7 +274,11 @@ static void check_arg(var_t *arg);
%%
input: gbl_statements { write_proxies($1); write_client($1); write_server($1); }
input: gbl_statements { fix_incomplete();
write_proxies($1);
write_client($1);
write_server($1);
}
;
gbl_statements: { $$ = NULL; }
...
...
@@ -1475,6 +1490,38 @@ static type_t *reg_type(type_t *type, const char *name, int t)
return type;
}
static int is_incomplete(const type_t *t)
{
return !t->defined && (is_struct(t->type) || is_union(t->type));
}
static void add_incomplete(type_t *t)
{
struct typenode *tn = xmalloc(sizeof *tn);
tn->type = t;
list_add_tail(&incomplete_types, &tn->entry);
}
static void fix_type(type_t *t)
{
if (t->kind == TKIND_ALIAS && is_incomplete(t)) {
type_t *ot = t->orig;
fix_type(ot);
t->fields = ot->fields;
t->defined = ot->defined;
}
}
static void fix_incomplete(void)
{
struct typenode *tn, *next;
LIST_FOR_EACH_ENTRY_SAFE(tn, next, &incomplete_types, struct typenode, entry) {
fix_type(tn->type);
free(tn);
}
}
static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *attrs)
{
type_t *ptr = type;
...
...
@@ -1544,6 +1591,8 @@ static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *a
yyerror("'%s': [string] attribute applied to non-pointer type",
cur->name);
if (is_incomplete(cur))
add_incomplete(cur);
reg_type(cur, cur->name, 0);
}
}
...
...
tools/widl/typegen.c
View file @
4e22899e
...
...
@@ -109,7 +109,7 @@ const char *string_of_type(unsigned char type)
}
}
static
int
is_struct
(
unsigned
char
type
)
int
is_struct
(
unsigned
char
type
)
{
switch
(
type
)
{
...
...
@@ -125,7 +125,7 @@ static int is_struct(unsigned char type)
}
}
static
int
is_union
(
unsigned
char
type
)
int
is_union
(
unsigned
char
type
)
{
switch
(
type
)
{
...
...
tools/widl/widltypes.h
View file @
4e22899e
...
...
@@ -305,5 +305,7 @@ int is_ptr(const type_t *t);
int
is_array
(
const
type_t
*
t
);
int
is_var_ptr
(
const
var_t
*
v
);
int
cant_be_null
(
const
var_t
*
v
);
int
is_struct
(
unsigned
char
tc
);
int
is_union
(
unsigned
char
tc
);
#endif
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