commit 6f45894c7f5f145208e0fce4344b2b87eb8ae722
parent 498af259eb087e38f22c7ba49615cd38e271fabd
Author: Quentin Carbonneaux <quentin@c9x.me>
Date: Wed, 15 Mar 2023 22:07:18 +0100
silence some warnings
Diffstat:
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -13,7 +13,8 @@ OBJ = $(COMMOBJ) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ)
SRCALL = $(OBJ:.o=.c)
-CFLAGS = $(CPPFLAGS) -Wall -Wextra -std=c99 -g -Wpedantic
+CFLAGS = $(CPPFLAGS) -std=c99 -g \
+ -Wall -Wextra -Wpedantic -Wno-format-truncation
qbe: $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) -o $@
diff --git a/amd64/sysv.c b/amd64/sysv.c
@@ -512,7 +512,7 @@ split(Fn *fn, Blk *b)
idup(&bn->ins, curi, bn->nins);
curi = &insb[NIns];
bn->visit = ++b->visit;
- (void)!snprintf(bn->name, NString, "%s.%d", b->name, b->visit);
+ snprintf(bn->name, NString, "%s.%d", b->name, b->visit);
bn->loop = b->loop;
bn->link = b->link;
b->link = bn;
diff --git a/arm64/abi.c b/arm64/abi.c
@@ -446,6 +446,7 @@ selcall(Fn *fn, Ins *i0, Ins *i1, Insl **ilp)
case 2: op = Ostoreh; break;
case 4:
case 8: op = store[*c->cls]; break;
+ default: die("unreachable");
}
emit(op, 0, R, i->arg[0], r);
} else {
@@ -546,7 +547,7 @@ split(Fn *fn, Blk *b)
idup(&bn->ins, curi, bn->nins);
curi = &insb[NIns];
bn->visit = ++b->visit;
- (void)!snprintf(bn->name, NString, "%s.%d", b->name, b->visit);
+ snprintf(bn->name, NString, "%s.%d", b->name, b->visit);
bn->loop = b->loop;
bn->link = b->link;
b->link = bn;
diff --git a/rega.c b/rega.c
@@ -239,6 +239,8 @@ pmrec(enum PMStat *status, int i, int *k)
c = -1;
emit(Ocopy, pm[i].cls, pm[i].dst, pm[i].src, R);
break;
+ default:
+ die("unreachable");
}
status[i] = Moved;
return c;
@@ -668,7 +670,7 @@ rega(Fn *fn)
b1->link = blist;
blist = b1;
fn->nblk++;
- (void)!snprintf(b1->name, sizeof(b1->name), "%s_%s", b->name, s->name);
+ snprintf(b1->name, NString, "%s_%s", b->name, s->name);
b1->nins = &insb[NIns] - curi;
stmov += b1->nins;
stblk += 1;