aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix parsing function macro invocationsMichael Matz2012-04-181-3/+18
| | | | | | If a function macro name is separated from the parentheses in an macro invocation the substitution doesn't take place. Fix this by handling comments.
* Fix detection of labels with a typedef nameMichael Matz2012-04-181-2/+10
| | | | | | | | | | | | | | This needs to be accepted: typedef int foo; void f (void) { foo: return; } namespaces for labels and types are different. The problem is that the block parser always tries to find a decl first and that routine doesn't peek enough to detect this case. Needs some adjustments to unget_tok() so that we can call it even when we already called it once, but next() didn't come around restoring the buffer yet. (It lazily does so not when the buffer becomes empty, but rather when the next call detects that the buffer is empty, i.e. it requires two next() calls until the unget buffer gets switched back).
* tcc_realloc: auto "memory full" errorgrischka2012-04-181-6/+0
|
* tcc.c: fix previous commit "Use CString to concat linker options"grischka2012-04-181-6/+6
| | | | | | | | | - remove redunant else branch - zero-terminate linker_arg - declare cstr_xxx as PUB_FUNC (which are functions used in tcc.c but not in the libtcc API. Useful for a tcc(.exe) that uses the libtcc.(so/dll)) - while at it, export PUB_FUNCs from dll
* Consider long int constant as 64 bits on x86-64Thomas Preud'homme2012-03-141-0/+4
| | | | | Quick and dirty hack to consider long int constant (as in 1UL or 1L) as 64 bits integer on x86-64 non Windows systems.
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-48/+48
|
* libtcc: minor adjustmentsgrischka2011-08-111-0/+5
| | | | | | | | | | | | | | | | | - use {B} to substitute tcc_lih_path (instead of \b) - expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS which fixes duplicate CONFIG_SYSROOT. - put default CONFIG_SYSROOT ("") into tcc.h - remove hack from commit db6fcce78f4d8ea25036dd6643e9fa83d8e52e5a because $(tccdir)/include is already in sysincludes - configure: error out for unrecognized options. - win32/build-tcc.bat: put libtcc into base dir where it will find lib/include automatically, and build libtcc_test example.
* fix self-referential token pastingJoe Soroka2011-07-081-2/+14
|
* fix end-of-scope for self-referential macrosJoe Soroka2011-07-081-0/+2
|
* Remove unused variablesThomas Preud'homme2011-05-161-2/+1
| | | | | Remove unused local variables and declare them conditionally when they are used only on some architectures.
* tccpp: fix problem in preprocess_skip with empty #grischka2011-03-061-0/+2
| | | | | | | | for example: #ifdef stuff # /* some comment */ #endif
* Replace comment by a blankChangming Xu2011-03-011-7/+11
| | | | | | | | - fix my prev commit: put declaration above statements to stay c89 compatible - replace commit by a blank #define con(a, b) a/**/b this should yield a b, not ab
* tcc -E: append a ' ' after substChangming Xu2011-02-271-0/+10
| | | | | | | | | | We need a ' ' after subst of m in the following case #define m(name,r) name ## r #define m0(a,b,c) int m(a,b) c #define m1(a,b,c) int m(a,b)c m0(a, b, c); m1(a, b, c);
* tccpp: treat gas comments in .S files as raw text, not tokensJoe Soroka2011-02-231-0/+5
|
* fix crash with get_tok_str() in skip()grischka2011-02-041-1/+1
| | | | | crash was triggered by numbers etc. as unexpected token, i.e. everything that requires additional information with the token.
* tccpp: fix bug in handling of recursive macrosJoe Soroka2011-02-011-2/+15
|
* tccpp: fix token pasting ##grischka2010-11-251-5/+3
| | | | | This patch takes advantage of new function tcc_open_bf from previous commit.
* libtcc: new function tcc_open_bf to create BufferedFilegrischka2010-11-251-18/+13
| | | | | | | | Use it in: - tcc_open - tcc_compile_string - tcc_define_symbol - tcc_assemble_inline
* tcc: Draft suppoprt for -MD/-MF optionsKirill Smelkov2010-06-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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", ...)
* Revert "tccpp: Allow local labels to start with a dot"Daniel Glöckner2010-05-061-6/+0
| | | | | | This reverts commit f740485a5ab2ecef741bf1161b9feeea9c18cac0. It breaks access to structure elements starting with L
* Clean changes introduced by 47abdbdThomas Preud'homme2010-04-201-21/+0
| | | | | | | | | | | | * 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
* Better handle ld scriptsThomas Preud'homme2010-04-151-0/+21
| | | | | | | * 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
* tccpp: Allow local labels to start with a dotDetlef Riekenberg2010-04-051-0/+6
| | | | | -- By by ... Detlef
* tccpp: Add missing bracket in an error messageDetlef Riekenberg2010-03-311-1/+1
|
* Fixed bug which prevent tcc preprocessor to ignore line number directivesAlexandre Becoulet2010-02-011-1/+1
|
* Dump the current token in skip(), when it's not the expected tokenDetlef Riekenberg2010-01-271-1/+1
|
* tccpp: signal missing #endif errorgrischka2010-01-141-2/+5
|
* tccpp: convert TOK_GET macro into functiongrischka2010-01-141-68/+63
|
* tccpp: warn about #define redefinitiongrischka2010-01-141-0/+19
|
* allow tcc be build from separate objectsgrischka2009-12-201-42/+179
| | | | If you want that, run: make NOTALLINONE=1
* tccpp: fix quirk with cached headers and #elsegrischka2009-08-241-1/+4
| | | | | | | | | | Such as with #ifndef FOO_H ... #else ... #endif
* tccpp: avoid double free with macro_ptr_allocated (after errors)grischka2009-08-241-0/+1
|
* cleanup: constify some global datagrischka2009-07-181-3/+4
|
* win32: treat long double as doublegrischka2009-07-181-0/+10
|
* win64: fix pointer <-> unsigned long typecast issuesgrischka2009-07-181-1/+5
|
* cleanup: stop abuse of sym->c for #define tokenstreamsgrischka2009-07-181-8/+10
|
* pp: return newline after directivegrischka2009-07-181-1/+2
|
* pp: simplify pasting, enable L ## numbergrischka2009-07-181-87/+25
|
* tcc_preprocess: add gcc-style include-depth flagsgrischka2009-06-171-7/+22
| | | | | | | | | # 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--
* fix "cached include" optimizationgrischka2009-05-111-53/+58
| | | | | | | 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.
* move static prototypes to libtcc.cgrischka2009-05-111-6/+11
|
* move some global variables into TCCStategrischka2009-05-111-3/+3
|
* move minor things from libtcc.c to other filesgrischka2009-05-051-0/+262
|
* move preprocessor to tccpp.cgrischka2009-05-051-0/+2643
|
* new files: tcc.h libtcc.c tccpp.c tccgen.cgrischka2009-05-051-0/+20