mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 16:47:42 +00:00
s390/tools: Use array instead of string initializer
The in-kernel disassembler intentionally uses nun-null terminated strings in order to keep the arrays which contain mnemonics as small as possible. GCC 15 however warns about this: ./arch/s390/include/generated/asm/dis-defs.h:1662:71: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization] 1662 | [1261] = { .opfrag = 0xea, .format = INSTR_SS_L0RDRD, .name = "unpka" }, \ Get rid of this warning by using array initializers. Reviewed-by: Jens Remus <jremus@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
b05d66c882
commit
7cbae7ea3d
@ -201,6 +201,17 @@ static int cmp_long_insn(const void *a, const void *b)
|
||||
return strcmp(((struct insn *)a)->name, ((struct insn *)b)->name);
|
||||
}
|
||||
|
||||
static void print_insn_name(const char *name)
|
||||
{
|
||||
size_t i, len;
|
||||
|
||||
len = strlen(name);
|
||||
printf("{");
|
||||
for (i = 0; i < len; i++)
|
||||
printf(" \'%c\',", name[i]);
|
||||
printf(" }");
|
||||
}
|
||||
|
||||
static void print_long_insn(struct gen_opcode *desc)
|
||||
{
|
||||
struct insn *insn;
|
||||
@ -223,7 +234,9 @@ static void print_long_insn(struct gen_opcode *desc)
|
||||
insn = &desc->insn[i];
|
||||
if (insn->name_len < 6)
|
||||
continue;
|
||||
printf("\t[LONG_INSN_%s] = \"%s\", \\\n", insn->upper, insn->name);
|
||||
printf("\t[LONG_INSN_%s] = ", insn->upper);
|
||||
print_insn_name(insn->name);
|
||||
printf(", \\\n");
|
||||
}
|
||||
printf("}\n\n");
|
||||
}
|
||||
@ -236,11 +249,13 @@ static void print_opcode(struct insn *insn, int nr)
|
||||
if (insn->type->byte != 0)
|
||||
opcode += 2;
|
||||
printf("\t[%4d] = { .opfrag = 0x%s, .format = INSTR_%s, ", nr, opcode, insn->format);
|
||||
if (insn->name_len < 6)
|
||||
printf(".name = \"%s\" ", insn->name);
|
||||
else
|
||||
printf(".offset = LONG_INSN_%s ", insn->upper);
|
||||
printf("}, \\\n");
|
||||
if (insn->name_len < 6) {
|
||||
printf(".name = ");
|
||||
print_insn_name(insn->name);
|
||||
} else {
|
||||
printf(".offset = LONG_INSN_%s", insn->upper);
|
||||
}
|
||||
printf(" }, \\\n");
|
||||
}
|
||||
|
||||
static void add_to_group(struct gen_opcode *desc, struct insn *insn, int offset)
|
||||
|
Loading…
x
Reference in New Issue
Block a user