system-hacks: define __GNUC__ for FreeBSD
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]
This commit is contained in:
parent
68a7af632c
commit
6fbcc14a5d
1 changed files with 11 additions and 12 deletions
23
libtcc.c
23
libtcc.c
|
|
@ -890,24 +890,23 @@ LIBTCCAPI TCCState *tcc_new(void)
|
||||||
# if defined(__FreeBSD__) || defined (__FreeBSD_kernel__) \
|
# if defined(__FreeBSD__) || defined (__FreeBSD_kernel__) \
|
||||||
|| defined(__NetBSD__) || defined(__OpenBSD__)
|
|| defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
tcc_define_symbol(s, "__WINT_TYPE__", "int");
|
tcc_define_symbol(s, "__WINT_TYPE__", "int");
|
||||||
# else
|
# ifdef __FreeBSD__
|
||||||
tcc_define_symbol(s, "__WINT_TYPE__", "unsigned int");
|
/* define __GNUC__ to have some useful stuff from sys/cdefs.h
|
||||||
# endif
|
that are unconditionally used in FreeBSDs other system headers :/ */
|
||||||
# if 0
|
|
||||||
/* glibc defines */
|
|
||||||
tcc_define_symbol(s, "__REDIRECT(name, proto, alias)",
|
|
||||||
"name proto __asm__ (#alias)");
|
|
||||||
tcc_define_symbol(s, "__REDIRECT_NTH(name, proto, alias)",
|
|
||||||
"name proto __asm__ (#alias) __THROW");
|
|
||||||
# endif
|
|
||||||
# if 1
|
|
||||||
/* define __GNUC__ to have some useful stuff from sys/cdefs.h */
|
|
||||||
tcc_define_symbol(s, "__GNUC__", "2");
|
tcc_define_symbol(s, "__GNUC__", "2");
|
||||||
tcc_define_symbol(s, "__GNUC_MINOR__", "1");
|
tcc_define_symbol(s, "__GNUC_MINOR__", "1");
|
||||||
tcc_define_symbol(s, "__builtin_alloca", "alloca");
|
tcc_define_symbol(s, "__builtin_alloca", "alloca");
|
||||||
tcc_define_symbol(s, "__builtin_memcpy", "memcpy");
|
tcc_define_symbol(s, "__builtin_memcpy", "memcpy");
|
||||||
tcc_define_symbol(s, "__USER_LABEL_PREFIX__", "");
|
tcc_define_symbol(s, "__USER_LABEL_PREFIX__", "");
|
||||||
# endif
|
# endif
|
||||||
|
# else
|
||||||
|
tcc_define_symbol(s, "__WINT_TYPE__", "unsigned int");
|
||||||
|
/* glibc defines */
|
||||||
|
tcc_define_symbol(s, "__REDIRECT(name, proto, alias)",
|
||||||
|
"name proto __asm__ (#alias)");
|
||||||
|
tcc_define_symbol(s, "__REDIRECT_NTH(name, proto, alias)",
|
||||||
|
"name proto __asm__ (#alias) __THROW");
|
||||||
|
# endif
|
||||||
#endif /* ndef TCC_TARGET_PE */
|
#endif /* ndef TCC_TARGET_PE */
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue