Emilio Cobos Álvarez : widl: Use DECLSPEC_ALIGN in MSVC compatible way for return types too.

Alexandre Julliard julliard at winehq.org
Fri Aug 7 10:42:29 CDT 2020


Module: wine
Branch: stable
Commit: 95daac2bc175394730c97266480dd6526e570abf
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=95daac2bc175394730c97266480dd6526e570abf

Author: Emilio Cobos Álvarez <emilio at crisal.io>
Date:   Sun May 17 01:02:04 2020 +0200

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 at crisal.io>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit b1084ff910864a44d6fd0e0bda6b2b6c64987b2e)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 tools/widl/typegen.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index a1db88a7c0..04280cbb72 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -4813,20 +4813,21 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
         if (is_array( arg->declspec.type ) || is_ptr( arg->declspec.type )) align = pointer_size;
         else type_memsize_and_alignment( arg->declspec.type, &align );
 
-        if (align >= pointer_size)
-            fprintf( file, "%s;\n", arg->name );
-        else
-            fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name );
+        if (align < pointer_size)
+            fprintf( file, "DECLSPEC_ALIGN(%u) ", pointer_size );
+        fprintf( file, "%s;\n", arg->name );
     }
     if (add_retval && !is_void( retval->declspec.type ))
     {
         print_file(file, 2, "%s", "");
-        write_type_decl( file, &retval->declspec, retval->name );
-        if (is_array( retval->declspec.type ) || is_ptr( retval->declspec.type ) ||
-            type_memsize( retval->declspec.type ) == pointer_size)
-            fprintf( file, ";\n" );
-        else
-            fprintf( file, " DECLSPEC_ALIGN(%u);\n", pointer_size );
+        write_type_left( file, &retval->declspec, NAME_DEFAULT, TRUE, TRUE );
+        if (needs_space_after( retval->declspec.type )) fputc( ' ', file );
+        if (!is_array( retval->declspec.type ) && !is_ptr( retval->declspec.type ) &&
+            type_memsize( retval->declspec.type ) != pointer_size)
+        {
+            fprintf( file, "DECLSPEC_ALIGN(%u) ", pointer_size );
+        }
+        fprintf( file, "%s;\n", retval->name );
     }
     print_file(file, 1, "} %s;\n", var_decl );
     if (needs_packing) print_file( file, 0, "#include <poppack.h>\n" );




More information about the wine-cvs mailing list