bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH] unictype/joininggroup_name: fix cast from pointer to integer warning in Windows
@ 2020-06-15 19:21 Biswapriyo Nath
  2020-06-15 20:18 ` Bruno Haible
  0 siblings, 1 reply; 2+ messages in thread
From: Biswapriyo Nath @ 2020-06-15 19:21 UTC (permalink / raw)
  To: bug-gnulib; +Cc: alexpux


[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #1.2: Type: text/html, Size: 112 bytes --]

[-- Attachment #2: 0001-unictype-joininggroup_name-fix-cast-from-pointer-to-.patch --]
[-- Type: text/plain, Size: 999 bytes --]

From f45476a45b1e9c5af879d4ed663917ac263baf92 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Tue, 16 Jun 2020 00:47:03 +0530
Subject: [PATCH] unictype/joininggroup_name: fix cast from pointer to integer warning in Windows

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
---
 lib/unictype/joininggroup_name.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/unictype/joininggroup_name.c b/lib/unictype/joininggroup_name.c
index dc683f8..429a073 100644
--- a/lib/unictype/joininggroup_name.c
+++ b/lib/unictype/joininggroup_name.c
@@ -40,7 +40,12 @@ static const struct joining_group_stringpool_t joining_group_stringpool_contents
 
 static const int joining_group_index[] =
   {
+#ifdef _WIN32
+#define ELEM(tag,string) (intptr_t)&((struct joining_group_stringpool_t *)0)->tag,
+#else
 #define ELEM(tag,string) (int)(long)&((struct joining_group_stringpool_t *)0)->tag,
+#endif
+
 #include "unictype/joininggroup_name.h"
 #undef ELEM
   };
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] unictype/joininggroup_name: fix cast from pointer to integer warning in Windows
  2020-06-15 19:21 [PATCH] unictype/joininggroup_name: fix cast from pointer to integer warning in Windows Biswapriyo Nath
@ 2020-06-15 20:18 ` Bruno Haible
  0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2020-06-15 20:18 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Biswapriyo Nath, alexpux

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
   };



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-15 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 19:21 [PATCH] unictype/joininggroup_name: fix cast from pointer to integer warning in Windows Biswapriyo Nath
2020-06-15 20:18 ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).