Dear tcc-devel,

While building the latest TinyCC (mob branch, commit around 2026-02-23) on 
FreeBSD/arm64 (aarch64), I encountered the following error during `make` in the 
`lib/` directory:

In file included from bcheck.c:25:
In file included from ../include/stdatomic.h:15:
../include/stddef.h:6: error: incompatible redefinition of 'wchar_t'

The error occurs because tcc’s internal `include/stddef.h` redefines `wchar_t` 
via `__WCHAR_TYPE__`, which conflicts with the system headers on this platform.

Currently, the following block exists in `tccdefs.h`:

#if defined _WIN32
    #define __WCHAR_TYPE__ unsigned short
    #define __WINT_TYPE__  unsigned short
#elif defined __linux__
    #define __WCHAR_TYPE__ int
    #define __WINT_TYPE__  unsigned int
#else
    #define __WCHAR_TYPE__ int
    #define __WINT_TYPE__  int
#endif

On FreeBSD/aarch64 the system definition is `unsigned int` (from 
`/usr/include/arm/_types.h`: `typedef unsigned int ___wchar_t;`).

After adding the following case, the redefinition error disappears and 
`libtcc1.a` (including `bcheck.o` with `-bt`) builds successfully:

#elif defined __FreeBSD__ || defined __FreeBSD_kernel__
    #define __WCHAR_TYPE__ unsigned int
    #define __WINT_TYPE__  unsigned int

There is still one remaining warning when compiling `bcheck.c`:

bcheck.c:907: warning: assignment from incompatible pointer type

The compiler itself builds and tests pass, so the warning does not appear to be 
critical. Could you please advise on the best way to handle this warning?

Thanks in advance,  
Daniil
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to