widl: Don't generate memset calls with zero length parameter.

Nicolas Le Cam niko.lecam at gmail.com
Wed Nov 18 12:54:41 CST 2009


This fixes the only warning I'm seeing on 32bit wine (when using
-Wno-unused-result) :

In file included from /usr/include/string.h:641,
                 from server_c.c:3:
In function ‘memset’,
    inlined from ‘make_pyramid_doub_carr’ at server_c.c:3880:
/usr/include/bits/string3.h:82: warning: call to
‘__warn_memset_zero_len’ declared with attribute warning: memset used
with constant zero length parameter; this could be due to transposed
parameters

-- 
Nicolas Le Cam
-------------- next part --------------
From b353500cb5cb68cfaebe3ed0e442fd319b6beaa8 Mon Sep 17 00:00:00 2001
From: Nicolas Le Cam <niko.lecam at gmail.com>
Date: Wed, 18 Nov 2009 19:39:08 +0100
Subject: widl: Don't generate memset calls with zero length parameter.

---
 tools/widl/typegen.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index fdb2379..68e9da1 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -3298,7 +3298,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
             size = 0;
         }
 
-        if (phase == PHASE_MARSHAL)
+        if (phase == PHASE_MARSHAL && alignment > 1)
             print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
         print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n",
                     alignment - 1, alignment - 1);
-- 
1.6.3.3


More information about the wine-patches mailing list