scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit e4b354e60f5965d973035f14fb82c3e49e23d49c
parent 1735d0307f5ae6d8d7c766439aca3e6145b4df42
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  9 Dec 2024 09:47:18 +0100

cc2: Use unsigned for the alignment

The biggest alignment of a C type fits in an integer for sure.

Diffstat:
Msrc/cmd/scc-cc/cc2/amd64-sysv/code.c | 2+-
Msrc/cmd/scc-cc/cc2/cc2.h | 2+-
Msrc/cmd/scc-cc/cc2/i386-sysv/code.c | 2+-
Msrc/cmd/scc-cc/cc2/qbe/code.c | 2+-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cmd/scc-cc/cc2/amd64-sysv/code.c b/src/cmd/scc-cc/cc2/amd64-sysv/code.c @@ -164,7 +164,7 @@ label(Symbol *sym) break; } if (sym->type.align != 1) - printf("\t.align\t%lu\n", sym->type.align ); + printf("\t.align\t%d\n", sym->type.align); printf("%s:\n", name); } diff --git a/src/cmd/scc-cc/cc2/cc2.h b/src/cmd/scc-cc/cc2/cc2.h @@ -154,7 +154,7 @@ typedef struct inst Inst; struct type { unsigned long size; - unsigned long align; + unsigned align; unsigned short id; short flags; }; diff --git a/src/cmd/scc-cc/cc2/i386-sysv/code.c b/src/cmd/scc-cc/cc2/i386-sysv/code.c @@ -163,7 +163,7 @@ label(Symbol *sym) break; } if (sym->type.align != 1) - printf("\t.align\t%lu\n", sym->type.align ); + printf("\t.align\t%d\n", sym->type.align); printf("%s:\n", name); } diff --git a/src/cmd/scc-cc/cc2/qbe/code.c b/src/cmd/scc-cc/cc2/qbe/code.c @@ -559,7 +559,7 @@ asalloc(void) Type *tp = &sym->type; extern Type ptrtype; - printf("\t%s =%s\talloc%lu\t%lu\n", + printf("\t%s =%s\talloc%d\t%lu\n", symname(sym), size2asm(&ptrtype), tp->align+3 & ~3, tp->size); }