Commit Graph

127 Commits

Author SHA1 Message Date
Rui Ueyama b33fe0ea82 Support line continuation 2020-12-07 12:00:06 +09:00
Rui Ueyama 8075582c21 Preserve newline and space during macro expansion 2020-12-07 12:00:06 +09:00
Rui Ueyama a8d76ad435 Replace remaining identifiers with 0 in macro constexpr 2020-12-07 12:00:06 +09:00
Rui Ueyama 5cb2f89e6a Add defined() macro operator 2020-12-07 12:00:06 +09:00
Rui Ueyama 769b5a0941 Use chibicc's preprocessor for all tests 2020-12-07 12:00:06 +09:00
Rui Ueyama 8f561aed9b Add macro token-pasting operator (##) 2020-12-07 12:00:06 +09:00
Rui Ueyama 8f6f7925a0 Add macro stringizing operator (#) 2020-12-07 12:00:06 +09:00
Rui Ueyama 1313fc6d3a Do not expand a token more than once for the same funclike macro 2020-12-07 12:00:06 +09:00
Rui Ueyama c7d7ce0f0c Allow parenthesized expressions as macro arguments 2020-12-07 12:00:06 +09:00
Rui Ueyama dd4306cdd8 Allow empty macro arguments 2020-12-07 12:00:06 +09:00
Rui Ueyama b9ad3e43cf Add multi-arity funclike #define 2020-12-07 12:00:06 +09:00
Rui Ueyama dec3b3fa02 Add zero-arity funclike #define 2020-12-07 12:00:06 +09:00
Rui Ueyama 1f80f581e5 Add #ifdef and #ifndef 2020-12-07 12:00:06 +09:00
Rui Ueyama acce00228b Do not expand a token more than once for the same objlike macro 2020-12-07 12:00:06 +09:00
Rui Ueyama 2651448084 Expand macros in the #if and #elif argument context 2020-12-07 12:00:06 +09:00
Rui Ueyama 9ad60e41d5 Add #undef 2020-12-07 12:00:06 +09:00
Rui Ueyama 97d33ad3bd Add objlike #define 2020-12-07 12:00:06 +09:00
Rui Ueyama e7a1857a31 Add #elif 2020-12-07 12:00:06 +09:00
Rui Ueyama c6e81d22f8 Add #else 2020-12-07 12:00:06 +09:00
Rui Ueyama aa570f3086 Skip nested #if in a skipped #if-clause 2020-12-07 12:00:06 +09:00
Rui Ueyama bf6ff928ad Add #if and #endif 2020-12-07 12:00:06 +09:00
Rui Ueyama d138864a2a Add -E option 2020-12-07 12:00:06 +09:00
Rui Ueyama d367510fcc Add #include "..." 2020-12-07 12:00:06 +09:00
Rui Ueyama 146c7b3dd4 Add the null directive 2020-12-07 12:00:06 +09:00
Rui Ueyama 8b726b5489 Run "ld" unless -c is given 2020-12-07 12:00:06 +09:00
Rui Ueyama b833cd0f29 Accept multiple input files 2020-12-07 12:00:06 +09:00
Rui Ueyama 140b43358c Run "as" command unless -S is given 2020-12-07 12:00:06 +09:00
Rui Ueyama 53e81033ce Add usual arithmetic conversion for function pointer 2020-12-07 12:00:06 +09:00
Rui Ueyama c5953ba132 Decay a function to a pointer in the func param context 2020-12-07 12:00:06 +09:00
Rui Ueyama d06a8ac6e6 Add function pointer 2020-12-07 12:00:06 +09:00
Rui Ueyama 5d15431df1 Add stage2 build 2020-12-07 12:00:06 +09:00
Rui Ueyama 9bf96124ba Add "long double" as an alias for "double" 2020-12-07 12:00:06 +09:00
Rui Ueyama ffea4219b1 Add flonum constant expression 2020-12-07 12:00:06 +09:00
Rui Ueyama e452cf7215 Support variadic function with floating-point parameters 2020-12-07 12:00:06 +09:00
Rui Ueyama 8b14859f63 Implement default argument promotion for float 2020-12-07 12:00:06 +09:00
Rui Ueyama c6b30568b4 Allow to define a function that takes/returns flonums 2020-12-07 12:00:06 +09:00
Rui Ueyama 8ec1ebf176 Allow to call a function that takes/returns flonums 2020-12-07 12:00:06 +09:00
Rui Ueyama 0ce1093027 Handle flonum for if, while, do, !, ?:, || and && 2020-12-07 12:00:06 +09:00
Rui Ueyama 83f76ebb66 Add flonum +, -, * and / 2020-12-07 12:00:06 +09:00
Rui Ueyama cf9ceecb2f Add flonum ==, !=, < and <= 2020-12-07 12:00:06 +09:00
Rui Ueyama 29de46aed4 Add "float" and "double" local variables and casts 2020-12-07 12:00:06 +09:00
Rui Ueyama 1e57f72d8a Add floating-point constant 2020-12-07 12:00:06 +09:00
Rui Ueyama 93d12771d0 Ignore "static" and "const" in array-dimensions 2020-12-07 12:00:06 +09:00
Rui Ueyama b773554275 Ignore const, volatile, auto, register, restrict or _Noreturn. 2020-12-07 12:00:06 +09:00
Rui Ueyama 7ba6fe8d94 Handle unsigned types in the constant expression 2020-12-07 12:00:06 +09:00
Rui Ueyama 6880a39d2a When comparing two pointers, treat them as unsigned 2020-12-07 12:00:06 +09:00
Rui Ueyama 8b8f3de48b Use long or ulong instead of int for some expressions 2020-12-07 12:00:06 +09:00
Rui Ueyama aaf10459d9 Add U, L and LL suffixes 2020-12-07 12:00:06 +09:00
Rui Ueyama 34ab83bdf4 Add unsigned integral types 2020-12-07 12:00:06 +09:00
Rui Ueyama 3f59ce7955 Add `signed` keyword 2020-12-07 12:00:06 +09:00