History

update

bellard committed 24 years ago

Commit b0b2d5d1 parent 2694c107 files · +49 −62Browse files

Unified · Split

7 files
  1. Makefile +20 −10
  2. README +7 −42
  3. TODO +7 −7
  4. stdbool.h +10 −0
  5. stddef.h +2 −1
  6. tcc-doc.texi +2 −2
  7. tcclib.h +1 −0
Makefile+20−10
@@ -5,13 +5,13 @@ prefix=/usr/local · 4 unmodified lines
5 5
6CFLAGS=-O2 -g -Wall -Wno-parentheses -Wno-missing-braces -I.6CFLAGS=-O2 -g -Wall -Wno-parentheses -Wno-missing-braces -I.
7LIBS=-ldl7LIBS=-ldl
8#CFLAGS=-O2 -g -Wall -Wno-parentheses -I. -pg -static -DPROFILE8CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
9#LIBS=9LIBS_P=
10 10
11CFLAGS+=-m386 -malign-functions=011CFLAGS+=-m386 -malign-functions=0
12DISAS=objdump -D -b binary -m i38612DISAS=objdump -D -b binary -m i386
13INSTALL=install13INSTALL=install
14VERSION=0.9.114VERSION=0.9.2
15 15
16all: tcc16all: tcc
17 17
@@ -21,7 +21,7 @@ test: test.ref test.out · 3 unmodified lines
21 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi21 @if diff -u test.ref test.out ; then echo "Auto Test OK"; fi
22 22
23prog.ref: prog.c 23prog.ref: prog.c
24 gcc $(CFLAGS) -o $@ $<24 gcc3 $(CFLAGS) -o $@ $<
25 25
26test.ref: prog.ref26test.ref: prog.ref
27 ./prog.ref > $@27 ./prog.ref > $@
@@ -33,12 +33,12 @@ run: tcc prog.c · 5 unmodified lines
33 ./tcc -I. prog.c33 ./tcc -I. prog.c
34 34
35# iterated test2 (compile tcc then compile prog.c !)35# iterated test2 (compile tcc then compile prog.c !)
36test2: tcc tcc.c prog.c36test2: tcc tcc.c prog.c test.ref
37 ./tcc -I. tcc.c -I. prog.c > test.out237 ./tcc -I. tcc.c -I. prog.c > test.out2
38 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi38 @if diff -u test.ref test.out2 ; then echo "Auto Test2 OK"; fi
39 39
40# iterated test3 (compile tcc then compile tcc then compile prog.c !)40# iterated test3 (compile tcc then compile tcc then compile prog.c !)
41test3: tcc tcc.c prog.c41test3: tcc tcc.c prog.c test.ref
42 ./tcc -I. tcc.c -I. tcc.c -I. prog.c > test.out342 ./tcc -I. tcc.c -I. tcc.c -I. prog.c > test.out3
43 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi43 @if diff -u test.ref test.out3 ; then echo "Auto Test3 OK"; fi
44 44
@@ -57,7 +57,7 @@ ex3: ex3.c · 12 unmodified lines
57 57
58# Tiny C Compiler58# Tiny C Compiler
59 59
60tcc_g: tcc.c Makefile60tcc_g: tcc.c i386-gen.c Makefile
61 gcc $(CFLAGS) -o $@ $< $(LIBS)61 gcc $(CFLAGS) -o $@ $< $(LIBS)
62 62
63tcc: tcc_g63tcc: tcc_g
@@ -66,11 +66,15 @@ tcc: tcc_g · 2 unmodified lines
66install: tcc 66install: tcc
67 $(INSTALL) -m755 tcc $(prefix)/bin67 $(INSTALL) -m755 tcc $(prefix)/bin
68 mkdir -p $(prefix)/lib/tcc68 mkdir -p $(prefix)/lib/tcc
69 $(INSTALL) -m644 stdarg.h stddef.h tcclib.h $(prefix)/lib/tcc69 $(INSTALL) -m644 stdarg.h stddef.h float.h tcclib.h $(prefix)/lib/tcc
70 70
71clean:71clean:
72 rm -f *~ *.o tcc tcc1 tcct tcc_g prog.ref *.bin *.i ex2 \72 rm -f *~ *.o tcc tcc1 tcct tcc_g prog.ref *.bin *.i ex2 \
73 core gmon.out test.out test.ref a.out73 core gmon.out test.out test.ref a.out tcc_p
74
75# profiling version
76tcc_p: tcc.c Makefile
77 gcc $(CFLAGS_P) -o $@ $< $(LIBS_P)
74 78
75# target for development79# target for development
76 80
@@ -78,6 +82,9 @@ clean: · 1 unmodified line
78 ./tcc -o $@ -I. $<82 ./tcc -o $@ -I. $<
79 $(DISAS) $@83 $(DISAS) $@
80 84
85instr: instr.o
86 objdump -d instr.o
87
81instr.o: instr.S88instr.o: instr.S
82 gcc -O2 -Wall -g -c -o $@ $<89 gcc -O2 -Wall -g -c -o $@ $<
83 90
@@ -88,6 +95,9 @@ tar: · 4 unmodified lines
88 cp -r ../tcc /tmp/$(FILE)95 cp -r ../tcc /tmp/$(FILE)
89 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz \96 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz \
90 $(FILE)/Makefile $(FILE)/README $(FILE)/TODO $(FILE)/COPYING \97 $(FILE)/Makefile $(FILE)/README $(FILE)/TODO $(FILE)/COPYING \
91 $(FILE)/tcc.c $(FILE)/stddef.h $(FILE)/stdarg.h $(FILE)/tcclib.h \98 $(FILE)/Changelog $(FILE)/tcc-doc.html \
99 $(FILE)/tcc.c $(FILE)/i386-gen.c \
100 $(FILE)/stddef.h $(FILE)/stdarg.h $(FILE)/stdbool.h $(FILE)/float.h \
101 $(FILE)/tcclib.h \
92 $(FILE)/ex*.c $(FILE)/prog.c )102 $(FILE)/ex*.c $(FILE)/prog.c )
93 rm -rf /tmp/$(FILE)103 rm -rf /tmp/$(FILE)
README+7−42
@@ -5,7 +5,7 @@ Features: · 4 unmodified lines
5--------5--------
6 6
7- SMALL! You can compile and execute C code everywhere, for example on7- SMALL! You can compile and execute C code everywhere, for example on
8 rescue disks (29KB for x86 TCC executable).8 rescue disks.
9 9
10- FAST! tcc generates optimized x86 code. No byte code10- FAST! tcc generates optimized x86 code. No byte code
11 overhead. Compiles, assemble and link about 7 times faster than 'gcc11 overhead. Compiles, assemble and link about 7 times faster than 'gcc
@@ -27,7 +27,7 @@ Documentation: · 15 unmodified lines
27 27
281) Installation281) Installation
29 29
30***TCC currently only work on Linux x86***.30***TCC currently only works on Linux x86***.
31 31
32Type 'make install' to compile and install tcc in /usr/local/bin and32Type 'make install' to compile and install tcc in /usr/local/bin and
33/usr/local/lib/tcc.33/usr/local/lib/tcc.
@@ -60,8 +60,8 @@ default ones are: /usr/include, /usr/lib/tcc, /usr/local/lib/tcc. · 26 unmodified lines
60libxxx.so. Standard library paths are checked, including those60libxxx.so. Standard library paths are checked, including those
61specificed with LD_LIBRARY_PATH.61specificed with LD_LIBRARY_PATH.
62 62
63Only one source code can be compiled. If you have multiple source63'-i file' : compile C source 'file' before main C source. With this
64files, add one which includes all your sources.64command, multiple C files can be compiled and linked together.
65 65
664) Examples664) Examples
67 67
@@ -84,44 +84,9 @@ generator. · 16 unmodified lines
84prog.c: auto test for TCC which tests many subtle possible bugs. Used84prog.c: auto test for TCC which tests many subtle possible bugs. Used
85when doing 'make test'.85when doing 'make test'.
86 86
87Exact differences with ANSI C:875) Full Documentation
88-----------------------------
89 88
90- Preprocessor: the preprocessor tokens are the same as C. It means89Please read tcc-doc.html to have all the features of TCC.
91 that in some rare cases, preprocessed numbers are not handled
92 exactly as in ANSI C. This approach has the advantage of being
93 simpler and FAST!
94
95- Types: floating point numbers are not supported yet.
96
97- Bit fields are not supported.
98
99- Linking: extern variables must appear in a referenced dll and cannot
100 appear in current source.
101
102Supported ANSI C extensions:
103---------------------------
104
105- 'inline' keyword is ignored (ISOC99).
106
107- 'restrict' keyword is ignored (ISOC99).
108
109- '__func__' is a string variable containing the current function name (ISOC99).
110
111- Variadic macros: __VA_ARGS__ can be used for function-like macros (ISOC99):
112 #define dprintf(level, __VA_ARGS__) printf(__VA_ARGS__).
113
114- Declarations can appear anywhere in a block (ISOC99).
115
116- Array and struct/union elements can be initialized in any order by
117 using designators (.e.g. { [0].x = 1 }) (ISOC99).
118
119- Compound initializers are supported (e.g. int *p = (int []){ 1, 2,
120 3}) (ISOC99).
121
122- '#!' at the start of a line is ignored to allow scripting.
123
124- Binary digits can be entered ('0b101' instead of '5').
125 90
126Technical Description:91Technical Description:
127---------------------92---------------------
@@ -162,7 +127,7 @@ License: · 34 unmodified lines
162TCC is distributed under the GNU General Public License (see COPYING127TCC is distributed under the GNU General Public License (see COPYING
163file). 128file).
164 129
165I accept only patches where you give your copyright explictely to me130I accept only patches where you give your copyright explicitely to me
166to simplify licensing issues.131to simplify licensing issues.
167 132
168Fabrice Bellard - Nov 17, 2001.133Fabrice Bellard - Nov 17, 2001.
TODO+7−7
@@ -1,21 +1,21 @@
1TODO list:1TODO list:
2 2
3Critical:3Critical:
4 4- finish float/double support. add function type convertion.
5- add float/double support (should be as small as possible while being5- section generation and GNUC __attributte__ handling.
6 usable for RISC code generator too).6- D option with '=' handling
7- 0 is pointer - fix type compare7- 0 is pointer - fix type compare
8- add message if external function or variable not found.
9- To check: 'sizeof' may not work if too complex expression is given.8- To check: 'sizeof' may not work if too complex expression is given.
10- fix 'char' and 'short' casts (in function parameters and in assignment).9- fix 'char' and 'short' casts (only in function parameters and in
11- function pointers to forward reference (patch code generator).10 assignment).
12 11
13Not critical:12Not critical:
14 13
14- interactive mode
15- fix multiple compound literals inits in blocks (ISOC99 normative15- fix multiple compound literals inits in blocks (ISOC99 normative
16 example - only relevant when using gotos! -> must add boolean16 example - only relevant when using gotos! -> must add boolean
17 variable to tell if compound literal was already initialized).17 variable to tell if compound literal was already initialized).
18- fix L"\x1234" wide string case (need to store them as ints ?) */18- fix L"\x1234" wide string case (need to store them as utf8 ?)
19- fix preprocessor symbol redefinition19- fix preprocessor symbol redefinition
20- better constant opt (&&, ||, ?:)20- better constant opt (&&, ||, ?:)
21- add ELF executable and shared library output option (would be needed21- add ELF executable and shared library output option (would be needed
stdbool.h+10−0
@@ -0,0 +1,10 @@
1#ifndef _STDBOOL_H
2#define _STDBOOL_H
3
4/* ISOC99 boolean */
5
6#define bool _Bool
7#define true 1
8#define false 0
9
10#endif /* _STDBOOL_H */
stddef.h+2−1
@@ -1,9 +1,10 @@
1#ifndef _STDDEF_H1#ifndef _STDDEF_H
2#define _STDDEF_H2#define _STDDEF_H
3 3
4/* TCC include file */
5#define NULL ((void *)0)4#define NULL ((void *)0)
6typedef unsigned int size_t;5typedef unsigned int size_t;
7typedef int wchar_t;6typedef int wchar_t;
7typedef int ptrdiff_t;
8#define offsetof(type, field) ((size_t) &((type *)0)->field)
8 9
9#endif10#endif
tcc-doc.texi+2−2
@@ -29,8 +29,8 @@ it was an executable. · 28 unmodified lines
29 29
30<h2>Exact differences with ANSI C</h2>30<h2>Exact differences with ANSI C</h2>
31 31
32TCC implements almost all the ANSI C standard, except floating point32TCC implements almost all the ANSI C standard, except floating points
33and long long numbers.33numbers.
34 34
35<ul>35<ul>
36 <li> The preprocessor tokens are the same as C. It means that in some36 <li> The preprocessor tokens are the same as C. It means that in some
tcclib.h+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 * only for your convenience so that you do not need to put the whole4 * only for your convenience so that you do not need to put the whole
5 * glibc include files on your floppy disk 5 * glibc include files on your floppy disk
6 */6 */
7
7#include <stddef.h>8#include <stddef.h>
8#include <stdarg.h>9#include <stdarg.h>
9 10

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t