aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
Commit message (Collapse)AuthorAgeFilesLines
* Add version tracking. Starting at 0.1.0 lemon2026-01-091-4/+14
|
* c: fix use after free lemon2026-01-091-1/+2
| | | | | A silly one, declsbuf.p can be realloc'd in the call to putdecl, but in this statement that pointer could be fetched before the call.
* cpp: fix pasting ident+keyword lemon2026-01-091-4/+7
|
* lexer: multibyte escape seqs in wide character literal lemon2026-01-091-4/+13
| | | | (hacky)
* c: allow 'register' in func parameter lemon2026-01-091-1/+1
|
* cpp: fix multiline comment in skipped preprocessor directive lemon2026-01-091-2/+16
|
* cpp: fix single-line comment after preprocessor directive lemon2026-01-091-1/+1
| | | | It was eating up the newline token
* c: fix diagnostic with "return <undeclared>" lemon2025-12-311-2/+2
|
* backend: separate instrs for integer/float store lemon2025-12-311-5/+5
|
* c: SYM expr should store decl ref as an index, not pointer lemon2025-12-303-52/+59
| | | | | | | | Because envdecls (now declsbuf) can be resized and invalidate those pointers. I missed this because the default initialization size of that buffer (and the fact that it would mostly only manifest with function-local expressions) made it not really come up in practice. Silly
* cpp: nicer handling of predefined macros lemon2025-12-291-40/+29
|
* backend: start implementing aarch64 lemon2025-12-281-0/+4
|
* avoid GOT relocations in unnecessary instances lemon2025-12-251-1/+1
| | | | | Also change xcon to have a flagset for symbols (whether it's a function, locally defined; later: thread local, etc).
* c: add _Generic lemon2025-12-221-0/+53
|
* c: recognize __attribute__ as decltok, improve diagnostic for expected ↵ lemon2025-12-221-1/+2
| | | | declaration
* preprocessor make some errors just warnings lemon2025-12-221-4/+6
|
* c/c.c: cleanup exprparse a little lemon2025-12-221-13/+12
|
* c: Fix some dumb uses of initialized stuff lemon2025-12-222-10/+12
| | | | | | Can't figure out what's wrong with the change to struct expr from 9721d6ba40 but it makes valgrind complain and causes miscompilation of the compiler itself..
* c: keyword aliases lemon2025-12-213-66/+81
| | | | | Some linux headers use __signed__ for whatever reason.. this is a general fix for those alternate keyword
* c: allow `return voidfn()` extension lemon2025-12-211-4/+30
|
* lexer: more small optimizations lemon2025-12-211-14/+33
|
* lexer: note source of #include when error occurs in #included file lemon2025-12-202-1/+8
|
* c: small typechecking bugfixes lemon2025-12-201-3/+3
|
* some static assertions for packed type sizes lemon2025-12-201-6/+8
|
* backend: unify pass memory allocation strategies lemon2025-12-201-1/+1
| | | | | | It was all over the place for temporary data structures used by individual passes. Now there is an arena specifically for that, which is nicer.
* c: support CRLF newlines lemon2025-12-201-3/+11
|
* c: fix a silly C edge case with function redeclaration storage class lemon2025-12-201-14/+21
| | | | | | C (or at least clang and gcc) allows declaring `static int f(...);` and defining it later as `int f(...) {...}`, omitting the 'static' in the latter definition.
* lexer: fix remnant use of TKEOF for character lemon2025-12-201-9/+7
|
* optimize lexer a bit more lemon2025-12-202-62/+88
|
* lexer: convert pp-idents to keywords only after preprocessing lemon2025-12-202-71/+75
|
* c: factor out to tldecl(), improve error recovery, lemon2025-12-201-73/+97
|
* c.h init zero bitset portability lemon2025-12-191-1/+1
|
* c: support 0-length arrays as syntax for flexible array members lemon2025-12-191-19/+29
| | | | | Keeping the expr around in the decllist paves the way for VLA support later on
* c: fix incr/decr codegen for floats lemon2025-12-191-2/+2
|
* c: hack to support __FUNCTION__ GNU extension lemon2025-12-191-4/+10
|
* cpp: GNU extension for named variadic arguments lemon2025-12-181-4/+7
|
* cpp: better error recovery for #define syntax error lemon2025-12-181-6/+7
|
* c: fix uninitiliazed field in decltypes lemon2025-12-171-0/+1
|
* nicer defaults and facilities for cross-compilation lemon2025-12-171-2/+16
|
* c: improve some type error diagnostics lemon2025-12-151-13/+22
|
* create distinct interned string type lemon2025-12-154-75/+76
| | | | | | | | | | | | | | Interned strings are used pervasively, so it's a good idea to add a layer of type safety to differentiate them from general cstrs and avoid potential bugs from comparing non-interned and interned strings. Not that that's happened so far that I can remember, but it could. I'm 90% sure it's legal to alias `struct {char c;}` pointers with `char` pointers. This specific typedef gives type safety but with a simple one-way `internstr -> const char *` typecast (with `&istr->c`). Converting the other way around is more intentional: a straight up cast `(internstr)cstr` which sticks out as unchecked and probably wrong, or calling the intern(cstr) function, which is the right way.
* move intern() to mem.c lemon2025-12-153-47/+0
| | | | | Being in lex.c was vestigial, since it was being used all over the frontend and backend.
* lex: loop with goto instead of tail recursion lemon2025-12-151-7/+8
| | | | | This uncovered a edgecase with loops and lifetime construction in regalloc!
* lexer: use a hashmap to lookup keywords lemon2025-12-152-28/+28
|
* c: error when defining function with incomplete parameter type lemon2025-12-151-0/+4
|
* c: support forward-declared enums lemon2025-12-151-34/+32
| | | | This is a common non-standard GNU extension.
* c: emit data for __func__ lazily lemon2025-12-151-15/+16
|
* c: fix another memory-leak-when-errors case lemon2025-12-141-1/+2
|
* c: as a hack, warn for zero-length array instead of error lemon2025-12-141-1/+1
| | | | | Treated as unsized array T[]. This shows up in some linux headers as a non-standard way to have flexible array members.
* c/builtin: fix vacopy lemon2025-12-141-5/+6
|