Author: cwittich
Date: Mon Oct 19 23:30:54 2009
New Revision: 43628
URL:
http://svn.reactos.org/svn/reactos?rev=43628&view=rev
Log:
sync widl to wine 1.1.31
Modified:
trunk/reactos/tools/widl/header.c
trunk/reactos/tools/widl/typegen.c
trunk/reactos/tools/widl/widl.c
trunk/reactos/tools/widl/widl.h
Modified: trunk/reactos/tools/widl/header.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/header.c?rev=43…
==============================================================================
--- trunk/reactos/tools/widl/header.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/header.c [iso-8859-1] Mon Oct 19 23:30:54 2009
@@ -346,9 +346,14 @@
if (name) fprintf(h, "%s%s", needs_space_after(t) ? " " :
"", name );
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
+ const var_list_t *args = type_function_get_args(pt);
+
if (ptr_level) fputc(')', h);
fputc('(', h);
- write_args(h, type_function_get_args(pt), NULL, 0, FALSE);
+ if (args)
+ write_args(h, args, NULL, 0, FALSE);
+ else
+ fprintf(h, "void");
fputc(')', h);
} else
write_type_right(h, t, is_field);
Modified: trunk/reactos/tools/widl/typegen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=4…
==============================================================================
--- trunk/reactos/tools/widl/typegen.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/typegen.c [iso-8859-1] Mon Oct 19 23:30:54 2009
@@ -144,6 +144,13 @@
}
}
+static inline unsigned int clamp_align(unsigned int align)
+{
+ unsigned int packing = (pointer_size == 4) ? win32_packing : win64_packing;
+ if(align > packing) align = packing;
+ return align;
+}
+
unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int
toplevel_param)
{
const type_t *t;
@@ -1164,13 +1171,12 @@
unsigned int falign = 0;
unsigned int fsize = type_memsize(v->type, &falign);
if (*align < falign) *align = falign;
- if (falign > packing) falign = packing;
+ falign = clamp_align(falign);
size = ROUND_SIZE(size, falign);
size += fsize;
}
- max_align = *align;
- if(max_align > packing) max_align = packing;
+ max_align = clamp_align(*align);
size = ROUND_SIZE(size, max_align);
return size;
@@ -1210,7 +1216,7 @@
type_t *ft = f->type;
unsigned int align = 0;
unsigned int size = type_memsize(ft, &align);
- if (align > packing) align = packing;
+ align = clamp_align(align);
if (align > salign) salign = align;
offset = ROUND_SIZE(offset, align);
offset += size;
@@ -2279,7 +2285,7 @@
type_t *ft = field->type;
unsigned int align = 0;
unsigned int size = type_memsize(ft, &align);
- if(align > packing) align = packing;
+ align = clamp_align(align);
if (salign < align) salign = align;
if (!is_conformant_array(ft) || type_array_is_decl_as_ptr(ft))
Modified: trunk/reactos/tools/widl/widl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/widl.c?rev=4362…
==============================================================================
--- trunk/reactos/tools/widl/widl.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/widl.c [iso-8859-1] Mon Oct 19 23:30:54 2009
@@ -52,7 +52,6 @@
static const char usage[] =
"Usage: widl [options...] infile.idl\n"
" or: widl [options...] --dlldata-only name1 [name2...]\n"
-" -a n Set structure alignment to 'n'\n"
" -b arch Set the target architecture\n"
" -c Generate client stub\n"
" -C file Name of client stub file (default is infile_c.c)\n"
@@ -82,6 +81,8 @@
" -W Enable pedantic warnings\n"
" --win32 Only generate 32-bit code\n"
" --win64 Only generate 64-bit code\n"
+" --win32-align n Set win32 structure alignment to 'n'\n"
+" --win64-align n Set win64 structure alignment to 'n'\n"
"Debug level 'n' is a bitmask with following meaning:\n"
" * 0x01 Tell which resource is parsed (verbose mode)\n"
" * 0x02 Dump internal structures\n"
@@ -111,7 +112,8 @@
int old_names = 0;
int do_win32 = 1;
int do_win64 = 1;
-int packing = 8;
+int win32_packing = 8;
+int win64_packing = 8;
char *input_name;
char *header_name;
@@ -150,11 +152,13 @@
PREFIX_CLIENT_OPTION,
PREFIX_SERVER_OPTION,
WIN32_OPTION,
- WIN64_OPTION
+ WIN64_OPTION,
+ WIN32_ALIGN_OPTION,
+ WIN64_ALIGN_OPTION
};
static const char short_options[] =
- "a:b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW";
+ "b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW";
static const struct option long_options[] = {
{ "dlldata", 1, 0, DLLDATA_OPTION },
{ "dlldata-only", 0, 0, DLLDATA_ONLY_OPTION },
@@ -165,6 +169,8 @@
{ "prefix-server", 1, 0, PREFIX_SERVER_OPTION },
{ "win32", 0, 0, WIN32_OPTION },
{ "win64", 0, 0, WIN64_OPTION },
+ { "win32-align", 1, 0, WIN32_ALIGN_OPTION },
+ { "win64-align", 1, 0, WIN64_ALIGN_OPTION },
{ 0, 0, 0, 0 }
};
@@ -246,7 +252,8 @@
{ "x86_64", SYS_WIN64 },
{ "sparc", SYS_WIN32 },
{ "alpha", SYS_WIN32 },
- { "powerpc", SYS_WIN32 }
+ { "powerpc", SYS_WIN32 },
+ { "arm", SYS_WIN32 }
};
unsigned int i;
@@ -522,9 +529,14 @@
do_win32 = 0;
do_win64 = 1;
break;
- case 'a':
- packing = strtol(optarg, NULL, 0);
- if(packing != 2 && packing != 4 && packing != 8)
+ case WIN32_ALIGN_OPTION:
+ win32_packing = strtol(optarg, NULL, 0);
+ if(win32_packing != 2 && win32_packing != 4 && win32_packing != 8)
+ error("Packing must be one of 2, 4 or 8\n");
+ break;
+ case WIN64_ALIGN_OPTION:
+ win64_packing = strtol(optarg, NULL, 0);
+ if(win64_packing != 2 && win64_packing != 4 && win64_packing != 8)
error("Packing must be one of 2, 4 or 8\n");
break;
case 'b':
Modified: trunk/reactos/tools/widl/widl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/widl.h?rev=4362…
==============================================================================
--- trunk/reactos/tools/widl/widl.h [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/widl.h [iso-8859-1] Mon Oct 19 23:30:54 2009
@@ -46,7 +46,8 @@
extern int old_names;
extern int do_win32;
extern int do_win64;
-extern int packing;
+extern int win32_packing;
+extern int win64_packing;
extern char *input_name;
extern char *header_name;