[PATCH 2/3] opcodes: fix -std=gnu23 compatibility wrt static_assert

Jens Remus jremus@linux.ibm.com
Mon Nov 18 09:39:17 GMT 2024
On 16.11.2024 07:32, Sam James wrote:
> static_assert is declared in C23 so we can't reuse that identifier:
> * Define our own static_assert conditionally;

...

> diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
> index 9d9f0973e55..49efd714157 100644
> --- a/opcodes/s390-opc.c
> +++ b/opcodes/s390-opc.c
> @@ -36,7 +36,9 @@
>   
>   /* Build-time checks are preferrable over runtime ones.  Use this construct
>      in preference where possible.  */
> +#ifndef static_assert
>   #define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
> +#endif
>   
>   #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
>   

Thanks for taking care! LGTM.

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303) and z/VSE Support
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des 
Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der 
Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list