| @@ -5,16 +5,18 @@ Features: · 4 unmodified lines |
| 5 | 5 | -------- |
| 6 | 6 | |
| 7 | 7 | - SMALL! You can compile and execute C code everywhere, for example on |
| 8 | | − rescue disks (25KB for x86 executable). |
| 8 | + rescue disks (27KB for x86 TCC executable). |
| 9 | 9 | |
| 10 | | −- FAST! tcc generates optimized x86 code. No byte code overhead. |
| 10 | +- FAST! tcc generates optimized x86 code. No byte code |
| 11 | + overhead. Compiles, assemble and link about 7 times faster than 'gcc |
| 12 | + -O0'. |
| 11 | 13 | |
| 12 | 14 | - UNLIMITED! Any C dynamic library can be used directly. TCC is |
| 13 | | − heading torward full ANSI C compliance. TCC can of course compile |
| 15 | + heading torward full ISOC99 compliance. TCC can of course compile |
| 14 | 16 | itself. |
| 15 | 17 | |
| 16 | 18 | - Compile and execute C source directly. No linking or assembly |
| 17 | | − necessary. Full C preprocessor included. |
| 19 | + necessary. Full C preprocessor included. |
| 18 | 20 | |
| 19 | 21 | - C script supported : just add '#!/usr/local/bin/tcc' at the first |
| 20 | 22 | line of your C source, and execute it directly from the command |
| @@ -27,7 +29,7 @@ Documentation: · 6 unmodified lines |
| 27 | 29 | |
| 28 | 30 | ***TCC currently only work on Linux x86***. |
| 29 | 31 | |
| 30 | | −Type 'make install' to compile and install tcc in /usr/local and |
| 32 | +Type 'make install' to compile and install tcc in /usr/local/bin and |
| 31 | 33 | /usr/local/lib/tcc. |
| 32 | 34 | |
| 33 | 35 | 2) Introduction |
| @@ -64,7 +66,7 @@ files, add one which includes all your sources. · 30 unmodified lines |
| 64 | 66 | 4) Examples |
| 65 | 67 | |
| 66 | 68 | ex1.c: simplest example (hello world). Can also be launched directly |
| 67 | | −as a script: ./ex2.c. |
| 69 | +as a script: './ex1.c'. |
| 68 | 70 | |
| 69 | 71 | ex2.c: more complicated example: find a number with the four |
| 70 | 72 | operations given a list of numbers (benchmark). |
| @@ -72,12 +74,12 @@ operations given a list of numbers (benchmark). · 1 unmodified line |
| 72 | 74 | ex3.c: compute fibonacci numbers (benchmark). |
| 73 | 75 | |
| 74 | 76 | ex4.c: more complicated: X11 program. Very complicated test in fact |
| 75 | | −because standard headers are being used ! Currently slow because |
| 76 | | −parsing does not use hash tables. |
| 77 | +because standard headers are being used ! |
| 77 | 78 | |
| 78 | 79 | ex5.c: 'hello world' with standard glibc headers. |
| 79 | 80 | |
| 80 | | −tcc.c: TCC can compile itself. Used to check the code generator. |
| 81 | +tcc.c: TCC can of course compile itself. Used to check the code |
| 82 | +generator. |
| 81 | 83 | |
| 82 | 84 | prog.c: auto test for TCC which tests many subtle possible bugs. Used |
| 83 | 85 | when doing 'make test'. |
| @@ -91,38 +93,57 @@ Exact differences with ANSI C: · 7 unmodified lines |
| 91 | 93 | rare cases, preprocessed numbers are not handled exactly as in ANSI |
| 92 | 94 | C. This approach has the advantage of being simpler and FAST! |
| 93 | 95 | |
| 94 | | − - __LINE__, __FILE__, __DATE__, __TIME__ are currently not handled. |
| 95 | | − |
| 96 | | − - #line not handled |
| 97 | | − |
| 98 | 96 | 2) C language |
| 99 | 97 | |
| 100 | | −- Parsing: variables cannot be initialized ('int a = 1' or 'int tab[2] = |
| 101 | | − {1, 2}' not supported). |
| 102 | | − |
| 103 | 98 | - Cannot pass struct/union as value. Cannot assign struct/union (use |
| 104 | 99 | memcpy instead). |
| 105 | 100 | |
| 106 | | −- Types: floating point numbers are not supported. |
| 101 | +- Types: floating point numbers are not supported yet. |
| 107 | 102 | |
| 108 | 103 | - (BUG) 'char' and 'short' casts do not truncate correctly. |
| 109 | 104 | |
| 110 | 105 | - 'sizeof' may not work if too complex expression is given. |
| 111 | 106 | |
| 112 | | −Supported C extensions: |
| 113 | | −---------------------- |
| 107 | +- bit fields are not supported. |
| 108 | + |
| 109 | +- L'c' or L"string" for wide chars are parsed but not handled as wchar_t. |
| 110 | + |
| 111 | +- Cannot initialize auto (=local) arrays with implicit size |
| 112 | + (workaround: specificy exact size in array declaration). Cannot |
| 113 | + initialize auto arrays with strings. |
| 114 | + |
| 115 | +3) Linking |
| 116 | + |
| 117 | +- extern variables must appear in a referenced dll and cannot appear |
| 118 | + in current source. |
| 119 | + |
| 120 | +Supported ANSI C extensions: |
| 121 | +--------------------------- |
| 122 | + |
| 123 | +- 'inline' keyword is ignored (ISOC99). |
| 124 | + |
| 125 | +- 'restrict' keyword is ignored (ISOC99). |
| 126 | + |
| 127 | +- '__func__' is a string variable containing the current function name (ISOC99). |
| 128 | + |
| 129 | +- variadic macros: __VA_ARGS__ can be used for function-like macros (ISOC99): |
| 130 | + #define dprintf(level, __VA_ARGS__) printf(__VA_ARGS__). |
| 131 | + |
| 132 | +- declarations can appear anywhere in a block (ISOC99). |
| 114 | 133 | |
| 115 | | −- 'inline' keyword is ignored. |
| 134 | +- array and struct/union elements can be initialized in any order by |
| 135 | + using designators (.e. { [0].x = 1 }) (ISOC99). |
| 116 | 136 | |
| 137 | +- binary digits can be entered ('0b101' instead of '5'). |
| 117 | 138 | |
| 118 | 139 | Technical Description: |
| 119 | 140 | --------------------- |
| 120 | 141 | |
| 121 | 142 | This is not my first C compiler (see my 'fbcc' compiler) but it |
| 122 | 143 | contains the first C preprocessor I wrote. The project started as a |
| 123 | | −joke to make the smallest C compiler. Then I expanded it torward ANSI |
| 124 | | −compliance. This C compiler is particular because each feature was |
| 125 | | −added while trying to be as simple and compact as possible. For |
| 144 | +joke to make the smallest C compiler. Then I expanded it torward |
| 145 | +ISOC99 compliance. This C compiler is particular because each feature |
| 146 | +was added while trying to be as simple and compact as possible. For |
| 126 | 147 | example, no intermediate structure is used to store code or |
| 127 | 148 | expressions. |
| 128 | 149 | |
| @@ -137,10 +158,10 @@ registers are used. When more registers are needed, one register is · 8 unmodified lines |
| 137 | 158 | flushed in a new local variable. |
| 138 | 159 | |
| 139 | 160 | Constant propagation is done for all operations. Multiplications and |
| 140 | | −divisions are optimized to shifts when appropriate. Logical operators |
| 141 | | −are optimized by maintaining a special cache for the processor |
| 142 | | −flags. &&, || and ! are optimized by maintaining a special 'jmp |
| 143 | | −target' value. No other jmp optimization is currently performed |
| 161 | +divisions are optimized to shifts when appropriate. Comparison |
| 162 | +operators are optimized by maintaining a special cache for the |
| 163 | +processor flags. &&, || and ! are optimized by maintaining a special |
| 164 | +'jmp target' value. No other jmp optimization is currently performed |
| 144 | 165 | because it would require to store the code in a more abstract fashion. |
| 145 | 166 | |
| 146 | 167 | The types and values descriptions are stored in a single 'int' |
| @@ -151,10 +172,10 @@ solution. · 4 unmodified lines |
| 151 | 172 | License: |
| 152 | 173 | ------- |
| 153 | 174 | |
| 154 | | −TCC is distributed under the GNU Generic Public License (see COPYING |
| 175 | +TCC is distributed under the GNU General Public License (see COPYING |
| 155 | 176 | file). |
| 156 | 177 | |
| 157 | 178 | I accept only patches where you give your copyright explictely to me |
| 158 | 179 | to simplify licensing issues. |
| 159 | 180 | |
| 160 | | −Fabrice Bellard - Nov 11, 2001. |
| 181 | +Fabrice Bellard - Nov 17, 2001. |