scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 04bf7a4f601788f822f90698fc8f18d52b76f5e8
parent 677232c01056366ed709373ebe020f2add080136
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 20 Jul 2015 19:12:45 +0200

Merge branch 'master' of ssh://suckless.org/gitrepos/scc

Diffstat:
MREADME | 2+-
Mcc1/types.c | 11+++++++----
Mcc2/Makefile | 9++++-----
Mconfig.mk | 2+-
4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/README b/README @@ -55,7 +55,7 @@ unnecessary complexity to the compiler (and increased compilation time): assembler). In the second case, it generates a lot of problems with modern processors and multithreading, where not holding the value in a - register is good enough (an explicit memory barrier is needed). + register is not good enough (an explicit memory barrier is needed). - restrict: This qualifer can only be applied to pointers to mark that the pointed object has no other alias. This qualifer diff --git a/cc1/types.c b/cc1/types.c @@ -210,9 +210,12 @@ mktype(Type *tp, unsigned op, short nelem, void *data) unsigned t; Type *bp; static char letters[] = { - [PTR] = L_POINTER, [ARY] = L_ARRAY, - [FTN] = L_FUNCTION, [ENUM] = L_INT, - [STRUCT] = L_STRUCT, [UNION] = L_UNION + [PTR] = L_POINTER, + [ARY] = L_ARRAY, + [FTN] = L_FUNCTION, + [ENUM] = L_INT, + [STRUCT] = L_STRUCT, + [UNION] = L_UNION }; if (op == PTR && tp == voidtype) @@ -230,7 +233,7 @@ mktype(Type *tp, unsigned op, short nelem, void *data) else type.defined = 1; - t = (op ^ (char) ((unsigned short) tp >> 3)) & NR_TYPE_HASH-1; + t = (op ^ (uintptr_t) tp >> 3) & NR_TYPE_HASH-1; tbl = &typetab[t]; for (bp = *tbl; bp; bp = bp->next) { if (eqtype(bp, &type)) { diff --git a/cc2/Makefile b/cc2/Makefile @@ -2,8 +2,6 @@ include ../config.mk OBJS = main.o parser.o cgen.o code.o optm.o peep.o -LIBS = -lcc - all: cc2 .POSIX: @@ -12,10 +10,11 @@ $(OBJS): ../inc/cc.h ../inc/sizes.h cc2.h main.o: error.h error.h: cc2.h - awk -f generror cc2.h > $@ - + rm -f $@; trap 'rm -f $$$$.h' EXIT INT QUIT + awk -f generror cc2.h > $$$$.h && mv $$$$.h $@ + cc2: $(OBJS) ../lib/libcc.a - $(CC) -L../lib $(LDFLAGS) $(OBJS) $(LIBS) -o $@ + $(CC) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $@ clean: rm -f $(OBJS) diff --git a/config.mk b/config.mk @@ -12,6 +12,6 @@ LD = $(CC) AR = ar # for Plan9 add -D_SUSV2_SOURCE -DNBOOL -CPPFLAGS = -D_DEFAULT_SOURCE +CPPFLAGS = CFLAGS = -std=c99 LDFLAGS = -s