207 Commits

Author SHA1 Message Date
Rui Ueyama
2fa8f489f3 Support sizeof(typename) where typename is a VLA 2020-12-07 12:00:06 +09:00
Rui Ueyama
07f901057f Add pointer arithmetic for VLA 2020-12-07 12:00:06 +09:00
Rui Ueyama
e8667afd08 Add sizeof() for VLA 2020-12-07 12:00:06 +09:00
Rui Ueyama
77275c546a Add alloca() 2020-12-07 12:00:06 +09:00
Rui Ueyama
4064871212 Make -E to imply -xc 2020-12-07 12:00:06 +09:00
Rui Ueyama
ee0a951b30 Add -x option 2020-12-07 12:00:06 +09:00
Rui Ueyama
8f5ff07dc0 Add -include option 2020-12-07 12:00:06 +09:00
Rui Ueyama
b3772845bd Add thread-local variable 2020-12-07 12:00:06 +09:00
Rui Ueyama
6d344ed945 Add -fcommon and -fno-common flags 2020-12-07 12:00:06 +09:00
Rui Ueyama
85e46b1071 Add tentative definition 2020-12-07 12:00:06 +09:00
Rui Ueyama
1b99badce4 Add offsetof 2020-12-07 12:00:06 +09:00
Rui Ueyama
11fc259b01 Add -idirafter option 2020-12-07 12:00:06 +09:00
Rui Ueyama
e5f4ca90fd Do not emit static inline functions if referenced by no one 2020-12-07 12:00:06 +09:00
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
e28a612e9c [GNU] Add ?: operator with omitted operand 2020-12-07 12:00:06 +09:00
Rui Ueyama
aee7891acb [GNU] Allow sizeof(<function type>) 2020-12-07 12:00:06 +09:00
Rui Ueyama
1faab48ecf Add _Generic 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
7d80a5136d Add typeof 2020-12-07 12:00:06 +09:00
Rui Ueyama
007e526ec5 [GNU] Support GCC-style variadic macro 2020-12-07 12:00:06 +09:00
Rui Ueyama
083c27559e [GNU] Handle ,##__VA_ARG__ 2020-12-07 12:00:06 +09:00
Rui Ueyama
338144869f Add __VA_OPT__ 2020-12-07 12:00:06 +09:00
Rui Ueyama
3a10c8aa44 [GNU] Add __BASE_FILE__ macro 2020-12-07 12:00:06 +09:00
Rui Ueyama
922604ae1e [GNU] Add __TIMESTAMP__ macro 2020-12-07 12:00:06 +09:00
Rui Ueyama
aaf20fb96e [GNU] Add line marker directive 2020-12-07 12:00:06 +09:00
Rui Ueyama
c61c0d0025 Add #line 2020-12-07 12:00:06 +09:00
Rui Ueyama
95eb5b01b3 Handle struct designator for anonymous struct member 2020-12-07 12:00:06 +09:00
Rui Ueyama
31dc1dfa21 Add union designated initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama
67f5834378 Add struct designated initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama
691c4fac15 [GNU] Allow to omit "=" in designated initializers 2020-12-07 12:00:06 +09:00
Rui Ueyama
835cd24b2c Allow array designators to initialize incomplete arrays 2020-12-07 12:00:06 +09:00
Rui Ueyama
c618c3b582 Add array designated initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama
2b2fa25507 Skip UTF-8 BOM markers 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
adb8b98889 [GNU] Accept $ as an identifier character 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
6adba75af8 Add UTF-32 string literal initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama
36230e0827 Add UTF-16 string literal initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama
cae061af2b Add wide string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama
c467ee665d Add UTF-32 string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama
9cabe1f204 Add UTF-16 string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama
57b21fe902 Add UTF-8 string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama
2dac3afece Add UTF-32 character literal 2020-12-07 12:00:06 +09:00
Rui Ueyama
454618cd15 Add UTF-16 character literal 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
0e77f3dff8 [GNU] Add __COUNTER__ macro 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
c3075b3030 Add anonymous struct and union 2020-12-07 12:00:06 +09:00