aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2017-09-24 18:57:48 +0200
committergrischka <grischka>2017-09-24 18:57:48 +0200
commit1443039416dd02750765efde1af35e31c8d41be3 (patch)
tree4e1eed95126f8948b1af1425c418ff9343d33d5f /libtcc.c
parent870271ea071971002fa556e09e1873db316fa1a9 (diff)
downloadtinycc-1443039416dd02750765efde1af35e31c8d41be3.tar.gz
tinycc-1443039416dd02750765efde1af35e31c8d41be3.tar.bz2
'long' review
add some features for more complete 'long' support tcc.h: - use LONG_SIZE=4/8 instead of TCC_LONG_ARE_64_BIT tccgen.c: - add ptrdiff_type, update size_type - support shift and ?: operations - support long enum types - display 'long' from type_to_str - nwchar_t is unsigned short on windows - unrelated: use memcpy in init_putv for long doubles to avoid random bytes in the image (if tcc was compiled by gcc) for diff purposes. tccpp.c: - make parse_number return correct types - improve multi-character-constants 'XX' 'abcd' Changelog: - update
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libtcc.c b/libtcc.c
index 6a5e452..41c814d 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -836,21 +836,21 @@ LIBTCCAPI TCCState *tcc_new(void)
# endif
/* TinyCC & gcc defines */
-#if defined(TCC_TARGET_PE) && PTR_SIZE == 8
+#if PTR_SIZE == 4
+ /* 32bit systems. */
+ tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned int");
+ tcc_define_symbol(s, "__PTRDIFF_TYPE__", "int");
+ tcc_define_symbol(s, "__ILP32__", NULL);
+#elif LONG_SIZE == 4
/* 64bit Windows. */
tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long long");
tcc_define_symbol(s, "__PTRDIFF_TYPE__", "long long");
tcc_define_symbol(s, "__LLP64__", NULL);
-#elif PTR_SIZE == 8
+#else
/* Other 64bit systems. */
tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long");
tcc_define_symbol(s, "__PTRDIFF_TYPE__", "long");
tcc_define_symbol(s, "__LP64__", NULL);
-#else
- /* Other 32bit systems. */
- tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned int");
- tcc_define_symbol(s, "__PTRDIFF_TYPE__", "int");
- tcc_define_symbol(s, "__ILP32__", NULL);
#endif
#if defined(TCC_MUSL)