Re: [PATCH] aarch64: remove casts from more struct initializers
Alice Carlotti <[email protected]> Sat, 25 Jul 2026 00:51:06 +0100
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
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)