History

#define __GNUC__ = 2.1

__GNUC__ nowadays as macro seems to mean the "GNU C dialect" rather than the compiler itself. See also http://gcc.gnu.org/ml/gcc/2008-07/msg00026.html This patch will probably cause problems of various kinds but maybe we should try nonetheless.

grischka committed 10 years ago

Commit f3c1ea61 parent 4d247c03 files · +27 −6Browse files

Unified · Split

3 files
  1. libtcc.c +19 −6
  2. tccgen.c +4 −0
  3. tcctok.h +4 −0
libtcc.c+19−6
@@ -885,15 +885,28 @@ LIBTCCAPI TCCState *tcc_new(void) · 884 unmodified lines
885885 /* wint_t is unsigned int by default, but (signed) int on BSDs
886886 and unsigned short on windows. Other OSes might have still
887887 other conventions, sigh. */
888−#if defined(__FreeBSD__) || defined (__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
888+# if defined(__FreeBSD__) || defined (__FreeBSD_kernel__)
889+ || defined(__NetBSD__) || defined(__OpenBSD__)
889890 tcc_define_symbol(s, "__WINT_TYPE__", "int");
890−#else
891+# else
891892 tcc_define_symbol(s, "__WINT_TYPE__", "unsigned int");
892−#endif
893+# endif
894+# if 0
893895 /* glibc defines */
894− tcc_define_symbol(s, "__REDIRECT(name, proto, alias)", "name proto __asm__ (#alias)");
895− tcc_define_symbol(s, "__REDIRECT_NTH(name, proto, alias)", "name proto __asm__ (#alias) __THROW");
896−#endif
896+ tcc_define_symbol(s, "__REDIRECT(name, proto, alias)",
897+ "name proto __asm__ (#alias)");
898+ tcc_define_symbol(s, "__REDIRECT_NTH(name, proto, alias)",
899+ "name proto __asm__ (#alias) __THROW");
900+# endif
901+# if 1
902+ /* define __GNUC__ to have some useful stuff from sys/cdefs.h */
903+ tcc_define_symbol(s, "__GNUC__", "2");
904+ tcc_define_symbol(s, "__GNUC_MINOR__", "1");
905+ tcc_define_symbol(s, "__builtin_alloca", "alloca");
906+ tcc_define_symbol(s, "__builtin_memcpy", "memcpy");
907+ tcc_define_symbol(s, "__USER_LABEL_PREFIX__", "");
908+# endif
909+#endif /* ndef TCC_TARGET_PE */
897910
898911 return s;
899912 }
tccgen.c+4−0
@@ -3104,10 +3104,14 @@ static void parse_attribute(AttributeDef *ad) · 3103 unmodified lines
31043104 case TOK_MODE_DI:
31053105 ad->a.mode = VT_LLONG + 1;
31063106 break;
3107+ case TOK_MODE_QI:
3108+ ad->a.mode = VT_BYTE + 1;
3109+ break;
31073110 case TOK_MODE_HI:
31083111 ad->a.mode = VT_SHORT + 1;
31093112 break;
31103113 case TOK_MODE_SI:
3114+ case TOK_MODE_word:
31113115 ad->a.mode = VT_INT + 1;
31123116 break;
31133117 default:
tcctok.h+4−0
@@ -117,10 +117,14 @@ · 116 unmodified lines
117117 DEF(TOK_FASTCALL1, "fastcall")
118118 DEF(TOK_FASTCALL2, "__fastcall")
119119 DEF(TOK_FASTCALL3, "__fastcall__")
120+
120121 DEF(TOK_MODE, "__mode__")
122+ DEF(TOK_MODE_QI, "__QI__")
121123 DEF(TOK_MODE_DI, "__DI__")
122124 DEF(TOK_MODE_HI, "__HI__")
123125 DEF(TOK_MODE_SI, "__SI__")
126+ DEF(TOK_MODE_word, "__word__")
127+
124128 DEF(TOK_DLLEXPORT, "dllexport")
125129 DEF(TOK_DLLIMPORT, "dllimport")
126130 DEF(TOK_NORETURN1, "noreturn")

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