[2/3] widl: Don't output method macro if name duplicates another method name

Nikolay Sivov nsivov at codeweavers.com
Fri Jul 27 10:40:02 CDT 2012


Don't output method macro if name duplicates another method name
-------------- next part --------------
>From a93e4efadcc0b5659699c0d4b8b39d08c471f5ab Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri, 27 Jul 2012 19:29:01 +0400
Subject: [PATCH 3/3] Don't output method macro if name duplicates another method name

---
 tools/widl/header.c |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/tools/widl/header.c b/tools/widl/header.c
index 9b1a2ca..d702b63 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -824,6 +824,28 @@ const var_t *is_callas(const attr_list_t *a)
   return get_attrp(a, ATTR_CALLAS);
 }
 
+static int is_inherited_method(const type_t *iface, const var_t *func)
+{
+  while ((iface = type_iface_get_inherit(iface)))
+  {
+    const statement_t *stmt;
+    STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
+    {
+      const var_t *funccmp = stmt->u.var;
+
+      if (!is_callas(func->attrs))
+      {
+         char inherit_name[256];
+         /* compare full name including property prefix */
+         strcpy(inherit_name, get_name(funccmp));
+         if (!strcmp(inherit_name, get_name(func))) return 1;
+      }
+    }
+  }
+
+  return 0;
+}
+
 static void write_method_macro(FILE *header, const type_t *iface, const char *name)
 {
   const statement_t *stmt;
@@ -842,7 +864,7 @@ static void write_method_macro(FILE *header, const type_t *iface, const char *na
       first_iface = 0;
     }
 
-    if (!is_callas(func->attrs)) {
+    if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) {
       const var_t *arg;
 
       fprintf(header, "#define %s_%s(This", name, get_name(func));
@@ -954,28 +976,6 @@ static void write_inline_wrappers(FILE *header, const type_t *iface, const char
   }
 }
 
-static int is_inherited_method(const type_t *iface, const var_t *func)
-{
-  while ((iface = type_iface_get_inherit(iface)))
-  {
-    const statement_t *stmt;
-    STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
-    {
-      const var_t *funccmp = stmt->u.var;
-
-      if (!is_callas(func->attrs))
-      {
-         char inherit_name[256];
-         /* compare full name including property prefix */
-         strcpy(inherit_name, get_name(funccmp));
-         if (!strcmp(inherit_name, get_name(func))) return 1;
-      }
-    }
-  }
-
-  return 0;
-}
-
 static void do_write_c_method_def(FILE *header, const type_t *iface, const char *name)
 {
   const statement_t *stmt;
-- 
1.5.6.5




More information about the wine-patches mailing list