Joe Soroka
75c6695932
tccpp: fix bug in handling of recursive macros
2011-02-01 13:23:40 -08:00
grischka
44e84bb22a
tccpp: fix token pasting ##
...
This patch takes advantage of new function tcc_open_bf
from previous commit.
2010-11-25 13:30:31 +01:00
grischka
e97bf88bad
libtcc: new function tcc_open_bf to create BufferedFile
...
Use it in:
- tcc_open
- tcc_compile_string
- tcc_define_symbol
- tcc_assemble_inline
2010-11-25 13:29:15 +01:00
Kirill Smelkov
0c928da96d
tcc: Draft suppoprt for -MD/-MF options
...
In build systems, this is used to automatically collect target
dependencies, e.g.
---- 8< (hello.c) ----
#include "hello.h"
#include <stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
$ tcc -MD -c hello.c # -> hello.o, hello.d
$ cat hello.d
hello.o : \
hello.c \
hello.h \
/usr/include/stdio.h \
/usr/include/features.h \
/usr/include/bits/predefs.h \
/usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h \
/usr/include/gnu/stubs.h \
/usr/include/bits/wordsize.h \
/usr/include/gnu/stubs-32.h \
/home/kirr/local/tcc/lib/tcc/include/stddef.h \
/usr/include/bits/types.h \
/usr/include/bits/wordsize.h \
/usr/include/bits/typesizes.h \
/usr/include/libio.h \
/usr/include/_G_config.h \
/usr/include/wchar.h \
/home/kirr/local/tcc/lib/tcc/include/stdarg.h \
/usr/include/bits/stdio_lim.h \
/usr/include/bits/sys_errlist.h \
NOTE: gcc supports -MD only for .c -> .o, but in tcc, we generate
dependencies for whatever action is being taken. E.g. for .c -> exe, the
result will be:
$ tcc -MD -o hello hello.c # -> hello, hello.d
hello: \
/usr/lib/crt1.o \
/usr/lib/crti.o \
hello.c \
hello.h \
/usr/include/stdio.h \
/usr/include/features.h \
/usr/include/bits/predefs.h \
/usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h \
/usr/include/gnu/stubs.h \
/usr/include/bits/wordsize.h \
/usr/include/gnu/stubs-32.h \
/home/kirr/local/tcc/lib/tcc/include/stddef.h \
/usr/include/bits/types.h \
/usr/include/bits/wordsize.h \
/usr/include/bits/typesizes.h \
/usr/include/libio.h \
/usr/include/_G_config.h \
/usr/include/wchar.h \
/home/kirr/local/tcc/lib/tcc/include/stdarg.h \
/usr/include/bits/stdio_lim.h \
/usr/include/bits/sys_errlist.h \
/usr/lib/libc.so \
/lib/libc.so.6 \
/usr/lib/ld-linux.so.2 \
/lib/ld-linux.so.2 \
/usr/lib/libc_nonshared.a \
/lib/libc.so.6 \
/usr/lib/libc_nonshared.a \
/home/kirr/local/tcc/lib/tcc/libtcc1.a \
/usr/lib/crtn.o \
So tcc dependency generator is a bit more clever than one used in gcc :)
Also, I've updated TODO and Changelog (in not-yet-released section).
v2:
(Taking inputs from grischka and me myself)
- put code to generate deps file into a function.
- used tcc_fileextension() instead of open-coding
- generate deps only when compilation/preprocessing was successful
v3:
- use pstrcpy instead of snprintf(buf, sizeof(buf), "%s", ...)
2010-06-21 20:49:02 +04:00
Daniel Glöckner
6eac6b7254
Revert "tccpp: Allow local labels to start with a dot"
...
This reverts commit f740485a5a
.
It breaks access to structure elements starting with L
2010-05-06 21:42:37 +02:00
Thomas Preud'homme
3ad3168125
Clean changes introduced by 47abdbd
...
* Replace the save/load_buffer_state by a dynarray approach:
- Filename and libname are added to a dynarray when first encountered
- Load repeatedly the files in the dynarray until no new undefined
symbol are encountered
* Replace snprintf by sprintf in libname_to_filename
* Use tcc_fileextension in filename_to_libname
* Introduce a tcc_strcpy_part fonction to copy only a subset of a
string
* Move new_undef_syms declaration from tcc.h to tccelf.c
2010-04-20 16:02:42 +02:00
Thomas Preud'homme
47abdbd3d5
Better handle ld scripts
...
* search file from INPUT and GROUP commands in the library path in
addition to the current directory
* handle libraries specified by -lfoo options
* Search lib in GROUP command repeatedly
2010-04-15 19:30:00 +02:00
Detlef Riekenberg
f740485a5a
tccpp: Allow local labels to start with a dot
...
--
By by ... Detlef
2010-04-05 12:28:27 +02:00
Detlef Riekenberg
95bc36a149
tccpp: Add missing bracket in an error message
2010-03-31 00:42:39 +02:00
Alexandre Becoulet
b9aeac0a64
Fixed bug which prevent tcc preprocessor to ignore line number directives
2010-02-01 18:08:51 +01:00
Detlef Riekenberg
900871ca8d
Dump the current token in skip(), when it's not the expected token
2010-01-27 00:02:33 +01:00
grischka
a40814cc9d
tccpp: signal missing #endif error
2010-01-14 21:00:05 +01:00
grischka
4e5170d4a5
tccpp: convert TOK_GET macro into function
2010-01-14 20:59:44 +01:00
grischka
280e20b1d3
tccpp: warn about #define redefinition
2010-01-14 20:59:44 +01:00
grischka
88a3ccab9f
allow tcc be build from separate objects
...
If you want that, run: make NOTALLINONE=1
2009-12-20 01:53:49 +01:00
grischka
569c20f104
tccpp: fix quirk with cached headers and #else
...
Such as with
#ifndef FOO_H
...
#else
...
#endif
2009-08-24 13:30:01 +02:00
grischka
d923e652f2
tccpp: avoid double free with macro_ptr_allocated (after errors)
2009-08-24 13:30:00 +02:00
grischka
c998985c74
cleanup: constify some global data
2009-07-18 22:07:42 +02:00
grischka
9fda4f4248
win32: treat long double as double
2009-07-18 22:07:17 +02:00
grischka
035918ef2f
win64: fix pointer <-> unsigned long typecast issues
2009-07-18 22:05:58 +02:00
grischka
bed17847bd
cleanup: stop abuse of sym->c for #define tokenstreams
2009-07-18 21:55:10 +02:00
grischka
85e481b66e
pp: return newline after directive
2009-07-18 21:54:58 +02:00
grischka
fcdb663dde
pp: simplify pasting, enable L ## number
2009-07-18 21:54:55 +02:00
grischka
e4ae77c7bb
tcc_preprocess: add gcc-style include-depth flags
...
# 1 "main.c"
# 1 "include/stdio.h" 1
# 123 "include/stdio.h" 3
# 10 "main.c" 2
flags: 1: level++; 3: same-level 2: level--
2009-06-17 02:10:42 +02:00
grischka
aed6a7cb60
fix "cached include" optimization
...
comparing the filenames as in the #include statement can be
ambiguous if including files are in different directories.
Now caches and checks the really opened filename instead.
2009-05-11 18:55:16 +02:00
grischka
0a35f9d66e
move static prototypes to libtcc.c
2009-05-11 18:45:56 +02:00
grischka
f9181416f6
move some global variables into TCCState
2009-05-11 18:45:44 +02:00
grischka
b8f6e1ae30
move minor things from libtcc.c to other files
2009-05-05 20:30:39 +02:00
grischka
805990b94e
move preprocessor to tccpp.c
2009-05-05 20:17:49 +02:00
grischka
a93bcdffae
new files: tcc.h libtcc.c tccpp.c tccgen.c
2009-05-05 20:17:11 +02:00