[PATCH gnupg] Fix pointer to integer cast warnings in Windows platform

NIIBE Yutaka gniibe at fsij.org
Wed Oct 5 08:47:40 CEST 2022


Hello,

Biswapriyo Nath wrote:
> Is it possible to review the patch please? Am I missing something
> which can prevent the review process?

I think that you assume that GnuPG is supported on Windows for 64-bit
architecture.  I don't think it's true.  My understanding is that we
need to fix problems, for Windows for 64-bit architecture.

It seems for me that your changes basically to silence warnings, hiding
the problems instead of fixing.

For now, I can only comment two changes:

diff --git a/agent/call-daemon.c b/agent/call-daemon.c
index 0c36052..cb03f3a 100644
--- a/agent/call-daemon.c
+++ b/agent/call-daemon.c
@@ -472,7 +472,7 @@ daemon_start (enum daemon_type type, ctrl_t ctrl)

 #ifdef HAVE_W32_SYSTEM
       snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
-                (unsigned long)get_agent_daemon_notify_event ());
+                (unsigned long)(uintptr_t)get_agent_daemon_notify_event ());
 #else
       snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
 #endif


IIUC, you tried to silence the warning of -Wpointer-to-int-cast.
If I fixed, I would fix the printing format and remove the cast.


diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index c6c52be..aecdd6e 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -129,7 +129,7 @@ void
 agent_query_dump_state (void)
 {
   log_info ("agent_query_dump_state: entry_ctx=%p pid=%ld popup_tid=%p\n",
-            entry_ctx, (long)assuan_get_pid (entry_ctx), (void*)popup_tid);
+            entry_ctx, (long)assuan_get_pid (entry_ctx), (void*)(uintptr_t)popup_tid);
 }

 /* Called to make sure that a popup window owned by the current


IIUC, you tried to silence the warning of -Wint-to-pointer-cast.

I think that we would need to fix Npth API here, if we want to maximize
clean use of Npth API between different systems.  The fundamental
problem is that the type "long" is not compatible to pointer on LLP64 system.


Those problems will be fixed eventually, when GnuPG will be supported on
Windows for 64-bit architecture.

Today, I created: https://dev.gnupg.org/T6227

I have:
https://dev.gnupg.org/T4655
https://dev.gnupg.org/T4656
-- 



More information about the Gnupg-devel mailing list