Commit Graph

89 Commits

Author SHA1 Message Date
Joe Soroka
ace0f7f259 re-apply VLA by Thomas Preud'homme 2011-04-06 09:17:03 -07:00
Joe Soroka
17571298f3 handle c99 flexible array members less hackily 2011-03-18 17:50:42 -07:00
Joe Soroka
06a7c415a9 revert complicated & broken flexible array member handling 2011-03-18 17:47:35 -07:00
Joe Soroka
0b8aa909a3 fix c99 for-loop init decl scope (thanks: grischka)
see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00005.html
2011-03-08 15:19:54 -08:00
Joe Soroka
9ff91d4c6f clarify support for functions returning an array (try#2)
fixes first attempt:
http://repo.or.cz/w/tinycc.git/commitdiff/31fe1cc
2011-03-08 15:12:09 -08:00
Joe Soroka
91163f167e revert last commit. fails "make test"
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.
2011-03-08 14:58:02 -08:00
Joe Soroka
31fe1cc62b clarify support for functions returning an array
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.
2011-03-08 14:13:08 -08:00
Joe Soroka
5eb82755db support c99 for-loop init decls (2nd attempt) 2011-03-08 13:36:04 -08:00
Joe Soroka
7fc2eee55c partially revert e23194a
see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00002.html
2011-03-08 13:22:48 -08:00
Joe Soroka
b3a8eed49e revert last 3 commits. will find better way. 2011-03-08 12:56:13 -08:00
Joe Soroka
2d292e69a1 small change to previous whitespace-only commit 2011-03-08 09:26:36 -08:00
Joe Soroka
545a37b306 some indentation made prev patch pretty; removed it 2011-03-08 01:59:50 -08:00
Joe Soroka
89059f94c0 refactor post_type() to be explicit about its recursion 2011-03-08 01:47:31 -08:00
Joe Soroka
772b302187 added a note clarifying post_type() recursion
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
2011-03-08 01:33:17 -08:00
Joe Soroka
e23194a1fa support c99 for-loop init decls 2011-03-07 11:28:31 -08:00
Joe Soroka
4fbe3cda33 use new weaken_symbol() to fix another real-world corner case 2011-03-07 01:05:09 -08:00
Joe Soroka
8bcb2ae1b2 factor out symbol weakening into new function 2011-03-07 01:02:23 -08:00
Joe Soroka
0f0c2d9c02 weak redefinition of a symbol should weaken the original 2011-03-07 00:25:27 -08:00
Joe Soroka
38cbb40e90 __typeof(t) should not include storage modifiers of t 2011-03-06 22:32:35 -08:00
Joe Soroka
c93eca4fe4 tccgen: handle __attribute((alias("target"))) 2011-03-03 01:58:45 -08:00
Joe Soroka
ce8c1886a5 collapse branch in decl(), making way for next patch 2011-03-03 01:07:36 -08:00
Joe Soroka
3beb383236 handle post-asm-label attributes on variables 2011-03-03 00:55:02 -08:00
Joe Soroka
823f832630 tcc: fix weak attribute handling 2011-03-02 13:31:09 -08:00
Jaroslav Kysela
ab73c9bc4e fix another static struct init issue (arrays with unknown size at end) 2011-02-22 12:15:45 +01:00
Jaroslav Kysela
dbefae52b0 Fix complex static initializers (handle additional '}' and '{' brackets)
- added an example to test suite
- the "warning: assignment discards qualifiers from pointer target type"
  is present but harmless
2011-02-22 12:15:44 +01:00
Thomas Preud'homme
11b2d33523 Add support of asm label for variables.
Add support for asm labels for variables, that is the ability to rename
a variable at assembly level with __asm__ ("newname") appended in
its declaration.
See http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Asm-Labels.html for more
details.
2011-02-09 00:12:57 +01:00
Thomas Preud'homme
32a682b88f Fix fct asm label: only valid for declaration
- Fix function assembly label mechanism introduced in commit
  9b09fc376e to only accept alternative
  name for function declaration.
- merge the code with the one introduced in commit
  264a103610.
- Don't memorize token for asm label but directly the asm label.
2011-02-09 00:12:57 +01:00
Thomas Preud'homme
c23400278a Fix incorrect use of basic type as bitflags.
Fix incorrect use of basic types as bitflags and inefficiency in commit
cf36410e30
2011-02-07 23:46:20 +01:00
Thomas Preud'homme
cf36410e30 Complain for static fct declared w/o file scope
Error out on static function without file scope and give an explaination
to the user

This is a rewrite of e9406c09a3 but
considering problems raised about static local function pointers in
632ee5a540.
2011-02-06 22:50:05 +01:00
Thomas Preud'homme
db560e9439 Revert "Implement C99 Variable Length Arrays"
This reverts commit a5a50eaafe.
2011-02-05 02:33:46 +01:00
Thomas Preud'homme
4b8470f3ae Revert "Disable C99 VLA when alloca is unavailable."
This reverts commit e3e5d4ad7a.
2011-02-05 02:33:45 +01:00
Thomas Preud'homme
e3e5d4ad7a Disable C99 VLA when alloca is unavailable.
* Disable C99 VLA detection when alloca is unavailable and protect the
  new reference to TOK_alloca in decl_initializer in order to compile
  and run for architecture without working alloca.

  Not all code of C99 VLA is commented as it would required many ifdef
  stanza. Just the detection is commented so that VT_VLA is never set
  any type and the C99 VLA code is compiled but never called. However
  vpush_global_sym(&func_old_type, TOK_alloca) in decl_initializer needs
  to be protected by an ifdef stanza as well because it uses TOK_alloca.

* include alloca and C99 VLA tests according to availability of
  TOK_alloca instead of relying on the current architecture
2011-02-04 15:24:48 +01:00
Thomas Preud'homme
a5a50eaafe Implement C99 Variable Length Arrays
Implement C99 Variable Length Arrays in tinycc:
- Support VLA with multiple level (nested vla)
- Update documentation with regards to VT_VLA
- Add a testsuite in tcctest.c
2011-02-04 02:22:25 +01:00
Joe Soroka
cf08675702 weak definitions overrule non-weak prototypes 2011-02-01 09:41:03 -08:00
Joe Soroka
4d5105c8f1 support weak attribute on variables 2011-02-01 00:37:53 -08:00
Shinichiro Hamaji
0ed7ba3f5e Support struct arguments with stdarg.h
- 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)
2010-12-28 19:32:40 +09:00
Ben Bacarisse
14673d0c49 Fix binding of assignment expressions. 2010-10-25 15:40:30 +01:00
Thomas Preud'homme
b8adf0090e Move asm label functions from tccasm.c to tccgen.c
* Move functions parse_asm_str and asm_label_instr from tccasm.c to
  tccgen.c
