scc

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

commit 2bc536749ffaedde7fa8307e7bdac88b68d21452
parent 7aca4703205556836e7207154398d71a2c32b259
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 24 Feb 2015 11:05:34 +0100

Imcrement portability

We want to be able to compile this program in a native plan9
environment, and take advantage of the toolchain of this
system. This is a first step, because plan9 lacks stdbool
and it also lacks stdint.

Diffstat:
Mcc1/Makefile | 4+---
Mcc1/code.c | 2+-
Mcc1/expr.c | 2+-
Mcc1/types.c | 2+-
Mcc2/Makefile | 4+---
Mcc2/cgen.c | 2+-
Mcc2/code.c | 3+--
Mcc2/main.c | 2+-
Mcc2/optm.c | 2+-
Mcc2/parser.c | 2+-
Minc/cc.h | 4++++
11 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/cc1/Makefile b/cc1/Makefile @@ -2,8 +2,6 @@ OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \ code.o stmt.o -CPPFLAGS = -LDFLAGS = -L../lib LIBS = -lcc all: cc1 @@ -11,7 +9,7 @@ all: cc1 $(OBJS) : cc1.h ../inc/cc.h ../inc/sizes.h cc1: $(OBJS) ../lib/libcc.a - $(CC) $(LDFLAGS) $(CFLAGS) $(OBJS) $(LIBS) -o $@ + $(CC) -L../lib $(LDFLAGS) $(OBJS) $(LIBS) -o $@ clean: rm -f $(OBJS) diff --git a/cc1/code.c b/cc1/code.c @@ -1,5 +1,5 @@ -#include <stdint.h> +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> diff --git a/cc1/expr.c b/cc1/expr.c @@ -1,4 +1,4 @@ -#include <stdint.h> +#include <inttypes.h> #include <stdio.h> #include <string.h> diff --git a/cc1/types.c b/cc1/types.c @@ -1,5 +1,5 @@ -#include <stdint.h> +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/cc2/Makefile b/cc2/Makefile @@ -1,8 +1,6 @@ OBJS = main.o parser.o cgen.o code.o optm.o -CPPFLAGS = -LDFLAGS = -L../lib LIBS = -lcc all: cc2 @@ -14,7 +12,7 @@ error.h: cc2.h ./generror cc2.h > $@ cc2: $(OBJS) ../lib/libcc.a - $(CC) $(LDFLAGS) $(CFLAGS) $(OBJS) $(LIBS) -o $@ + $(CC) -L../lib $(LDFLAGS) $(OBJS) $(LIBS) -o $@ clean: rm -f $(OBJS) diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -1,7 +1,7 @@ #include <assert.h> #include <stdarg.h> -#include <stdint.h> +#include <inttypes.h> #include <stdlib.h> #include "../inc/cc.h" diff --git a/cc2/code.c b/cc2/code.c @@ -1,8 +1,7 @@ #include <stdarg.h> -#include <stdbool.h> #include <stddef.h> -#include <stdint.h> +#include <inttypes.h> #include <stdio.h> #include "../inc/cc.h" diff --git a/cc2/main.c b/cc2/main.c @@ -1,6 +1,6 @@ #include <stdarg.h> -#include <stdint.h> +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> diff --git a/cc2/optm.c b/cc2/optm.c @@ -1,6 +1,6 @@ #include <stddef.h> -#include <stdint.h> +#include <inttypes.h> #include "../inc/cc.h" #include "cc2.h" diff --git a/cc2/parser.c b/cc2/parser.c @@ -1,6 +1,6 @@ #include <errno.h> -#include <stdint.h> +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/inc/cc.h b/inc/cc.h @@ -3,8 +3,12 @@ #define CC_H_ #ifndef __bool_true_and_false_defined +#ifdef NBOOL +typedef unsigned bool; +#else #include <stdbool.h> #endif +#endif #define TINT short