[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] unictype/joininggroup_name: fix cast from pointer to integer
From: |
Bruno Haible |
Subject: |
Re: [PATCH] unictype/joininggroup_name: fix cast from pointer to integer warning in Windows |
Date: |
Mon, 15 Jun 2020 22:18:17 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; ) |
Hi Biswapriyo,
Thanks for the report and patch.
I prefer a patch without #if.
And the intermediate type can be intptr_t, uintptr_t, or size_t. I prefer
size_t because that's how gperf does it (and gperf does it like this because
it avoids including <stdint.h>).
2020-06-15 Bruno Haible <bruno@clisp.org>
unictype/joininggroup-name: Fix warning on 64-bit mingw.
Reported by Biswapriyo Nath <nathbappai@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-06/msg00036.html>.
* lib/unictype/joininggroup_name.c (ELEM): Cast struct offset to size_t
first.
diff --git a/lib/unictype/joininggroup_name.c b/lib/unictype/joininggroup_name.c
index dc683f8..b45ab5c 100644
--- a/lib/unictype/joininggroup_name.c
+++ b/lib/unictype/joininggroup_name.c
@@ -40,7 +40,7 @@ static const struct joining_group_stringpool_t
joining_group_stringpool_contents
static const int joining_group_index[] =
{
-#define ELEM(tag,string) (int)(long)&((struct joining_group_stringpool_t
*)0)->tag,
+#define ELEM(tag,string) (int)(size_t)&((struct joining_group_stringpool_t
*)0)->tag,
#include "unictype/joininggroup_name.h"
#undef ELEM
};