Commit Graph

1286 Commits

Author SHA1 Message Date
Rémi Bernon d90dc11d1a widl: Remove unnecessary WinRT type comments.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-25 21:03:58 +01:00
Jacek Caban 6653a381cb widl: Don't apply call_as methods to async interface.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-18 16:25:02 +01:00
Alexandre Julliard 107103e2bd wpp: Remove some dead code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-03 20:18:38 +01:00
Rémi Bernon 54035a2101 widl: Support WinRT contract attribute.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:50:04 +01:00
Rémi Bernon ee490ee26c widl: Support WinRT apicontract type.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:49:52 +01:00
Rémi Bernon 19b5f3e060 widl: Support WinRT contractversion attribute parsing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:49:49 +01:00
Rémi Bernon 13592f0cdb widl: Add abi_prefix parameter to format_namespace.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 19:49:47 +01:00
Kevin Puetz 997439967f widl: Allow adding the same custdata GUID multiple times in a typelib.
e.g. using the same kind of custdata in multiple interfaces

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-18 22:27:51 +01:00
Kevin Puetz 02b6df007a widl: Write ATTR_CUSTOM into typelib.
Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-18 22:27:51 +01:00
Kevin Puetz 7afd550f34 widl: Parse attribute custom(guid,expr).
Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-18 22:27:51 +01:00
Rémi Bernon a35ca92362 widl: Prefer mangled name over typedef in WinRT mode.
For types under a non-global namespace.

MIDL generates prefixed mangled name for every use of enum, struct and
union types. When the types are in the global namespace, the typedef
name is used instead.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 21:06:18 +01:00
Rémi Bernon a154a42c0d widl: Restrict some keywords to WinRT mode only.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 21:06:18 +01:00
Rémi Bernon 92eb5ef5a1 widl: Support repetition for some attributes.
Some attributes can be specified multiple times, this is the case for
instance for "custom" attribute, as well as WinRT "static".

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: PuetzKevinA@JohnDeere.com
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 21:06:18 +01:00
Eric Kohl ba72ef6c22 widl: Add the [allocate] acf attribute.
Signed-off-by: Eric Kohl <eric.kohl@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-27 21:04:46 +01:00
Nikolay Sivov d7b166976d widl: Allow [restricted] for coclass-es.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-24 15:03:32 +02:00
Nikolay Sivov fe5bfa5b71 widl: Add null source pointer check for typelib writer.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38964
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-24 15:03:28 +02:00
Nikolay Sivov 0a49202109 widl: Allow [hidden] attribute on enum members.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-23 18:42:51 +02:00
Nikolay Sivov 8eb756c699 widl: Enable [hidden] attribute for enums.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-23 18:42:31 +02:00
Kevin Puetz 7955b2e526 widl: Remove duplicate '\n\n' in midl_info_guid.
Per standard, ctime already ends with '\n\0', so this doubled it.

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-21 12:54:17 +02:00
Kevin Puetz 44ccc4f638 widl: All VARDESC fields of TKIND_UNION should have oInst=0.
Also fix uninitialized value in this field for TKIND_DISPATCH.

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-18 15:35:03 +02:00
Nikolay Sivov 0dd6f1ef35 widl: Emit a guard around library contents.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-14 19:42:40 +02:00
Alexandre Julliard a204ad557d makefiles: Expand makedep path at compile time.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-09 20:30:31 +02:00
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