Re: [PATCH] ipc: supress warning on cast of ipc_port_t to name

2026-01-28 Thread Samuel Thibault
Applied, thanks!

Milos Nikic, le mer. 28 janv. 2026 14:22:27 -0800, a ecrit:
> This patch fixes a warning when building on 64-bit architectures where
> sizeof(void *) > sizeof(mach_port_name_t).
> 
> The double cast (via uintptr_t) explicitly tells the compiler that the
> truncation of the pointer value into the 32-bit port name is intentional,
> preserving the existing behavior while silencing the warning.
> ---
>  ipc/ipc_port.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
> index e959f67..884a4f4 100644
> --- a/ipc/ipc_port.c
> +++ b/ipc/ipc_port.c
> @@ -35,6 +35,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  
>  #include 
> @@ -1177,6 +1178,7 @@ ipc_port_t
>  ipc_port_alloc_special(ipc_space_t space)
>  {
>   ipc_port_t port;
> + mach_port_name_t name;
>  
>   port = ip_alloc();
>   if (port == IP_NULL)
> @@ -1197,7 +1199,8 @@ ipc_port_alloc_special(ipc_space_t space)
>*  the fast rpc path).
>*/
>  
> - ipc_port_init(port, space, (mach_port_name_t)port);
> + name = (mach_port_name_t)(uintptr_t) port;
> + ipc_port_init(port, space, name);
>  
>   return port;
>  }
> -- 
> 2.52.0
> 
> 

-- 
Samuel
 on se croirait en cool : Some browsers close comments on the first ">" 
character, so to hide script content from such browsers, you can transpose 
operands for relational and shift operators (e.g., use "y < x" rather than "x > 
y") or use scripting language-dependent escapes for ">".
 -+- #ens-mim -+-



[PATCH] ipc: supress warning on cast of ipc_port_t to name

2026-01-28 Thread Milos Nikic
This patch fixes a warning when building on 64-bit architectures where
sizeof(void *) > sizeof(mach_port_name_t).

The double cast (via uintptr_t) explicitly tells the compiler that the
truncation of the pointer value into the 32-bit port name is intentional,
preserving the existing behavior while silencing the warning.
---
 ipc/ipc_port.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index e959f67..884a4f4 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -35,6 +35,7 @@
  */
 
 #include 
+#include 
 #include 
 
 #include 
@@ -1177,6 +1178,7 @@ ipc_port_t
 ipc_port_alloc_special(ipc_space_t space)
 {
ipc_port_t port;
+   mach_port_name_t name;
 
port = ip_alloc();
if (port == IP_NULL)
@@ -1197,7 +1199,8 @@ ipc_port_alloc_special(ipc_space_t space)
 *  the fast rpc path).
 */
 
-   ipc_port_init(port, space, (mach_port_name_t)port);
+   name = (mach_port_name_t)(uintptr_t) port;
+   ipc_port_init(port, space, name);
 
return port;
 }
-- 
2.52.0