Rémi Bernon
280932536f
widl: Support fully qualified names in WinRT mode.
...
Interfaces are going to reference each other across namespaces, so this
implements a type lookup with the full name.
It supports the following idl syntax in WinRT mode:
#ifdef __WIDL__
#pragma winrt ns_prefix
#endif
import "wtypes.idl";
namespace Windows {
namespace Foo {
[object]
interface IFoo {}
}
namespace Bar {
[object]
interface IBar { HRESULT DoBar([in] Windows.Foo.IFoo *foo); }
}
}
That was previously failing to parse the Windows.Foo.IFoo part and to
lookup the corresponding type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-07 21:07:00 +02:00
Rémi Bernon
6698a2ef7f
widl: Output interface C names in method argument list.
...
This fixes WinRT interface generation where only simple names were used
instead of the C interface names.
With the previous sample idl:
#ifdef __WIDL__
#pragma winrt ns_prefix
#endif
import "wtypes.idl";
namespace Windows {
[object]
interface IFoo {}
[object]
interface IBar { HRESULT DoBar([in] IFoo *foo); }
}
$ widl -o windows.foo.h windows.foo.idl
Generated file diff before/after:
diff --git a/windows.foo.h b/windows.foo.h
index 3790dc7..65151cb 100644
--- a/windows.foo.h
+++ b/windows.foo.h
@@ -123,7 +123,7 @@ typedef struct __x_ABI_CWindows_CIBarVtbl {
/*** IBar methods ***/
HRESULT (STDMETHODCALLTYPE *DoBar)(
__x_ABI_CWindows_CIBar *This,
- IFoo *foo);
+ __x_ABI_CWindows_CIFoo *foo);
END_INTERFACE
} __x_ABI_CWindows_CIBarVtbl;
@@ -138,7 +138,7 @@ interface __x_ABI_CWindows_CIBar {
#define __x_ABI_CWindows_CIBar_DoBar(This,foo) (This)->lpVtbl->DoBar(This,foo)
#else
/*** IBar methods ***/
-static FORCEINLINE HRESULT __x_ABI_CWindows_CIBar_DoBar(__x_ABI_CWindows_CIBar* This,IFoo *foo) {
+static FORCEINLINE HRESULT __x_ABI_CWindows_CIBar_DoBar(__x_ABI_CWindows_CIBar* This,__x_ABI_CWindows_CIFoo *foo) {
return This->lpVtbl->DoBar(This,foo);
}
#endif
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-07 21:07:00 +02:00
Rémi Bernon
f4f612a077
widl: Search for known types in current namespace.
...
Fixes the following error with this sample idl:
#ifdef __WIDL__
#pragma winrt ns_prefix
#endif
import "wtypes.idl";
namespace Windows {
[object]
interface IFoo {}
[object]
interface IBar { HRESULT DoBar([in] IFoo *foo); }
}
$ widl -o windows.foo.h windows.foo.idl
windows.foo.idl:13: error: type 'IFoo' not found
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-07 21:07:00 +02:00
Martin Storsjo
d51c5723c3
widl: Make decl_needs_parens static.
...
This function lacks a declaration in header.h and isn't used
outside of this source file.
This fixes warnings about missing a prototype, when built as part
of mingw-w64-tools (where it is built with -Wmissing-prototypes).
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 17:16:26 +02:00
Emilio Cobos Álvarez
b1084ff910
widl: Use DECLSPEC_ALIGN in MSVC compatible way for return types too.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49173
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 11:54:40 +02:00
Jacek Caban
4fd8190ef1
widl: Use DECLSPEC_ALIGN in MSVC compatible way.
...
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 20:55:04 +02:00
Chip Davis
1387075b80
widl: Cast server functions to void *.
...
This avoids a warning casting between calling conventions with Clang.
Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-09 21:04:04 +02:00
Dmitry Timoshkov
2c501aa750
widl: If a variable doesn't have a name provide an autogenerated one.
...
Otherwise widl crashes while generating a typelib for a structure
with an embedded anonymous union:
typedef struct _s
{
int type;
union
{
int f;
};
} s;
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-17 15:04:59 +01:00
Dmitry Timoshkov
8d0f8da652
widl: Generate name for a tagless union.
...
Otherwise widl crashes while generating a typelib for
typedef struct _s
{
int type;
union
{
int field;
} u;
} s;
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-17 15:04:59 +01:00
Jacek Caban
26ad9a7ba3
widl: Check dispinterfaces for duplicated methods.
...
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-04 21:30:27 +01:00
Zebediah Figura
56995dd322
widl: Output a registry script for all interfaces written into the typelib.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46005
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-30 16:22:33 +01:00
Alexandre Julliard
90a543d3d7
widl: Also search the include dir relative to the binary path.
...
Suggested by Kevin Puetz.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-30 11:33:13 +01:00
Rémi Bernon
1491453ea9
widl: Cast freed pointers to void* to fix discarded-array-qualifiers warning.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-02 22:02:56 +01:00
Jacek Caban
c15f83a2a3
widl: Use strmake in get_name.
...
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-08 23:37:06 +01:00
Jacek Caban
d5c745e467
widl: Don't use fixed size buffer in ctl2_encode_string.
...
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-08 23:36:54 +01:00
Jacek Caban
908c2bec28
widl: Don't use fixed size buffer in ctl2_encode_name.
...
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-08 23:36:50 +01:00
Alexandre Julliard
5f39d36a6c
widl: Add --sysroot and --nostdinc options.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-02 13:55:16 +01:00
Alexandre Julliard
264d8884d5
widl: Add strmake() helper.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-02 13:55:16 +01:00
Zebediah Figura
8746bf094f
widl: Also compute buffer size for non-ref arrays.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47886
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-07 09:59:38 +02:00
Zebediah Figura
dd35baa8e3
widl: Write pointer classes for explicitly declared arrays only if they are top-level parameters.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-07 09:59:36 +02:00
Michael Stefaniuc
bbcf44eb97
widl: Add the ARRAY_SIZE() macro.
...
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-26 21:05:44 +02:00
Francois Gouget
2814409990
widl: Fix a variable name in a comment.
...
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-02 20:46:58 +02:00
Richard Pospesel
57f697e137
widl: Respect wire-marshal typedefs in type libraries.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47041
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:04:10 +02:00
Richard Pospesel
4b1dfa6037
widl: Add the typedef to the type library if the aliasee is an anonymous UDT.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47050
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:04:05 +02:00
Zebediah Figura
96e11d51ba
widl: Write public typedefs into the typelib if they are referenced directly.
...
I.e. write "apple_t" into the typelib given the following snippet:
typedef [public] struct { ... } apple_t;
library {
interface IFoo {
HRESULT a(apple_t arg);
}
}
Based on a patch by Richard Pospesel.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:04:01 +02:00
Zebediah Figura
4f4763ab6b
widl: Handle encapsulated unions in type libraries.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:03:57 +02:00
Zebediah Figura
732f67ed38
widl: Generate a name for the encapsulated union type.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 20:03:52 +02:00
Richard Pospesel
181cafcd52
widl: Fail compilation if an incomplete union or enum is used in a remoted field.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 09:33:57 +02:00
Zebediah Figura
a58e4cc07c
widl: Check for redefinition of named user types.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 09:33:55 +02:00
Zebediah Figura
0aa6049c8d
widl: Create exactly one type_t object per named enum type.
...
Based on a patch by Richard Pospesel.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47035
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-20 09:08:57 +02:00
Zebediah Figura
833639bd09
widl: Create exactly one type_t object per named union type.
...
Based on a patch by Richard Pospesel.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-20 09:08:54 +02:00
Zebediah Figura
42321d7a11
widl: Create exactly one type_t object per named structure type.
...
Regardless of whether we are writing a typelib.
Based on a patch by Richard Pospesel.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-20 09:08:51 +02:00
Zebediah Figura
55234f65a8
widl: Track whether the type has been defined yet in the statement_t and var_t structures.
...
Based on a patch by Richard Pospesel.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47149
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-20 09:08:48 +02:00
Zebediah Figura
60d668631f
widl: Don't store the default pointer type in the type_t structure.
...
This fixes type format string generation for the following IDL:
typedef int *intp;
[pointer_default(ref)] interface IRef {
void a(intp *a);
}
[pointer_default(unique)] interface IUnique {
void b(intp *a);
}
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-19 11:29:28 +02:00
Zebediah Figura
5cc3548299
widl: Store the "inline" function specifier inside the decl_spec_t structure.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-19 11:29:28 +02:00
Richard Pospesel
7e4da76689
widl: Store the "const" type qualifier inside the decl_spec_t structure.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-19 11:29:28 +02:00
Zebediah Figura
df948ccc05
widl: Fix nesting of functions, pointers, and arrays.
...
This is actually broken in MIDL, even as recent as the version shipped with
the Windows 10 SDK, but it makes our code simpler, so there's no reason not
to do it right.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-19 11:29:28 +02:00
Richard Pospesel
f131795b30
widl: Pass a decl_spec_t to type_new_alias().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-16 10:09:33 +02:00
Richard Pospesel
d4dfbb630f
widl: Pass a decl_spec_t to type_new_array().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-16 10:09:29 +02:00
Richard Pospesel
e8b6c05242
widl: Pass a decl_spec_t to write_type_left().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-16 10:09:24 +02:00
Richard Pospesel
aa2bd521d9
widl: Pass a decl_spec_t to write_type_v().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-16 10:09:19 +02:00
Zebediah Figura
d0e10aa372
widl: Store the type for casts and sizeof() expressions as a decl_spec_t.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-16 10:09:13 +02:00
Richard Pospesel
e63df7f7bf
widl: Store the aliasee as a decl_spec_t structure.
...
Signed-off-by: Richard Pospesel <richard@torproject.org>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-15 10:22:40 +02:00
Zebediah Figura
2babcd6c1c
widl: Use the type_type field to track whether the type is an alias.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-15 10:22:35 +02:00
Zebediah Figura
07c131f0f4
widl: Introduce type_array_{get,set}_ptr_tfsoff().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-15 10:22:24 +02:00
Zebediah Figura
c5ab9d01be
widl: Use type_iface_get_inherit() in check_async_uuid().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-15 10:22:19 +02:00
Zebediah Figura
b4fe4ccc96
widl: Introduce type_iface_get_async_iface().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-15 10:22:14 +02:00
Zebediah Figura
8b2a065892
widl: Move the "idx" parameter from struct func_details to var_t.
...
It's not a part of the type; e.g. it doesn't make sense on a function pointer.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 12:16:10 +02:00
Zebediah Figura
a55aa54c42
widl: Use type_function_get_args() in more places.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 12:16:03 +02:00
Richard Pospesel
ebac6a6ac4
widl: Use type_pointer_get_default_fc() in declare_var().
...
Signed-off-by: Richard Pospesel <richard@torproject.org>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-14 12:15:57 +02:00