FreeBSDs system headers contain unconditional usage of macros like __aligned(x), which are only conditionally defined in sys/cdefs.h (conditional on __GNUC__ or __INTEL_COMPILER). Bug in FreeBSD, but as work-around we can define __GNUC__ which picks up these defs. [This also moves back the glibc defines we had before into the non-BSD ifdef branch]
Unified · Split
| @@ -890,24 +890,23 @@ LIBTCCAPI TCCState *tcc_new(void) · 889 unmodified lines | ||
| 890 | 890 | # if defined(__FreeBSD__) || defined (__FreeBSD_kernel__) \ |
| 891 | 891 | || defined(__NetBSD__) || defined(__OpenBSD__) |
| 892 | 892 | tcc_define_symbol(s, "__WINT_TYPE__", "int"); |
| 893 | +# ifdef __FreeBSD__ | |
| 894 | + /* define __GNUC__ to have some useful stuff from sys/cdefs.h | |
| 895 | + that are unconditionally used in FreeBSDs other system headers :/ */ | |
| 896 | + tcc_define_symbol(s, "__GNUC__", "2"); | |
| 897 | + tcc_define_symbol(s, "__GNUC_MINOR__", "1"); | |
| 898 | + tcc_define_symbol(s, "__builtin_alloca", "alloca"); | |
| 899 | + tcc_define_symbol(s, "__builtin_memcpy", "memcpy"); | |
| 900 | + tcc_define_symbol(s, "__USER_LABEL_PREFIX__", ""); | |
| 901 | +# endif | |
| 893 | 902 | # else |
| 894 | 903 | tcc_define_symbol(s, "__WINT_TYPE__", "unsigned int"); |
| 895 | −# endif | |
| 896 | −# if 0 | |
| 897 | 904 | /* glibc defines */ |
| 898 | 905 | tcc_define_symbol(s, "__REDIRECT(name, proto, alias)", |
| 899 | 906 | "name proto __asm__ (#alias)"); |
| 900 | 907 | tcc_define_symbol(s, "__REDIRECT_NTH(name, proto, alias)", |
| 901 | 908 | "name proto __asm__ (#alias) __THROW"); |
| 902 | 909 | # endif |
| 903 | −# if 1 | |
| 904 | − /* define __GNUC__ to have some useful stuff from sys/cdefs.h */ | |
| 905 | − tcc_define_symbol(s, "__GNUC__", "2"); | |
| 906 | − tcc_define_symbol(s, "__GNUC_MINOR__", "1"); | |
| 907 | − tcc_define_symbol(s, "__builtin_alloca", "alloca"); | |
| 908 | − tcc_define_symbol(s, "__builtin_memcpy", "memcpy"); | |
| 909 | − tcc_define_symbol(s, "__USER_LABEL_PREFIX__", ""); | |
| 910 | −# endif | |
| 911 | 910 | #endif /* ndef TCC_TARGET_PE */ |
| 912 | 911 | |
| 913 | 912 | return s; |