diff mbox series

Update BAD_TYPECHECK to work on x86_64

Message ID ZUhn7LOcgLOJjKZr@jupiter.tail36e24.ts.net
State New
Headers show
Series Update BAD_TYPECHECK to work on x86_64 | expand

Commit Message

Flavio Cruz Nov. 6, 2023, 4:13 a.m. UTC
---
 sysdeps/mach/mach_rpc.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Samuel Thibault Nov. 6, 2023, 10:30 p.m. UTC | #1
Applied, thanks!

Flavio Cruz, le dim. 05 nov. 2023 23:13:32 -0500, a ecrit:
> ---
>  sysdeps/mach/mach_rpc.h | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/sysdeps/mach/mach_rpc.h b/sysdeps/mach/mach_rpc.h
> index 152f057ca7..ed81403be6 100644
> --- a/sysdeps/mach/mach_rpc.h
> +++ b/sysdeps/mach/mach_rpc.h
> @@ -20,11 +20,8 @@
>  
>  /* Macro used by MIG to cleanly check the type.  */
>  #define BAD_TYPECHECK(type, check) __glibc_unlikely (({	\
> -  union { mach_msg_type_t t; uint32_t w; } _t, _c;	\
> +  union { mach_msg_type_t t; uintptr_t w; } _t, _c;	\
>    _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))
>  
> -/* TODO: add this assertion for x86_64.  */
> -#ifndef __x86_64__
> -_Static_assert (sizeof (uint32_t) == sizeof (mach_msg_type_t),
> -                "mach_msg_type_t needs to be the same size as uint32_t");
> -#endif
> +_Static_assert (sizeof (uintptr_t) == sizeof (mach_msg_type_t),
> +                "mach_msg_type_t needs to be the same size as uintptr_t");
> -- 
> 2.39.2
diff mbox series

Patch

diff --git a/sysdeps/mach/mach_rpc.h b/sysdeps/mach/mach_rpc.h
index 152f057ca7..ed81403be6 100644
--- a/sysdeps/mach/mach_rpc.h
+++ b/sysdeps/mach/mach_rpc.h
@@ -20,11 +20,8 @@ 
 
 /* Macro used by MIG to cleanly check the type.  */
 #define BAD_TYPECHECK(type, check) __glibc_unlikely (({	\
-  union { mach_msg_type_t t; uint32_t w; } _t, _c;	\
+  union { mach_msg_type_t t; uintptr_t w; } _t, _c;	\
   _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))
 
-/* TODO: add this assertion for x86_64.  */
-#ifndef __x86_64__
-_Static_assert (sizeof (uint32_t) == sizeof (mach_msg_type_t),
-                "mach_msg_type_t needs to be the same size as uint32_t");
-#endif
+_Static_assert (sizeof (uintptr_t) == sizeof (mach_msg_type_t),
+                "mach_msg_type_t needs to be the same size as uintptr_t");