aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Make sizeof() be of type size_tMichael Matz2012-04-181-3/+14
| | | | | | | | This matters when sizeof is directly used in arithmetic, ala "uintptr_t t; t &= -sizeof(long)" (for alignment). When sizeof isn't size_t (as it's specified to be) this masking will truncate the high bits of the uintptr_t object (if uintptr_t is larger than uint).
* Fix detection of labels with a typedef nameMichael Matz2012-04-181-1/+20
| | | | | | | | | | | | | | 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).
* Fix bitfield loads into char/short.Michael Matz2012-04-181-2/+3
| | | | | | Removes a premature optimization of char/short loads rewriting the source type. It did so also for bitfield loads, thereby removing all the shifts/maskings.
* Fix conversion in a?0:ptr.Michael Matz2012-04-181-5/+14
| | | | | | (cond ? 0 : ptr)->member wasn't handled correctly. If one arm is a null pointer constant (which also can be a pointer) the result type is that of the other arm.
* Remove vnrott (duplicate vrotb)Thomas Preud'homme2012-03-141-16/+0
|
* Error out when assigning void value.Thomas Preud'homme2012-01-221-0/+2
| | | | | | | | tcc should now error out when compiling code like: VOID ExitProcess(UINT uExitCode); (…) retCode = ExitProcess(pi.dwProcessId);
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-75/+75
|
* x86-64: fix flags and zero-pad long doublesgrischka2011-08-061-1/+5
| | | | | | | | | | This fixes a bug introduced in commit 8d107d9ffd8126d82b1c56be47431a6bcef39f08 that produced wrong code because of interference between 0x10 bits VT_CONST and x86_64-gen.c:TREG_MEM Also fully zero-pad long doubles on x86-64 to avoid random bytes in output files which disturb file comparison.
* Accept colon separated paths with -L and -Igrischka2011-08-011-0/+9
| | | | | | | | | | | | | | | | | | This allows passing colon separated paths to tcc_add_library_path tcc_add_sysinclude_path tcc_add_include_path Also there are new configure variables CONFIG_TCC_LIBPATH CONFIG_TCC_SYSINCLUDE_PATHS which define the lib/sysinclude paths all in one and can be overridden from configure/make For TCC_TARGET_PE semicolons (;) are used as separators Also, \b in the path string is replaced by s->tcc_lib_path (CONFIG_TCCDIR rsp. -B option)
* Revert "Force const. expr. in expr_cond outside function"Thomas Preud'homme2011-07-311-1/+1
| | | | | This reverts commit b2f5ee9b2de40e26ba3d92cf3950be6da7766b7d as it's useless on mob.
* Force const. expr. in expr_cond outside functionThomas Preud'homme2011-07-311-1/+1
| | | | | | Since no code should be generated outside a function, force expr_cond to only consider constant expression when outside a function since the generic code can generate some code.
* re-added negative-array-size testcase and fixed fix for itJoe Soroka2011-07-221-3/+3
|
* Revert "better constant handling for expr_cond"grischka2011-07-161-4/+1
| | | | | It produced wrong code with one of my test projects. This reverts commit cd3d1a45f34be3c9a358f1743bcaf8aac897992e.
* win64: va_arg with structuresgrischka2011-07-141-0/+4
|
* tccgen: reset aligned attribute for next typegrischka2011-07-141-0/+1
| | | | | | | | | | | | Basically, with: typedef __attribute__((aligned(16))) struct _xyz { ... } xyz, *pxyz; we want the struct aligned but not the pointer. FIXME: This patch is a hack, waiting for someone in the knowledge of correct __attribute__ semantics.
* handle arrays with a flexible member but no initializerJoe Soroka2011-07-111-1/+1
|
* better constant handling for expr_condJoe Soroka2011-07-111-1/+4
|
* Remove unused variablesThomas Preud'homme2011-05-161-1/+6
| | | | | Remove unused local variables and declare them conditionally when they are used only on some architectures.
* use of TOK_alloca breaks cross compiler buildJoe Soroka2011-04-121-0/+4
| | | | | | | | | | | VLA inserts a call to alloca via enum TOK_alloca, but TOK_alloca only exists on I386 and X86_64 targets. This patch just emits an error at compile-time if someone tries to compile some VLA code for a TOK_alloca-less target. The best solution might be to just push the problem to link-time, since the existence-or-not of a alloca implementation can only be determined by linking. It seems like just declaring TOK_alloca unconditionally would achieve that, but for now, this at least gets the cross compilers to build.
* simplify/rollback VLA pointer subtractionJoe Soroka2011-04-111-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't know if it makes a difference to gen_op(TOK_PDIV) or not, but logically the ptr1_is_vla test in TP's VLA patch seems out of order, where the patch to fix it would be: ------------------------------------------------------------------ @@ -1581,15 +1581,15 @@ ST_FUNC void gen_op(int op) u = pointed_size(&vtop[-1].type); } gen_opic(op); + if (ptr1_is_vla) + vswap(); /* set to integer type */ #ifdef TCC_TARGET_X86_64 vtop->type.t = VT_LLONG; #else vtop->type.t = VT_INT; #endif - if (ptr1_is_vla) - vswap(); - else + if (!ptr1_is_vla) vpushi(u); gen_op(TOK_PDIV); } else { ------------------------------------------------------------------ Instead of that patch, which increases the complexity of the code, this one fixes the problem by just rolling back and retrying with a simpler approach.
* remove no-longer-necessary naive fix for vla vstack leakJoe Soroka2011-04-091-5/+0
|
* prevent internal segfault on apparent VLA at file scopeJoe Soroka2011-04-091-0/+2
|
* VLA fix [3/3]: store VLA sizeofs in anonymous runtime stack varsJoe Soroka2011-04-091-33/+22
|
* VLA fix [2/3]: removed VT_ARRAY from VT_VLA typesJoe Soroka2011-04-081-20/+11
| | | | | | | | | A VLA is not really an array, it's a pointer-to-an-array. Making this explicit allows us to back out a few parts of the original VLA patch and paves the way for the next part of the fix, where a VLA will be stored on the runtime stack as a pointer-to-an-array, rather than on the compile- time stack as a Sym*.
* move a comment to its correct locationJoe Soroka2011-04-081-1/+1
|
* add naive workaround for VLA vstack leakJoe Soroka2011-04-081-0/+5
|
* VLA bcheck works via bound alloca; add test, remove warningJoe Soroka2011-04-061-3/+1
|
* clarify post_type() VT_STORAGE handling by moving it outJoe Soroka2011-04-061-7/+7
|
* re-apply VLA by Thomas Preud'hommeJoe Soroka2011-04-061-30/+130
|
* handle c99 flexible array members less hackilyJoe Soroka2011-03-181-1/+18
|
* revert complicated & broken flexible array member handlingJoe Soroka2011-03-181-18/+4
|
* fix c99 for-loop init decl scope (thanks: grischka)Joe Soroka2011-03-081-0/+2
| | | | see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00005.html
* clarify support for functions returning an array (try#2)Joe Soroka2011-03-081-4/+9
| | | | | fixes first attempt: http://repo.or.cz/w/tinycc.git/commitdiff/31fe1cc
* revert last commit. fails "make test"Joe Soroka2011-03-081-8/+5
| | | | | | | | | test target in Makefile does not depend on tcc. i'm not sure why, but i can think of at least one good reason. in my local tree I have it modified to do so, but somehow inadvertently reverted that so when i did "make test" before committing, it didn't actually test my changes. sorry.
* clarify support for functions returning an arrayJoe Soroka2011-03-081-5/+8
| | | | | | | | | previously, tcc would accept a prototype of a function returning an array, but not giving those functions bodies nor calling them. it seems that gcc has never supported them, so we should probably just error out... but it's possible that someone already using tcc includes some header that contains an unused prototype for one, so let's continue to support that.
* support c99 for-loop init decls (2nd attempt)Joe Soroka2011-03-081-3/+18
|
* partially revert e23194aJoe Soroka2011-03-081-19/+3
| | | | see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00002.html
* revert last 3 commits. will find better way.Joe Soroka2011-03-081-96/+85
|
* small change to previous whitespace-only commitJoe Soroka2011-03-081-2/+2
|
* some indentation made prev patch pretty; removed itJoe Soroka2011-03-081-85/+81
|
* refactor post_type() to be explicit about its recursionJoe Soroka2011-03-081-5/+20
|
* added a note clarifying post_type() recursionJoe Soroka2011-03-081-0/+3
| | | | | | | | | some ancient pre-K&R C allows a function to return an array and the array brackets to be put after the arguments, such that "int c()[]" means the same as "int[] c()" see: http://llvm.org/bugs/show_bug.cgi?id=2399 http://java.sun.com/docs/books/jls/third_edition/html/classes.html#38703
* support c99 for-loop init declsJoe Soroka2011-03-071-3/+19
|
* use new weaken_symbol() to fix another real-world corner caseJoe Soroka2011-03-071-1/+1
|
* factor out symbol weakening into new functionJoe Soroka2011-03-071-10/+17
|
* weak redefinition of a symbol should weaken the originalJoe Soroka2011-03-071-0/+3
|
* __typeof(t) should not include storage modifiers of tJoe Soroka2011-03-061-0/+2
|
* tccgen: handle __attribute((alias("target")))Joe Soroka2011-03-031-1/+24
|
* collapse branch in decl(), making way for next patchJoe Soroka2011-03-031-9/+9
|
* handle post-asm-label attributes on variablesJoe Soroka2011-03-031-25/+14
|