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
76693d52
Commit
76693d52
authored
May 12, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
May 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Added support for nameless structs and unions.
parent
935418cb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
14 deletions
+105
-14
winnt.h
include/winnt.h
+44
-3
header.c
tools/widl/header.c
+57
-11
parser.y
tools/widl/parser.y
+4
-0
No files found.
include/winnt.h
View file @
76693d52
...
@@ -245,8 +245,24 @@ extern "C" {
...
@@ -245,8 +245,24 @@ extern "C" {
#define DUMMYUNIONNAME8 u8
#define DUMMYUNIONNAME8 u8
#endif
/* !defined(NONAMELESSUNION) */
#endif
/* !defined(NONAMELESSUNION) */
#ifndef __C89_NAMELESS
#undef __C89_NAMELESS
# if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
#undef __C89_NAMELESSSTRUCTNAME
#undef __C89_NAMELESSSTRUCTNAME1
#undef __C89_NAMELESSSTRUCTNAME2
#undef __C89_NAMELESSSTRUCTNAME3
#undef __C89_NAMELESSSTRUCTNAME4
#undef __C89_NAMELESSSTRUCTNAME5
#undef __C89_NAMELESSUNIONNAME
#undef __C89_NAMELESSUNIONNAME1
#undef __C89_NAMELESSUNIONNAME2
#undef __C89_NAMELESSUNIONNAME3
#undef __C89_NAMELESSUNIONNAME4
#undef __C89_NAMELESSUNIONNAME5
#undef __C89_NAMELESSUNIONNAME6
#undef __C89_NAMELESSUNIONNAME7
#undef __C89_NAMELESSUNIONNAME8
#if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
# ifdef __GNUC__
# ifdef __GNUC__
/* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
/* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
# if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
# if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
...
@@ -255,16 +271,41 @@ extern "C" {
...
@@ -255,16 +271,41 @@ extern "C" {
# elif defined(_MSC_VER)
# elif defined(_MSC_VER)
# define __C89_NAMELESS
# define __C89_NAMELESS
# endif
# endif
# endif
#endif
#endif
#ifdef __C89_NAMELESS
#ifdef __C89_NAMELESS
# define __C89_NAMELESSSTRUCTNAME
# define __C89_NAMELESSSTRUCTNAME
# define __C89_NAMELESSSTRUCTNAME1
# define __C89_NAMELESSSTRUCTNAME2
# define __C89_NAMELESSSTRUCTNAME3
# define __C89_NAMELESSSTRUCTNAME4
# define __C89_NAMELESSSTRUCTNAME5
# define __C89_NAMELESSUNIONNAME
# define __C89_NAMELESSUNIONNAME
# define __C89_NAMELESSUNIONNAME1
# define __C89_NAMELESSUNIONNAME2
# define __C89_NAMELESSUNIONNAME3
# define __C89_NAMELESSUNIONNAME4
# define __C89_NAMELESSUNIONNAME5
# define __C89_NAMELESSUNIONNAME6
# define __C89_NAMELESSUNIONNAME7
# define __C89_NAMELESSUNIONNAME8
#else
#else
# define __C89_NAMELESS
# define __C89_NAMELESS
# define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
# define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
# define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
# define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
# define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
# define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
# define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
# define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
# define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
# define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
# define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
# define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
# define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
# define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
# define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
# define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
# define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
#endif
#endif
/* C99 restrict support */
/* C99 restrict support */
...
...
tools/widl/header.c
View file @
76693d52
...
@@ -167,21 +167,67 @@ const char *get_name(const var_t *v)
...
@@ -167,21 +167,67 @@ const char *get_name(const var_t *v)
return
buffer
;
return
buffer
;
}
}
static
void
write_field
(
FILE
*
h
,
var_t
*
v
)
{
if
(
!
v
)
return
;
if
(
v
->
type
)
{
indent
(
h
,
0
);
write_type_def_or_decl
(
h
,
v
->
type
,
TRUE
,
v
->
name
);
fprintf
(
h
,
";
\n
"
);
}
}
static
void
write_fields
(
FILE
*
h
,
var_list_t
*
fields
)
static
void
write_fields
(
FILE
*
h
,
var_list_t
*
fields
)
{
{
unsigned
nameless_struct_cnt
=
0
,
nameless_struct_i
=
0
,
nameless_union_cnt
=
0
,
nameless_union_i
=
0
;
const
char
*
name
;
char
buf
[
32
];
var_t
*
v
;
var_t
*
v
;
if
(
!
fields
)
return
;
if
(
!
fields
)
return
;
LIST_FOR_EACH_ENTRY
(
v
,
fields
,
var_t
,
entry
)
write_field
(
h
,
v
);
LIST_FOR_EACH_ENTRY
(
v
,
fields
,
var_t
,
entry
)
{
if
(
!
v
||
!
v
->
type
)
continue
;
switch
(
type_get_type_detect_alias
(
v
->
type
))
{
case
TYPE_STRUCT
:
case
TYPE_ENCAPSULATED_UNION
:
nameless_struct_cnt
++
;
break
;
case
TYPE_UNION
:
nameless_union_cnt
++
;
break
;
default:
;
}
}
LIST_FOR_EACH_ENTRY
(
v
,
fields
,
var_t
,
entry
)
{
if
(
!
v
||
!
v
->
type
)
continue
;
indent
(
h
,
0
);
name
=
v
->
name
;
switch
(
type_get_type_detect_alias
(
v
->
type
))
{
case
TYPE_STRUCT
:
case
TYPE_ENCAPSULATED_UNION
:
if
(
!
v
->
name
)
{
fprintf
(
h
,
"__C89_NAMELESS "
);
if
(
nameless_struct_cnt
==
1
)
{
name
=
"__C89_NAMELESSSTRUCTNAME"
;
}
else
if
(
nameless_struct_i
<
5
/* # of supporting macros */
)
{
sprintf
(
buf
,
"__C89_NAMELESSSTRUCTNAME%d"
,
++
nameless_struct_i
);
name
=
buf
;
}
}
break
;
case
TYPE_UNION
:
if
(
!
v
->
name
)
{
fprintf
(
h
,
"__C89_NAMELESS "
);
if
(
nameless_union_cnt
==
1
)
{
name
=
"__C89_NAMELESSUNIONNAME"
;
}
else
if
(
nameless_union_i
<
8
/* # of supporting macros */
)
{
sprintf
(
buf
,
"__C89_NAMELESSUNIONNAME%d"
,
++
nameless_union_i
);
name
=
buf
;
}
}
break
;
default:
;
}
write_type_def_or_decl
(
h
,
v
->
type
,
TRUE
,
name
);
fprintf
(
h
,
";
\n
"
);
}
}
}
static
void
write_enums
(
FILE
*
h
,
var_list_t
*
enums
)
static
void
write_enums
(
FILE
*
h
,
var_list_t
*
enums
)
...
...
tools/widl/parser.y
View file @
76693d52
...
@@ -740,6 +740,10 @@ s_field: m_attributes decl_spec declarator { $$ = declare_var(check_field_attrs
...
@@ -740,6 +740,10 @@ s_field: m_attributes decl_spec declarator { $$ = declare_var(check_field_attrs
$2, $3, FALSE);
$2, $3, FALSE);
free($3);
free($3);
}
}
| m_attributes structdef { var_t *v = make_var(NULL);
v->type = $2; v->attrs = $1;
$$ = v;
}
;
;
funcdef: declaration { $$ = $1;
funcdef: declaration { $$ = $1;
...
...
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