aarch64: remove casts from more struct initializers

Message ID 20f5044f-1c6a-4988-bda3-67495b8423e4@suse.com
State Committed
Headers
Series aarch64: remove casts from more struct initializers |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Jan Beulich July 24, 2026, 8:48 a.m. UTC
  Commit 0e89ce812b79 ("aarch64: Remove cast from struct initializer")
didn't go quite far enough: The building of aarch64-gen itself has a
similar issue. Cover that as well. Since FLD_CONST_* are used only there,
move their #define-s there rather than introducing more #undef-s.
  

Comments

Alice Carlotti July 24, 2026, 11:51 p.m. UTC | #1
On Fri, Jul 24, 2026 at 10:48:01AM +0200, Jan Beulich wrote:
> Commit 0e89ce812b79 ("aarch64: Remove cast from struct initializer")
> didn't go quite far enough: The building of aarch64-gen itself has a
> similar issue. Cover that as well. Since FLD_CONST_* are used only there,
> move their #define-s there rather than introducing more #undef-s.

OK, thanks - and apologies again for the breakage.

Alice

> 
> --- a/opcodes/aarch64-gen.c
> +++ b/opcodes/aarch64-gen.c
> @@ -994,7 +994,12 @@ typedef struct operand operand;
>  #undef F
>  #endif
>  
> -#define FLD AARCH64_FIELD
> +#define FLD(lsb, w)  { .num = lsb, .width = w }
> +
> +#define FLD_CONST_0  { .num = 0, .width = 1, .is_const = true }
> +#define FLD_CONST_00 { .num = 0, .width = 2, .is_const = true }
> +#define FLD_CONST_01 { .num = 1, .width = 2, .is_const = true }
> +#define FLD_CONST_1  { .num = 1, .width = 1, .is_const = true }
>  
>  /* The parentheses used when calling this macro ensure that the list of fields
>     appears as a single argument to the X and Y macros.  */
> --- a/opcodes/aarch64-opc.h
> +++ b/opcodes/aarch64-opc.h
> @@ -59,11 +59,6 @@ typedef struct aarch64_field aarch64_fie
>  #define AARCH64_FIELD_CONST(val, width) ((aarch64_field) {width, val, true})
>  #define AARCH64_FIELD_NIL ((aarch64_field) {0, 0, false})
>  
> -#define FLD_CONST_0 AARCH64_FIELD_CONST (0, 1)
> -#define FLD_CONST_00 AARCH64_FIELD_CONST (0, 2)
> -#define FLD_CONST_01 AARCH64_FIELD_CONST (1, 2)
> -#define FLD_CONST_1 AARCH64_FIELD_CONST (1, 1)
> -
>  /* Instruction fields.  These defines are included to reduce the initial diff
>     size, but the indirection should eventually be eliminated.  */
>  #define FLD_CRm                AARCH64_FIELD( 8,  4)
  

Patch

--- a/opcodes/aarch64-gen.c
+++ b/opcodes/aarch64-gen.c
@@ -994,7 +994,12 @@  typedef struct operand operand;
 #undef F
 #endif
 
-#define FLD AARCH64_FIELD
+#define FLD(lsb, w)  { .num = lsb, .width = w }
+
+#define FLD_CONST_0  { .num = 0, .width = 1, .is_const = true }
+#define FLD_CONST_00 { .num = 0, .width = 2, .is_const = true }
+#define FLD_CONST_01 { .num = 1, .width = 2, .is_const = true }
+#define FLD_CONST_1  { .num = 1, .width = 1, .is_const = true }
 
 /* The parentheses used when calling this macro ensure that the list of fields
    appears as a single argument to the X and Y macros.  */
--- a/opcodes/aarch64-opc.h
+++ b/opcodes/aarch64-opc.h
@@ -59,11 +59,6 @@  typedef struct aarch64_field aarch64_fie
 #define AARCH64_FIELD_CONST(val, width) ((aarch64_field) {width, val, true})
 #define AARCH64_FIELD_NIL ((aarch64_field) {0, 0, false})
 
-#define FLD_CONST_0 AARCH64_FIELD_CONST (0, 1)
-#define FLD_CONST_00 AARCH64_FIELD_CONST (0, 2)
-#define FLD_CONST_01 AARCH64_FIELD_CONST (1, 2)
-#define FLD_CONST_1 AARCH64_FIELD_CONST (1, 1)
-
 /* Instruction fields.  These defines are included to reduce the initial diff
    size, but the indirection should eventually be eliminated.  */
 #define FLD_CRm                AARCH64_FIELD( 8,  4)