aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/c.c
Commit message (Collapse)AuthorAgeFilesLines
* c: remove unused functionlemon13 days1-12/+0
|
* c: error for statement expression outside functionlemon13 days1-4/+15
|
* c: eval2xintcon check intnesslemon13 days1-8/+9
|
* frontend: GNU statement expressionslemon13 days1-33/+55
|
* c.c static eval2extlemon13 days1-1/+1
|
* frontend: allow folding some non constant expressions as a GNU extensionlemon13 days1-14/+29
| | | | And also permit zero size objects
* c: fix some more static initializer edge caseslemon13 days1-7/+13
|
* c: fix complex assignmentlemon14 days1-3/+1
|
* c: for undeclared function calls, put implicit decl in toplevellemon14 days1-0/+5
| | | | To avoid repeated warnings
* c: fix some compatible type declarationslemon14 days1-17/+7
| | | | | | | | | | | When K&R prototypes are present, definition of compatible types and composite types becomes recursive. For example `int f(int (*)())` should be compatible with `int f(int (*)(int))` etc
* support extern inline "definitions"lemon2026-04-171-1/+0
|
* c: fix using array as condition valuelemon2026-04-171-2/+2
| | | | Decays to pointer
* revert cbf1018b21e and actual fixlemon2026-04-141-3/+10
| | | | | Actually that check was OK. The issue was in isnullpo(), not detecting the folded `(void*)0`
* c: allow nested aggregate with flexible array memberlemon2026-04-141-2/+4
|
* c: fix type of `<unsigned> /= <float>`lemon2026-04-141-2/+5
| | | | | | Would wrongly generate `udiv` and fail later in the backend. Should add a IR sanity checks pass to catch e.g. unsigned operations being used with floating point classes.
* c: make type of conditional expr with pointers match non void pointerlemon2026-04-141-1/+1
| | | | | | | | | | | | | | | | Here's what the C standard[1] says about the conditional operator: ``` if one operand is a null pointer constant, the result has the type of the other operand; otherwise, one operand is a pointer to void or a qualified version of void, in which case the result type is a pointer to an appropriately qualified version of void. `` But actually, some codebases rely on things like 'x ? &foo.memb : NULL' to have the type of `&foo.memb`, and not `void *`... [1]: ISO/IEC 9899:TC3 ยง6.5.15
* cpp: concat 123 ## .lemon2026-04-141-1/+2
|
* c: implement explicit cast complex -> scalarlemon2026-04-131-3/+7
|
* c: match class, not typetag, for libgcc stubslemon2026-04-131-1/+1
|
* C99 complex types MVPlemon2026-04-131-38/+356
| | | | | | | | | Missing: static eval of complex values, Silly inefficient implementation of equality comparisons between them The whole thing is pretty inefficient without proper aggregate mem2reg anyway
* frontend: accept zero size arrays and empty aggregateslemon2026-04-131-23/+19
| | | | | | GNU extension. Previously was overloading arraylength==0 to mean unsized array, now they are distinct with the type flag TFUNKNOWN marking unsized arrays & aggregates.
* frontend: always narrow assignment expression used as valuelemon2026-04-111-2/+2
|
* c: fix bitfields in unionslemon2026-04-101-4/+6
|
* IR: emit inline function standalone bodies lazilylemon2026-03-231-5/+12
| | | | | | | If a function is stashed for inlining and inlined in all of its callsites or unused, it never ends up in the object file. If any symbol reference to it is emitted, then it must be de-inlined (rematerialized), and this is done near the end before emitting the actual object file.
* c: __attribute__ after declaratorlemon2026-03-231-0/+1
|
* c: __attribute__ in more placeslemon2026-03-231-0/+2
|
* c: remove inline 'backing' type tag for enumslemon2026-03-231-1/+0
| | | | | | | | | | It was meant as a micro-optimization but actually keeping it in sync was annoying. This for example was broken: ``` extern enum foo { ... } g_foo; enum foo g_foo; ```
* style: change uvlong -> u64int, vlong -> s64intlemon2026-03-221-16/+16
| | | | | Is much nicer. I don't know whether I want to do it for the other int types too. char and uchar are fine as bytes. u/short -> u/s16int, maybe.
* IR: add 3rd operand to Instrlemon2026-03-221-3/+3
| | | | | The motivation is for aarch64 msub/madd instrs, for isel to produce. But it should be useful for other things too.
* Rework handling of predefined macros.lemon2026-03-211-3/+3
| | | | And add some GCC predefs like __SIZE_TYPE__, __LONG_SIZE__, etc
* c: fix crash with dead code in condexprlemon2026-03-201-1/+2
|
* c: better preserve source location in some caseslemon2026-03-201-2/+4
|
* io: make -w suppress notes toolemon2026-03-201-6/+6
|
* c: fix isboollike() for phislemon2026-03-191-2/+3
|
* c: fix qualifiers for array declaratorslemon2026-03-191-7/+10
| | | | | | `const int x[]` was being treated as `const int x[const]`, which is wrong, and matters when `x` is a function parameter that really decays to a pointer (`int const *const x`)
* ir: do not always try to put small literals in .textlemon2026-03-191-3/+3
| | | | | OpenBSD enforces read xor execute (XOM) even in x86-64. Not aware of any other platforms that do this.
* c: remove unused initialization of decl.alignlemon2026-03-191-3/+3
| | | | | The intent is for _Alignas declarations but those aren't implemented yet. And initializing that field in declarator() can mess with .sym.
* c: fix edge cases with zero sized bitfields and static initializerslemon2026-03-181-7/+6
|
* Refactor: use typedefs and CamelCase for aggregate typeslemon2026-03-181-498/+502
| | | | Looks nicer
* Refactor: move some utils from antcc.h to their own headerslemon2026-03-171-0/+1
|
* REFACTOR: finish renaminglemon2026-03-171-4/+4
|
* REFACTOR: move sources to src/lemon2026-03-171-0/+4772