shithub: scc

Download patch

ref: 04bf7a4f601788f822f90698fc8f18d52b76f5e8
parent: 677232c01056366ed709373ebe020f2add080136
parent: 14b140af2cbbabfd64a7cb4bc82d9e169ec36622
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Jul 20 15:12:45 EDT 2015

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

--- a/README
+++ b/README
@@ -55,7 +55,7 @@
 	  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
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -210,9 +210,12 @@
 	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 @@
 	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)) {
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -2,8 +2,6 @@
 
 OBJS = main.o parser.o cgen.o code.o optm.o peep.o
 
-LIBS = -lcc
-
 all: cc2
 
 .POSIX:
@@ -12,10 +10,11 @@
 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)
--- a/config.mk
+++ b/config.mk
@@ -12,6 +12,6 @@
 AR = ar
 
 # for Plan9 add -D_SUSV2_SOURCE -DNBOOL
-CPPFLAGS = -D_DEFAULT_SOURCE
+CPPFLAGS =
 CFLAGS   = -std=c99
 LDFLAGS  = -s