* Remove CONFIG_TCC_ASM_LABEL macro as asm label are available on all
  archs.
See:
http://lists.nongnu.org/archive/html/tinycc-devel/2010-09/msg00026.html
for the rationale.
2010-09-14 23:21:15 +02:00
Thomas Preud'homme
9b09fc376e Add support of asm label for functions.
Add support for asm labels for functions, that is the ability to rename
a function at assembly level with __asm__ ("newname") appended in
function declaration.
2010-09-10 20:15:03 +02:00
Shinichiro Hamaji
c31dc7aa0c Fix casts from 32bit integer types to 64bit integer types.
This bug was reported in
http://lists.gnu.org/archive/html/tinycc-devel/2010-08/msg00050.html

In this case, we should not emit any code when we cast from VT_FUNC to VT_PTR.
2010-08-31 08:35:31 +09:00
grischka
4ab4efd3a6 Revert "implemented C99 for loop with variable declaration"
This reverts commit 433ecdfc9d.

The patch breaks e.g. with
    for ((i = 10); --i;);

In particular to check for a type decl. this is not sufficient:
    if (tok < TOK_UIDENT) {

A future approach to c99 loop variables might instead use:
    if (parse_btype(...)) {

plus refactor function decl() accordingly.
2010-08-21 13:39:12 +02:00
grischka
3ba37e1e3f tccgen: Revert yuanbin's recent patches
This reverts commits 670993..d35138
Maybe these commits fixed something but also seemed to cause problems.
2010-06-21 18:21:44 +02:00
Claudio Bley
433ecdfc9d implemented C99 for loop with variable declaration 2010-06-21 11:57:32 +02:00
grischka
632ee5a540 Revert "Complain for static fct declared w/o file scope"
This reverts commit e9406c09a3.

We don't want errors for static local function pointers, such as:
  {
    static void (*fn)();
    ...
  }
2010-06-15 17:03:23 +02:00
grischka
5fcd1fef1c Fix last commits: remove CRLF, chmod 644 tccgen.c 2010-06-15 17:02:09 +02:00
yuanbin
d351384fdc tccgen: skip ')' in front of ',' for initializer 2010-06-13 14:50:53 +08:00
yuanbin
952e83e0ca tccgen: skip fields from same union 2010-06-13 02:37:28 +08:00
yuanbin
d6ce75b4d6 tccgen.c: skip fields from same union 2010-06-13 01:12:36 +08:00
yuanbin
dd72577759 tccgen: initial the last member of union 2010-06-11 21:18:05 +08:00
yuanbin
6709933d78 tccgen: initial last member of union 2010-06-11 20:48:33 +08:00