• R/O
  • SSH

CbC: Commit

micro-C base Continuation based C


Commit MetaInfo

Revisionce2364964f1e41db77bc85f98c242bde1d154aaf (tree)
Zeit2006-09-27 16:28:22
Autorshinji_kono
Commitershinji_kono

Log Message

gcc 4.x fix
find gcc include path script
macro symbol concatenation

Ändern Zusammenfassung

Diff

diff -r 9fdb3181ecb9 -r ce2364964f1e Makefile
--- a/Makefile Sat Apr 15 22:26:54 2006 +0900
+++ b/Makefile Wed Sep 27 16:28:22 2006 +0900
@@ -20,10 +20,12 @@
2020 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o
2121 # CODE=mc-code-ia32.c
2222 CODE=mc-code-$(ARCH).c
23+GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)`
24+
2325 #
2426 TARGET=test/simp
2527
26-all: mc mc-ia32 mc-powerpc mc-mips mc-arm
28+all: mc-include.c mc mc-ia32 mc-powerpc mc-mips mc-arm
2729
2830 mc: mc-$(ARCH)
2931 cp mc-$(ARCH) mc
@@ -58,6 +60,9 @@
5860 conv/null.c: conv_func.tbl tools/conv_func.pl
5961 perl tools/conv_func.pl
6062
63+mc-include.c:
64+ perl tools/find-gcc-include-path -l $(CC) > mc-include.c
65+
6166 mc.h-new:
6267 perl tools/mc-h-renum.pl mc.h > mc.h.1
6368 mv mc.h.1 mc.h
@@ -180,16 +185,15 @@
180185 make clean
181186 tar cBf - . | gzip > ../comp.tgz
182187
183-depend : conv/conv.h
184- makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
185- mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
186- mc-macro.c mc-inline.c mc-macro.h mc-parse.h \
188+depend : mc.h mc-include.c conv/conv.h
189+ makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
190+ mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
191+ mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
187192 conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
188193 conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
189- mc-code-null.c \
190- mc-code-powerpc.c \
191- mc-code-arm.c \
192- mc-code-mips.c
194+ mc-code-arm.c \
195+ mc-code-powerpc.c \
196+ mc-code-mips.c
193197
194198 clean :
195199 -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 @@
254258 mc-code-ia32.o: /usr/include/stdio.h /usr/include/_types.h
255259 mc-code-ia32.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
256260 mc-code-ia32.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
257-mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h
261+mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h mc-include.c
258262 mc-codegen.o: /usr/include/stdio.h /usr/include/_types.h
259263 mc-codegen.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
260264 mc-codegen.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
@@ -273,14 +277,14 @@
273277 mc-switch.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
274278 mc-switch.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
275279 mc-switch.o: mc-parse.h mc-codegen.h mc-code.h
280+mc-inline.o: /usr/include/stdio.h /usr/include/_types.h
281+mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
282+mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
283+mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h
276284 mc-macro.o: /usr/include/stdio.h /usr/include/_types.h
277285 mc-macro.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
278286 mc-macro.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
279287 mc-macro.o: mc-parse.h mc-macro.h mc-codegen.h mc-code.h
280-mc-inline.o: /usr/include/stdio.h /usr/include/_types.h
281-mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
282-mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
283-mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h
284288 conv/c.o: /usr/include/stdio.h /usr/include/_types.h
285289 conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
286290 conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
@@ -297,18 +301,14 @@
297301 conv/null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
298302 conv/null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
299303 conv/null.o: mc-parse.h conv/conv.h conv/convdef.h conv/null.h
300-mc-code-null.o: /usr/include/stdio.h /usr/include/_types.h
301-mc-code-null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
302-mc-code-null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
303-mc-code-null.o: mc-parse.h mc-code.h mc-codegen.h
304-mc-code-powerpc.o: /usr/include/stdio.h /usr/include/_types.h
305-mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
306-mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h
307-mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h
308304 mc-code-arm.o: /usr/include/stdio.h /usr/include/_types.h
309305 mc-code-arm.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
310306 mc-code-arm.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
311307 mc-code-arm.o: mc-parse.h mc-code.h mc-codegen.h
308+mc-code-powerpc.o: /usr/include/stdio.h /usr/include/_types.h
309+mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
310+mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h
311+mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h mc-include.c
312312 mc-code-mips.o: /usr/include/stdio.h /usr/include/_types.h
313313 mc-code-mips.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
314314 mc-code-mips.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
diff -r 9fdb3181ecb9 -r ce2364964f1e Makefile.ia32
--- a/Makefile.ia32 Sat Apr 15 22:26:54 2006 +0900
+++ b/Makefile.ia32 Wed Sep 27 16:28:22 2006 +0900
@@ -1,7 +1,7 @@
11 # CC = gcc -std=c99
22 CC = cc
33 # -O3
4-CFLAGS = -g -Wall -I.
4+CFLAGS = -g -Wall -I. -DUSE_CODE_KEYWORD
55 # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
66 # LDFLAGS = -pg
77 # for Linux Zaurus
@@ -18,10 +18,12 @@
1818 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o
1919 # CODE=mc-code-ia32.c
2020 CODE=mc-code-$(ARCH).c
21+GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)`
22+#
2123 #
2224 TARGET=test/simp
2325
24-all: mc mc-ia32 mc-powerpc mc-mips mc-arm
26+all: mc-include.c mc
2527
2628 mc: mc-$(ARCH)
2729 cp mc-$(ARCH) mc
@@ -53,6 +55,9 @@
5355 conv/null.c: conv_func.tbl tools/conv_func.pl
5456 perl tools/conv_func.pl
5557
58+mc-include.c:
59+ perl tools/find-gcc-include-path -l $(CC) > mc-include.c
60+
5661 mc.h-new:
5762 perl tools/mc-h-renum.pl mc.h > mc.h.1
5863 mv mc.h.1 mc.h
@@ -173,8 +178,8 @@
173178 make clean
174179 tar cBf - . | gzip > ../comp.tgz
175180
176-depend :
177- makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
181+depend : mc.h mc-include.c
182+ makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
178183 mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
179184 mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
180185 conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
@@ -184,7 +189,7 @@
184189 mc-code-mips.c
185190
186191 clean :
187- -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
192+ -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
188193
189194 mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER)
190195 $(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 @@
242247
243248 # DO NOT DELETE
244249
245-mc-code-ia32.o: /usr/include/stdio.h /usr/include/features.h
246-mc-code-ia32.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
247-mc-code-ia32.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
248-mc-code-ia32.o: /usr/include/bits/types.h /usr/include/libio.h
249-mc-code-ia32.o: /usr/include/_G_config.h /usr/include/wchar.h
250-mc-code-ia32.o: /usr/include/bits/wchar.h /usr/include/gconv.h
251-mc-code-ia32.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
252-mc-code-ia32.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
253-mc-code-ia32.o: mc-code.h
254-mc-codegen.o: /usr/include/stdio.h /usr/include/features.h
255-mc-codegen.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
256-mc-codegen.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
257-mc-codegen.o: /usr/include/bits/types.h /usr/include/libio.h
258-mc-codegen.o: /usr/include/_G_config.h /usr/include/wchar.h
259-mc-codegen.o: /usr/include/bits/wchar.h /usr/include/gconv.h
260-mc-codegen.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
261-mc-codegen.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
262-mc-codegen.o: mc-code.h mc-switch.h mc-inline.h
263-mc-parse.o: /usr/include/stdio.h /usr/include/features.h
264-mc-parse.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
265-mc-parse.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
266-mc-parse.o: /usr/include/bits/types.h /usr/include/libio.h
267-mc-parse.o: /usr/include/_G_config.h /usr/include/wchar.h
268-mc-parse.o: /usr/include/bits/wchar.h /usr/include/gconv.h
269-mc-parse.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
270-mc-parse.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
271-mc-parse.o: mc-switch.h mc-macro.h mc-inline.h conv/conv.h
272-mc-tree.o: /usr/include/stdio.h /usr/include/features.h
273-mc-tree.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
274-mc-tree.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
275-mc-tree.o: /usr/include/bits/types.h /usr/include/libio.h
276-mc-tree.o: /usr/include/_G_config.h /usr/include/wchar.h
277-mc-tree.o: /usr/include/bits/wchar.h /usr/include/gconv.h
278-mc-tree.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
279-mc-tree.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h
280-mc-switch.o: /usr/include/stdio.h /usr/include/features.h
281-mc-switch.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
282-mc-switch.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
283-mc-switch.o: /usr/include/bits/types.h /usr/include/libio.h
284-mc-switch.o: /usr/include/_G_config.h /usr/include/wchar.h
285-mc-switch.o: /usr/include/bits/wchar.h /usr/include/gconv.h
286-mc-switch.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
287-mc-switch.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
288-mc-switch.o: mc-code.h
289-mc-macro.o: /usr/include/stdio.h /usr/include/features.h
290-mc-macro.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
291-mc-macro.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
292-mc-macro.o: /usr/include/bits/types.h /usr/include/libio.h
293-mc-macro.o: /usr/include/_G_config.h /usr/include/wchar.h
294-mc-macro.o: /usr/include/bits/wchar.h /usr/include/gconv.h
295-mc-macro.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
296-mc-macro.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-macro.h
297-mc-macro.o: mc-codegen.h mc-code.h
298-conv/c.o: /usr/include/stdio.h /usr/include/features.h
299-conv/c.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
300-conv/c.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
301-conv/c.o: /usr/include/bits/types.h /usr/include/libio.h
302-conv/c.o: /usr/include/_G_config.h /usr/include/wchar.h
303-conv/c.o: /usr/include/bits/wchar.h /usr/include/gconv.h
304-conv/c.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
305-conv/c.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
306-conv/c.o: conv/convdef.h conv/c.h
307-conv/c2cbc.o: mc.h
308-conv/cbc2c.o: mc.h
309-conv/null.o: /usr/include/stdio.h /usr/include/features.h
310-conv/null.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
311-conv/null.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
312-conv/null.o: /usr/include/bits/types.h /usr/include/libio.h
313-conv/null.o: /usr/include/_G_config.h /usr/include/wchar.h
314-conv/null.o: /usr/include/bits/wchar.h /usr/include/gconv.h
315-conv/null.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
316-conv/null.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
317-conv/null.o: conv/convdef.h conv/null.h
318-mc-code-powerpc.o: /usr/include/stdio.h /usr/include/features.h
319-mc-code-powerpc.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
320-mc-code-powerpc.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
321-mc-code-powerpc.o: /usr/include/bits/types.h /usr/include/libio.h
322-mc-code-powerpc.o: /usr/include/_G_config.h /usr/include/wchar.h
323-mc-code-powerpc.o: /usr/include/bits/wchar.h /usr/include/gconv.h
324-mc-code-powerpc.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
325-mc-code-powerpc.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
326-mc-code-powerpc.o: mc-codegen.h
327-mc-code-mips.o: /usr/include/stdio.h /usr/include/features.h
328-mc-code-mips.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
329-mc-code-mips.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h
330-mc-code-mips.o: /usr/include/bits/types.h /usr/include/libio.h
331-mc-code-mips.o: /usr/include/_G_config.h /usr/include/wchar.h
332-mc-code-mips.o: /usr/include/bits/wchar.h /usr/include/gconv.h
333-mc-code-mips.o: /usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h
334-mc-code-mips.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
335-mc-code-mips.o: mc-codegen.h
diff -r 9fdb3181ecb9 -r ce2364964f1e Makefile.linuxzaurus
--- a/Makefile.linuxzaurus Sat Apr 15 22:26:54 2006 +0900
+++ b/Makefile.linuxzaurus Wed Sep 27 16:28:22 2006 +0900
@@ -4,8 +4,8 @@
44 # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
55 # LDFLAGS = -pg
66 # for Linux Zaurus
7-CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include
8-CFLAGS1 = -g -I. -fsigned-char
7+CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include -DUSE_CODE_KEYWORD
8+CFLAGS1 = -g -I. -fsigned-char -DUSE_CODE_KEYWORD
99 BASE=0
1010 STAGE=1
1111 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE)
@@ -20,9 +20,9 @@
2020 #
2121 TARGET=test/simp
2222
23-all: mc mc-ia32 mc-powerpc mc-mips mc-arm
23+all: mc
2424
25-mc: mc-$(ARCH)
25+mc: mc-include.c mc-$(ARCH)
2626 cp mc-$(ARCH) mc
2727
2828 TAGS:
@@ -52,6 +52,9 @@
5252 conv/null.c: conv_func.tbl tools/conv_func.pl
5353 perl tools/conv_func.pl
5454
55+mc-include.c:
56+ perl tools/find-gcc-include-path -l $(CC) > mc-include.c
57+
5558 mc.h-new:
5659 perl tools/mc-h-renum.pl mc.h > mc.h.1
5760 mv mc.h.1 mc.h
@@ -174,7 +177,7 @@
174177 make clean
175178 tar cBf - . | gzip > ../comp.tgz
176179
177-depend :
180+depend : mc-include.c
178181 makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
179182 mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
180183 mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
diff -r 9fdb3181ecb9 -r ce2364964f1e Makefile.mips
--- a/Makefile.mips Sat Apr 15 22:26:54 2006 +0900
+++ b/Makefile.mips Wed Sep 27 16:28:22 2006 +0900
@@ -1,11 +1,11 @@
11 # CC = gcc -std=c99
22 # -O3
3-CFLAGS = -g -Wall -I.
3+CFLAGS = -g -Wall -I. -DUSE_CODE_KEYWORD
44 # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
55 # LDFLAGS = -pg
66 # for Linux Zaurus
77 # CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include
8-CFLAGS1 = -g -I.
8+CFLAGS1 = -g -I. -DUSE_CODE_KEYWORD
99 BASE=0
1010 STAGE=1
1111 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE)
@@ -13,16 +13,16 @@
1313 MC=mc-$(ARCH)
1414 MLIB = -lm
1515 PRINTF= # printf.c
16-CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/c2cbc.o conv/cbc2c.o
16+CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/cbc2c.o
1717 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o
1818 # CODE=mc-code-ia32.c
1919 CODE=mc-code-$(ARCH).c
2020 #
2121 TARGET=test/simp
2222
23-all: mc mc-ia32 mc-powerpc mc-mips mc-arm
23+all: mc
2424
25-mc: mc-$(ARCH)
25+mc: mc-include.c mc-$(ARCH)
2626 cp mc-$(ARCH) mc
2727
2828 TAGS:
@@ -52,6 +52,9 @@
5252 conv/null.c: conv_func.tbl tools/conv_func.pl
5353 perl tools/conv_func.pl
5454
55+mc-include.c:
56+ perl tools/find-gcc-include-path -l $(CC) > mc-include.c
57+
5558 mc.h-new:
5659 perl tools/mc-h-renum.pl mc.h > mc.h.1
5760 mv mc.h.1 mc.h
@@ -172,7 +175,7 @@
172175 make clean
173176 tar cBf - . | gzip > ../comp.tgz
174177
175-depend :
178+depend : mc-include.c
176179 makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
177180 mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
178181 mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
diff -r 9fdb3181ecb9 -r ce2364964f1e Makefile.powerpc
--- a/Makefile.powerpc Sat Apr 15 22:26:54 2006 +0900
+++ b/Makefile.powerpc Wed Sep 27 16:28:22 2006 +0900
@@ -1,12 +1,12 @@
11 CC = gcc -std=c99
22 # -O2
33 # -O99
4-CFLAGS = -g -Wall -I.
4+CFLAGS = -g -Wall -I. -DUSE_CODE_KEYWORD
55 # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
66 # LDFLAGS = -pg
77 # for Linux Zaurus
88 # CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include
9-CFLAGS1 = -g -I.
9+CFLAGS1 = -g -I. -DUSE_CODE_KEYWORD
1010 BASE=0
1111 STAGE=1
1212 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE)
@@ -20,10 +20,12 @@
2020 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o
2121 # CODE=mc-code-ia32.c
2222 CODE=mc-code-$(ARCH).c
23+GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)`
24+
2325 #
2426 TARGET=test/simp
2527
26-all: mc mc-ia32 mc-powerpc mc-mips mc-arm
28+all: mc-include.c mc mc-ia32 mc-powerpc mc-mips mc-arm
2729
2830 mc: mc-$(ARCH)
2931 cp mc-$(ARCH) mc
@@ -58,6 +60,9 @@
5860 conv/null.c: conv_func.tbl tools/conv_func.pl
5961 perl tools/conv_func.pl
6062
63+mc-include.c:
64+ perl tools/find-gcc-include-path -l $(CC) > mc-include.c
65+
6166 mc.h-new:
6267 perl tools/mc-h-renum.pl mc.h > mc.h.1
6368 mv mc.h.1 mc.h
@@ -139,7 +144,7 @@
139144 check: mc $(MC) $(TARGET).c
140145 -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
141146 -./b.out > $(TARGET).gcc.out
142- -./$(MC) -s $(TARGET).c
147+ -./$(MC) -s $(TARGET).c
143148 -$(CC) $(TARGET).s $(MLIB)
144149 -./a.out > $(TARGET).$(MC).out
145150 -diff $(TARGET).gcc.out $(TARGET).$(MC).out
@@ -147,18 +152,18 @@
147152 check-inline: mc $(MC) $(TARGET).c
148153 -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
149154 -./b.out > $(TARGET).gcc.out
150- -./$(MC) -s -DINLINE=inline $(TARGET).c
155+ -./$(MC) -s -DINLINE=inline $(TARGET).c
151156 -$(CC) $(TARGET).s $(MLIB)
152157 -./a.out > $(TARGET).$(MC).out
153158 -diff $(TARGET).gcc.out $(TARGET).$(MC).out
154159
155160 check-code: mc $(MC)
156- -./$(MC) -s $(TARGET).c
161+ -./$(MC) -s $(TARGET).c
157162 -$(CC) $(TARGET).s $(MLIB)
158163 -./a.out > $(TARGET).$(MC).out
159164 -diff $(TARGET).code-out $(TARGET).$(MC).out
160165 check-code-make: mc $(MC)
161- -./$(MC) -s $(TARGET).c
166+ -./$(MC) -s $(TARGET).c
162167 -$(CC) $(TARGET).s $(MLIB)
163168 -./a.out > $(TARGET).code-out
164169
@@ -180,16 +185,15 @@
180185 make clean
181186 tar cBf - . | gzip > ../comp.tgz
182187
183-depend : conv/conv.h
184- makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
185- mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
186- mc-macro.c mc-inline.c mc-macro.h mc-parse.h \
188+depend : mc.h mc-include.c conv/conv.h
189+ makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
190+ mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
191+ mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
187192 conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
188193 conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
189- mc-code-null.c \
190- mc-code-powerpc.c \
191- mc-code-arm.c \
192- mc-code-mips.c
194+ mc-code-arm.c \
195+ mc-code-powerpc.c \
196+ mc-code-mips.c
193197
194198 clean :
195199 -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 @@
250254
251255
252256 # DO NOT DELETE
253-
254-mc-code-ia32.o: /usr/include/stdio.h /usr/include/_types.h
255-mc-code-ia32.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
256-mc-code-ia32.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
257-mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h
258-mc-codegen.o: /usr/include/stdio.h /usr/include/_types.h
259-mc-codegen.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
260-mc-codegen.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
261-mc-codegen.o: mc-parse.h mc-codegen.h mc-code.h mc-switch.h mc-inline.h
262-mc-codegen.o: conv/conv.h
263-mc-parse.o: /usr/include/stdio.h /usr/include/_types.h
264-mc-parse.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
265-mc-parse.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
266-mc-parse.o: mc-parse.h mc-codegen.h mc-switch.h mc-macro.h mc-inline.h
267-mc-parse.o: conv/conv.h
268-mc-tree.o: /usr/include/stdio.h /usr/include/_types.h
269-mc-tree.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
270-mc-tree.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
271-mc-tree.o: mc-parse.h mc-codegen.h
272-mc-switch.o: /usr/include/stdio.h /usr/include/_types.h
273-mc-switch.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
274-mc-switch.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
275-mc-switch.o: mc-parse.h mc-codegen.h mc-code.h
276-mc-macro.o: /usr/include/stdio.h /usr/include/_types.h
277-mc-macro.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
278-mc-macro.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
279-mc-macro.o: mc-parse.h mc-macro.h mc-codegen.h mc-code.h
280-mc-inline.o: /usr/include/stdio.h /usr/include/_types.h
281-mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
282-mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
283-mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h
284-conv/c.o: /usr/include/stdio.h /usr/include/_types.h
285-conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
286-conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
287-conv/c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c.h
288-conv/c2cbc.o: /usr/include/stdio.h /usr/include/_types.h
289-conv/c2cbc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
290-conv/c2cbc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
291-conv/c2cbc.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c2cbc.h
292-conv/cbc2c.o: /usr/include/stdio.h /usr/include/_types.h
293-conv/cbc2c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
294-conv/cbc2c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
295-conv/cbc2c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/cbc2c.h
296-conv/null.o: /usr/include/stdio.h /usr/include/_types.h
297-conv/null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
298-conv/null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
299-conv/null.o: mc-parse.h conv/conv.h conv/convdef.h conv/null.h
300-mc-code-null.o: /usr/include/stdio.h /usr/include/_types.h
301-mc-code-null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
302-mc-code-null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
303-mc-code-null.o: mc-parse.h mc-code.h mc-codegen.h
304-mc-code-powerpc.o: /usr/include/stdio.h /usr/include/_types.h
305-mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
306-mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h
307-mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h
308-mc-code-arm.o: /usr/include/stdio.h /usr/include/_types.h
309-mc-code-arm.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
310-mc-code-arm.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
311-mc-code-arm.o: mc-parse.h mc-code.h mc-codegen.h
312-mc-code-mips.o: /usr/include/stdio.h /usr/include/_types.h
313-mc-code-mips.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
314-mc-code-mips.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
315-mc-code-mips.o: mc-parse.h mc-code.h mc-codegen.h
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-code-arm.c
--- a/mc-code-arm.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-code-arm.c Wed Sep 27 16:28:22 2006 +0900
@@ -4109,6 +4109,23 @@
41094109
41104110
41114111 void
4112+code_builtin_fabsf(int e)
4113+{
4114+}
4115+void
4116+code_builtin_fabs(int e)
4117+{
4118+}
4119+void
4120+code_builtin_inff()
4121+{
4122+}
4123+void
4124+code_builtin_inf(int op)
4125+{
4126+}
4127+
4128+void
41124129 code_dneg(int freg,int d)
41134130 {
41144131 char *frn;
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-code-ia32.c
--- a/mc-code-ia32.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-code-ia32.c Wed Sep 27 16:28:22 2006 +0900
@@ -31,14 +31,7 @@
3131
3232 #if defined(__GNUC__) && __GNUC__ >= 4
3333
34-char *l_include_path[] = {
35- "/usr/include/linux/",
36- "/usr/local/include",
37- "/usr/lib/gcc/i486-linux-gnu/4.0.3/include",
38- "/usr/lib/gcc/i386-redhat-linux/4.0.2/include/",
39- "/usr/include/",
40- 0
41-};
34+#include "mc-include.c"
4235
4336 static
4437 char *init_src0 = "\
@@ -48,7 +41,6 @@
4841 #define alloca __builtin_alloca\n\
4942 #define __STDC__ 1\n\
5043 #define __extension__\n\
51-#define __STDC__ 1\n\
5244 #define __flexarr\n\
5345 #define __const const\n\
5446 #define __THORW\n\
@@ -129,21 +121,46 @@
129121 #define __PTRDIFF_TYPE__ int\n\
130122 #define __LDBL_MIN_10_EXP__ (-4931)\n\
131123 #define __LDBL_DIG__ 18\n\
132-#define size_t int\n\
133-";
124+"
125+#ifdef __APPLE__
126+"#define __APPLE__ 1\n"
127+"#define __GNUC__ 4\n"
128+#endif
129+;
130+
131+/*
132+
133+ #define size_t int\n\
134+
135+*/
134136
135137 #else
136138
137-char *l_include_path[] = {
138- "/usr/include/",
139- "/usr/include/linux/",
140- "/usr/include/diet/",
141- "/usr/lib/gcc-lib/i386-linux/2.95.4/include/",
142- "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/",
143- "/usr/lib/dietlibc/include/",
144- 0
145-};
146-
139+#include "mc-include.c"
140+
141+#if defined(__GNUC__) && __GNUC__ >= 3
142+static
143+char *init_src0 = "\
144+#define __builtin_va_start(ap,arg) ap=(((int)(&arg))+sizeof(arg))\n\
145+#define __builtin_va_arg(ap,type) (*((type *)ap)++)\n\
146+#define __builtin_va_end\n\
147+#define __i386__ 1\n\
148+#define __LITTLE_ENDIAN__ 1\n\
149+#define __STDC__ 1\n\
150+#define __extension__\n\
151+// #define __restrict\n\
152+#define __flexarr\n\
153+#define __const const\n\
154+#define __THORW\n\
155+// #define __attribute__(a)\n\
156+#define __inline__ inline\n\
157+#define __inline inline\n\
158+#define __GNUC__ 3\n\
159+#define __builtin_va_list int\n\
160+typedef long unsigned int __SIZE_TYPE__ ;\n\
161+"
162+
163+#else
147164 static
148165 char *init_src0 = "\
149166 #define va_list int\n\
@@ -153,18 +170,21 @@
153170 #define __i386__ 1\n\
154171 #define __LITTLE_ENDIAN__ 1\n\
155172 #define __STDC__ 1\n\
156-#define size_t int\n\
157173 #define __extension__\n\
158174 // #define __restrict\n\
159-#define __gnuc_va_list int\n\
160175 #define __flexarr\n\
161176 #define __const const\n\
162177 #define __THORW\n\
163178 // #define __attribute__(a)\n\
164179 #define __inline__ inline\n\
165-#define wchar_t int\n\
166-#define __GNUC__ 2\n\
167-";
180+#define __SIZE_TYPE__ long unsigned int\n\
181+#define __GNUC__ 3\n\
182+"
183+
184+#endif
185+
186+
187+ ;
168188
169189 #endif
170190
@@ -185,7 +205,10 @@
185205 #define DATA_EMIT_MODE 1
186206 #define RODATA_EMIT_MODE 2
187207
208+#ifdef __APPLE__
209+#else
188210 #define DOT_SIZE 1
211+#endif
189212
190213 static int output_mode = TEXT_EMIT_MODE;
191214
@@ -250,6 +273,7 @@
250273 static int code_disp_label;
251274 static int func_disp_label;
252275
276+// static int goffset_label;
253277
254278 static int
255279 lvar(int l)
@@ -882,23 +906,40 @@
882906 void
883907 code_gvar(int e1,int creg) {
884908 use_int(creg);
909+#ifdef __APPLE__
910+ if (cadr(e1)) {
911+ printf("\tmovl $_%s+%d,%s\n",((NMTBL*)caddr(e1))->nm,cadr(e1),
912+ register_name(creg,0));
913+ } else {
914+ printf("\tmovl $_%s,%s\n",((NMTBL*)caddr(e1))->nm,register_name(creg,0));
915+ }
916+#else
885917 if (cadr(e1)) {
886918 printf("\tmovl $%s+%d,%s\n",((NMTBL*)caddr(e1))->nm,cadr(e1),
887919 register_name(creg,0));
888920 } else {
889921 printf("\tmovl $%s,%s\n",((NMTBL*)caddr(e1))->nm,register_name(creg,0));
890922 }
923+#endif
891924
892925 }
893926
894927 void
895928 code_rgvar(int e1,int creg) {
896929 use_int(creg);
930+#ifdef __APPLE__
931+ if (cadr(e1)) {
932+ printf("\tmovl _%s+%d,%s\n",((NMTBL*)caddr(e1))->nm,cadr(e1),
933+ register_name(creg,0));
934+ } else
935+ printf("\tmovl _%s,%s\n",((NMTBL*)caddr(e1))->nm,register_name(creg,0));
936+#else
897937 if (cadr(e1)) {
898938 printf("\tmovl %s+%d,%s\n",((NMTBL*)caddr(e1))->nm,cadr(e1),
899939 register_name(creg,0));
900940 } else
901941 printf("\tmovl %s,%s\n",((NMTBL*)caddr(e1))->nm,register_name(creg,0));
942+#endif
902943
903944 }
904945
@@ -911,12 +952,21 @@
911952 void
912953 code_crgvar(int e1,int creg,int sign,int sz){
913954 use_int(creg);
955+#ifdef __APPLE__
956+ if (cadr(e1)) {
957+ printf("\t%s _%s+%d,%s\n",cload(sign,sz),
958+ ((NMTBL*)caddr(e1))->nm,cadr(e1),register_name(creg,0));
959+ } else
960+ printf("\t%s _%s,%s\n",cload(sign,sz),
961+ ((NMTBL*)caddr(e1))->nm,register_name(creg,0));
962+#else
914963 if (cadr(e1)) {
915964 printf("\t%s %s+%d,%s\n",cload(sign,sz),
916965 ((NMTBL*)caddr(e1))->nm,cadr(e1),register_name(creg,0));
917966 } else
918967 printf("\t%s %s,%s\n",cload(sign,sz),
919968 ((NMTBL*)caddr(e1))->nm,register_name(creg,0));
969+#endif
920970
921971 }
922972
@@ -985,7 +1035,11 @@
9851035 void
9861036 code_fname(NMTBL *n,int creg) {
9871037 use_int(creg);
1038+#ifdef __APPLE__
1039+ printf("\tmovl $_%s,%s\n",n->nm,register_name(creg,0));
1040+#else
9881041 printf("\tmovl $%s,%s\n",n->nm,register_name(creg,0));
1042+#endif
9891043 }
9901044
9911045 void
@@ -1135,6 +1189,19 @@
11351189 void
11361190 code_cmp_crgvar(int e1,int reg,int sz,int label,int cond) {
11371191 use_int(reg);
1192+#ifdef __APPLE__
1193+ if (cadr(e1)) {
1194+ if (sz==1)
1195+ printf("\tcmpb $0,_%s+%d\n",((NMTBL*)caddr(e1))->nm,cadr(e1));
1196+ else if (sz==SIZE_OF_SHORT)
1197+ printf("\tcmpw $0,_%s+%d\n",((NMTBL*)caddr(e1))->nm,cadr(e1));
1198+ } else {
1199+ if (sz==1)
1200+ printf("\tcmpb $0,_%s\n",((NMTBL*)caddr(e1))->nm);
1201+ else if (sz==SIZE_OF_SHORT)
1202+ printf("\tcmpw $0,_%s\n",((NMTBL*)caddr(e1))->nm);
1203+ }
1204+#else
11381205 if (cadr(e1)) {
11391206 if (sz==1)
11401207 printf("\tcmpb $0,%s+%d\n",((NMTBL*)caddr(e1))->nm,cadr(e1));
@@ -1146,6 +1213,7 @@
11461213 else if (sz==SIZE_OF_SHORT)
11471214 printf("\tcmpw $0,%s\n",((NMTBL*)caddr(e1))->nm);
11481215 }
1216+#endif
11491217 jcond(label,cond);
11501218 }
11511219
@@ -1164,10 +1232,17 @@
11641232 void
11651233 code_cmp_rgvar(int e1,int reg,int label,int cond) {
11661234 use_int(reg);
1235+#ifdef __APPLE
1236+ if (cadr(e1))
1237+ printf("\tcmpl $0,_%s+%d\n",((NMTBL*)caddr(e1))->nm,cadr(e1));
1238+ else
1239+ printf("\tcmpl $0,_%s\n",((NMTBL*)caddr(e1))->nm);
1240+#else
11671241 if (cadr(e1))
11681242 printf("\tcmpl $0,%s+%d\n",((NMTBL*)caddr(e1))->nm,cadr(e1));
11691243 else
11701244 printf("\tcmpl $0,%s\n",((NMTBL*)caddr(e1))->nm);
1245+#endif
11711246 jcond(label,cond);
11721247 }
11731248
@@ -1416,7 +1491,11 @@
14161491 }
14171492
14181493 if (car(e2) == FNAME) {
1494+#ifdef __APPLE__
1495+ printf("\tcall\tL_%s$stub\n",n->nm);
1496+#else
14191497 printf("\tcall\t%s\n",n->nm);
1498+#endif
14201499 } else {
14211500 printf("\tcall\t*%s\n",register_name(REG_EAX,0));
14221501 }
@@ -1480,7 +1559,11 @@
14801559
14811560 void
14821561 code_jmp(char *s) {
1562+#ifdef __APPLE__
1563+ printf("\tjmp\tL_%s$stub\n",s);
1564+#else
14831565 printf("\tjmp %s\n",s);
1566+#endif
14841567 }
14851568
14861569
@@ -1549,10 +1632,17 @@
15491632 code_assign_gvar(int e2,int creg,int byte) {
15501633 if (byte) { use_data_reg(creg,1);
15511634 } else { use_int(creg); }
1635+#ifdef __APPLE__
1636+ if (cadr(e2))
1637+ printf("\t%s %s,_%s+%d\n",move(byte),register_name(creg,byte),((NMTBL*)caddr(e2))->nm,cadr(e2));
1638+ else
1639+ printf("\t%s %s,_%s\n",move(byte),register_name(creg,byte),((NMTBL*)caddr(e2))->nm);
1640+#else
15521641 if (cadr(e2))
15531642 printf("\t%s %s,%s+%d\n",move(byte),register_name(creg,byte),((NMTBL*)caddr(e2))->nm,cadr(e2));
15541643 else
15551644 printf("\t%s %s,%s\n",move(byte),register_name(creg,byte),((NMTBL*)caddr(e2))->nm);
1645+#endif
15561646 }
15571647
15581648 void
@@ -1894,10 +1984,16 @@
18941984 {
18951985 text_mode(0);
18961986 printf("\t.align 4\n");
1987+#ifndef __APPLE__
18971988 if (stmode!=STATIC)
18981989 printf(".globl %s\n",name);
18991990 printf("\t.type\t%s,@function\n",name);
19001991 printf("%s:\n",name);
1992+#else
1993+ if (stmode!=STATIC)
1994+ printf(".globl _%s\n",name);
1995+ printf("_%s:\n",name);
1996+#endif
19011997 }
19021998
19031999
@@ -1915,10 +2011,14 @@
19152011 {
19162012 disp &= -SIZE_OF_INT;
19172013 printf("\t.set _%d,%d\n",code_disp_label,disp+code_disp_offset-8);
2014+#ifndef __APPLE__
19182015 printf("_%d:\n",labelno);
19192016 printf("\t.size\t%s,_%d-%s\n",name,labelno,name);
19202017 local_table();
19212018 labelno++;
2019+#else
2020+ local_table();
2021+#endif
19222022 free_all_register();
19232023 }
19242024
@@ -1927,10 +2027,16 @@
19272027 {
19282028 text_mode(0);
19292029 printf("\t.align 2\n");
2030+#ifndef __APPLE__
19302031 if (stmode!=STATIC)
19312032 printf(".globl %s\n",name);
19322033 printf("%s:\n",name);
19332034 printf("\t.type\t%s,@function\n",name);
2035+#else
2036+ if (stmode!=STATIC)
2037+ printf(".globl _%s\n",name);
2038+ printf("_%s:\n",name);
2039+#endif
19342040 printf("\tpushl %%ebp\n");
19352041 printf("\tmovl %%esp,%%ebp\n");
19362042 printf("\tpushl %%ebx\n");
@@ -1938,6 +2044,15 @@
19382044 printf("\tpushl %%edi\n");
19392045 func_disp_label=fwdlabel();
19402046 printf("\tlea _%d(%%ebp),%%esp\n",func_disp_label);
2047+#ifdef __APPLE__
2048+#if 0
2049+ printf("\tcalli\t___i686.get_pc_thunk.cx\n");
2050+ printf("_%d:\n",labelno);
2051+ goffset_label = labelno;
2052+ labelno++;
2053+#endif
2054+#endif
2055+
19412056 control=1;
19422057 }
19432058
@@ -1996,8 +2111,10 @@
19962111 printf("\tleave\n");
19972112 printf("\tret\n");
19982113 printf("\t.set _%d,%d\n",func_disp_label,disp+disp_offset);
2114+#ifndef __APPLE__
19992115 printf("_%d:\n",labelno);
20002116 printf("\t.size\t%s,_%d-%s\n",name,labelno,name);
2117+#endif
20012118 local_table();
20022119 labelno++;
20032120 free_all_register();
@@ -2055,7 +2172,11 @@
20552172 extern void
20562173 ascii(char *s)
20572174 {
2175+#ifdef __APPLE__
2176+ printf("\t.ascii \"");
2177+#else
20582178 printf("\t.string \"");
2179+#endif
20592180 while(*s) {
20602181 if (*s=='\n')
20612182 printf("%cn",92);
@@ -2069,7 +2190,11 @@
20692190 printf("%c",*s);
20702191 s++;
20712192 }
2193+#ifdef __APPLE__
2194+ printf("\\0%c\n",34);
2195+#else
20722196 printf("%c\n",34);
2197+#endif
20732198 }
20742199
20752200 extern int
@@ -2122,9 +2247,15 @@
21222247 } else
21232248 data_mode(n->nm);
21242249 align(a);
2250+#ifdef __APPLE__
2251+ if (n && n->sc!=STATIC)
2252+ printf(".globl\t_%s\n",n->nm);
2253+ printf("_%s:\n",n->nm);
2254+#else
21252255 if (n && n->sc!=STATIC)
21262256 printf(".globl\t%s\n",n->nm);
21272257 printf("%s:\n",n->nm);
2258+#endif
21282259 }
21292260
21302261 extern void
@@ -2197,10 +2328,17 @@
21972328 emit_address(char *s,int offset)
21982329 {
21992330 data_mode(0);
2331+#ifdef __APPLE__
2332+ if (offset)
2333+ printf("\t.long _%s+%d\n",s,offset);
2334+ else
2335+ printf("\t.long _%s\n",s);
2336+#else
22002337 if (offset)
22012338 printf("\t.long %s+%d\n",s,offset);
22022339 else
22032340 printf("\t.long %s\n",s);
2341+#endif
22042342 }
22052343
22062344 extern void
@@ -2251,6 +2389,8 @@
22512389 int init;
22522390 init=0;
22532391 for(n=global_list;n;n = n->next) {
2392+ if (is_code(n) || is_function(n)) {
2393+ }
22542394 if ((n->sc == GVAR||n->sc == STATIC) && n->dsp != -1) {
22552395 if (is_code(n)||is_function(n)) continue;
22562396 /* n->dsp = -1 means initialized global */
@@ -2258,10 +2398,28 @@
22582398 data_mode(0);
22592399 init=1;
22602400 }
2401+#ifdef __APPLE__
2402+ printf(".comm _%s,%d\n",n->nm,size(n->ty));
2403+#else
22612404 printf(".comm %s,%d\n",n->nm,size(n->ty));
2405+#endif
22622406 // .lcomm?
22632407 }
22642408 }
2409+#ifdef __APPLE__
2410+ for(n = global_list;n!=&null_nptr;n = n->next) {
2411+ if (is_code(n)||is_function(n)) {
2412+ if (n->sc==EXTRN1) {
2413+ data_mode(0);
2414+ }
2415+ printf("\t.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5\n");
2416+ printf("L_%s$stub:\n",n->nm);
2417+ printf("\t.indirect_symbol _%s\n",n->nm);
2418+ printf("\thlt ; hlt ; hlt ; hlt ; hlt\n");
2419+ }
2420+ }
2421+#endif
2422+
22652423 }
22662424
22672425 void
@@ -2277,8 +2435,13 @@
22772435 data_mode(0);
22782436 init=1;
22792437 }
2438+#ifdef __APPLE__
2439+ if (n->dsp!= -1) /* -1 means initialized global */
2440+ printf(".lcomm _%s,%d\n",n->nm,size(n->ty));
2441+#else
22802442 if (n->dsp!= -1) /* -1 means initialized global */
22812443 printf(".lcomm %s,%d\n",n->nm,size(n->ty));
2444+#endif
22822445 }
22832446 }
22842447 }
@@ -2287,7 +2450,11 @@
22872450 cstring_mode(int align)
22882451 {
22892452 if (output_mode!=RODATA_EMIT_MODE) {
2453+#ifndef __APPLE__
22902454 printf(".section\t.rodata\n\t.align 2\n");
2455+#else
2456+ printf("\t.cstring\n");
2457+#endif
22912458 output_mode = RODATA_EMIT_MODE;
22922459 }
22932460 }
@@ -2309,8 +2476,10 @@
23092476 printf(".data\n");
23102477 output_mode = DATA_EMIT_MODE;
23112478 }
2479+#ifndef __APPLE__
23122480 if (name)
23132481 printf("\t.type\t%s,@object\n",name);
2482+#endif
23142483 }
23152484
23162485 #if FLOAT_CODE
@@ -2342,10 +2511,17 @@
23422511
23432512 void code_dassign_gvar(int e2,int freg,int d)
23442513 {
2514+#ifdef __APPLE__
2515+ if (cadr(e2))
2516+ printf("\t%s _%s+%d\n",fstore(d),((NMTBL*)caddr(e2))->nm,cadr(e2));
2517+ else
2518+ printf("\t%s _%s\n",fstore(d),((NMTBL*)caddr(e2))->nm);
2519+#else
23452520 if (cadr(e2))
23462521 printf("\t%s %s+%d\n",fstore(d),((NMTBL*)caddr(e2))->nm,cadr(e2));
23472522 else
23482523 printf("\t%s %s\n",fstore(d),((NMTBL*)caddr(e2))->nm);
2524+#endif
23492525 }
23502526
23512527 void code_dassign_lvar(int e2,int freg,int d)
@@ -2390,7 +2566,11 @@
23902566 if (value==1.0) {
23912567 printf("\tfld1\n"); return;
23922568 }
2569+#ifdef __APPLE__
2570+ printf(" \t.literal8\n\t.align 3\n");
2571+#else
23932572 printf(" \t.section\t.rodata\n\t.align 8\n");
2573+#endif
23942574 lb=fwdlabel();
23952575 printf("_%d:\n",lb);
23962576 #if ENDIAN_D==0
@@ -2404,6 +2584,23 @@
24042584 printf("\tfldl _%d\n",lb);
24052585 }
24062586
2587+void
2588+code_builtin_fabsf(int e)
2589+{
2590+}
2591+void
2592+code_builtin_fabs(int e)
2593+{
2594+}
2595+void
2596+code_builtin_inff()
2597+{
2598+}
2599+void
2600+code_builtin_inf()
2601+{
2602+}
2603+
24072604 void code_dneg(int freg,int d)
24082605 {
24092606 printf("\tfchs\n");
@@ -2464,10 +2661,17 @@
24642661
24652662 void code_drgvar(int e2,int d,int freg)
24662663 {
2664+#ifdef __APPLE__
2665+ if (cadr(e2))
2666+ printf("\t%s _%s+%d\n",fload(d),((NMTBL*)caddr(e2))->nm,cadr(e2));
2667+ else
2668+ printf("\t%s _%s\n",fload(d),((NMTBL*)caddr(e2))->nm);
2669+#else
24672670 if (cadr(e2))
24682671 printf("\t%s %s+%d\n",fload(d),((NMTBL*)caddr(e2))->nm,cadr(e2));
24692672 else
24702673 printf("\t%s %s\n",fload(d),((NMTBL*)caddr(e2))->nm);
2674+#endif
24712675 }
24722676
24732677
@@ -2478,10 +2682,17 @@
24782682
24792683 void code_cmp_drgvar(int e2,int reg,int d,int label,int cond)
24802684 {
2685+#ifdef __APPLE__
2686+ if (cadr(e2))
2687+ printf("\tfcomp _%s+%d\n",((NMTBL*)caddr(e2))->nm,cadr(e2));
2688+ else
2689+ printf("\tfcomp _%s\n",((NMTBL*)caddr(e2))->nm);
2690+#else
24812691 if (cadr(e2))
24822692 printf("\tfcomp %s+%d\n",((NMTBL*)caddr(e2))->nm,cadr(e2));
24832693 else
24842694 printf("\tfcomp %s\n",((NMTBL*)caddr(e2))->nm);
2695+#endif
24852696 jcond(label,cond);
24862697 }
24872698
@@ -2830,6 +3041,15 @@
28303041 n = ((NMTBL*)caddr(e1))->nm;
28313042 use_int(e2);
28323043 crn = register_name(e2,0);
3044+#ifdef __APPLE__
3045+ if (cadr(e1)) {
3046+ printf("\tmovl _%s+%d,%s\n",n,cadr(e1),crn);
3047+ printf("\torl _%s+%d,%s\n",n,cadr(e1)+4,crn);
3048+ } else {
3049+ printf("\tmovl _%s,%s\n",n,crn);
3050+ printf("\torl _%s+4,%s\n",n,crn);
3051+ }
3052+#else
28333053 if (cadr(e1)) {
28343054 printf("\tmovl %s+%d,%s\n",n,cadr(e1),crn);
28353055 printf("\torl %s+%d,%s\n",n,cadr(e1)+4,crn);
@@ -2837,6 +3057,7 @@
28373057 printf("\tmovl %s,%s\n",n,crn);
28383058 printf("\torl %s+4,%s\n",n,crn);
28393059 }
3060+#endif
28403061 printf("\ttestl %s,%s\n",crn,crn);
28413062 jcond(label,cond);
28423063 }
@@ -2870,6 +3091,15 @@
28703091 n = ((NMTBL*)caddr(e1))->nm;
28713092 use_longlong(e2);
28723093 #if ENDIAN_L==0
3094+#ifdef __APPLE__
3095+ if (cadr(e1)) {
3096+ printf("\tmovl %s,_%s+%d\n",l_eax(e2),n,cadr(e1));
3097+ printf("\tmovl %s,_%s+%d\n",l_edx(e2),n,cadr(e1)+4);
3098+ } else {
3099+ printf("\tmovl %s,_%s\n",l_eax(e2),n);
3100+ printf("\tmovl %s,_%s+4\n",l_edx(e2),n);
3101+ }
3102+#else
28733103 if (cadr(e1)) {
28743104 printf("\tmovl %s,%s+%d\n",l_eax(e2),n,cadr(e1));
28753105 printf("\tmovl %s,%s+%d\n",l_edx(e2),n,cadr(e1)+4);
@@ -2878,6 +3108,7 @@
28783108 printf("\tmovl %s,%s+4\n",l_edx(e2),n);
28793109 }
28803110 #endif
3111+#endif
28813112 }
28823113
28833114 void code_lassign_lvar(int e1,int e2)
@@ -2923,6 +3154,15 @@
29233154 n = ((NMTBL*)caddr(e1))->nm;
29243155 use_longlong(e2);
29253156 #if ENDIAN_L==0
3157+#ifdef __APPLE__
3158+ if (cadr(e1)) {
3159+ printf("\tmovl _%s+%d,%s\n",n,cadr(e1),l_eax(e2));
3160+ printf("\tmovl _%s+%d,%s\n",n,cadr(e1)+4,l_edx(e2));
3161+ } else {
3162+ printf("\tmovl _%s,%s\n",n,l_eax(e2));
3163+ printf("\tmovl _%s+4,%s\n",n,l_edx(e2));
3164+ }
3165+#else
29263166 if (cadr(e1)) {
29273167 printf("\tmovl %s+%d,%s\n",n,cadr(e1),l_eax(e2));
29283168 printf("\tmovl %s+%d,%s\n",n,cadr(e1)+4,l_edx(e2));
@@ -2931,6 +3171,7 @@
29313171 printf("\tmovl %s+4,%s\n",n,l_edx(e2));
29323172 }
29333173 #endif
3174+#endif
29343175 }
29353176
29363177 void code_lrlvar(int e1,int e2)
@@ -3404,7 +3645,11 @@
34043645 code_table_open(int l)
34053646 {
34063647 output_mode=DATA_EMIT_MODE;
3648+#ifdef __APPLE__
3649+ printf(" \t.literal4\n\t.align 2\n");
3650+#else
34073651 printf(" \t.section\t.rodata\n\t.align 4\n");
3652+#endif
34083653 fwddef(l);
34093654 }
34103655
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-code-mips.c
--- a/mc-code-mips.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-code-mips.c Wed Sep 27 16:28:22 2006 +0900
@@ -29,11 +29,15 @@
2929 #include "mc-code.h"
3030 #include "mc-codegen.h"
3131
32+#if 0
3233 char *l_include_path[] = {
3334 "/usr/include/",
3435 "/usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/",
3536 0
3637 };
38+#else
39+#include "mc-include.c"
40+#endif
3741
3842 // va_start, va_arg is wrong, use va_mips.h
3943
@@ -3682,6 +3686,23 @@
36823686
36833687
36843688 void
3689+code_builtin_fabsf(int e)
3690+{
3691+}
3692+void
3693+code_builtin_fabs(int e)
3694+{
3695+}
3696+void
3697+code_builtin_inff()
3698+{
3699+}
3700+void
3701+code_builtin_inf()
3702+{
3703+}
3704+
3705+void
36853706 code_dneg(int freg,int d)
36863707 {
36873708 char *frn;
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-code-powerpc.c
--- a/mc-code-powerpc.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-code-powerpc.c Wed Sep 27 16:28:22 2006 +0900
@@ -29,18 +29,7 @@
2929 #include "mc-code.h"
3030 #include "mc-codegen.h"
3131
32-char *l_include_path[] = {
33- "/usr/local/include",
34- "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/include",
35- "/usr/lib/gcc/i686-apple-darwin8/4.0.0/include/",
36- "/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/include",
37- "/usr/lib/gcc/i686-apple-darwin8/4.0.1/include/",
38- "/usr/include",
39- "/System/Library/Frameworks",
40- "/Library/Frameworks",
41- 0
42-};
43-
32+#include "mc-include.c"
4433
4534 static
4635 char *init_src0 = "\
@@ -54,6 +43,9 @@
5443 #define __builtin_va_start(ap,arg) ap=(((int)(&arg))+sizeof(arg))\n\
5544 #define __builtin_va_arg(ap,type) (*((type *)ap)++)\n\
5645 #define alloca __builtin_alloca\n\
46+#define __FLT_MIN__ 1.17549435e-38F\n\
47+#define __DBL_MIN__ 2.2250738585072014e-308\n\
48+#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L\n\
5749 ";
5850
5951 #define TEXT_EMIT_MODE 0
@@ -1338,7 +1330,6 @@
13381330 }
13391331 }
13401332
1341-
13421333 void
13431334 code_neg(int creg) {
13441335 use_int(creg);
@@ -3466,7 +3457,6 @@
34663457 }
34673458
34683459 void
3469-
34703460 code_dconst(int e2,int freg,int d)
34713461 {
34723462 int lb;
@@ -3519,6 +3509,78 @@
35193509 free_register(r);
35203510 }
35213511
3512+void
3513+code_builtin_fabsf(int e)
3514+{
3515+ char *frn;
3516+ g_expr0(e);
3517+ use_float(0,freg);
3518+ frn = fregister_name(freg);
3519+ printf("\tfabs %s,%s\n",frn,frn);
3520+}
3521+
3522+void
3523+code_builtin_fabs(int e)
3524+{
3525+ char *frn;
3526+ g_expr0(e);
3527+ use_float(1,freg);
3528+ frn = fregister_name(freg);
3529+ printf("\tfabs %s,%s\n",frn,frn);
3530+}
3531+
3532+static void
3533+code_inf(int d)
3534+{
3535+ int lb;
3536+ int r;
3537+ char *rrn,*frn;
3538+ int freg = USE_CREG;
3539+
3540+ use_float(d,freg);
3541+ frn = fregister_name(freg);
3542+ rrn = register_name((r=get_register()));
3543+ use_reg(r); // to clear ptr cache
3544+ printf(" \t.data\n\t.align 3\n");
3545+ lb=fwdlabel();
3546+ printf("L_%d:\n",lb);
3547+ if (d) {
3548+#if ENDIAN_D==0
3549+ printf("\t.long\t0x%x,0x%x\n",0,0x7ff00000);
3550+#else
3551+ printf("\t.long\t0x%x,0x%x\n",0x7ff00000,0);
3552+#endif
3553+ } else {
3554+ printf("\t.long\t0x%x\n",0x7f800000);
3555+ }
3556+ if (output_mode==TEXT_EMIT_MODE) {
3557+ printf(".text\n");
3558+ } else {
3559+ text_mode(0);
3560+ }
3561+ printf("\taddis %s,r31,ha16(L_%d-L_%d)\n",rrn,lb,code_base);
3562+ printf("\tla %s,lo16(L_%d-L_%d)(%s)\n",rrn,lb,code_base,rrn);
3563+ if (d) {
3564+ printf("\tlfd %s,0(%s)\n",frn,rrn);
3565+ } else {
3566+ printf("\tlfs %s,0(%s)\n",frn,rrn);
3567+ }
3568+ free_register(r);
3569+}
3570+
3571+void
3572+code_builtin_inff()
3573+{
3574+ code_inf(0);
3575+}
3576+
3577+void
3578+code_builtin_inf()
3579+{
3580+ code_inf(1);
3581+}
3582+
3583+
35223584
35233585 void
35243586 code_dneg(int freg,int d)
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-code.h
--- a/mc-code.h Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-code.h Wed Sep 27 16:28:22 2006 +0900
@@ -278,6 +278,10 @@
278278 #endif
279279
280280 extern void code_alloca(int e,int reg);
281+extern void code_builtin_fabsf(int e);
282+extern void code_builtin_fabs(int e);
283+extern void code_builtin_inff();
284+extern void code_builtin_inf();
281285 extern void code_arg_register(NMTBL *fnptr);
282286
283287 extern int get_register();
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-codegen.c
--- a/mc-codegen.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-codegen.c Wed Sep 27 16:28:22 2006 +0900
@@ -290,6 +290,12 @@
290290 jump(e2,caddr(e1));
291291 return VOID;
292292 case ARRAY:
293+ if (chk==2) {
294+ g_expr0(e2);
295+ g_expr0(caddr(e1));
296+ code_gexpr(e1);
297+ return t;
298+ }
293299 e1=binop(ADD,e2,caddr(e1),cadddr(e1),caddddr(e1));
294300 e1 = indop(e1); t = type;
295301 g_expr0(e1);
@@ -542,6 +548,20 @@
542548 /* Too late. Should be evaluated in pexpr. */
543549 code_const(is_const(e2),USE_CREG);
544550 return INT;
551+ case BUILTIN_FABSF:
552+ code_builtin_fabsf(e2);
553+ return FLOAT;
554+ case BUILTIN_FABS:
555+ case BUILTIN_FABSL:
556+ code_builtin_fabs(e2);
557+ return DOUBLE;
558+ case BUILTIN_INFF:
559+ code_builtin_inff();
560+ return FLOAT;
561+ case BUILTIN_INF:
562+ case BUILTIN_INFL:
563+ code_builtin_inf();
564+ return DOUBLE;
545565 case COMMA:
546566 g_expr_u(e2);
547567 return g_expr0(caddr(e1));
@@ -2925,13 +2945,17 @@
29252945 if (car(e)<0) {
29262946 mode = GDECL;
29272947 switch (car(e)){
2928- case CONST: e=list2(car(e),cadr(e));
2948+ case CONST: e=list2(car(e),cadr(e)); break;
29292949 case FCONST:
2930- case DCONST: e=dlist2(car(e),dcadr(e));
2931- case LCONST: e=llist2(car(e),lcadr(e));
2932- case STRING: e=list3(car(e),cadr(e),caddr(e));
2950+ case DCONST: e=dlist2(car(e),dcadr(e)); break;
2951+ case LCONST: e=llist2(car(e),lcadr(e)); break;
2952+ case STRING: e=list3(car(e),cadr(e),caddr(e)); break;
29332953 case STRUCT: // for udpcl
2934- e=glist3(car(e),copy_expr(cadr(e)),copy_expr(caddr(e)));
2954+ e=glist3(car(e),copy_expr(cadr(e)),copy_expr(caddr(e))); break;
2955+ case ARRAY:
2956+ e= glist5(car(e),copy_expr(cadr(e)),
2957+ copy_expr(caddr(e)),cadddr(e),caddddr(e));
2958+ break;
29352959 }
29362960 mode = smode;
29372961 return e;
@@ -2941,8 +2965,6 @@
29412965 case ARROW:
29422966 case PERIOD:
29432967 return glist4(car(e),copy_expr(cadr(e)),caddr(e),cadddr(e));
2944- case ARRAY:
2945- return glist5(car(e),copy_expr(cadr(e)),copy_expr(caddr(e)),cadddr(e),caddddr(e));
29462968 case LVAR: case RLVAR:
29472969 case GVAR: case RGVAR:
29482970 return (e>=lfree)?glist3(car(e),cadr(e),caddr(e)):e;
@@ -3047,24 +3069,26 @@
30473069
30483070 // printf("## asm\n");
30493071 e = reverse0(e);
3072+
30503073 for(i=out;i;i=cadr(i)) {
3051- p = ((NMTBL*)cadr(car(i)))->nm;
3052- e1 = car(e); e = cadr(e);
3053- repl = code_asm_operand(p,e1,ASM_OUTPUT,repl,0,0);
3054- if (car(car(repl))==REGISTER) {
3055- assign = list2(assign_expr0(e1,car(repl),INT,INT),assign);
3056- }
3074+ p = ((NMTBL*)cadr(car(i)))->nm;
3075+ e1 = car(e); e = cadr(e);
3076+ repl = code_asm_operand(p,e1,ASM_OUTPUT,repl,0,0);
3077+ if (!chk && car(car(repl))==REGISTER) {
3078+ assign = list2(assign_expr0(e1,car(repl),INT,INT),assign);
3079+ }
30573080 }
30583081 repl0 = repl;
30593082 n = length(repl0);
30603083 for(i=in;i;i=cadr(i)) {
3061- p = ((NMTBL*)cadr(car(i)))->nm;
3062- e1 = car(e); e = cadr(e);
3063- repl = code_asm_operand(p,e1,ASM_INPUT,repl,n,repl0);
3064- if (car(car(repl))==REGISTER) {
3065- g_expr_u(assign_expr0(car(repl),e1,INT,INT));
3066- }
3084+ p = ((NMTBL*)cadr(car(i)))->nm;
3085+ e1 = car(e); e = cadr(e);
3086+ repl = code_asm_operand(p,e1,ASM_INPUT,repl,n,repl0);
3087+ if (!chk && car(car(repl))==REGISTER) {
3088+ g_expr_u(assign_expr0(car(repl),e1,INT,INT));
3089+ }
30673090 }
3091+
30683092 repl = reverse0(repl);
30693093 p = ((NMTBL*)cadr(asm0))->nm;
30703094 code_asm(p,repl);
@@ -4530,7 +4554,8 @@
45304554 }
45314555 if ((t1=type_value(type))>0 &&
45324556 car(type_value(type))==ARRAY && car(e)==GVAR) {
4533- e=list2(ADDRESS,e);
4557+ if (!chk)
4558+ e=list2(ADDRESS,e);
45344559 }
45354560 if (t>0) {
45364561 switch(car(t)) {
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-inline.c
--- a/mc-inline.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-inline.c Wed Sep 27 16:28:22 2006 +0900
@@ -928,6 +928,9 @@
928928 case STRING:
929929 case FNAME:
930930 case FLABEL:
931+ case BUILTIN_INF:
932+ case BUILTIN_INFF:
933+ case BUILTIN_INFL:
931934 return e1;
932935 case RSTRUCT:
933936 // list3(RSTRUCT,e,size)
@@ -1107,6 +1110,17 @@
11071110 return pdassign(e1);
11081111 case DASSOP: case FASSOP:
11091112 return pdassop(e1);
1113+
1114+ case BUILTIN_FABS:
1115+ case BUILTIN_FABSF:
1116+ case BUILTIN_FABSL:
1117+ e2 = pexpr(e2);
1118+ if (is_const(e2)) {
1119+ if (dcadr(e2) >= 0.0 ) return e2;
1120+ return pexpr(list2(car(e1)==BUILTIN_FABSF?
1121+ FMINUS:DMINUS,e2));
1122+ }
1123+ return list2(car(e1),e2);
11101124 #endif
11111125 #if LONGLONG_CODE
11121126 case LASS:
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-macro.c
--- a/mc-macro.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-macro.c Wed Sep 27 16:28:22 2006 +0900
@@ -666,7 +666,12 @@
666666 while(*chptr++); break;
667667 } else if (c=='/'&&chptr[0]=='*') {
668668 cheap->ptr--; chptr++;
669- while((c = *chptr++)) {
669+ for(;;) {
670+ c = *chptr++;
671+ if (!c) {
672+ getline();
673+ continue;
674+ }
670675 if (c=='*'&&chptr[0]=='/') {
671676 c = *chptr++; break;
672677 }
@@ -845,6 +850,7 @@
845850 int c,len;
846851 int in_quote = 0;
847852 int in_wquote = 0;
853+ int string_flag = 0;
848854 char *macro;
849855 char *body = body0;
850856 char **expand;
@@ -874,14 +880,26 @@
874880 mconcat = 1;
875881 // name concatenation. flag only. remove and re-evaluate
876882 // in the top level. (and skip space)
883+ } else if (!mconcat && c=='#' && alpha(*body)) {
884+ // turn into string next macro literal
885+ string_flag = 1;
886+ *cheap->ptr = '"';
887+ cheap = increment_cheap(cheap,expand);
888+ goto names;
877889 } else if (alpha(c)) {
878890 // find a name
879891 body--; // ungetc
892+names:
880893 nptrm = get_name(body,&len,NONDEF);
881894 if (!nptrm) {
882895 while((*cheap->ptr = *body++) && len--)
883896 cheap = increment_cheap(cheap,expand);
884897 body--;
898+ if (string_flag) {
899+ string_flag = 0;
900+ *cheap->ptr = '"';
901+ cheap = increment_cheap(cheap,expand);
902+ }
885903 continue;
886904 }
887905 body += len;
@@ -889,6 +907,7 @@
889907 nptrm = name_space_search(nptrm,MACRO);
890908 macro = (char *)car(nptrm->dsp);
891909 // if (check_recurse(macro,history)) goto skip;
910+// string_falg = 0;
892911 switch(nptrm->sc) {
893912 case FMACRO:
894913 if (c==' '||c=='\t') {
@@ -906,7 +925,14 @@
906925 break;
907926 case MACRO:
908927 if (neqname(nptrm->nm,macro)) {
909- if (macro[0]==0) continue;
928+ if (macro[0]==0) {
929+ if (string_flag) {
930+ string_flag = 0;
931+ *cheap->ptr = '"';
932+ cheap = increment_cheap(cheap,expand);
933+ }
934+ continue;
935+ }
910936 *cheap->ptr = 0;
911937 cheap = increment_cheap(cheap,expand);
912938 macrop=macro_eval(macrop,macro,list2((int)macro,history));
@@ -921,6 +947,11 @@
921947 while((*cheap->ptr = *macro++)/* && len-- */)
922948 cheap = increment_cheap(cheap,expand);
923949 }
950+ if (string_flag) {
951+ string_flag = 0;
952+ *cheap->ptr = '"';
953+ cheap = increment_cheap(cheap,expand);
954+ }
924955 continue;
925956 }
926957 *cheap->ptr = c;
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-parse.c
--- a/mc-parse.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-parse.c Wed Sep 27 16:28:22 2006 +0900
@@ -596,7 +596,7 @@
596596 #ifdef USE_CODE_KEYWORD
597597 reserve("code",CODE);
598598 #endif
599- reserve("__code__",CODE);
599+ reserve("__code",CODE);
600600 reserve("environment",ENVIRONMENT);
601601 reserve("float",FLOAT);
602602 reserve("double",DOUBLE);
@@ -610,6 +610,12 @@
610610 reserve("__builtin_alloca",ALLOCA);
611611 reserve("__builtin_constant_p",BUILTINP);
612612 reserve("__builtin_expect",BUILTIN_EXPECT);
613+ reserve("__builtin_fabs",BUILTIN_FABS);
614+ reserve("__builtin_fabsf",BUILTIN_FABSF);
615+ reserve("__builtin_fabsl",BUILTIN_FABSL);
616+ reserve("__builtin_inf",BUILTIN_INF);
617+ reserve("__builtin_inff",BUILTIN_INFF);
618+ reserve("__builtin_infl",BUILTIN_INFL);
613619 reserve("__attribute__",ATTRIBUTE);
614620 reserve("__attribute",ATTRIBUTE);
615621 reserve("__label__",LABEL);
@@ -619,6 +625,7 @@
619625 reserve("__LINE__",C_LINE);
620626 #if ASM_CODE
621627 reserve("asm",ASM);
628+ reserve("__asm",ASM); // ?
622629 reserve("__asm__",ASM);
623630 #endif
624631
@@ -1497,8 +1504,10 @@
14971504 return offset;
14981505 }
14991506 t1 = caddr(type0); /* list of fields */
1500- if (sym==LC) getsym(0);
1501- else if (sym==LPAR) {
1507+ if (sym==LC) {
1508+ mode = STAT;
1509+ getsym(0);
1510+ } else if (sym==LPAR) {
15021511 // have to be a value, no comma cascading values
15031512 // .__tcp_lhash_lock = (rwlock_t) { },
15041513 // We cannot this distinguish this case and cascading comma here.
@@ -1560,6 +1569,7 @@
15601569 mode=STADECL;
15611570 nptr0=new_static_name("__lstruct",'_');
15621571 def(nptr0,0);
1572+ mode=smode;
15631573 //nptr0->next = local_static_list; local_static_list = nptr0;
15641574 //nptr0->sc = STATIC;
15651575 //nptr0->ty = t = type;
@@ -2998,7 +3008,15 @@
29983008 if (sym!=STRING) error(DCERR);
29993009 asm0=list3(STRING,(int)nptr,nptr->dsp);
30003010 getsym(0);
3001- if (sym!=COLON) error(DCERR);
3011+ if (sym!=COLON) {
3012+#if 0
3013+ if (sym==RPAR) {
3014+ // old type asm statement
3015+ goto output;
3016+ }
3017+#endif
3018+ error(DCERR);
3019+ }
30023020 do {
30033021 // output expression
30043022 getsym(0);
@@ -3478,6 +3496,52 @@
34783496 checksym(RPAR);
34793497 type=t;
34803498 return e;
3499+ case BUILTIN_FABSF:
3500+ conv->prefix_(sym);
3501+ getsym(0);
3502+ checksym(LPAR);
3503+ e=expr0();
3504+ checksym(RPAR);
3505+ e = list2(op,rvalue_t(e,FLOAT));
3506+ type = FLOAT;
3507+ if (is_const(e)) {
3508+#if FLOAT_CODE
3509+ return (dcadr(e)>0.0) ? dcadr(e) : dlist2(FCONST,-dcadr(e));
3510+#endif
3511+ }
3512+ return e;
3513+ case BUILTIN_FABS:
3514+ case BUILTIN_FABSL:
3515+ conv->prefix_(sym);
3516+ getsym(0);
3517+ checksym(LPAR);
3518+ e=expr0();
3519+ checksym(RPAR);
3520+ e = list2(op,rvalue_t(e,DOUBLE));
3521+ type = DOUBLE;
3522+ if (is_const(e)) {
3523+#if FLOAT_CODE
3524+ return (dcadr(e)>0.0) ? dcadr(e) : dlist2(DCONST,-dcadr(e));
3525+#endif
3526+ }
3527+ return e;
3528+ case BUILTIN_INFF:
3529+ conv->prefix_(sym);
3530+ getsym(0);
3531+ checksym(LPAR);
3532+ checksym(RPAR);
3533+ type = FLOAT;
3534+ e = list2(op,0);
3535+ return e;
3536+ case BUILTIN_INF:
3537+ case BUILTIN_INFL:
3538+ conv->prefix_(sym);
3539+ getsym(0);
3540+ checksym(LPAR);
3541+ checksym(RPAR);
3542+ type = DOUBLE;
3543+ e = list2(op,0);
3544+ return e;
34813545 case SIZEOF:
34823546 conv->prefix_(sym);
34833547 if(getsym(0)==LPAR) {
@@ -3676,8 +3740,12 @@
36763740 } else {
36773741 if (stmode!=GOTO) // undefined on goto statement is OK
36783742 error(UDERR);
3743+ smode = mode; mode = GDECL;
3744+ // type = nptr->ty= glist3(FUNCTION,INT,0);
3745+ type = INT;
3746+ def(nptr,0);
36793747 nptr->sc = EXTRN1;
3680- type = nptr->ty= glist3(FUNCTION,INT,0);
3748+ mode = smode;
36813749 e1=list2(FNAME,(int)nptr);
36823750 // type=list3(nptr->sc,nptr->ty,nptr->dsp);
36833751 break;
@@ -3793,11 +3861,11 @@
37933861 mode=STADECL;
37943862 def(nptr0,0);
37953863 e1 = size(type);
3864+ mode = smode;
37963865 decl_data_field(type,nptr0,0);
37973866 conv->rc_();
37983867 checksym(RC);
37993868 e1 = list3(RSTRUCT,list3(GVAR,0,(int)nptr0),e1);
3800- mode = smode;
38013869 return e1;
38023870 }
38033871 e1=expr13();
@@ -4467,6 +4535,13 @@
44674535 getch();
44684536 }
44694537 }
4538+ /* C99 */
4539+ if (ch=='F' || ch=='L') {
4540+ // float or long double
4541+ *cheap->ptr = ch;
4542+ cheap = increment_cheap(cheap,&num);
4543+ getch();
4544+ }
44704545 *cheap->ptr = 0;
44714546 cheap = increment_cheap(cheap,&num);
44724547 dsymval = strtod(num,0);
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-switch.c
--- a/mc-switch.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-switch.c Wed Sep 27 16:28:22 2006 +0900
@@ -120,6 +120,7 @@
120120 {
121121 int range = max-min;
122122 int g;
123+ int c = 128*CASE_MERGE_RATE/100;
123124 // compute possible merge delta
124125 g = gcd(*delta,delta1);
125126 g = gcd(g,range);
@@ -136,7 +137,7 @@
136137 }
137138 #endif
138139 // count/((max-min)/delta) > 0.8
139- return count1*128>(range*128*CASE_MERGE_RATE/100);
140+ return count1*128>(range*c);
140141 }
141142
142143 static void
diff -r 9fdb3181ecb9 -r ce2364964f1e mc-tree.c
--- a/mc-tree.c Sat Apr 15 22:26:54 2006 +0900
+++ b/mc-tree.c Wed Sep 27 16:28:22 2006 +0900
@@ -537,8 +537,8 @@
537537 }
538538 case STRING:
539539 {
540- nptr = (NMTBL*)cadr(e);
541- int c; char *s = nptr->nm; int i=nptr->dsp;
540+ int c; char *s; int i;
541+ nptr = (NMTBL*)cadr(e); s = nptr->nm;i=nptr->dsp;
542542 fprintf(vout,"\"");
543543 while(--i>0) {
544544 c=*s++;
diff -r 9fdb3181ecb9 -r ce2364964f1e mc.h
--- a/mc.h Sat Apr 15 22:26:54 2006 +0900
+++ b/mc.h Wed Sep 27 16:28:22 2006 +0900
@@ -186,28 +186,31 @@
186186 #define COMP 13
187187 #define IVAR 14
188188 #define RIVAR 15
189-#define LABEL 16
189+#define BUILTIN_INF 16
190+#define BUILTIN_INFF 17
191+#define BUILTIN_INFL 18
192+#define LABEL 19
190193
191194 #define NULLARY_ARGS(i) (i==RETURN||i==ENVIRONMENT||i==LCALL||i==REGISTER||i==DREGISTER||i==FREGISTER||i==LREGISTER||(GVAR<=(i%SOP)&&(i%SOP)<=LABEL))
192195
193196 /* unary argments */
194197
195-#define ADDRESS 17
196-#define MINUS 18
197-#define LNOT 19
198-#define BNOT 20
199-#define INC 21
200-#define PERIOD 22
201-#define ARROW 23
202-#define POSTINC 24
203-#define UPOSTINC 25
204-#define PREINC 26
205-#define UPREINC 27
206-#define POSTDEC 28
207-#define UPOSTDEC 29
208-#define PREDEC 30
209-#define UPREDEC 31
210-#define DEC 32
198+#define ADDRESS 20
199+#define MINUS 21
200+#define LNOT 22
201+#define BNOT 23
202+#define INC 24
203+#define PERIOD 25
204+#define ARROW 26
205+#define POSTINC 27
206+#define UPOSTINC 28
207+#define PREINC 29
208+#define UPREINC 30
209+#define POSTDEC 31
210+#define UPOSTDEC 32
211+#define PREDEC 33
212+#define UPREDEC 34
213+#define DEC 35
211214 #define CPOSTINC (COP+POSTINC)
212215 #define CUPOSTINC (COP+UPOSTINC)
213216 #define CPREINC (COP+PREINC)
@@ -232,9 +235,9 @@
232235 #define LPREINC (LOP+PREINC)
233236 #define LUPOSTINC (LOP+UPOSTINC)
234237 #define LUPREINC (LOP+UPREINC)
235-#define INDIRECT 33
236-#define RINDIRECT 34
237-#define URINDIRECT 35
238+#define INDIRECT 36
239+#define RINDIRECT 37
240+#define URINDIRECT 38
238241 #define CRINDIRECT (COP+RINDIRECT)
239242 #define CURINDIRECT (COP+URINDIRECT)
240243 #define SRINDIRECT (SOP+RINDIRECT)
@@ -243,58 +246,61 @@
243246 #define DRINDIRECT (DOP+RINDIRECT)
244247 #define LRINDIRECT (LOP+RINDIRECT)
245248 #define LURINDIRECT (LOP+URINDIRECT)
246-#define RSTRUCT 36
247-#define ALLOCA 37
248-#define BUILTINP 38
249-#define BUILTIN_EXPECT 39
250-#define ATTRIBUTE 40
251-#define BIT_FIELD 41
252-#define RBIT_FIELD 42
253-#define BPREINC 43
254-#define BPOSTINC 44
255-#define CONV 45
249+#define RSTRUCT 39
250+#define ALLOCA 40
251+#define BUILTINP 41
252+#define BUILTIN_EXPECT 42
253+#define BUILTIN_FABS 43
254+#define BUILTIN_FABSF 44
255+#define BUILTIN_FABSL 45
256+#define ATTRIBUTE 46
257+#define BIT_FIELD 47
258+#define RBIT_FIELD 48
259+#define BPREINC 49
260+#define BPOSTINC 50
261+#define CONV 51
256262
257263 #define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV)
258264
259265 /* binary argments */
260266
261-#define MUL 46
262-#define UMUL 47
263-#define DIV 48
264-#define UDIV 49
265-#define MOD 50
266-#define UMOD 51
267-#define ADD 52
268-#define SUB 53
269-#define CMP 54
270-#define RSHIFT 55
271-#define URSHIFT 56
272-#define LSHIFT 57
273-#define ULSHIFT 58
274-#define GT 59
275-#define UGT 60
276-#define GE 61
277-#define UGE 62
278-#define LT 63
279-#define ULT 64
280-#define LE 65
281-#define ULE 66
282-#define EQ 67
283-#define NEQ 68
284-#define BAND 69
285-#define EOR 70
286-#define BOR 71
287-#define LAND 72
288-#define LOR 73
289-#define ASS 74
290-#define UCMP 75
291-#define UCMPGE 76
292-#define CMPGE 77
293-#define CMPEQ 78
294-#define CMPNEQ 79
295-#define ASSOP 80
296-#define UASSOP 81
297-#define COMMA 82
267+#define MUL 52
268+#define UMUL 53
269+#define DIV 54
270+#define UDIV 55
271+#define MOD 56
272+#define UMOD 57
273+#define ADD 58
274+#define SUB 59
275+#define CMP 60
276+#define RSHIFT 61
277+#define URSHIFT 62
278+#define LSHIFT 63
279+#define ULSHIFT 64
280+#define GT 65
281+#define UGT 66
282+#define GE 67
283+#define UGE 68
284+#define LT 69
285+#define ULT 70
286+#define LE 71
287+#define ULE 72
288+#define EQ 73
289+#define NEQ 74
290+#define BAND 75
291+#define EOR 76
292+#define BOR 77
293+#define LAND 78
294+#define LOR 79
295+#define ASS 80
296+#define UCMP 81
297+#define UCMPGE 82
298+#define CMPGE 83
299+#define CMPEQ 84
300+#define CMPNEQ 85
301+#define ASSOP 86
302+#define UASSOP 87
303+#define COMMA 88
298304
299305 #define CASS (COP+ASS)
300306 #define CASSOP (COP+ASSOP)
@@ -354,21 +360,21 @@
354360 #define LEOR (LOP+EOR)
355361 #define LBOR (LOP+BOR)
356362
357-#define BASS 83
358-#define BASSOP 84
359-#define BFD_REPL 85
363+#define BASS 89
364+#define BASSOP 90
365+#define BFD_REPL 91
360366
361-#define JUMP 86
367+#define JUMP 92
362368
363-#define STASS 87
369+#define STASS 93
364370
365371
366372 #define BINARY_ARGS(i) ((MUL<=(i%SOP)&&(i%SOP)<=STASS))
367373
368374 /* ternary argments */
369375
370-#define COND 88
371-#define UCOND 89
376+#define COND 94
377+#define UCOND 95
372378 #define SCOND (SOP+COND)
373379 #define SUCOND (SOP+UCOND)
374380 #define DCOND (DOP+COND)
@@ -380,33 +386,33 @@
380386
381387 /* not appeared as tags */
382388
383-#define LPAR 90
384-#define RPAR 91
385-#define LBRA 92
386-#define RBRA 93
387-#define LC 94
388-#define RC 95
389-#define COLON 96
390-#define SM 97
391-#define CNAME 98
389+#define LPAR 96
390+#define RPAR 97
391+#define LBRA 98
392+#define RBRA 99
393+#define LC 100
394+#define RC 101
395+#define COLON 102
396+#define SM 103
397+#define CNAME 104
392398
393-#define I2C 99
394-#define I2S 100
395-#define I2I 101
396-#define I2U 102
397-#define I2D 103
398-#define I2F 104
399-#define I2LL 105
400-#define I2ULL 106
399+#define I2C 105
400+#define I2S 106
401+#define I2I 107
402+#define I2U 108
403+#define I2D 109
404+#define I2F 110
405+#define I2LL 111
406+#define I2ULL 112
401407
402-#define U2UC 107
403-#define U2US 108
404-#define U2I 109
405-#define U2U 110
406-#define U2D 111
407-#define U2F 112
408-#define U2LL 113
409-#define U2ULL 114
408+#define U2UC 113
409+#define U2US 114
410+#define U2I 115
411+#define U2U 116
412+#define U2D 117
413+#define U2F 118
414+#define U2LL 119
415+#define U2ULL 120
410416
411417
412418 #define D2I (DOP+I2I)
@@ -441,27 +447,27 @@
441447
442448 /* statement start */
443449
444-#define ST_DECL 115
445-#define ST_IF 116
446-#define ST_DO 117
447-#define ST_WHILE 118
448-#define ST_FOR 119
449-#define ST_SWITCH 120
450-#define ST_COMP 121
451-#define ST_BREAK 122
452-#define ST_CONTINUE 123
453-#define ST_CASE 124
454-#define ST_DEFAULT 125
455-#define ST_RETURN 126
456-#define ST_GOTO 127
457-#define ST_ASM 128
458-#define ST_LABEL 129
459-#define ST_OP 130
460-#define ST_COMMENT 131
450+#define ST_DECL 121
451+#define ST_IF 122
452+#define ST_DO 123
453+#define ST_WHILE 124
454+#define ST_FOR 125
455+#define ST_SWITCH 126
456+#define ST_COMP 127
457+#define ST_BREAK 128
458+#define ST_CONTINUE 129
459+#define ST_CASE 130
460+#define ST_DEFAULT 131
461+#define ST_RETURN 132
462+#define ST_GOTO 133
463+#define ST_ASM 134
464+#define ST_LABEL 135
465+#define ST_OP 136
466+#define ST_COMMENT 137
461467
462468 #define IS_STATEMENT(i) (i==INLINE||(ST_DECL<=i&&i<=ST_COMMENT))
463469
464-#define HAS_ADDRESS 132
470+#define HAS_ADDRESS 138
465471
466472 /* statement end */
467473
diff -r 9fdb3181ecb9 -r ce2364964f1e test/arg.c
--- a/test/arg.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/arg.c Wed Sep 27 16:28:22 2006 +0900
@@ -5,18 +5,18 @@
55 };
66
77 void *exit_env;
8-code (*exit_code)();
8+__code (*exit___code)();
99
10-code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,code(*exit1)(),void *env)
10+__code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(),void *env)
1111 {
12- printf("#0011:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit_code,env==exit_env);
12+ printf("#0011:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env);
1313 goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env);
1414 }
1515
16-code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,code(*exit1)(),void *env)
16+__code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(),void *env)
1717 {
1818 struct arg args0;
19- printf("#0018:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit_code,env==exit_env );
19+ printf("#0018:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env );
2020 args0.a0 = arg0;
2121 args0.a1 = arg1;
2222 args0.a2 = arg2;
@@ -25,17 +25,17 @@
2525 goto cargs(args0,exit1,env);
2626 }
2727
28-code cargs(struct arg args0,code exit1(),void *env)
28+__code cargs(struct arg args0,__code exit1(),void *env)
2929 {
3030 printf("#0029:args: %d %d %d %d %d : %x %x\n",
3131 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,
32- exit1==exit_code,env==exit_env);
32+ exit1==exit___code,env==exit_env);
3333 // goto exit1(321),env;
3434 goto (*exit1)(0),env;
3535 }
3636
3737
38-code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l)
38+__code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l)
3939 {
4040 printf("#0039:args3: %d %d %d %d %d : %x %x %x %x\n",
4141 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
@@ -47,21 +47,21 @@
4747 goto carg4(args0,args1,j,k,l,i);
4848 }
4949
50-code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l)
50+__code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l)
5151 {
5252 printf("#0051:args4: %d %d %d %d %d : %x %x %x %x\n",
5353 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
5454 goto carg5(args1,args0,j,k,l,i);
5555 }
5656
57-code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l)
57+__code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l)
5858 {
5959 printf("#0058:args5: %d %d %d %d %d : %x %x %x %x\n",
6060 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
6161 goto carg6(i,j,k,l,args0);
6262 }
6363
64-code carg6(int i, int j,int k,int l,struct arg args0)
64+__code carg6(int i, int j,int k,int l,struct arg args0)
6565 {
6666 printf("#0065:args6: %d %d %d %d %d : %x %x %x %x\n",
6767 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
@@ -70,7 +70,7 @@
7070
7171 int main1(int n)
7272 {
73- goto carg1(0,1,2,3,4,exit_code=return,exit_env=environment);
73+ goto carg1(0,1,2,3,4,exit___code=return,exit_env=environment);
7474 return n;
7575 }
7676
diff -r 9fdb3181ecb9 -r ce2364964f1e test/arg1.c
--- a/test/arg1.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/arg1.c Wed Sep 27 16:28:22 2006 +0900
@@ -5,18 +5,18 @@
55 };
66
77 void *exit_env;
8-code (*exit_code)();
8+__code (*exit___code)();
99
10-code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,code(*exit1)(),void *env)
10+__code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(),void *env)
1111 {
12- printf("#0011:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit_code,env==exit_env);
12+ printf("#0011:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env);
1313 goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env);
1414 }
1515
16-code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,code(*exit1)(),void *env)
16+__code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,__code(*exit1)(),void *env)
1717 {
1818 struct arg args0;
19- printf("#0018:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit_code,env==exit_env );
19+ printf("#0018:arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1==exit___code,env==exit_env );
2020 args0.a0 = arg0;
2121 args0.a1 = arg1;
2222 args0.a2 = arg2;
@@ -25,17 +25,17 @@
2525 goto cargs(args0,exit1,env);
2626 }
2727
28-code cargs(struct arg args0,code exit1(),void *env)
28+__code cargs(struct arg args0,__code exit1(),void *env)
2929 {
3030 printf("#0029:args: %d %d %d %d %d : %x %x\n",
3131 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,
32- exit1==exit_code,env==exit_env);
32+ exit1==exit___code,env==exit_env);
3333 // goto exit1(321),env;
3434 goto (*exit1)(0),env;
3535 }
3636
3737
38-code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l)
38+__code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l)
3939 {
4040 printf("#0039:args3: %d %d %d %d %d : %x %x %x %x\n",
4141 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
@@ -47,21 +47,21 @@
4747 goto carg4(args0,args1,j,k,l,i);
4848 }
4949
50-code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l)
50+__code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l)
5151 {
5252 printf("#0051:args4: %d %d %d %d %d : %x %x %x %x\n",
5353 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
5454 goto carg5(args1,args0,j,k,l,i);
5555 }
5656
57-code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l)
57+__code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l)
5858 {
5959 printf("#0058:args5: %d %d %d %d %d : %x %x %x %x\n",
6060 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
6161 goto carg6(i,j,k,l,args0);
6262 }
6363
64-code carg6(int i, int j,int k,int l,struct arg args0)
64+__code carg6(int i, int j,int k,int l,struct arg args0)
6565 {
6666 printf("#0065:args6: %d %d %d %d %d : %x %x %x %x\n",
6767 args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l);
@@ -70,7 +70,7 @@
7070
7171 int main1(int n)
7272 {
73- goto carg1(0,1,2,3,4,exit_code=return,exit_env=environment);
73+ goto carg1(0,1,2,3,4,exit___code=return,exit_env=environment);
7474 return n;
7575 }
7676
diff -r 9fdb3181ecb9 -r ce2364964f1e test/basic-code.c
--- a/test/basic-code.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/basic-code.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,17 +1,17 @@
11 int printf(const char *format, ...);
22
3-code
3+__code
44 f50(
55 float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float a11,float a12,float a13,float a14,float a15,float a16,float a17,float a18,float a19,float a20,float a21,float a22,float a23,float a24,float a25,float a26,float a27,float a28,float a29,float a30,float a31,float a32,float a33,float a34,float a35,float a36,float a37,float a38,float a39,float a40,float a41,float a42,float a43,float a44,float a45,float a46,float a47,float a48,float a49
66 );
77
88
9-code
9+__code
1010 d50(
1111 double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10,double a11,double a12,double a13,double a14,double a15,double a16,double a17,double a18,double a19,double a20,double a21,double a22,double a23,double a24,double a25,double a26,double a27,double a28,double a29,double a30,double a31,double a32,double a33,double a34,double a35,double a36,double a37,double a38,double a39,double a40,double a41,double a42,double a43,double a44,double a45,double a46,double a47,double a48,double a49
1212 );
1313
14-code
14+__code
1515 i50(
1616 int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10,int a11,int a12,int a13,int a14,int a15,int a16,int a17,int a18,int a19,int a20,int a21,int a22,int a23,int a24,int a25,int a26,int a27,int a28,int a29,int a30,int a31,int a32,int a33,int a34,int a35,int a36,int a37,int a38,int a39,int a40,int a41,int a42,int a43,int a44,int a45,int a46,int a47,int a48,int a49
1717 )
@@ -29,7 +29,7 @@
2929 );
3030 }
3131
32-code
32+__code
3333 f50(
3434 float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float a11,float a12,float a13,float a14,float a15,float a16,float a17,float a18,float a19,float a20,float a21,float a22,float a23,float a24,float a25,float a26,float a27,float a28,float a29,float a30,float a31,float a32,float a33,float a34,float a35,float a36,float a37,float a38,float a39,float a40,float a41,float a42,float a43,float a44,float a45,float a46,float a47,float a48,float a49
3535 )
@@ -47,7 +47,7 @@
4747 );
4848 }
4949
50-code
50+__code
5151 d50(
5252 double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10,double a11,double a12,double a13,double a14,double a15,double a16,double a17,double a18,double a19,double a20,double a21,double a22,double a23,double a24,double a25,double a26,double a27,double a28,double a29,double a30,double a31,double a32,double a33,double a34,double a35,double a36,double a37,double a38,double a39,double a40,double a41,double a42,double a43,double a44,double a45,double a46,double a47,double a48,double a49
5353 )
@@ -63,10 +63,10 @@
6363 goto exit0();
6464 }
6565
66-code (*ret)(int);
66+__code (*ret)(int);
6767 void *env;
6868
69-code
69+__code
7070 exit0()
7171 {
7272 goto (*ret)(0),env;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/conv.c
--- a/test/conv.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/conv.c Wed Sep 27 16:28:22 2006 +0900
@@ -14,23 +14,23 @@
1414 typedef char *stack;
1515
1616 struct cont_interface { // General Return Continuation
17- code (*ret)();
17+ __code (*ret)();
1818 };
1919
20-code f(int i,stack sp) {
20+__code f(int i,stack sp) {
2121 int k,j;
2222 k = 3+i;
2323 goto f_g0(i,k,sp);
2424 }
2525
2626 struct f_g0_interface { // Specialized Return Continuation
27- code (*ret)();
27+ __code (*ret)();
2828 int i_,k_,j_;
2929 };
3030
31-code f_g1(int j,stack sp);
31+__code f_g1(int j,stack sp);
3232
33-code f_g0(int i,int k,stack sp) { // Caller
33+__code f_g0(int i,int k,stack sp) { // Caller
3434 struct f_g0_interface *c =
3535 (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface));
3636
@@ -41,24 +41,24 @@
4141 goto g(i+3,sp);
4242 }
4343
44-code f_g1(int j,stack sp) { // Continuation
44+__code f_g1(int j,stack sp) { // Continuation
4545 struct f_g0_interface *c = sp;
4646 int k = c->k_;
4747 sp += sizeof(struct f_g0_interface);
4848 goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp);
4949 }
5050
51-code g(int i,stack sp) {
51+__code g(int i,stack sp) {
5252 goto (( (struct cont_interface *)sp)->ret)(i+4,sp);
5353 }
5454
5555 struct main_continuation { // General Return Continuation
56- code (*ret)();
57- code (*main_ret)();
56+ __code (*ret)();
57+ __code (*main_ret)();
5858 void *env;
5959 };
6060
61-code main_return(int i,stack sp) {
61+__code main_return(int i,stack sp) {
6262 printf("#0061:%d\n",i);
6363 goto (( (struct main_continuation *)sp)->main_ret)(0),
6464 ((struct main_continuation *)sp)->env;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/conv1.c
--- a/test/conv1.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/conv1.c Wed Sep 27 16:28:22 2006 +0900
@@ -32,23 +32,23 @@
3232 typedef char *stack;
3333
3434 struct cont_interface { // General Return Continuation
35- code (*ret)();
35+ __code (*ret)();
3636 };
3737
38-code f(int i,stack sp) {
38+__code f(int i,stack sp) {
3939 int k,j;
4040 k = 3+i;
4141 goto f_g0(i,k,sp);
4242 }
4343
4444 struct f_g0_interface { // Specialized Return Continuation
45- code (*ret)();
45+ __code (*ret)();
4646 int i_,k_,j_;
4747 };
4848
49-code f_g1(int j,stack sp);
49+__code f_g1(int j,stack sp);
5050
51-code f_g0(int i,int k,stack sp) { // Caller
51+__code f_g0(int i,int k,stack sp) { // Caller
5252 struct f_g0_interface *c =
5353 (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface));
5454
@@ -59,7 +59,7 @@
5959 goto g(i+3,sp);
6060 }
6161
62-code f_g1(int j,stack sp) { // Continuation
62+__code f_g1(int j,stack sp) { // Continuation
6363 struct f_g0_interface *c = sp;
6464 int k = c->k_;
6565 sp+=sizeof(struct f_g0_interface);
@@ -67,9 +67,9 @@
6767 goto (c->ret)(k+4+j,sp);
6868 }
6969
70-code g_h1(int j,stack sp);
70+__code g_h1(int j,stack sp);
7171
72-code g(int i,stack sp) { // Caller
72+__code g(int i,stack sp) { // Caller
7373 struct f_g0_interface *c =
7474 (struct f_g0_interface *)(sp -= sizeof(struct f_g0_interface));
7575
@@ -79,7 +79,7 @@
7979 goto h(i+3,sp);
8080 }
8181
82-code g_h1(int j,stack sp) { // Continuation
82+__code g_h1(int j,stack sp) { // Continuation
8383 struct f_g0_interface *c = sp;
8484 int i = c->i_;
8585 sp+=sizeof(struct f_g0_interface);
@@ -87,18 +87,18 @@
8787 goto (c->ret)(j+i,sp);
8888 }
8989
90-code h(int i,stack sp) {
90+__code h(int i,stack sp) {
9191 struct f_g0_interface *c = sp;
9292 goto (c->ret)(i+4,sp);
9393 }
9494
9595 struct main_continuation { // General Return Continuation
96- code (*ret)();
97- code (*main_ret)();
96+ __code (*ret)();
97+ __code (*main_ret)();
9898 void *env;
9999 };
100100
101-code main_return(int i,stack sp) {
101+__code main_return(int i,stack sp) {
102102 if (loop-->0)
103103 goto f(233,sp);
104104 printf("#0103:%d\n",i);
@@ -108,26 +108,26 @@
108108
109109 /* little optimzation without stack continuation (2) */
110110
111-code f2(int i,char *sp) {
111+__code f2(int i,char *sp) {
112112 int k,j;
113113 k = 3+i;
114114 goto g2(i,k,i+3,sp);
115115 }
116116
117-code g2(int i,int k,int j,char *sp) {
117+__code g2(int i,int k,int j,char *sp) {
118118 j = j+4;
119119 goto h2(i,k+4+j,sp);
120120 }
121121
122-code h2_1(int i,int k,int j,char *sp) {
122+__code h2_1(int i,int k,int j,char *sp) {
123123 goto main_return2(i+j,sp);
124124 }
125125
126-code h2(int i,int k,char *sp) {
126+__code h2(int i,int k,char *sp) {
127127 goto h2_1(i,k,i+4,sp);
128128 }
129129
130-code main_return2(int i,stack sp) {
130+__code main_return2(int i,stack sp) {
131131 if (loop-->0)
132132 goto f2(233,sp);
133133 printf("#0132:%d\n",i);
@@ -137,30 +137,30 @@
137137
138138 /* little optimizaed case (3) */
139139
140-code f2_1(int i,char *sp) {
140+__code f2_1(int i,char *sp) {
141141 int k,j;
142142 k = 3+i;
143143 goto g2_1(k,i+3,sp);
144144 }
145145
146-code g2_1(int k,int i,char *sp) {
146+__code g2_1(int k,int i,char *sp) {
147147 goto h2_11(k,i+4,sp);
148148 }
149149
150-code f2_0_1(int k,int j,char *sp);
151-code h2_1_1(int i,int k,int j,char *sp) {
150+__code f2_0_1(int k,int j,char *sp);
151+__code h2_1_1(int i,int k,int j,char *sp) {
152152 goto f2_0_1(k,i+j,sp);
153153 }
154154
155-code h2_11(int i,int k,char *sp) {
155+__code h2_11(int i,int k,char *sp) {
156156 goto h2_1_1(i,k,i+4,sp);
157157 }
158158
159-code f2_0_1(int k,int j,char *sp) {
159+__code f2_0_1(int k,int j,char *sp) {
160160 goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp);
161161 }
162162
163-code main_return2_1(int i,stack sp) {
163+__code main_return2_1(int i,stack sp) {
164164 if (loop-->0)
165165 goto f2_1(233,sp);
166166 printf("#0165:%d\n",i);
diff -r 9fdb3181ecb9 -r ce2364964f1e test/conv2.c
--- a/test/conv2.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/conv2.c Wed Sep 27 16:28:22 2006 +0900
@@ -17,17 +17,17 @@
1717 */
1818
1919 struct _ret { // General Return Continuation // ####
20- code (*_ret)();
20+ __code (*_ret)();
2121 };
2222
2323 // in include file
2424 struct env000 { // ####
25- code (*ret)(int,stack *sp); // ####
25+ __code (*ret)(int,stack *sp); // ####
2626 arg000 { int i; } arg000; // ####
2727 local000 { int k,j; } local000; // ####
2828 };
2929
30-code
30+__code
3131 f0(int i, stack _sp) {
3232 struct env000 *_save; // ####
3333 int k,j;
@@ -40,7 +40,7 @@
4040 goto g0(i+3,_sp);
4141 }
4242
43-static code
43+static __code
4444 f0_1(int _reply,stack _sp)
4545 {
4646 struct _env000 *_save; // ####
@@ -55,11 +55,11 @@
5555
5656 // in inlucde file
5757 struct env001 { // ####
58- code (*ret)(int,stack *sp); // ####
58+ __code (*ret)(int,stack *sp); // ####
5959 arg001 { int i; } arg001; // ####
6060 } ;
6161
62-code
62+__code
6363 g0(int i, stack _sp) {
6464 struct _env001 *_save; // ####
6565
@@ -70,7 +70,7 @@
7070 goto h0(i+4,sp);
7171 }
7272
73-static code
73+static __code
7474 g0_1(int _reply,stack _sp)
7575 {
7676 struct _env001 *_save; // ####
@@ -84,7 +84,7 @@
8484 }
8585
8686
87-static code
87+static __code
8888 h0(int i,stack _sp)
8989 {
9090 struct _ret *ret = (struct _ret *)_sp; // ####
@@ -99,12 +99,12 @@
9999
100100 // in inlucde file
101101 struct _main_ret {
102- code (*ret)(int);
103- code (*_main_ret)(int);
102+ __code (*ret)(int);
103+ __code (*_main_ret)(int);
104104 void *env;
105105 } ;
106106
107-code
107+__code
108108 _exit(int ret,stack sp)
109109 {
110110 struct _main_ret *ret = (struct _main_ret *)_sp;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/conv3.c
--- a/test/conv3.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/conv3.c Wed Sep 27 16:28:22 2006 +0900
@@ -17,17 +17,17 @@
1717 */
1818
1919 struct _ret { // General Return Continuation // ####
20- code (*_ret)();
20+ __code (*_ret)();
2121 };
2222
2323 // in include file
2424 struct env000 { // ####
25- code (*ret)(int,stack *sp); // ####
25+ __code (*ret)(int,stack *sp); // ####
2626 arg000 { int i; } arg000; // ####
2727 local000 { int k,j; } local000; // ####
2828 };
2929
30-code
30+__code
3131 f0(int i, stack _sp) {
3232 struct env000 *_env;
3333 _env = (typeof(_env))(_sp = _new_stack(_sp,sizeof( *_env))); // ####
@@ -38,7 +38,7 @@
3838 goto g0(_env->arg000.i+3,_sp);
3939 }
4040
41-static code
41+static __code
4242 f0_1(int _reply,stack _sp)
4343 {
4444 struct _env000 *_env; // ####
@@ -52,11 +52,11 @@
5252
5353 // in inlucde file
5454 struct env001 { // ####
55- code (*ret)(int,stack *sp); // ####
55+ __code (*ret)(int,stack *sp); // ####
5656 arg001 { int i; } arg001; // ####
5757 } ;
5858
59-code
59+__code
6060 g0(int i, stack _sp) {
6161 struct _env001 *_env; // ####
6262
@@ -67,7 +67,7 @@
6767 goto h0(_env->arg001.i+4,sp);
6868 }
6969
70-static code
70+static __code
7171 g0_1(int _reply,stack _sp)
7272 {
7373 struct _env001 *_env; // ####
@@ -80,7 +80,7 @@
8080 }
8181
8282
83-static code
83+static __code
8484 h0(int i,stack _sp)
8585 {
8686 struct _ret *ret = (struct _ret *)_sp; // ####
@@ -95,12 +95,12 @@
9595
9696 // in inlucde file
9797 struct _main_ret {
98- code (*ret)(int);
99- code (*_main_ret)(int);
98+ __code (*ret)(int);
99+ __code (*_main_ret)(int);
100100 void *env;
101101 } ;
102102
103-code
103+__code
104104 _exit(int ret,stack sp)
105105 {
106106 struct _main_ret *ret = (struct _main_ret *)_sp;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/fact-a.c
--- a/test/fact-a.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/fact-a.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,6 +1,6 @@
11 #include "stdio.h"
22
3-code factorial(int n,int result,int orig,code(*print)(),code(*exit1)(), void *exit1env)
3+__code factorial(int n,int result,int orig,__code(*print)(),__code(*exit1)(), void *exit1env)
44 {
55 if (n<0) {
66 printf("#0005:err %d!\n",n);
@@ -15,7 +15,7 @@
1515 }
1616 }
1717
18-code print(int n,int result,int orig,code(*print)(),code (*exit1)(),void*exit1env);
18+__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(),void*exit1env);
1919
2020 int main( int ac, char *av[])
2121 {
@@ -25,7 +25,7 @@
2525 goto factorial(n,1,n,print,return,environment);
2626 }
2727
28-code print(int n,int result,int orig,code(*print)(),code (*exit1)(),void*exit1env)
28+__code print(int n,int result,int orig,__code(*print)(),__code (*exit1)(),void*exit1env)
2929 {
3030 printf("#0029:%d! = %d\n",orig, result);
3131 goto (*exit1)(0),exit1env;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/fact.c
--- a/test/fact.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/fact.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,5 +1,5 @@
11 #include "stdio.h"
2-code print();
2+__code print();
33 int
44 main(ac,av)
55 int ac;
@@ -11,19 +11,19 @@
1111 goto factorial(n,1,n,print,return,environment);
1212 }
1313
14-code print(n,result,orig,print,exit1,exit1env)
14+__code print(n,result,orig,print,exit1,exit1env)
1515 int n,result,orig;
16-code (*print)(),(*exit1)();
16+__code (*print)(),(*exit1)();
1717 void *exit1env;
1818 {
1919 printf("#0018:%d! = %d\n",n, result);
2020 goto (*exit1)(0),exit1env;
2121 }
2222
23-code factorial(n,result,orig,print,exit1,exit1env)
23+__code factorial(n,result,orig,print,exit1,exit1env)
2424 int n,result,orig;
25-code (*print)();
26-code (*exit1)();
25+__code (*print)();
26+__code (*exit1)();
2727 void *exit1env;
2828 {
2929 if (n<0) {
diff -r 9fdb3181ecb9 -r ce2364964f1e test/float_gcc.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/float_gcc.c Wed Sep 27 16:28:22 2006 +0900
@@ -0,0 +1,58 @@
1+#include <math.h>
2+
3+extern int printf(const char *,...);
4+
5+
6+#if 0
7+static __inline__ int __inline_signbitf( float __x ) {
8+ union{ float __f; unsigned int __u;
9+ }
10+ __u = {__x};
11+ return (int)(__u.__u >> 31);
12+}
13+
14+static __inline__ int __inline_isnormalf( float __x ) {
15+ float fabsf = __builtin_fabsf(__x);
16+ if( __x != __x ) return 0;
17+ return fabsf < __builtin_inff() && fabsf >= __FLT_MIN__;
18+}
19+
20+ extern double scalb ( double, double ) __asm("_scalb$UNIX2003" );
21+#endif
22+
23+
24+double fabs0(double a)
25+{
26+ return __builtin_fabs(a);
27+}
28+
29+float fabsf0(float a)
30+{
31+ return __builtin_fabsf(a);
32+}
33+
34+
35+
36+int main()
37+{
38+ float a = 0.3;
39+ double d = 0.3;
40+ float f ;
41+ double dd ;
42+ int i,j;
43+ i = __inline_signbitf(a);
44+ j = __inline_isnormalf(a);
45+ d = scalb( d, d );
46+
47+ dd = __builtin_inf();
48+ printf("inf %g\n",dd);
49+ f = __builtin_inff();
50+ printf("inff %g\n",f);
51+ // printf("scalb %g\n",d);
52+
53+ d = -0.3;
54+
55+ printf("%d %d %g\n",i,j,d);
56+ printf("%g %g\n",fabs0(d),fabsf0(d));
57+ printf("%g %g\n",fabs0(-d),fabsf0(-d));
58+}
diff -r 9fdb3181ecb9 -r ce2364964f1e test/func_conv_err.c
--- a/test/func_conv_err.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/func_conv_err.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,5 +1,5 @@
11
2-code hoge()
2+__code hoge()
33 {
44 goto hoge(); // ok
55 }
@@ -10,25 +10,25 @@
1010 return 1;
1111 }
1212
13-code hoga(int i)
13+__code hoga(int i)
1414 {
1515 f(); // ok
1616 h(); // ok h() is a function
1717 if (i)
1818 goto f(); // bad
1919 else if(i-1)
20- goto g(i); // ok g() is a code segement
20+ goto g(i); // ok g() is a __code segement
2121 } // need goto bad
2222
2323 int
24-g(int i) { // g is already used as code bad
24+g(int i) { // g is already used as __code bad
2525 k();
2626 if (i)
2727 goto h(); // bad
2828 // should complain.... no return value
2929 }
3030
31-code k() { // bad k is already used as function
31+__code k() { // bad k is already used as function
3232 goto hoge(); // ok
3333 }
3434
diff -r 9fdb3181ecb9 -r ce2364964f1e test/goto.c
--- a/test/goto.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/goto.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,71 +1,71 @@
11
22
3-code (*conv)(int,code (*)());
4-code a2(int i,code conv());
5-code a3(int i,code conv());
6-code a4(int i,code conv());
7-code a5(int i,code conv());
8-code a6();
9-code a7();
10-code a8();
11-code a9();
3+__code (*conv)(int,__code (*)());
4+__code a2(int i,__code conv());
5+__code a3(int i,__code conv());
6+__code a4(int i,__code conv());
7+__code a5(int i,__code conv());
8+__code a6();
9+__code a7();
10+__code a8();
11+__code a9();
1212
13-char* print_conv(code conv());
13+char* print_conv(__code conv());
1414
15-code (*exit0)(int);
15+__code (*exit0)(int);
1616 void *env;
1717
18-code
19-a2(int i,code conv())
18+__code
19+a2(int i,__code conv())
2020 {
2121 printf("#0020:a2 %d %s\n",i,print_conv(conv));
2222 goto conv(i+1,a4);
2323 }
2424
25-code
26-a3(int i,code (*conv)())
25+__code
26+a3(int i,__code (*conv)())
2727 {
2828 printf("#0027:a3 %d %s\n",i,print_conv(conv));
2929 goto conv(i+1,a5);
3030 }
3131
32-code
33-a4(int i,code conv())
32+__code
33+a4(int i,__code conv())
3434 {
3535 printf("#0034:a4 %d %s\n",i,print_conv(conv));
3636 goto (*conv)(i+1,a6);
3737 }
3838
39-code
40-a5(int i,code (*conv)())
39+__code
40+a5(int i,__code (*conv)())
4141 {
4242 printf("#0041:a5 %d %s\n",i,print_conv(conv));
4343 goto (*conv)(i+1,i+2,i+3,a7);
4444 }
4545
46-code
47-a6(int i,int j,int k,code conv())
46+__code
47+a6(int i,int j,int k,__code conv())
4848 {
4949 printf("#0048:a6 %d %s\n",i,print_conv(conv));
5050 goto conv(i+1,j,k,a8);
5151 }
5252
53-code
54-a7(int i,,int j,int k,code (*conv)())
53+__code
54+a7(int i,,int j,int k,__code (*conv)())
5555 {
5656 printf("#0055:a7 %d %s\n",i,print_conv(conv));
5757 goto conv(i+1,j,k,a9);
5858 }
5959
60-code
61-a8(int i,int j,int k,code conv())
60+__code
61+a8(int i,int j,int k,__code conv())
6262 {
6363 printf("#0062:a8 %d %s\n",i,print_conv(conv));
6464 goto (*conv)(i+1,j,k,exit0);
6565 }
6666
67-code
68-a9(int i,int j,int k,code (*conv)())
67+__code
68+a9(int i,int j,int k,__code (*conv)())
6969 {
7070 printf("#0069:a9 %d %s\n",i,print_conv(conv));
7171 goto (*conv)(0),env;
@@ -79,7 +79,7 @@
7979 }
8080
8181 char*
82-print_conv(code conv())
82+print_conv(__code conv())
8383 {
8484 if(conv==a2) return "a2";
8585 if(conv==a3) return "a3";
diff -r 9fdb3181ecb9 -r ce2364964f1e test/i3.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/i3.c Wed Sep 27 16:28:22 2006 +0900
@@ -0,0 +1,25 @@
1+
2+extern int printf(const char *,...);
3+
4+// #define CASE_MERGE_RATE 50
5+unsigned int CASE_MERGE_RATE=50;
6+unsigned int a=100;
7+
8+int
9+main()
10+{
11+ int max = 524288;
12+ int min = 131072;
13+ int range = 393216;
14+ int count1 = 3;
15+ int g = 1;
16+
17+// range 393216 min 131072, max 524288, count 3, delta 1, rate 0.000762939 t=0
18+
19+ printf("## range %d min %d, max %d, count %d, delta %d, rate %g t=%d\n",
20+ range, min,max,count1,g,
21+ ((double)count1)*100.0/range,
22+ count1*128>(range*128*CASE_MERGE_RATE/a)
23+ );
24+ return 0;
25+}
diff -r 9fdb3181ecb9 -r ce2364964f1e test/longcode.c
--- a/test/longcode.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/longcode.c Wed Sep 27 16:28:22 2006 +0900
@@ -27,18 +27,18 @@
2727 int ccount;
2828 } player;
2929
30-code
30+__code
3131 put_enemy_bung(
32- code(*junction)(int,teki *,player,struct move_interface),
32+ __code(*junction)(int,teki *,player,struct move_interface),
3333 int tekino,
3434 teki *enemy,
3535 player jiki,
3636 struct move_interface interface);
3737
38-code
38+__code
3939 move13_1(int tekino,teki *enemy,player jiki,struct move_interface interface);
4040
41-code
41+__code
4242 move13(int tekino,teki *enemy,player jiki,struct move_interface interface)
4343 {
4444 if (enemy[keyenemyno].f == 0 ) {
diff -r 9fdb3181ecb9 -r ce2364964f1e test/macro.c
--- a/test/macro.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/macro.c Wed Sep 27 16:28:22 2006 +0900
@@ -33,6 +33,10 @@
3333
3434 #define name_hoge(c) (c+a)
3535
36+#define hoge000(a) (a+a) /* hoge
37+ comment
38+*/
39+
3640
3741 int
3842 main() {
@@ -71,9 +75,30 @@
7175 #endif
7276 printf("#0071:%d\n",name(3,hoge));
7377 printf("#0072:%d\n",names(3,hoge));
78+ printf("#0073:%d\n",hoge000(3));
7479 return 0;
7580 }
7681
82+/* For GCC 2.7 and later, we can use specific type-size attributes. */
83+# define __intN_t(N, MODE) \
84+ typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
85+# define __u_intN_t(N, MODE) \
86+ typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
87+
88+# ifndef __int8_t_defined
89+# define __int8_t_defined
90+__intN_t (8, __QI__);
91+__intN_t (16, __HI__);
92+__intN_t (32, __SI__);
93+__intN_t (64, __DI__);
94+# endif
95+
96+__u_intN_t (8, __QI__);
97+__u_intN_t (16, __HI__);
98+__u_intN_t (32, __SI__);
99+__u_intN_t (64, __DI__);
100+
101+
77102 int tmp()
78103 #if 0
79104 {
diff -r 9fdb3181ecb9 -r ce2364964f1e test/ret_check.c
--- a/test/ret_check.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/ret_check.c Wed Sep 27 16:28:22 2006 +0900
@@ -2,25 +2,25 @@
22
33 #ifdef __micro_c__
44
5-code(*f_incl_ret)(int);
5+____code(*f_incl_ret)(int);
66 void *f_incl_env;
77
8-code
8+__code
99 f_incl2(int a0)
1010 { // 正しいのはコッチ
1111 printf("#0010:%d\n",a0);
1212 goto f_incl_ret(a0),f_incl_env;
1313 }
1414
15-code
15+__code
1616 f_incl2_test(float a0)
1717 { // ret先のinterface型が異なる
1818 printf("#0017:%g\n",a0);
1919 goto f_incl_ret(a0),f_incl_env;
2020 }
2121
22-code
23-f_incl1(int a0,code(*ret)(int))
22+__code
23+f_incl1(int a0,__code(*ret)(int))
2424 {
2525 printf("#0024:%d\n",a0);
2626 goto ret(a0*a0);
diff -r 9fdb3181ecb9 -r ce2364964f1e test/simp.c
--- a/test/simp.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/simp.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,5 +1,7 @@
1-#include "stdio.h"
1+// #include "stdio.h"
2+extern int printf(char *const,...);
23
4+// #define UNDECL
35
46 float f = 3;
57 float g = 4096.0f;
@@ -36,6 +38,10 @@
3638 ch = 'E';
3739 main1(-8);
3840 printf("#0037:%d\n",main2(3));
41+#ifdef UNDECL
42+ j = k; // undeclared global variable
43+ printf("#0037:%d\n",h);
44+#endif
3945 return main0(ac,ch,av);
4046 }
4147
diff -r 9fdb3181ecb9 -r ce2364964f1e test/test1.c
--- a/test/test1.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/test1.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,5 +1,5 @@
11 /*
2- test for CbC converted code from C
2+ test for CbC converted __code from C
33 */
44
55 #include "stdio.h"
@@ -9,25 +9,25 @@
99 void *stack0; /* size of void* == 1 */
1010
1111 struct cont_save { /* General Return Continuation */
12- code (*ret)();
12+ __code (*ret)();
1313 };
1414
1515 /*
16- code g(int,void *);
17- code f_g0(int ,int ,void *);
18- code f_g1(int,void *);
16+ __code g(int,void *);
17+ __code f_g0(int ,int ,void *);
18+ __code f_g1(int,void *);
1919 */
2020
2121 struct f_g0_save { /* Specialized Return Continuation */
22- code (*ret)();
22+ __code (*ret)();
2323 int ii,kk,jj;
2424 };
2525
26-code g(int i,void *sp) {
26+__code g(int i,void *sp) {
2727 goto (* ((struct cont_save *)sp)->ret)(i+4,sp);
2828 }
2929
30-code f_g1(int j,void *sp) { /* Continuation */
30+__code f_g1(int j,void *sp) { /* Continuation */
3131 int k;
3232 struct f_g0_save *c;
3333
@@ -37,7 +37,7 @@
3737 goto (* ((struct cont_save *)sp)->ret)(k+4+j,sp);
3838 }
3939
40-code f(int i,void *sp) {
40+__code f(int i,void *sp) {
4141 int k,j;
4242 struct f_g0_save *c;
4343 printf("#0042:f 0 sp: %x\n",sp-stack0);
@@ -58,14 +58,14 @@
5858
5959
6060 struct f0_save { /* Specialized Return Continuation */
61- code (*ret)();
62- code (*exit1)();
61+ __code (*ret)();
62+ __code (*exit1)();
6363 void *exit1env;
6464 int jj;
6565 };
6666
67-code f1(int i,void *sp) ;
68-code f0(int i,int j,code(*exit2)(), void *exit2env,void *sp)
67+__code f1(int i,void *sp) ;
68+__code f0(int i,int j,__code(*exit2)(), void *exit2env,void *sp)
6969 {
7070 struct f0_save *c;
7171 printf("#0070:f0 1 sp: %x\n",sp-stack0);
@@ -80,10 +80,10 @@
8080 goto f(i,sp);
8181 }
8282
83-code f1(int i,void *sp) {
83+__code f1(int i,void *sp) {
8484 int j;
8585 int *exit2env;
86- code (*exit2)();
86+ __code (*exit2)();
8787 struct f0_save *c;
8888
8989 c = sp;
@@ -110,7 +110,7 @@
110110 goto f0(i,j,return,environment,sp);
111111 }
112112
113-code print(int i,int j,(*exit1)(),void*exit1env)
113+__code print(int i,int j,(*exit1)(),void*exit1env)
114114 {
115115 printf("#0114:%d %d\n",i,j);
116116 goto (*exit1)(0),exit1env;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/test2.c
--- a/test/test2.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/test2.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,23 +1,23 @@
11 #include <stdio.h>
22 int sender_bit;
33
4-code (*ret)(int);
4+__code (*ret)(int);
55 void *env;
66
77 struct packet {
88 int bit;
99 char *msg;
10- code (*next)();
10+ __code (*next)();
1111 };
1212
13-code print_struct(struct packet pkt)
13+__code print_struct(struct packet pkt)
1414 {
1515 printf("bit: %d\n", pkt.bit);
1616 printf("message: %s\n", pkt.msg);
1717 goto ret(0), env;
1818 }
1919
20-code initSender(int init_bit, struct packet pkt)
20+__code initSender(int init_bit, struct packet pkt)
2121 {
2222 sender_bit = init_bit;
2323 pkt.next = print_struct;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/throw.c
--- a/test/throw.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/throw.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,7 +1,7 @@
11
22 extern int printf(const char *,...);
33
4-code (*ret)();
4+__code (*ret)();
55 void *env;
66
77 #define ENVSIZE (1<<14)
@@ -14,13 +14,13 @@
1414 int last;
1515 } interface1;
1616
17-code
17+__code
1818 throw2(interface1 arg,int i,int j)
1919 {
2020 goto ret(3),env;
2121 }
2222
23-code
23+__code
2424 throw1(interface1 arg,int i,int j)
2525 {
2626 printf("%d %d %d %d %d\n",arg.last,arg.a,arg.c[99],i,j);
@@ -28,7 +28,7 @@
2828 goto throw2(arg,i,74);
2929 }
3030
31-code
31+__code
3232 throw(interface1 arg,int i,int j)
3333 {
3434 char *space = (char *)malloc(ENVSIZE)+ENVSIZE;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmp1.c
--- a/test/tmp1.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmp1.c Wed Sep 27 16:28:22 2006 +0900
@@ -1,8 +1,8 @@
11 /* easy test */
22
3-code (*ret)();
3+__code (*ret)();
44 void *env;
5-code exit1(int ac);
5+__code exit1(int ac);
66
77 main0(ac,av)
88 int ac;
@@ -18,13 +18,13 @@
1818 printf("#0017:main0 %d end.\n",ac);
1919 }
2020
21-code exit1(int ac)
21+__code exit1(int ac)
2222 {
2323 // exit(0);
2424 goto code3(0,1,2,3,4,5);
2525 }
2626
27-code code3(a,b,c,d,e,f)
27+__code code3(a,b,c,d,e,f)
2828 char a,b;
2929 int c,d,e,f;
3030 {
@@ -35,7 +35,7 @@
3535 goto code4(a+3,b+3,c+3,d+3,e+3,f+3);
3636 }
3737
38-code code4(a,b,c,d,e,f)
38+__code code4(a,b,c,d,e,f)
3939 char a,b;
4040 int c,d,e,f;
4141 {
@@ -52,19 +52,19 @@
5252 else goto ret(0),env;
5353 }
5454
55-code code0(ac,av,ret)
55+__code code0(ac,av,ret)
5656 int ac;
5757 char *av[];
58-code ret();
58+__code ret();
5959 {
6060 goto code1(ac,av,ret);
6161 }
6262
63-code code1(ac,av,exit)
63+__code code1(ac,av,exit)
6464 int ac,exit;
6565 char *av[];
6666 {
67- code (*f)(int);
67+ __code (*f)(int);
6868 printf("#0067:code1: %d\n",ac);
6969 f = exit;
7070 if (ac>3)
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmp2.c
--- a/test/tmp2.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmp2.c Wed Sep 27 16:28:22 2006 +0900
@@ -20,9 +20,9 @@
2020 goto code0(av,return,environment);
2121 }
2222
23-code code0(av,ret,retenv)
23+__code code0(av,ret,retenv)
2424 char *av[];
25-code (*ret)();
25+__code (*ret)();
2626 void *retenv;
2727 {
2828 char *p;
@@ -31,9 +31,9 @@
3131 goto code1(av,ret,retenv);
3232 }
3333
34-code code1(av,ret,retenv)
34+__code code1(av,ret,retenv)
3535 char *av[];
36-code (*ret)();
36+__code (*ret)();
3737 void *retenv;
3838 {
3939 fprintf(stdout,"4: %s\n",av[0]);
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmp4.c
--- a/test/tmp4.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmp4.c Wed Sep 27 16:28:22 2006 +0900
@@ -24,10 +24,10 @@
2424 goto code0(i,j,k,av,return,environment);
2525 }
2626
27-code code0(i,j,k,av,ret,retenv)
27+__code code0(i,j,k,av,ret,retenv)
2828 int i,j,k;
2929 char *av[];
30-code (*ret)();
30+__code (*ret)();
3131 void *retenv;
3232 {
3333 char *p;
@@ -36,20 +36,20 @@
3636 goto code1(i,j,k,av,ret,retenv);
3737 }
3838
39-code code1(i,j,k,av,ret,retenv)
39+__code code1(i,j,k,av,ret,retenv)
4040 int i,j,k;
4141 char *av[];
42-code (*ret)();
42+__code (*ret)();
4343 void *retenv;
4444 {
4545 fprintf(stdout,"4: %s\n",av[0]+2);
4646 goto code2(i,j,k,av,ret,retenv);
4747 }
4848
49-code code2(i,j,k,av,ret,retenv)
49+__code code2(i,j,k,av,ret,retenv)
5050 int i,j,k;
5151 char *av[];
52-code (*ret)();
52+__code (*ret)();
5353 void *retenv;
5454 {
5555 fprintf(stdout,"5: %s\n",av[0]+2);
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmp6.c
--- a/test/tmp6.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmp6.c Wed Sep 27 16:28:22 2006 +0900
@@ -24,7 +24,7 @@
2424 main0(ac,av,ret,retenv)
2525 int ac;
2626 char *av[];
27-code (*ret)();
27+__code (*ret)();
2828 void *retenv;
2929 {
3030 int i,j,k;
@@ -35,12 +35,12 @@
3535 goto code0(i,j,k,av,ret,retenv,return,environment);
3636 }
3737
38-code code0(i,j,k,av,ret,retenv,ret1,ret1env)
38+__code code0(i,j,k,av,ret,retenv,ret1,ret1env)
3939 int i,j,k;
4040 char *av[];
41-code (*ret)();
41+__code (*ret)();
4242 void *retenv;
43-code (*ret1)();
43+__code (*ret1)();
4444 void *ret1env;
4545 {
4646 char *p;
@@ -49,24 +49,24 @@
4949 goto code1(i,j,k,av,ret,retenv,ret1,ret1env);
5050 }
5151
52-code code1(i,j,k,av,ret,retenv,ret1,ret1env)
52+__code code1(i,j,k,av,ret,retenv,ret1,ret1env)
5353 int i,j,k;
5454 char *av[];
55-code (*ret)();
55+__code (*ret)();
5656 void *retenv;
57-code (*ret1)();
57+__code (*ret1)();
5858 void *ret1env;
5959 {
6060 fprintf(stdout,"4: %s\n",av[0]);
6161 goto code2(i,j,k,av,ret,retenv,ret1,ret1env);
6262 }
6363
64-code code2(i,j,k,av,ret,retenv,ret1,ret1env)
64+__code code2(i,j,k,av,ret,retenv,ret1,ret1env)
6565 int i,j,k;
6666 char *av[];
67-code (*ret)();
67+__code (*ret)();
6868 void *retenv;
69-code (*ret1)();
69+__code (*ret1)();
7070 void *ret1env;
7171 {
7272 fprintf(stdout,"5: %s\n",av[0]);
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmp7.c
--- a/test/tmp7.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmp7.c Wed Sep 27 16:28:22 2006 +0900
@@ -10,6 +10,12 @@
1010 INLINE struct aa
1111 main0(int);
1212
13+INLINE void
14+main01(int k, struct aa a)
15+{
16+ printf("main01 k=%d,a[0]=%d,a[99]=%d\n",k,a.a[0],a.a[99]);
17+}
18+
1319 INLINE struct aa
1420 main0(int k)
1521 {
@@ -78,6 +84,10 @@
7884
7985 j = 3;
8086
87+ aaa.a[0] = 55;
88+ aaa.a[99] = 66;
89+ main01(j,aaa);
90+
8191 bbb = main0(123);
8292 printf("#0082:copied main0 ccc.a[55] %d==123\n",bbb.a[55]);
8393 aap[2] = &bbb;
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmp8.c
--- a/test/tmp8.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmp8.c Wed Sep 27 16:28:22 2006 +0900
@@ -13,7 +13,7 @@
1313 int
1414 main()
1515 {
16- int a[0] ;
16+ int a[1] ;
1717 for(asize=4;asize<64000;asize=asize*2+12) {
1818 f2(1);
1919 f2(0);
diff -r 9fdb3181ecb9 -r ce2364964f1e test/tmpa.c
--- a/test/tmpa.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/tmpa.c Wed Sep 27 16:28:22 2006 +0900
@@ -16,11 +16,11 @@
1616 typedef struct{
1717 char dest;
1818 int VF01[4];
19- code (*ret)();
19+ __code (*ret)();
2020 void *env;
2121 } interface;
2222
23-code a0(interface a) {
23+__code a0(interface a) {
2424 printf("#0023:%d\n",a.dest);
2525 goto a.ret(0),a.env;
2626 }
diff -r 9fdb3181ecb9 -r ce2364964f1e test/too-long-argument.c
--- a/test/too-long-argument.c Sat Apr 15 22:26:54 2006 +0900
+++ b/test/too-long-argument.c Wed Sep 27 16:28:22 2006 +0900
@@ -2,14 +2,14 @@
22
33 #undef WRONGNUMBER
44
5-typedef code
5+typedef __code
66 (*CCC)( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff,
7- code(*ret)(int),
7+ __code(*ret)(int),
88 void *env);
99
10-code
10+__code
1111 tcode2( int f1,int f2,int f3,int f4,int f5,int f6,int f7,int f8,int f9,int fa,int fb,int fc,int fd,int fe,int ff,
12- code(*ret)(int),
12+ __code(*ret)(int),
1313 void *env)
1414 {
1515 fprintf(stdout,"tcode2: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n",
@@ -17,10 +17,10 @@
1717 goto ret(0),env;
1818 }
1919
20-code
20+__code
2121 tcode1(f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff,ret,env)
2222 int f1,f2,f3,f4,f5,f6,f7,f8,f9,fa,fb,fc,fd,fe,ff;
23- code(*ret)(int);
23+ __code(*ret)(int);
2424 void *env;
2525 {
2626 fprintf(stdout,"tcode1: f1=%d,f2=%d,f3=%d,f4=%d,f5=%d,f6=%d,f7=%d,f8=%d,f9=%d,fa=%d,fb=%d,fc=%d,fd=%d,fe=%d,ff=%d\n",
@@ -28,8 +28,8 @@
2828 goto ret(0),env;
2929 }
3030
31-code
32-tcode4(int x,int y,CCC junction,code(*ret)(int),void *env)
31+__code
32+tcode4(int x,int y,CCC junction,__code(*ret)(int),void *env)
3333 {
3434 #ifdef WRONGNUMBER
3535 goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,ret,env);
@@ -38,8 +38,8 @@
3838 #endif
3939 }
4040
41-code
42-tcode0(int x,int y,code(*junction)(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,code(*)(int),void *),code(*ret)(int),void *env)
41+__code
42+tcode0(int x,int y,__code(*junction)(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,__code(*)(int),void *),__code(*ret)(int),void *env)
4343 {
4444 #ifdef WRONGNUMBER
4545 goto junction(0,1,2,3,4,5,6,7,8,9,10,11,12,13,ret,env);
diff -r 9fdb3181ecb9 -r ce2364964f1e tools/find-gcc-include-path
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/find-gcc-include-path Wed Sep 27 16:28:22 2006 +0900
@@ -0,0 +1,19 @@
1+#!/usr/bin/perl
2+
3+my $CC = $ARGV[1];
4+my $gcc = `echo '#include <stddef.h>' | $CC -E - `;
5+
6+$gcc =~ m=\"(/[^"]+/)stddef\.h"=;
7+my $gcc_path = $1;
8+
9+if ($ARGV[0]=~/-l/) {
10+print <<EOF
11+char *l_include_path[] = {
12+ "/usr/include/",
13+ "$gcc_path",
14+ 0
15+};
16+EOF
17+} else {
18+ print "$gcc_path\n";
19+}
Show on old repository browser