Daniel Glöckner
76b02c2a03
Futher changes to casts
...
nocode_wanted can't be used to enforce constant expressions, as it is
set f.ex. by __builtin_constant_p.
A null pointer is unequal to a pointer to any object or function.
Assuming symbols always point to memory, a symbol+constant cast to bool
is always true.
2008-11-30 07:21:49 +01:00
Daniel Glöckner
5fd6f7bd44
Fix get_tok_str wrt wide characters
...
Fixes both, character constants and string literals.
2008-11-30 07:21:46 +01:00
Daniel Glöckner
deb410710c
Rewrote '?' for constants
...
The condition is now cast to _Bool and it now works with return
types bigger than 32 bit.
2008-11-30 07:21:42 +01:00
Daniel Glöckner
1b599ea7f8
Cast parameter of '!' to _Bool
2008-11-30 07:21:35 +01:00
Daniel Glöckner
2d9b5e0bb8
Rewrote casts
...
Casting of constants was done only inside functions.
I restructured the code and used intermediate types (long double/long long)
for most conversions to have less ifs.
Please review.
There are lots of cases to take care of and lots of mistakes to make.
2008-11-30 07:21:30 +01:00
grischka
83466c6151
line-numbers output for TCC -E
2008-11-30 07:21:01 +01:00
grischka
7bebf1f59a
was hash, not link
2008-09-15 02:07:55 +02:00
Daniel Glöckner
a80acab4fc
Display error on statement expressions with complex return type
...
The return type of a statement expression (a GCC extention) may
involve elements on the symbol stack that have been put there by
the expression. These will be freed at the end of the expression
so that the calling block can not use them.
Contrary to the comment (written in 2003), this bug no longer shows
up in Valgrind, as freed symbols are now put onto a stack for later
reuse.
2008-09-12 22:23:02 +02:00
Daniel Glöckner
3783b33508
Fix bitfields with non-int types and in unions
...
The ISO C draft allow only signed/unsigned int and _Bool as base type
for bitfields. TinyCC ever since allowed a wider range of types, but
there were many bugs that shifted values when they shouldn't, etc..
The patch introduces a restriction to the layout of bitfields with
mixed types that makes it incompatible with GCC. In
struct {
typeA x:1;
typeB y:1;
};
y is combined with x in the same byte iff typeA is typeB (neglecting
signedness). This is done to avoid alignment issues and exceeding the
width of typeA.
2008-09-12 22:23:01 +02:00
Daniel Glöckner
43a34d354a
Force null pointer exception for code outside of a function
...
TinyCC sometimes has problems to evaluate constant expressions at
compile time. This leads to code being generated outside of functions.
Without this patch some of these bugs are not caught, because
cur_text_section still points to the section of the last function.
Before the first function cur_text_section is uninitialized.
Setting cur_text_section to a null pointer should make TinyCC die in
all cases.
2008-09-12 22:23:00 +02:00
Daniel Glöckner
5a92536cea
Optimize arithmetic with pointer to value on stack + constant
2008-09-12 22:23:00 +02:00
Daniel Glöckner
e263ee3cbf
Fix gv for long longs
...
long long a();
long long b() {
return a();
}
At the end of b there will be some useless register shuffling.
This is because return wants to have the result of a in REG_IRET.
gv checks if this is the case for BOTH registers of the long long.
After this test it uses REG_LRET for the second register if the
first is supposed to be REG_IRET. In other cases it uses RC_INT.
The patch compares the second register against the class it will
have in the end instead of the register class the first register
will have.
At this point I would like to remind those who pick up the patches
that there are two other mails by me with uncommitted fixes:
http://lists.gnu.org/archive/html/tinycc-devel/2003-10/msg00044.html
http://lists.gnu.org/archive/html/tinycc-devel/2008-08/msg00007.html
Daniel
2008-09-12 22:22:59 +02:00
Daniel Glöckner
256f6e6200
A prefix for default library/include search paths
...
This patch is useful for cross compilers. Without this patch tcc
tries to use the host's libraries, crt*.o and include files.
The patch prepends a string to all default paths. The string can
be passed to configure with --sysroot=string.
Daniel
2008-09-12 22:22:58 +02:00
Daniel Glöckner
12265da6cd
Runtime lib functions
...
Yesterday I felt the urge to change a few things in TinyCC.
This is the first and biggest change of all of them.
- use __aeabi_*divmod functions in ARM EABI to make binaries depend
solely on standardized library functions
- refactor ARM floating point <-> integer conversion a bit
- rename long long->float and shift library functions to correspond to
the names used by GCC
- compile more tokens conditionally to reduce the size of TinyCC
The intention is primarily to allow users of the ARM target to use
libgcc (which is usually available as a shared library) instead of
libtcc1 (which can't be compiled for ARM due to lack of an inline
assembler).
Changing the EABI target to use the divmod functions in theory allows
to use it without libtcc1 on any (not necessarily GCC based) ARM EABI
system.
Daniel
2008-09-12 22:22:36 +02:00
grischka
2c6cd08bcc
fix isidnum_table for CH_EOF (-1)
2008-09-12 02:36:05 +02:00
grischka
1300cec38c
free_section bugfix
2008-09-12 02:36:01 +02:00
grischka
f9bf48d643
release loaded dlls cleanly (Sam K)
2008-05-05 22:40:49 +00:00
grischka
96bd8f2b25
enable pe-output from libtcc (Shmuel Zeigerman)
2008-05-05 22:39:43 +00:00
grischka
f2698687fb
fix options in C scripts after -run
2008-04-27 18:50:35 +00:00
grischka
5247bbc2f0
fix stabstr with linked objects
2008-04-27 18:49:31 +00:00
grischka
23594b6980
enable multiple states and fix minor memory leaks
2008-04-27 18:47:35 +00:00
grischka
f22e961f80
update manual, changelog
2008-03-31 19:50:58 +00:00
grischka
a327c7a552
added verbosity levels (-vv -vvv)
2008-03-31 19:49:14 +00:00
grischka
4d9aaacc85
Accept standard input as an inputstream (Hanzac Chen)
2008-03-31 18:42:56 +00:00
grischka
9bcc0b970b
Add -soname linker option (Marc Andre Tanner)
2008-03-25 21:04:47 +00:00
grischka
6ed868c51c
Enable -B option for library path on win32
2008-03-08 20:00:56 +00:00
grischka
3667408a57
Just warn about unknown directives, define __STDC_VERSION__=199901L
2008-01-16 20:16:35 +00:00
grischka
5342b32eef
Switch to newer tccpe.c (includes support for resources)
2007-12-19 17:36:42 +00:00
grischka
adb1456472
Handle backslashes within #include, #error, #warning
2007-12-17 19:35:15 +00:00
grischka
6c96c41ee4
Import changesets (part 4) 428,457,460,467: defines for openbsd etc.
2007-12-16 18:24:44 +00:00
grischka
34140dd627
Use _WIN32 for a windows hosted tcc and define it for the PE target.
2007-12-13 19:07:19 +00:00
grischka
f99d3de221
Import 409,410: ARM EABI by Daniel Glckner
2007-12-04 20:38:09 +00:00
grischka
2de1b2d14c
Some in-between fixes (See Changelog for details).
2007-11-25 22:14:35 +00:00
grischka
d778bde7f9
Import more changesets from Rob Landley's fork (part 2)
2007-11-21 17:16:31 +00:00
grischka
54bf8c0556
Import some changesets from Rob Landley's fork (part 1)
2007-11-14 17:34:30 +00:00
bellard
fb2c34f8cd
fixed sign extension in some type conversions (Dave Dodge)
2006-10-28 14:47:39 +00:00
bellard
52b7254b9c
fixed multiple typedef specifiers handling
2006-10-28 14:28:02 +00:00
bellard
0bea5c7f21
workaround for function pointers in conditional expressions (Dave Dodge)
2006-10-28 14:15:37 +00:00
bellard
24a19cc37e
discard type qualifiers when comparing function parameters (Dave Dodge)
2006-10-28 14:13:28 +00:00
bellard
3b8cd565be
fixed multiple concatenation of PPNUM tokens (initial patch by Dave Dodge)
2006-10-28 14:05:19 +00:00
bellard
200b58dad8
initial implementation of -E option
2006-10-16 19:44:00 +00:00
bellard
62c5a5466a
fixed parsing of function parameters
2005-09-03 22:51:34 +00:00
bellard
7bc5e51847
anonymous union/struct support (Filip Navara)
2005-09-03 22:33:53 +00:00
bellard
e9c64e3f47
windows style fastcall (Filip Navara)
2005-09-03 22:21:22 +00:00
bellard
81f957ae09
normalized slashes in paths (Filip Navara)
2005-09-03 22:18:51 +00:00
bellard
6f8b8887b1
added support for win32 wchar_t (Filip Navara)
2005-09-03 21:54:47 +00:00
bellard
44738b516a
fixed function type check
2005-09-03 21:07:35 +00:00
bellard
b0b8ac13ce
mark executable sections as executable when running in memory
2005-09-03 18:31:43 +00:00
bellard
4d7eadb2fa
preprocessor function macro parsing fix (grischka) - disabled -fleading-underscore for win32
2005-06-17 22:05:58 +00:00
bellard
f6db2edc40
added -f[no-]leading-underscore - '@' symbol for asm
2005-06-15 22:32:29 +00:00
bellard
fe9b1f60ce
win32 merge (grischka)
2005-04-17 13:15:54 +00:00
bellard
4821702fb4
win32 merge
2005-04-14 23:49:21 +00:00
bellard
0bca832c18
#pragma pack support (grischka)
2005-04-13 21:30:51 +00:00
bellard
8f2d519203
#include_next support (Bernhard Fischer)
2005-04-10 22:18:53 +00:00
bellard
2c538d7a2b
initial PE format support
2005-04-10 21:46:58 +00:00
bellard
fc72e41a55
better gcc compatibility (Jon Griffiths)
2004-12-16 22:19:28 +00:00
bellard
48c85f1b15
optimisations: hash table for include file search, pool for symbol allocation - sympler token string allocation - '-b' fix with '-run' option
2004-11-07 15:45:19 +00:00
bellard
1d0e5e8b01
stack full fix
2004-11-02 21:55:13 +00:00
bellard
1e1d3ff687
packed attribute support
2004-10-29 23:55:13 +00:00
bellard
736b565766
fixed const and volatile function parameters typing - fixed string parsing when skipping code
2004-10-28 21:14:30 +00:00
bellard
6b52984ce4
added _Bool in bit-fields
2004-10-27 21:42:06 +00:00
bellard
c9c05ca5f0
copyright update
2004-10-27 21:38:03 +00:00
bellard
59c3563827
do not generate code for unused inline functions - fixed long long code gen bug - added --oformat linker option
2004-10-23 22:52:05 +00:00
bellard
9668499b9f
primitive fastcall functions support - -fno-common option - -Ttext linker option - bit field fixes - section alignment fixes
2004-10-18 00:18:20 +00:00
bellard
13affef3f1
win32 configure
2004-10-07 21:11:43 +00:00
bellard
c50af8399d
fixed __LINE__ token type
2004-10-07 20:15:50 +00:00
bellard
ec7d36326d
C67 COFF executable format support (TK)
2004-10-05 22:33:55 +00:00
bellard
6e5b1cc43a
ARM fixes (Daniel Glockner)
2004-10-04 22:19:21 +00:00
bellard
79c72b2419
initial TMS320C67xx support (TK)
2004-10-04 21:57:35 +00:00
bellard
df36de6507
fixes for dietlibc
2004-10-02 14:11:28 +00:00
bellard
22d8df96c6
comment parsing fix - bitfields partial fix
2004-10-02 13:48:50 +00:00
bellard
fe203057c2
fixed assignment of const struct in struct
2003-10-17 20:59:15 +00:00
bellard
114883e078
added -funsigned-char, -fsigned-char and -Wimplicit-function-declaration
2003-10-17 20:43:47 +00:00
bellard
4df5bd2eb0
ARM target support (Daniel Glockner) - allow unsigned char as default on ARM (Daniel Glockner) - fixed small ld script support (Daniel Glockner)
2003-10-14 22:15:56 +00:00
bellard
bef8703f77
added arguments to -run - fixed libc linking when running in memory - output a warning instead of an error if invalid escaped sequence in character
2003-10-04 21:23:51 +00:00
bellard
d369a77647
unbounded section name (might be useful when section name contains function name for g++ linkonce sections)
2003-10-04 14:41:18 +00:00
bellard
c5ce5eaeda
fixed -w option - doc update (thanx to Romain Francoise)
2003-10-04 13:04:47 +00:00
bellard
9c1106d854
added -w option
2003-09-19 20:35:50 +00:00
bellard
f8d0241764
changed tcc_get_symbol() prototype
2003-07-20 19:19:58 +00:00
bellard
c5959b77b4
fixed typdefed type parsing (Mauro Persano)
2003-07-20 18:44:29 +00:00
bellard
7b940fcb1b
reject abstract declarators in function definition (Mauro Persano)
2003-07-20 12:40:53 +00:00
bellard
21d2d99bdc
suppressed warning for const function parameters
2003-06-02 20:32:30 +00:00
bellard
d0476a0e2e
help update
2003-05-24 16:21:09 +00:00
bellard
98713a6be3
added -rdynamic support
2003-05-24 15:46:29 +00:00
bellard
8f5e44a439
changed license to LGPL
2003-05-24 14:11:17 +00:00
bellard
638e666c42
fixed zero arg macro parse
2003-05-18 18:48:33 +00:00
bellard
6cdf6f88d7
fixed macro argument substitution
2003-05-18 17:16:20 +00:00
bellard
c4e6b2e9be
alacarte linking (Dave Long)
2003-04-28 22:06:38 +00:00
bellard
2b64f2f570
added -nostdlib
2003-04-27 11:45:01 +00:00
bellard
7828683e60
added __builtin_constant_p() and __builtin_types_compatible_p() support
2003-04-26 21:28:09 +00:00
bellard
9791bfaf48
more precise C type check support (const warnings) - added generic -W option support
2003-04-26 20:49:46 +00:00
bellard
410fc57ba0
default output object filename is basename of input filename (same behaviour as gcc)
2003-04-16 21:35:02 +00:00
bellard
214ccccea7
simpler function call API
2003-04-16 21:16:20 +00:00
bellard
c5ab452d64
switch label parse fix
2003-04-14 22:23:36 +00:00
bellard
85fa15e64c
compile fix
2003-04-13 22:42:15 +00:00
bellard
40987541dc
added __TIME__ and __DATE__ support - added -v and -run options
2003-04-13 21:54:03 +00:00
bellard
5647993e79
configure support
2003-04-13 19:49:30 +00:00
bellard
f46a02a360
fixed macro function bug
2003-04-13 18:32:37 +00:00
bellard
cab6018913
fixed comment parsing
2003-04-13 18:05:51 +00:00
bellard
0c618f4b7f
sanitized string and character constant parsing
2003-04-13 17:37:14 +00:00
bellard
d6819c2c36
comment fixes (Peter Lund)
2003-04-13 14:35:27 +00:00
bellard
73acbe2413
function parameters must be converted to pointer of functions
2003-04-13 14:30:32 +00:00
bellard
60b9a1aa38
better _Bool lvalue support
2003-04-13 14:11:34 +00:00
bellard
eed54d6bfb
struct syntax fix
2003-04-13 14:03:18 +00:00
bellard
8e40dd90bb
macro opt - asm support - new option parsing - supressed IL code
2003-01-06 20:21:08 +00:00
bellard
4df76253ad
FreeBSD fixes - file type guessing - glibc2.2 fixes - ELF align issue
2002-12-08 14:35:31 +00:00
bellard
abf909e1ac
added static bit fields init - version change - #error and #warning fix - support aligned attribute without parameter
2002-11-24 16:00:08 +00:00
bellard
b9d9425993
fixed structure type test - fixed enum parsing - added warning for int/ptr conversions instead of error
2002-11-24 14:56:25 +00:00
bellard
7b2721ff07
added empty structs support - changed double align to 4 (i386 default ABI) - added align support for structs - added GCC defines for basic types
2002-11-24 14:18:17 +00:00
bellard
0841db04c5
fixed structure init without {} - fixed function declaration parse
2002-11-23 23:56:12 +00:00
bellard
ab9973c843
optimized unary() - fix long long signed comparisons
2002-11-23 23:12:26 +00:00
bellard
0adc5a8921
fixed line numbering
2002-11-23 22:35:28 +00:00
bellard
a9f08655ac
expression optimization
2002-11-23 22:26:46 +00:00
bellard
9e180474f0
optimized token strings - optimized token hashing
2002-11-23 22:02:40 +00:00
bellard
8901fbeef1
parsing optimizations
2002-11-23 18:15:17 +00:00
bellard
b81d4ba6b3
prepared parser for direct use of file->buf_ptr - faster comment parsing
2002-11-22 23:28:06 +00:00
bellard
cdcfed9737
restored include file optimization - added static on all globals
2002-11-22 22:16:30 +00:00
bellard
2956bd85cd
suppressed ch1 and preparser
2002-11-22 18:12:41 +00:00
bellard
e926c359bb
error message fixes - CH_EOB is now '\'
2002-11-22 14:43:38 +00:00
bellard
2f219d8702
use CH_EOB
2002-11-22 14:12:28 +00:00
bellard
63965fc585
further parse optimizations
2002-11-22 13:37:52 +00:00
bellard
5286d3d84c
suppressed secondary hash tables - began parsing optimization
2002-11-20 00:29:04 +00:00
bellard
9620fd18e4
added CType structure for type storage - supressed define hash table - added time dump in bench
2002-11-18 21:46:44 +00:00
bellard
804d0c8d41
added computed gotos - better runtime error handling
2002-11-03 00:43:55 +00:00
bellard
43f30315f9
added alignof and typeof - better sizeof support - fixed get_tok_str() for TOK_PPNUM
2002-11-02 20:45:52 +00:00
bellard
c0180c4e5f
added correct ## handling : added TOK_PPNUM token
2002-11-02 17:02:31 +00:00
bellard
c62792e6aa
ignore some gcc options - removed many memory leaks - suppressed many global variables
2002-11-02 14:12:32 +00:00
bellard
d8ef07df04
added tcc_relocate() and tcc_get_symbol()
2002-09-08 22:46:32 +00:00
bellard
8ecc9cd789
macro optimization - string constant optimisation
2002-09-08 21:55:47 +00:00
bellard
ab4da04aa9
added include file optimization
2002-09-08 19:34:32 +00:00
bellard
509fa60368
force #if #endif match in same file
2002-09-08 16:14:57 +00:00
bellard
405c88106d
fixed bound checking for structures - fixed ?: type handling - fixed '--' parsing
2002-09-08 12:42:36 +00:00
bellard
44b19defc2
fixed octal char const parsing - better __FUNCTION__ handling - handling of static libraries in case of memory compilation
2002-08-31 12:43:39 +00:00
bellard
6dd6a026c3
better command line parsing - added -r option
2002-08-30 22:46:35 +00:00
bellard
d2115bfb27
added symbol + relocation handling
2002-08-29 23:05:59 +00:00
bellard
46803f05e0
fixed local extern handling - fixed '!' with symbols
2002-08-29 21:57:41 +00:00
bellard
41391fbb20
added linux define - added __FUNCTION - fixed spaces parsing - defined special macros
2002-08-29 21:16:24 +00:00
bellard
f946dffd33
suppressed section_ptr - fixed constant string allocation
2002-08-18 14:34:57 +00:00
bellard
53834650fb
moved ELF stuff to tccelf.c - fixed #include and #line parsing - removed size limit on strings - added support for bound checking in generated executables - fixed -I include order - fixed incorrect function displayed in runtime error - fixed lvalue type when saved in local stack
2002-08-18 13:22:55 +00:00
bellard
7ac43f6d19
better DLL generation - added size to all ELF symbols - dynamic hash table size
2002-07-27 23:08:04 +00:00
bellard
18e40e1a25
add stripping if not debug mode - moved debug and bound check init
2002-07-27 15:38:21 +00:00
bellard
519ec30bcf
added __start_x and __stop_x symbol generation - fp_hw fix for dynamic executables
2002-07-27 15:18:33 +00:00
bellard
9b48237795
use data_offset in sections instead of pointer to ease section reallocation - relocated .stabs and .bounds sections - fixed char constants casts - fixed implicit cast to unary plus - fixed type for string constants
2002-07-27 14:05:37 +00:00
bellard
540cd6fde7
fixed preprocessor expression parsing
2002-07-26 22:59:19 +00:00
bellard
b12e91aa01
fixed command line help - added -B option - moved bcheck.c outside of tcc
2002-07-24 22:10:59 +00:00
bellard
6cdecbe4e6
added runtime library - fixed more relocations
2002-07-22 23:37:39 +00:00
bellard
9051cc21af
better elf output - generalized dynamic array use
2002-07-22 00:20:38 +00:00
bellard
7b54a53e08
added archive support - better ELF output - fixed symbol relocation - added COMMON symbol handling
2002-07-18 00:51:11 +00:00
bellard
a50e58e5ba
more consistent command line handling
2002-07-15 22:17:02 +00:00
bellard
61a1599052
added object file reading support
2002-07-15 21:33:00 +00:00