Commit Graph

102 Commits

Author SHA1 Message Date
Rui Ueyama 31087f8d4b Handle inline functions as static functions 2020-12-07 12:00:06 +09:00
Rui Ueyama a2535163e2 Add basic "asm" statement 2020-12-07 12:00:06 +09:00
Rui Ueyama 1433b404d6 [GNU] Add __builtin_types_compatible_p 2020-12-07 12:00:06 +09:00
Rui Ueyama c61c0d0025 Add #line 2020-12-07 12:00:06 +09:00
Rui Ueyama 37998be0c1 Improve error message for multibyte characters 2020-12-07 12:00:06 +09:00
Rui Ueyama 238277714d Allow to concatenate regular string literals with L/u/U string literals 2020-12-07 12:00:06 +09:00
Rui Ueyama 0e5d250ebf Allow multibyte UTF-8 character in identifier 2020-12-07 12:00:06 +09:00
Rui Ueyama a57c661d46 Accept multibyte character as wide character literal
On most Unix-like systems, wide character literal is 32-bit long
and encodes a Unicode code point. On Windows, that is 16-bit
long and encodes a UTF-16 code unit. Clearly, there's a portability
issue here. Personally I've never used wide characters in my code
as I didn't find it useful.

Being said that, some header files contain wide character literal,
so we need to support that so that chibicc can include such files.

We assume that source files are always encoded in UTF-8.
2020-12-07 12:00:06 +09:00
Rui Ueyama c31886aa7a Add \u and \U escape sequences 2020-12-07 12:00:06 +09:00
Rui Ueyama e27417fcde Add __DATE__ and __TIME__ macros 2020-12-07 12:00:06 +09:00
Rui Ueyama 2c91da54df Turn on -Wall compiler flag and fix compiler warnings 2020-12-07 12:00:06 +09:00
Rui Ueyama cc852fe99d Add bitfield 2020-12-07 12:00:06 +09:00
Rui Ueyama be8b6f6d31 Add -U option 2020-12-07 12:00:06 +09:00
Rui Ueyama fc69f5c6f9 Add -D option 2020-12-07 12:00:06 +09:00
Rui Ueyama 3f2c2d5bca Tokenize numeric tokens as pp-numbers 2020-12-07 12:00:06 +09:00
Rui Ueyama c72df1c9be Allow to call a fucntion returning a struct 2020-12-07 12:00:06 +09:00
Rui Ueyama b29f052102 Support passed-on-stack arguments 2020-12-07 12:00:06 +09:00
Rui Ueyama 6f17071885 Add __FILE__ and __LINE__ 2020-12-07 12:00:06 +09:00
Rui Ueyama a1dd6213c8 Add -I<dir> option 2020-12-07 12:00:06 +09:00
Rui Ueyama d85fc4ffcf Add #include <...> 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 dec3b3fa02 Add zero-arity funclike #define 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 bf6ff928ad Add #if and #endif 2020-12-07 12:00:06 +09:00
Rui Ueyama ec149f64d2 Skip extra tokens after `#include "..."` 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 1e1ea39dad Add a do-nothing preprocessor 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 140b43358c Run "as" command unless -S is given 2020-12-07 12:00:06 +09:00
Rui Ueyama f3d96136f2 Split cc1 from compiler driver 2020-12-07 12:00:06 +09:00
Rui Ueyama d06a8ac6e6 Add function pointer 2020-12-07 12:00:06 +09:00
Rui Ueyama 83f76ebb66 Add flonum +, -, * and / 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 1fad2595d6 Allow to omit parameter name in function declaration 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 754a24fafc Add va_start to support variadic functions 2020-12-07 12:00:06 +09:00
Rui Ueyama 58fc86137c Allow to call a variadic function 2020-12-07 12:00:06 +09:00
Rui Ueyama ee252e6ce7 Add do ... while 2020-12-07 12:00:06 +09:00
Rui Ueyama 9df51789e7 Add _Alignof and _Alignas 2020-12-07 12:00:06 +09:00
Rui Ueyama cd688a89b8 Allow to initialize struct flexible array member 2020-12-07 12:00:06 +09:00
Rui Ueyama 1eae5ae367 Handle union initializers for global variable 2020-12-07 12:00:06 +09:00
Rui Ueyama e9d2c46ab3 Handle struct initializers for local variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 0d717373cc Add string literal initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama ae0a37dc4b Initialize excess array elements with zero 2020-12-07 12:00:06 +09:00
Rui Ueyama 22dd560ecf Support local variable initializers 2020-12-07 12:00:06 +09:00
Rui Ueyama 447ee098c5 Add ?: operator 2020-12-07 12:00:06 +09:00
Rui Ueyama d0c0cb74b2 Add <<, >>, <<= and >>= 2020-12-07 12:00:06 +09:00
Rui Ueyama 044d9ae07b Add switch-case 2020-12-07 12:00:06 +09:00