aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2014-04-07 00:26:36 +0200
committerMichael Matz <matz@suse.de>2014-04-07 00:27:46 +0200
commit0961a38493c545cd23a791cf66b45d8fc78accbd (patch)
treeab3a34678bcf4d1dcd933a3637ac3abbc03c8fc5 /libtcc.c
parent0e43f3aef401f87030a540646f061b025a5a130b (diff)
downloadtinycc-0961a38493c545cd23a791cf66b45d8fc78accbd.tar.gz
tinycc-0961a38493c545cd23a791cf66b45d8fc78accbd.tar.bz2
Declare wint_t in <stddef.h> when needed
Some old glibcs <wctype.h> require <stddef.h> to provide wint_t, accomodate them.
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libtcc.c b/libtcc.c
index 601999e..cc84cd7 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -988,8 +988,17 @@ LIBTCCAPI TCCState *tcc_new(void)
#ifdef TCC_TARGET_PE
tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short");
+ tcc_define_symbol(s, "__WINT_TYPE__", "unsigned short");
#else
tcc_define_symbol(s, "__WCHAR_TYPE__", "int");
+ /* wint_t is unsigned int by default, but (signed) int on BSDs
+ and unsigned short on windows. Other OSes might have still
+ other conventions, sigh. */
+#if defined(__FreeBSD__) || defined (__FreeBSD_kernel__)
+ tcc_define_symbol(s, "__WINT_TYPE__", "int");
+#else
+ tcc_define_symbol(s, "__WINT_TYPE__", "unsigned int");
+#endif
#endif
#ifndef TCC_TARGET_PE