From 1443039416dd02750765efde1af35e31c8d41be3 Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 24 Sep 2017 18:57:48 +0200 Subject: '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 --- libtcc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libtcc.c') 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) -- cgit v1.3.1