Commit Graph

1272 Commits

Author SHA1 Message Date
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
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