widl: Always set pass-by-reference return value in get_user_type. get_user_type.

Gerald Pfeifer gerald at pfeifer.com
Sat Nov 18 03:49:06 CST 2017


GCC is warning about

   typegen.c:3711:16: warning: 'uname' may be used uninitialized 
   in this function [-Wmaybe-uninitialized]

and indeed looking at the code I can see why in

   case TGT_USER_TYPE:
   {
     const char *uname;
     const type_t *utype = get_user_type(type, &uname);
     return get_required_buffer_size_type(utype, uname, NULL, FALSE, alignment);
   }

The patch below addresses that (and hence one of two warnings left
with GCC 8).

Gerald


Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
 tools/widl/typegen.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index e63600c71b..34694f179d 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -316,7 +316,11 @@ static type_t *get_user_type(const type_t *t, const char **pname)
         if (type_is_alias(t))
             t = type_alias_get_aliasee(t);
         else
+        {
+            if (pname)
+                *pname = NULL;
             return NULL;
+        }
     }
 }
 
-- 
2.15.0



More information about the wine-patches mailing list