aboutsummaryrefslogtreecommitdiff
path: root/tcctok.h
Commit message (Collapse)AuthorAgeFilesLines
* tccpp: Implement __COUNTER__Michael Matz2017-07-091-0/+1
| | | | | | | | | | | This requires one more change in how macro arguments are expanded: the standard requires that macro args are expanded before substituting into the replacement list. This implies expanding them only once even when they occur multiple times in the list. TCC expanded them repeatedly in that case. Without __COUNTER__ that's harmless. So, simply always expand arguments (when used without # and ##) once and store the resulting tokens.
* add C11's _GenericMatthias Gatto2017-07-051-1/+3
| | | | | | | | | | Simple implementation, I'm not even sure to respect C standart here, but it should work with most use case. This add an case in unary(), and generate TokString depending of _Generic controlling exression, use begin_macro to "push" the generated TokString, then call unary() again before exiting the switch so the just add token are reevaluate again.
* Revert "partial revert of the commit 4ad186c5ef61"grischka2017-02-051-1/+0
| | | | | | | | | | | | | | | | | | There seems nothing wrong. With int t1 = 176401255; float f = 0.25; int t2 = t1 * f; // 176401255 * 0.25 = 44100313.75 according to the arithmetic conversion rules, the number 176401255 needs to be converted to float, and the compiler can choose either the nearest higher or nearest lower representable number "in an implementation-defined manner". Which may be 176401248 or 176401264. So as result both 44100312 and 44100313 are correct. This reverts commit 664c19ad5ef16f3463087a33ecfe5d5ac24f81ec.
* tccasm: Implement .set sym, exprMichael Matz2016-12-151-0/+1
| | | | | | | | | | That, as well as "sym = expr", if expr contains symbols. Slightly tricky because a definition from .set is overridable, whereas proper definitions aren't. This doesn't yet allow using this for override tricks from C and global asm blocks because the symbol tables from C and asm are separate.
* Implement __builtin_choose_exprMichael Matz2016-12-151-0/+1
| | | | Follows GCC implementation.
* tccasm: Accept .balignMichael Matz2016-12-151-0/+1
|
* tccasm: Implement .pushsection and .popsectionMichael Matz2016-12-151-0/+2
|
* lib/libtcc1.c: cleanupgrischka2016-10-191-3/+0
| | | | | | | - remove #include dependencies from libtcc1.c for easier cross compilation - clear_cache only on ARM - error-message for mprotect failure
* #define __GNUC__ = 2.1grischka2016-10-151-0/+4
| | | | | | | | | | __GNUC__ nowadays as macro seems to mean the "GNU C dialect" rather than the compiler itself. See also http://gcc.gnu.org/ml/gcc/2008-07/msg00026.html This patch will probably cause problems of various kinds but maybe we should try nonetheless.
* Revert part of "fix installation amd bcheck for Windows"grischka2016-10-011-1/+0
| | | | | | | tccelf.c : force linking bcheck by adding elf symbol __bound_init bcheck.c : use (size_t)1 for x86_64 Fixes 7e7e6148fdb4adbda936f80b5d4ac3d738908d95
* .rept asm directiveseyko2016-04-221-0/+2
| | | | | and '.' alone is a token now in *.S (not an identifier) representing a current position in the code (PC).
* __builtin_expect no-opseyko2016-04-161-0/+1
| | | | | Taken from David Mertens tcc branch on github https://github.com/run4flat/tinycc.git
* correct version of "Identifiers can start and/or contain"seyko2016-04-131-26/+31
| | | | | | | A problem was in TOK_ASMDIR_text: - sprintf(sname, ".%s", get_tok_str(tok1, NULL)); + sprintf(sname, "%s", get_tok_str(tok1, NULL)); When tok1 is '.text', then sname is '..text'
* revert of the 'Identifiers can start and/or contain'seyko2016-04-131-31/+26
| | | | | | | | When tccboot kernels compiles with 'Identifiers can start and/or', this kernel don't start. It is hard to find what is wrong. PS: there was no test for identifiers in *.S with '.'
* Identifiers can start and/or contain '.' in *.Sseyko2016-04-051-26/+31
| | | | | | | | | | | | | | | | | modified version of the old one which don't allow '.' in #define Identifiers. This allow correctly preprocess the following code in *.S #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f ; \ // .previous SRC(1: movw (%esi), %bx) 6001: A test included.
* reverse of the "Identifiers can start and/or contain '.'"seyko2016-04-031-31/+26
| | | | | | | | | | | | | | | | | - Identifiers can start and/or contain '.' in PARSE_FLAG_ASM_FILE - Move all GAS directives under TOK_ASMDIR prefix This patches breaks compilation of the tccboot (linux 2.4.26 kernel). A test.S which fails with this patches: #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f<---->; \ .previous SRC(1:<>movw (%esi), %bx<------>) // 029-test.S:7: error: macro 'SRC' used with too many args
* Move all GAS directives under TOK_ASMDIR prefix to include leading '.'Vlad Vissoultchev2016-03-151-26/+31
| | | | Use only these tokens in `asm_parse_directive` and don't recycle others' tokens (like TOK_SECTION1)
* tcctok.h: Put TOK_memmove in the correct places (I hope).Edmund Grimley Evans2015-11-051-1/+2
| | | | This should have been part of b051549. Someone should test on ARM.
* tcctok.h: Revert 41408f2, which moved TOK_memmove.Edmund Grimley Evans2015-11-051-1/+1
|
* fix for the "tccgen.c: Use memmove for struct assignment"seyko2015-11-051-1/+1
| | | | | | | | | | | ./configure --enable-cross make tcc -o i386-tcc tcc.c tcc -o x86_64-tcc tcc.c tcc -o i386-win-tcc tcc.c In file included from tcc.c:22: In file included from libtcc.c:39: tccgen.c:2580: error: 'TOK_memmove' undeclared
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-0/+335
|
* Reorganize the source tree.gus knight2015-07-271-335/+0
| | | | | | | | | | * Documentation is now in "docs". * Source code is now in "src". * Misc. fixes here and there so that everything still works. I think I got everything in this commit, but I only tested this on Linux (Make) and Windows (CMake), so I might've messed something up on other platforms...
* Trim trailing spaces everywhere.gus knight2015-07-271-1/+1
|
* tccpp: alternative #pragma push/pop_macrogrischka2015-04-231-0/+2
| | | | | | | using next_nomacro() so that for example #define push_macro foobar does not affect how the pragma works (same behavior as gcc, albeit not MS's cl).
* Revert "* and #pragma pop_macro("macro_name")"grischka2015-04-231-2/+0
| | | | | | | | | | | | - pop_macro incorrect with initially undefined macro - horrible implementation (tcc_open_bf) - crashes eventually (abuse of Sym->prev_tok) - the (unrelated) asm_label part is the opposite of a fix (Despite of its name this variable has nothing to do with the built-in assembler) This reverts commit 0c8447db7970813292a8be74ee50e49091be5d15.
* "#pragma once" implementationseyko2015-04-211-0/+1
|
* * and #pragma pop_macro("macro_name")seyko2015-04-211-0/+2
| | | | | | | | | | * give warning if pragma is unknown for tcc * don't free asm_label in sym_free(), it's a job of the asm_free_labels(). The above pragmas are used in the mingw headers. Thise pragmas are implemented in gcc-4.5+ and current clang.
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-151-0/+2
|
* Revert "implement #pragma comment(lib,...)"Steven G. Messervey2015-04-151-3/+0
| | | | | | This reverts commit 8615bb40fb39bf7435462ca54cbbc24aaecae502. Reverting as it breaks on MinGW targets
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-151-0/+3
|
* replace a method to force bcheck.o linkingseyko2015-04-121-0/+1
| | | | | | * define __bound_init as external_global_sym insteed of the compiling a tiny program * remove warning about buf[] when CONFIG_TCC_BCHECK is not defined
* arm64: Implement __clear_cache.Edmund Grimley Evans2015-03-081-0/+1
| | | | | | __clear_cache is defined in lib-arm64.c with a single call to __arm64_clear_cache, which is the real built-in function and is turned into inline assembler by gen_clear_cache in arm64-gen.c
* Add __builtin_return_address.Edmund Grimley Evans2015-03-061-0/+1
| | | | | | Implementation is mostly shared with __builtin_frame_address. It seems to work on arm64, i386 and x86_64. It may need to be adapted for other targets.
* partial revert of the commit 4ad186c5ef61seyko2015-03-041-0/+4
| | | | | | | | | | | | | | | A test program: /* result of the new version inroduced in 4ad186c5ef61: t2a = 44100312 */ #include<stdio.h> int main() { int t1 = 176401255; float f = 0.25f; int t2a = (int)(t1 * f); // must be 44100313 int t2b = (int)(t1 * (float)0.25f); printf("t2a=%d t2b=%d \n",t2a,t2b); return 0; }
* Add arm64 (AArch64) as a target architecture.Edmund Grimley Evans2015-02-231-0/+33
|
* Add support for .p2align asm directive.Reimar Döffinger2015-01-201-0/+1
| | | | Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* Parse assembler .hidden directiveMichael Matz2014-04-141-0/+1
| | | | | This makes TCCs assembler understand the '.hidden symbol' directive (and emits a STV_HIDDEN ELF symbol then).
* Parse and emit hidden visibilityMichael Matz2014-04-141-0/+2
| | | | | | | This adds parsing of (GCC compatible) visibility attribute in order to mark selected global symbols as hidden. The generated .o files contain hidden symbols already, the TCC linker doesn't yet do the right thing.
* Create bcheck region for argv and arge argumentThomas Preud'homme2014-03-291-0/+1
| | | | | | | | | | | For program manipulating argv or arge as pointer with construct such as: (while *argv++) { do_something_with_argv; } it is necessary to have argv and arge inside a region. This patch create regions argv and arge) if main is declared with those parameters.
* i386: use __fixdfdi instead of __tcc_cvt_ftolgrischka2014-01-061-43/+46
| | | | | | | | | | | | Variants __fixsfdi/__fixxfdi are not needed for now because the value is converted to double always. Also: - remove __tcc_fpinit for unix as it seems redundant by the __setfpucw call in the startup code - avoid reference to s->runtime_main in cross compilers - configure: fix --with-libgcc help - tcctok.h: cleanup
* Revert "Add support for thread-local storage variables"Thomas Preud'homme2013-11-031-1/+0
| | | | | | | | | | TLS support in tinyCC is absolutely not ready: - segment register not select in load and store - no relocation added for computing offset of per-thread symbol - no support for TLS-specific relocations - no program header added as per Drepper document about TLS This reverts commit 1c4afd13501f07a673aed5f130166f2ee0f30927.
* Add support for thread-local storage variablesThomas Preud'homme2013-10-291-0/+1
|
* i386-gen: preserve fp control word in gen_cvt_ftoigrischka2013-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | - Use runtime function for conversion - Also initialize fp with tcc -run on windows This fixes a bug where double x = 1.0; double y = 1.0000000000000001; double z = x < y ? 0 : sqrt (x*x - y*y); caused a bad sqrt because rounding precision for the x < y comparison was different to the one used within the sqrt function. This also fixes a bug where printf("%d, %d", (int)pow(10, 2), (int)pow(10, 2)); would print 100, 99 Unrelated: win32: document relative include & lib lookup win32: normalize_slashes: do not mirror silly gcc behavior This reverts part of commit 8a81f9e1036637e21a47e14fb56bf64133546890 winapi: add missing WINAPI decl. for some functions
* 64-bit tests now pass (well, nearly).James Lyon2013-04-241-0/+4
| | | | | tcctest1-3 fail, but this appears to be due to bugs in GCC rather than TCC (from manual inspection of the output).
* tcctok.h: fix ifdef target/host confusionJoe Soroka2011-04-121-1/+1
|
* re-apply VLA by Thomas Preud'hommeJoe Soroka2011-04-061-0/+2
|
* tccgen: handle __attribute((alias("target")))Joe Soroka2011-03-031-0/+2
|
* Revert "Make TOK_alloca available for x86-64"Thomas Preud'homme2011-02-051-2/+0
| | | | This reverts commit af26ac56bfc584b70e20158e67f7035024076ec8.
* Make TOK_alloca available for x86-64Thomas Preud'homme2011-02-041-0/+2
| | | | | | | TOK_alloca is now available on x86-64 so make put definition of TOK_alloca outside the BCHECK conditional macro definition but test if arch is i386 or x86-64. This makes C99 VLA works (understand compile) on x86-64.
* Support struct arguments with stdarg.hShinichiro Hamaji2010-12-281-6/+1
| | | | | | | | - add __builtin_va_arg_types to check how arguments were passed - move most code of stdarg into libtcc1.c - remove __builtin_malloc and __builtin_free - add a test case based on the bug report (http://www.mail-archive.com/tinycc-devel@nongnu.org/msg03036.html)