tyfkda / xcc

Standalone C compiler/assembler/linker/libc for x86-64/aarch64/riscv64/wasm
https://tyfkda.github.io/xcc/
MIT License
197 stars 14 forks source link

refactor: long types and wchar_t cross-platform compatibility #158

Closed ijsf closed 3 months ago

ijsf commented 3 months ago

Requirement for #156.

This seems to be one of the more invasive changes necessary.

  1. unsigned long, long, uintptr_t and intptr_t do not have sizes that are explicitly defined in the C spec, while some of the arithmetic done on it assumes 64-bit sizes. The pointer types have been replaced with typedefs, and all of these types ultimately resolve to long long or stdint types now.
  2. The use of wchar_t is now explicitly a 32-bit integer inside the compiler.
ijsf commented 3 months ago

I've cleaned up this PR. All tests are passing now.

uintptr_t and intptr_t are not touched, even though they are host dependent. Though in some places their use could theoretically be problematic (e.g. ELF header, ld objects), but it is of no concern right now.

tyfkda commented 3 months ago

After careful consideration, I would like to reject this pull request because it is difficult for me to support the MinGW64 platform. I apologize for not being able to meet your request.