[2/6] widl: Ignore assigment of a duplicate uuid.

Dmitry Timoshkov dmitry at baikal.ru
Thu Oct 15 07:46:46 CDT 2015


MSDN KB285146 article describes this behaviour, and the tests in the last
patch confirm that.

Technically this means that in the construct like

typedef [uuid(016fe2ec-b2c8-45f8-b23b-39e53a75396d)]
enum _d { d1, d2 } d;

only 'd' gets assigned the specified uuid, '_d' will get uuid offset set
to -1 (undefined) which leads to '_d' having NULL_GUID. This matches widl
behaviour, in this case widl emits a warning (mentioned in the KB article).

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 tools/widl/write_msft.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index fc0eae7..68e61e8 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -497,7 +497,14 @@ static int ctl2_alloc_guid(
     hash_key = ctl2_hash_guid(&guid->guid);
 
     offset = ctl2_find_guid(typelib, hash_key, &guid->guid);
-    if (offset != -1) return offset;
+    if (offset != -1)
+    {
+        warning("duplicate uuid {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
+                 guid->guid.Data1, guid->guid.Data2, guid->guid.Data3,
+                 guid->guid.Data4[0], guid->guid.Data4[1], guid->guid.Data4[2], guid->guid.Data4[3],
+                 guid->guid.Data4[4], guid->guid.Data4[5], guid->guid.Data4[6], guid->guid.Data4[7]);
+        return -1;
+    }
 
     offset = ctl2_alloc_segment(typelib, MSFT_SEG_GUID, sizeof(MSFT_GuidEntry), 0);
 
-- 
2.6.1




More information about the wine-patches mailing list