Commit Graph

18 Commits

Author SHA1 Message Date
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 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 dcd4579226 Handle a function returning bool, char or short
x86-64 psABI says that only the least significant 8 bits are
significant if RAX has a return value of a function returning bool.
Likewise, it looks like only the least significant 1 or 2 bytes
are guaranteed to have a correct value for char and short return
values, respectively.
2020-12-07 12:00:06 +09:00
Rui Ueyama 30b3e216cd Add return that doesn't take any value 2020-12-07 12:00:06 +09:00
Rui Ueyama 319772b42e Add static local variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 7a1f816783 Accept `void` as a parameter list
`foo(void)` indicate that function foo does not take a parameter.
2020-12-07 12:00:06 +09:00
Rui Ueyama 79632219d0 Decay an array to a pointer in the func param context 2020-12-07 12:00:06 +09:00
Rui Ueyama 736232f3d6 Support file-scope functions 2020-12-07 12:00:05 +09:00
Rui Ueyama 44bba965cb Add _Bool type
_Bool isn't just a 1-bit integer because when you convert a value
to bool, the result is 1 if the original value is non-zero. This
is contrary to the other small integral types, e.g. char, as you
can see below:

  char x  = 256; // x is 0
  _Bool y = 256; // y is 1
2020-12-07 12:00:05 +09:00
Rui Ueyama fdc80bc6b5 Handle function argument type conversion 2020-12-07 12:00:05 +09:00
Rui Ueyama 818352acc0 Handle return type conversion 2020-12-07 12:00:05 +09:00
Rui Ueyama 9d48eef58b Add short type 2020-10-15 14:22:16 +09:00
Rui Ueyama 43c2f0829f Add long type 2020-10-15 14:22:16 +09:00
Rui Ueyama cd832a311e Rewrite tests in shell script in C 2020-10-15 14:22:15 +09:00