History

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]

Michael Matz committed 10 years ago

Commit 6fbcc141 parent 68a7af61 file · +9 −10Browse files

Unified · Split

libtcc.c+9−10
@@ -890,24 +890,23 @@ LIBTCCAPI TCCState *tcc_new(void) · 889 unmodified lines
890890 # if defined(__FreeBSD__) || defined (__FreeBSD_kernel__) \
891891 || defined(__NetBSD__) || defined(__OpenBSD__)
892892 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
893902 # else
894903 tcc_define_symbol(s, "__WINT_TYPE__", "unsigned int");
895−# endif
896−# if 0
897904 /* glibc defines */
898905 tcc_define_symbol(s, "__REDIRECT(name, proto, alias)",
899906 "name proto __asm__ (#alias)");
900907 tcc_define_symbol(s, "__REDIRECT_NTH(name, proto, alias)",
901908 "name proto __asm__ (#alias) __THROW");
902909 # 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
911910 #endif /* ndef TCC_TARGET_PE */
912911
913912 return s;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t