scc

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

commit 7d4935f67a93400ffd2d3f1ce38ad574dae53ba6
parent 7a03077ea6e8f3c3e87495764e51756970c12fea
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  3 May 2021 19:27:26 +0200

Merge commit '5b35e653' into master

Diffstat:
Msrc/cmd/cc/cc1/amd64-sysv.c | 8++++----
Msrc/cmd/cc/cc1/arch.c | 6+++---
Msrc/cmd/cc/cc1/arm64-sysv.c | 8++++----
Msrc/cmd/cc/cc1/builtin.c | 4++--
Msrc/cmd/cc/cc1/cc1.h | 6+++---
Msrc/cmd/cc/cc1/expr.c | 1+
Msrc/cmd/cc/cc1/i386-sysv.c | 8++++----
Msrc/cmd/cc/cc1/types.c | 2+-
Msrc/cmd/cc/cc1/z80-scc.c | 8++++----
Msrc/cmd/cc/posix/cc.c | 4++--
Msrc/libc/arch/amd64/Makefile | 4+++-
Msrc/libc/arch/arm/Makefile | 4+++-
Msrc/libc/arch/arm64/Makefile | 4+++-
Msrc/libc/arch/i386/Makefile | 4+++-
Msrc/libc/arch/ppc/Makefile | 4+++-
15 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/src/cmd/cc/cc1/amd64-sysv.c b/src/cmd/cc/cc1/amd64-sysv.c @@ -71,7 +71,7 @@ amd64_sysv(void) .align = 1, .n.rank = RANK_CHAR, }, - .ushortype = { + .ushorttype = { .op = INT, .letter = L_UINT16, .prop = TDEFINED | TINTEGER | TARITH, @@ -80,7 +80,7 @@ amd64_sysv(void) .n.rank = RANK_USHORT, }, - .shortype = { + .shorttype = { .op = INT, .letter = L_INT16, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, @@ -88,7 +88,7 @@ amd64_sysv(void) .align = 2, .n.rank = RANK_SHORT, }, - .uinttype = (Type) { + .uinttype = { .op = INT, .letter = L_UINT32, .prop = TDEFINED | TINTEGER | TARITH, @@ -96,7 +96,7 @@ amd64_sysv(void) .align = 4, .n.rank = RANK_UINT, }, - .inttype = (Type) { + .inttype = { .op = INT, .letter = L_INT32, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, diff --git a/src/cmd/cc/cc1/arch.c b/src/cmd/cc/cc1/arch.c @@ -9,7 +9,7 @@ Type *voidtype, *pvoidtype, *booltype, *uchartype, *chartype, *schartype, *uinttype, *inttype, *sizettype, *pdifftype, - *ushortype, *shortype, + *ushorttype, *shorttype, *longtype, *ulongtype, *ullongtype, *llongtype, *floattype, *doubletype, *ldoubletype, @@ -66,8 +66,8 @@ iarch(void) inttype = &arch->inttype; sizettype = &arch->sizettype; pdifftype = &arch->pdifftype; - ushortype = &arch->ushortype; - shortype = &arch->shortype; + ushorttype = &arch->ushorttype; + shorttype = &arch->shorttype; longtype = &arch->longtype; ulongtype = &arch->ulongtype; ullongtype = &arch->ullongtype; diff --git a/src/cmd/cc/cc1/arm64-sysv.c b/src/cmd/cc/cc1/arm64-sysv.c @@ -71,7 +71,7 @@ arm64_sysv(void) .align = 1, .n.rank = RANK_CHAR, }, - .ushortype = { + .ushorttype = { .op = INT, .letter = L_UINT16, .prop = TDEFINED | TINTEGER | TARITH, @@ -80,7 +80,7 @@ arm64_sysv(void) .n.rank = RANK_USHORT, }, - .shortype = { + .shorttype = { .op = INT, .letter = L_INT16, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, @@ -88,7 +88,7 @@ arm64_sysv(void) .align = 2, .n.rank = RANK_SHORT, }, - .uinttype = (Type) { + .uinttype = { .op = INT, .letter = L_UINT32, .prop = TDEFINED | TINTEGER | TARITH, @@ -96,7 +96,7 @@ arm64_sysv(void) .align = 4, .n.rank = RANK_UINT, }, - .inttype = (Type) { + .inttype = { .op = INT, .letter = L_INT32, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, diff --git a/src/cmd/cc/cc1/builtin.c b/src/cmd/cc/cc1/builtin.c @@ -19,7 +19,7 @@ builtin_va_arg(Symbol *sym) } if (tp == booltype || tp == chartype || tp == uchartype || tp == schartype || - tp == shortype || tp == ushortype) { + tp == shorttype || tp == ushorttype) { warn("bool, char and short are promoted to int when passed through '...'"); tp = (tp->prop & TSIGNED) ? inttype : uinttype; } @@ -75,7 +75,7 @@ builtin_va_start(Symbol *sym) tp = last->type; if (tp == booltype || tp == chartype || tp == uchartype || tp == schartype || - tp == shortype || tp == ushortype) { + tp == shorttype || tp == ushorttype) { warn("last parameter before '...' must not be bool, char or short"); } diff --git a/src/cmd/cc/cc1/cc1.h b/src/cmd/cc/cc1/cc1.h @@ -370,8 +370,8 @@ struct arch { Type schartype; Type uchartype; Type chartype; - Type ushortype; - Type shortype; + Type ushorttype; + Type shorttype; Type uinttype; Type inttype; Type longtype; @@ -530,7 +530,7 @@ extern Type *voidtype, *pvoidtype, *booltype, *uchartype, *chartype, *schartype, *uinttype, *inttype, *sizettype, *pdifftype, - *ushortype, *shortype, + *ushorttype, *shorttype, *longtype, *ulongtype, *ullongtype, *llongtype, *floattype, *doubletype, *ldoubletype, diff --git a/src/cmd/cc/cc1/expr.c b/src/cmd/cc/cc1/expr.c @@ -348,6 +348,7 @@ arithmetic(int op, Node *lp, Node *rp) } } errorp("incorrect arithmetic operands"); + return lp; } static Node * diff --git a/src/cmd/cc/cc1/i386-sysv.c b/src/cmd/cc/cc1/i386-sysv.c @@ -71,7 +71,7 @@ i386_sysv(void) .align = 1, .n.rank = RANK_CHAR, }, - .ushortype = { + .ushorttype = { .op = INT, .letter = L_UINT16, .prop = TDEFINED | TINTEGER | TARITH, @@ -80,7 +80,7 @@ i386_sysv(void) .n.rank = RANK_USHORT, }, - .shortype = { + .shorttype = { .op = INT, .letter = L_INT16, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, @@ -88,7 +88,7 @@ i386_sysv(void) .align = 2, .n.rank = RANK_SHORT, }, - .uinttype = (Type) { + .uinttype = { .op = INT, .letter = L_UINT32, .prop = TDEFINED | TINTEGER | TARITH, @@ -96,7 +96,7 @@ i386_sysv(void) .align = 4, .n.rank = RANK_UINT, }, - .inttype = (Type) { + .inttype = { .op = INT, .letter = L_INT32, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, diff --git a/src/cmd/cc/cc1/types.c b/src/cmd/cc/cc1/types.c @@ -138,7 +138,7 @@ ctype(int type, int sign, int size) case 0: return (sign == UNSIGNED) ? uinttype : inttype; case SHORT: - return (sign == UNSIGNED) ? ushortype : shortype; + return (sign == UNSIGNED) ? ushorttype : shorttype; case LONG: return (sign == UNSIGNED) ? ulongtype : longtype; case LLONG: diff --git a/src/cmd/cc/cc1/z80-scc.c b/src/cmd/cc/cc1/z80-scc.c @@ -71,7 +71,7 @@ z80_scc(void) .align = 1, .n.rank = RANK_CHAR, }, - .ushortype = { + .ushorttype = { .op = INT, .letter = L_UINT16, .prop = TDEFINED | TINTEGER | TARITH, @@ -80,7 +80,7 @@ z80_scc(void) .n.rank = RANK_USHORT, }, - .shortype = { + .shorttype = { .op = INT, .letter = L_INT16, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, @@ -88,7 +88,7 @@ z80_scc(void) .align = 2, .n.rank = RANK_SHORT, }, - .uinttype = (Type) { + .uinttype = { .op = INT, .letter = L_UINT16, .prop = TDEFINED | TINTEGER | TARITH, @@ -96,7 +96,7 @@ z80_scc(void) .align = 1, .n.rank = RANK_UINT, }, - .inttype = (Type) { + .inttype = { .op = INT, .letter = L_INT16, .prop = TDEFINED | TINTEGER | TARITH | TSIGNED, diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c @@ -1,5 +1,5 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE 500 +#define _POSIX_SOURCE 200809L + #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> diff --git a/src/libc/arch/amd64/Makefile b/src/libc/arch/amd64/Makefile @@ -22,7 +22,9 @@ OBJS =\ all: $(LIBC) $(SYS) -$(LIBC): $(OBJS) +$(LIBC): $(LIBCLST) + +$(LIBCLST): $(OBJS) $(MKLST) dep: inc-dep diff --git a/src/libc/arch/arm/Makefile b/src/libc/arch/arm/Makefile @@ -18,7 +18,9 @@ OBJS =\ all: $(LIBC) $(SYS) -$(LIBC): $(OBJS) +$(LIBC): $(LIBCLST) + +$(LIBCLST): $(OBJS) $(MKLST) dep: inc-dep diff --git a/src/libc/arch/arm64/Makefile b/src/libc/arch/arm64/Makefile @@ -18,7 +18,9 @@ OBJS =\ all: $(LIBC) $(SYS) -$(LIBC): $(OBJS) +$(LIBC): $(LIBCLST) + +$(LIBCLST): $(OBJS) $(MKLST) dep: inc-dep diff --git a/src/libc/arch/i386/Makefile b/src/libc/arch/i386/Makefile @@ -18,7 +18,9 @@ OBJS =\ all: $(LIBC) $(SYS) -$(LIBC): $(OBJS) +$(LIBC): $(LIBCLST) + +$(LIBCLST): $(OBJS) $(MKLST) dep: inc-dep diff --git a/src/libc/arch/ppc/Makefile b/src/libc/arch/ppc/Makefile @@ -18,7 +18,9 @@ OBJS =\ all: $(LIBC) $(SYS) -$(LIBC): $(OBJS) +$(LIBC): $(LIBCLST) + +$(LIBCLST): $(OBJS) $(MKLST) dep: inc-dep