summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndreas Fried <andreas.fried@kit.edu>2021-10-29 13:49:02 +0200
committerAndreas Fried <andreas.fried@kit.edu>2021-10-29 13:49:02 +0200
commit3be8b1900506805e4c791f2815e810b8f7f8695c (patch)
treedb27a49ffc8984c1203f5218fbaf45002daa034d
parent61f23b0e05096e08c39a60f1ee9bc515326309ef (diff)
Silence some newer GCC warnings.
GCC warns if buffers used with %s in snprintf are longer than the destination buffer plus any fixed characters in the format string. We shorten the buffers accordingly. Also, a fallthrough comment was in a wrong position. It goes after the closing brace of a case-block.
-rw-r--r--ir/be/amd64/amd64_emitter.c2
-rw-r--r--ir/ir/irargs.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/ir/be/amd64/amd64_emitter.c b/ir/be/amd64/amd64_emitter.c
index 920fbe7..fdbdf8e 100644
--- a/ir/be/amd64/amd64_emitter.c
+++ b/ir/be/amd64/amd64_emitter.c
@@ -256,8 +256,8 @@ static void amd64_emit_am(const ir_node *const node, bool indirect_star)
const arch_register_t *reg2 = arch_get_irn_register_in(node, 2);
emit_register_mode(reg2, attr->base.size);
be_emit_cstring(", ");
- // fallthrough
}
+ // fallthrough
case AMD64_OP_REG_REG: {
const arch_register_t *reg1 = arch_get_irn_register_in(node, 1);
emit_register_mode(reg1, attr->base.size);
diff --git a/ir/ir/irargs.c b/ir/ir/irargs.c
index 0bf2f87..024ddb8 100644
--- a/ir/ir/irargs.c
+++ b/ir/ir/irargs.c
@@ -138,7 +138,7 @@ static int firm_emit(lc_appendable_t *app, const lc_arg_occ_t *occ,
}
case k_type: {
ir_type *type = (ir_type*)X;
- char type_name[256];
+ char type_name[255];
ir_print_type(type_name, sizeof(type_name), type);
tp_opcode opcode = get_type_opcode(type);
snprintf(buf, sizeof(buf), "%s%s:%s", A("type"),
@@ -170,7 +170,7 @@ static int firm_emit(lc_appendable_t *app, const lc_arg_occ_t *occ,
break;
default:
if (is_Const(node)) {
- char tv_buf[256];
+ char tv_buf[253];
ir_tarval *tv = get_Const_tarval(node);
if (tv)
tarval_snprintf(tv_buf, sizeof(tv_buf), tv);