harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit 57a34f36c869b38e8cddade9174d1eb04a5f23c0
parent 068e8da091f9053726251bc221abf40fdea630ff
Author: Sertonix <sertonix@posteo.net>
Date:   Fri, 21 Apr 2023 23:48:06 +0000

fix types on 32bit platform

In 2 places the string format expects `size_t` to be of type `long`.
This breaks the build on 32bit platforms. Maybe the automatic builds
could be ran with different architectures to prevent such problems in
the future.

Diffstat:
Msrc/check.c | 2+-
Msrc/emit.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -698,7 +698,7 @@ check_expr_assert(struct context *ctx, if (!cond) { if (aexpr->assert.message != NULL) { char format[40]; - snprintf(format, 40, "Static assertion failed %%%lds", + snprintf(format, 40, "Static assertion failed %%%zds", expr->assert.message->constant.string.len); if (aexpr->assert.cond == NULL) { error(ctx, aexpr->loc, expr, format, diff --git a/src/emit.c b/src/emit.c @@ -327,7 +327,7 @@ emit_data(struct qbe_def *def, FILE *out) fprintf(out, "%s\ndata $%s = ", def->exported ? " export" : "", def->name); if (def->data.align != ALIGN_UNDEFINED) { - fprintf(out, "align %lu ", def->data.align); + fprintf(out, "align %zu ", def->data.align); } fprintf(out, "{ ");