Mercurial > hg > CbC > old > device
changeset 615:2dee957ef988
test case on undeclared name
gcc include path handling
author | kono |
---|---|
date | Wed, 06 Sep 2006 15:21:06 +0900 |
parents | e4e007f4026d |
children | 2ba903c8e749 |
files | .gdbinit Changes Idea Makefile Makefile.ia32 Makefile.mips Makefile.powerpc mc-code-ia32.c mc-code-powerpc.c mc-parse.c test/simp.c tools/find-gcc-include-path |
diffstat | 12 files changed, 154 insertions(+), 234 deletions(-) [+] |
line wrap: on
line diff
--- a/.gdbinit Tue May 30 21:36:03 2006 +0900 +++ b/.gdbinit Wed Sep 06 15:21:06 2006 +0900 @@ -56,3 +56,4 @@ run -DINLINE=inline test/tmp7.c # run -DINLINE=inline test/code-gen-all.c # run -s throw.c +run -s test/simp.c
--- a/Changes Tue May 30 21:36:03 2006 +0900 +++ b/Changes Wed Sep 06 15:21:06 2006 +0900 @@ -8755,3 +8755,14 @@ そうか... sse2 をサポートしないと、やっぱりだめなのね。 Pen 4 以上では。 +Wed Jun 21 14:58:17 JST 2006 + +64bit 対応とかいろいろあるよな。 +SPU は比較的容易にサポート出来そう。 + +でも、それより先に、 + statement を含むparse tree のprint + statement を含むparse tree のS式表現のprint + S式表現のparser +を書かないと。 +
--- a/Idea Tue May 30 21:36:03 2006 +0900 +++ b/Idea Wed Sep 06 15:21:06 2006 +0900 @@ -1712,4 +1712,24 @@ +Wed Sep 6 14:59:09 JST 2006 + code hoge(int a, code f(int k,...), ...) + { + goto f(a,...); + } + +syntax が汚い... type の指定はなんとかしないとだめだね。 + + ... + + int a, + +ずれたときのコストがなぁ。良く見えないんだよね。 + +可能だとは思うんだけど。 + + __meta goto { + } + +みたいな感じ?
--- a/Makefile Tue May 30 21:36:03 2006 +0900 +++ b/Makefile Wed Sep 06 15:21:06 2006 +0900 @@ -20,10 +20,12 @@ COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c +GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)` + # TARGET=test/simp -all: mc mc-ia32 mc-powerpc mc-mips mc-arm +all: mc-include.c mc mc-ia32 mc-powerpc mc-mips mc-arm mc: mc-$(ARCH) cp mc-$(ARCH) mc @@ -58,6 +60,9 @@ conv/null.c: conv_func.tbl tools/conv_func.pl perl tools/conv_func.pl +mc-include.c: + perl tools/find-gcc-include-path -l $(CC) > mc-include.c + mc.h-new: perl tools/mc-h-renum.pl mc.h > mc.h.1 mv mc.h.1 mc.h @@ -180,16 +185,15 @@ make clean tar cBf - . | gzip > ../comp.tgz -depend : conv/conv.h - makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ - mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \ - mc-macro.c mc-inline.c mc-macro.h mc-parse.h \ +depend : mc.h mc-include.c conv/conv.h + makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ + mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \ + mc-inline.c mc-macro.c mc-macro.h mc-parse.h \ conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \ conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \ - mc-code-null.c \ - mc-code-powerpc.c \ - mc-code-arm.c \ - mc-code-mips.c + mc-code-arm.c \ + mc-code-powerpc.c \ + mc-code-mips.c clean : -rm -f mc mc-null mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i *.cbc.? */*.cbc.? @@ -254,7 +258,7 @@ mc-code-ia32.o: /usr/include/stdio.h /usr/include/_types.h mc-code-ia32.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-code-ia32.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h +mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h mc-include.c mc-codegen.o: /usr/include/stdio.h /usr/include/_types.h mc-codegen.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-codegen.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h @@ -273,14 +277,14 @@ mc-switch.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-switch.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h mc-switch.o: mc-parse.h mc-codegen.h mc-code.h +mc-inline.o: /usr/include/stdio.h /usr/include/_types.h +mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h +mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h +mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h mc-macro.o: /usr/include/stdio.h /usr/include/_types.h mc-macro.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-macro.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h mc-macro.o: mc-parse.h mc-macro.h mc-codegen.h mc-code.h -mc-inline.o: /usr/include/stdio.h /usr/include/_types.h -mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h conv/c.o: /usr/include/stdio.h /usr/include/_types.h conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h @@ -297,18 +301,14 @@ conv/null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h conv/null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h conv/null.o: mc-parse.h conv/conv.h conv/convdef.h conv/null.h -mc-code-null.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-code-null.o: mc-parse.h mc-code.h mc-codegen.h -mc-code-powerpc.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h -mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h mc-code-arm.o: /usr/include/stdio.h /usr/include/_types.h mc-code-arm.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-code-arm.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h mc-code-arm.o: mc-parse.h mc-code.h mc-codegen.h +mc-code-powerpc.o: /usr/include/stdio.h /usr/include/_types.h +mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h +mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h +mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h mc-include.c mc-code-mips.o: /usr/include/stdio.h /usr/include/_types.h mc-code-mips.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h mc-code-mips.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
--- a/Makefile.ia32 Tue May 30 21:36:03 2006 +0900 +++ b/Makefile.ia32 Wed Sep 06 15:21:06 2006 +0900 @@ -1,7 +1,7 @@ # CC = gcc -std=c99 CC = cc # -O3 -CFLAGS = -g -Wall -I. +CFLAGS = -g -Wall -I. -DUSE_CODE_KEYWORD # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage # LDFLAGS = -pg # for Linux Zaurus @@ -18,10 +18,12 @@ COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c +GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)` +# # TARGET=test/simp -all: mc mc-ia32 mc-powerpc mc-mips mc-arm +all: mc-include.c mc mc: mc-$(ARCH) cp mc-$(ARCH) mc @@ -53,6 +55,9 @@ conv/null.c: conv_func.tbl tools/conv_func.pl perl tools/conv_func.pl +mc-include.c: + perl tools/find-gcc-include-path -l $(CC) > mc-include.c + mc.h-new: perl tools/mc-h-renum.pl mc.h > mc.h.1 mv mc.h.1 mc.h @@ -173,8 +178,8 @@ make clean tar cBf - . | gzip > ../comp.tgz -depend : - makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ +depend : mc.h mc-include.c + makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \ mc-inline.c mc-macro.c mc-macro.h mc-parse.h \ conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \ @@ -184,7 +189,7 @@ mc-code-mips.c clean : - -rm -f mc mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i + -rm -f mc mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.c mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER) $(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER) @@ -242,94 +247,3 @@ # DO NOT DELETE -mc-code-ia32.o: /usr/include/stdio.h /usr/include/features.h -mc-code-ia32.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-code-ia32.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-code-ia32.o: /usr/include/bits/types.h /usr/include/libio.h -mc-code-ia32.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-code-ia32.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-code-ia32.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-code-ia32.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h -mc-code-ia32.o: mc-code.h -mc-codegen.o: /usr/include/stdio.h /usr/include/features.h -mc-codegen.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-codegen.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-codegen.o: /usr/include/bits/types.h /usr/include/libio.h -mc-codegen.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-codegen.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-codegen.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-codegen.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h -mc-codegen.o: mc-code.h mc-switch.h mc-inline.h -mc-parse.o: /usr/include/stdio.h /usr/include/features.h -mc-parse.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-parse.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-parse.o: /usr/include/bits/types.h /usr/include/libio.h -mc-parse.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-parse.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-parse.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-parse.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h -mc-parse.o: mc-switch.h mc-macro.h mc-inline.h conv/conv.h -mc-tree.o: /usr/include/stdio.h /usr/include/features.h -mc-tree.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-tree.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-tree.o: /usr/include/bits/types.h /usr/include/libio.h -mc-tree.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-tree.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-tree.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-tree.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h -mc-switch.o: /usr/include/stdio.h /usr/include/features.h -mc-switch.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-switch.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-switch.o: /usr/include/bits/types.h /usr/include/libio.h -mc-switch.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-switch.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-switch.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-switch.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h -mc-switch.o: mc-code.h -mc-macro.o: /usr/include/stdio.h /usr/include/features.h -mc-macro.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-macro.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-macro.o: /usr/include/bits/types.h /usr/include/libio.h -mc-macro.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-macro.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-macro.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-macro.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-macro.h -mc-macro.o: mc-codegen.h mc-code.h -conv/c.o: /usr/include/stdio.h /usr/include/features.h -conv/c.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -conv/c.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -conv/c.o: /usr/include/bits/types.h /usr/include/libio.h -conv/c.o: /usr/include/_G_config.h /usr/include/wchar.h -conv/c.o: /usr/include/bits/wchar.h /usr/include/gconv.h -conv/c.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -conv/c.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h -conv/c.o: conv/convdef.h conv/c.h -conv/c2cbc.o: mc.h -conv/cbc2c.o: mc.h -conv/null.o: /usr/include/stdio.h /usr/include/features.h -conv/null.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -conv/null.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -conv/null.o: /usr/include/bits/types.h /usr/include/libio.h -conv/null.o: /usr/include/_G_config.h /usr/include/wchar.h -conv/null.o: /usr/include/bits/wchar.h /usr/include/gconv.h -conv/null.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -conv/null.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h -conv/null.o: conv/convdef.h conv/null.h -mc-code-powerpc.o: /usr/include/stdio.h /usr/include/features.h -mc-code-powerpc.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-code-powerpc.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-code-powerpc.o: /usr/include/bits/types.h /usr/include/libio.h -mc-code-powerpc.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-code-powerpc.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-code-powerpc.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-code-powerpc.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h -mc-code-powerpc.o: mc-codegen.h -mc-code-mips.o: /usr/include/stdio.h /usr/include/features.h -mc-code-mips.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h -mc-code-mips.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h -mc-code-mips.o: /usr/include/bits/types.h /usr/include/libio.h -mc-code-mips.o: /usr/include/_G_config.h /usr/include/wchar.h -mc-code-mips.o: /usr/include/bits/wchar.h /usr/include/gconv.h -mc-code-mips.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h -mc-code-mips.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h -mc-code-mips.o: mc-codegen.h
--- a/Makefile.mips Tue May 30 21:36:03 2006 +0900 +++ b/Makefile.mips Wed Sep 06 15:21:06 2006 +0900 @@ -13,7 +13,7 @@ MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c -CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/c2cbc.o conv/cbc2c.o +CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/cbc2c.o COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c
--- a/Makefile.powerpc Tue May 30 21:36:03 2006 +0900 +++ b/Makefile.powerpc Wed Sep 06 15:21:06 2006 +0900 @@ -1,12 +1,12 @@ CC = gcc -std=c99 # -O2 # -O99 -CFLAGS = -g -Wall -I. +CFLAGS = -g -Wall -I. -DUSE_CODE_KEYWORD # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage # LDFLAGS = -pg # for Linux Zaurus # CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include -CFLAGS1 = -g -I. +CFLAGS1 = -g -I. -DUSE_CODE_KEYWORD BASE=0 STAGE=1 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE) @@ -20,10 +20,12 @@ COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o # CODE=mc-code-ia32.c CODE=mc-code-$(ARCH).c +GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)` + # TARGET=test/simp -all: mc mc-ia32 mc-powerpc mc-mips mc-arm +all: mc-include.c mc mc-ia32 mc-powerpc mc-mips mc-arm mc: mc-$(ARCH) cp mc-$(ARCH) mc @@ -58,6 +60,9 @@ conv/null.c: conv_func.tbl tools/conv_func.pl perl tools/conv_func.pl +mc-include.c: + perl tools/find-gcc-include-path -l $(CC) > mc-include.c + mc.h-new: perl tools/mc-h-renum.pl mc.h > mc.h.1 mv mc.h.1 mc.h @@ -139,7 +144,7 @@ check: mc $(MC) $(TARGET).c -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) -./b.out > $(TARGET).gcc.out - -./$(MC) -s $(TARGET).c + -./$(MC) -s $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).$(MC).out -diff $(TARGET).gcc.out $(TARGET).$(MC).out @@ -147,18 +152,18 @@ check-inline: mc $(MC) $(TARGET).c -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) -./b.out > $(TARGET).gcc.out - -./$(MC) -s -DINLINE=inline $(TARGET).c + -./$(MC) -s -DINLINE=inline $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).$(MC).out -diff $(TARGET).gcc.out $(TARGET).$(MC).out check-code: mc $(MC) - -./$(MC) -s $(TARGET).c + -./$(MC) -s $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).$(MC).out -diff $(TARGET).code-out $(TARGET).$(MC).out check-code-make: mc $(MC) - -./$(MC) -s $(TARGET).c + -./$(MC) -s $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).code-out @@ -180,16 +185,15 @@ make clean tar cBf - . | gzip > ../comp.tgz -depend : conv/conv.h - makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ - mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \ - mc-macro.c mc-inline.c mc-macro.h mc-parse.h \ +depend : mc.h mc-include.c conv/conv.h + makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ + mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \ + mc-inline.c mc-macro.c mc-macro.h mc-parse.h \ conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \ conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \ - mc-code-null.c \ - mc-code-powerpc.c \ - mc-code-arm.c \ - mc-code-mips.c + mc-code-arm.c \ + mc-code-powerpc.c \ + mc-code-mips.c clean : -rm -f mc mc-null mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i *.cbc.? */*.cbc.? @@ -250,66 +254,3 @@ # DO NOT DELETE - -mc-code-ia32.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-ia32.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-ia32.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h -mc-codegen.o: /usr/include/stdio.h /usr/include/_types.h -mc-codegen.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-codegen.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-codegen.o: mc-parse.h mc-codegen.h mc-code.h mc-switch.h mc-inline.h -mc-codegen.o: conv/conv.h -mc-parse.o: /usr/include/stdio.h /usr/include/_types.h -mc-parse.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-parse.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-parse.o: mc-parse.h mc-codegen.h mc-switch.h mc-macro.h mc-inline.h -mc-parse.o: conv/conv.h -mc-tree.o: /usr/include/stdio.h /usr/include/_types.h -mc-tree.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-tree.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-tree.o: mc-parse.h mc-codegen.h -mc-switch.o: /usr/include/stdio.h /usr/include/_types.h -mc-switch.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-switch.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-switch.o: mc-parse.h mc-codegen.h mc-code.h -mc-macro.o: /usr/include/stdio.h /usr/include/_types.h -mc-macro.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-macro.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-macro.o: mc-parse.h mc-macro.h mc-codegen.h mc-code.h -mc-inline.o: /usr/include/stdio.h /usr/include/_types.h -mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h -conv/c.o: /usr/include/stdio.h /usr/include/_types.h -conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -conv/c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c.h -conv/c2cbc.o: /usr/include/stdio.h /usr/include/_types.h -conv/c2cbc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -conv/c2cbc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -conv/c2cbc.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c2cbc.h -conv/cbc2c.o: /usr/include/stdio.h /usr/include/_types.h -conv/cbc2c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -conv/cbc2c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -conv/cbc2c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/cbc2c.h -conv/null.o: /usr/include/stdio.h /usr/include/_types.h -conv/null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -conv/null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -conv/null.o: mc-parse.h conv/conv.h conv/convdef.h conv/null.h -mc-code-null.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-code-null.o: mc-parse.h mc-code.h mc-codegen.h -mc-code-powerpc.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h -mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h -mc-code-arm.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-arm.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-arm.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-code-arm.o: mc-parse.h mc-code.h mc-codegen.h -mc-code-mips.o: /usr/include/stdio.h /usr/include/_types.h -mc-code-mips.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h -mc-code-mips.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h -mc-code-mips.o: mc-parse.h mc-code.h mc-codegen.h
--- a/mc-code-ia32.c Tue May 30 21:36:03 2006 +0900 +++ b/mc-code-ia32.c Wed Sep 06 15:21:06 2006 +0900 @@ -31,14 +31,7 @@ #if defined(__GNUC__) && __GNUC__ >= 4 -char *l_include_path[] = { - "/usr/include/linux/", - "/usr/local/include", - "/usr/lib/gcc/i486-linux-gnu/4.0.3/include", - "/usr/lib/gcc/i386-redhat-linux/4.0.2/include/", - "/usr/include/", - 0 -}; +#include "mc-include.c" static char *init_src0 = "\ @@ -129,21 +122,41 @@ #define __PTRDIFF_TYPE__ int\n\ #define __LDBL_MIN_10_EXP__ (-4931)\n\ #define __LDBL_DIG__ 18\n\ -#define size_t int\n\ "; +/* + + #define size_t int\n\ + +*/ + #else -char *l_include_path[] = { - "/usr/include/", - "/usr/include/linux/", - "/usr/include/diet/", - "/usr/lib/gcc-lib/i386-linux/2.95.4/include/", - "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/", - "/usr/lib/dietlibc/include/", - 0 -}; - +#include "mc-include.c" + +#if defined(__GNUC__) && __GNUC__ >= 3 +static +char *init_src0 = "\ +#define __builtin_va_start(ap,arg) ap=(((int)(&arg))+sizeof(arg))\n\ +#define __builtin_va_arg(ap,type) (*((type *)ap)++)\n\ +#define __builtin_va_end\n\ +#define __i386__ 1\n\ +#define __LITTLE_ENDIAN__ 1\n\ +#define __STDC__ 1\n\ +#define __extension__\n\ +// #define __restrict\n\ +#define __flexarr\n\ +#define __const const\n\ +#define __THORW\n\ +// #define __attribute__(a)\n\ +#define __inline__ inline\n\ +#define __inline inline\n\ +#define __GNUC__ 3\n\ +#define __builtin_va_list int\n\ +typedef long unsigned int __SIZE_TYPE__ ;\n\ +" + +#else static char *init_src0 = "\ #define va_list int\n\ @@ -153,18 +166,21 @@ #define __i386__ 1\n\ #define __LITTLE_ENDIAN__ 1\n\ #define __STDC__ 1\n\ -#define size_t int\n\ #define __extension__\n\ // #define __restrict\n\ -#define __gnuc_va_list int\n\ #define __flexarr\n\ #define __const const\n\ #define __THORW\n\ // #define __attribute__(a)\n\ #define __inline__ inline\n\ -#define wchar_t int\n\ -#define __GNUC__ 2\n\ -"; +#define __SIZE_TYPE__ long unsigned int\n\ +#define __GNUC__ 3\n\ +" + +#endif + + + ; #endif
--- a/mc-code-powerpc.c Tue May 30 21:36:03 2006 +0900 +++ b/mc-code-powerpc.c Wed Sep 06 15:21:06 2006 +0900 @@ -29,18 +29,7 @@ #include "mc-code.h" #include "mc-codegen.h" -char *l_include_path[] = { - "/usr/local/include", - "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/include", - "/usr/lib/gcc/i686-apple-darwin8/4.0.0/include/", - "/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/include", - "/usr/lib/gcc/i686-apple-darwin8/4.0.1/include/", - "/usr/include", - "/System/Library/Frameworks", - "/Library/Frameworks", - 0 -}; - +#include "mc-include.c" static char *init_src0 = "\
--- a/mc-parse.c Tue May 30 21:36:03 2006 +0900 +++ b/mc-parse.c Wed Sep 06 15:21:06 2006 +0900 @@ -3676,8 +3676,12 @@ } else { if (stmode!=GOTO) // undefined on goto statement is OK error(UDERR); + smode = stmode; stmode = GDECL; + // type = nptr->ty= glist3(FUNCTION,INT,0); + type = INT; + def(nptr,0); nptr->sc = EXTRN1; - type = nptr->ty= glist3(FUNCTION,INT,0); + stmode = smode; e1=list2(FNAME,(int)nptr); // type=list3(nptr->sc,nptr->ty,nptr->dsp); break;
--- a/test/simp.c Tue May 30 21:36:03 2006 +0900 +++ b/test/simp.c Wed Sep 06 15:21:06 2006 +0900 @@ -1,5 +1,6 @@ #include "stdio.h" +#define UNDECL float f = 3; float g = 4096.0f; @@ -36,6 +37,10 @@ ch = 'E'; main1(-8); printf("#0037:%d\n",main2(3)); +#ifdef UNDECL + j = k; // undeclared global variable + printf("#0037:%d\n",h); +#endif return main0(ac,ch,av); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/find-gcc-include-path Wed Sep 06 15:21:06 2006 +0900 @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +my $CC = $ARGV[1]; +my $gcc = `echo '#include <stddef.h>' | $CC -E - `; + +$gcc =~ m=\"(/[^"]+/)stddef\.h"=; +my $gcc_path = $1; + +if ($ARGV[0]=~/-l/) { +print <<EOF +char *l_include_path[] = { + "/usr/include/", + "$gcc_path", + 0 +}; +EOF +} else { + print "$gcc_path\n"; +}