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 --- tcc.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'tcc.h') diff --git a/tcc.h b/tcc.h index bfe6ab4..06965eb 100644 --- a/tcc.h +++ b/tcc.h @@ -361,6 +361,12 @@ extern long double strtold (const char *__nptr, char **__endptr); /* target address type */ #define addr_t ElfW(Addr) +#if PTR_SIZE == 8 && !defined TCC_TARGET_PE +# define LONG_SIZE 8 +#else +# define LONG_SIZE 4 +#endif + /* -------------------------------------------- */ #define INCLUDE_STACK_SIZE 32 @@ -880,14 +886,14 @@ struct filespec { #define VT_CONSTANT 0x0100 /* const modifier */ #define VT_VOLATILE 0x0200 /* volatile modifier */ #define VT_VLA 0x0400 /* VLA type (also has VT_PTR and VT_ARRAY) */ -#define VT_LONG 0x0800 +#define VT_LONG 0x0800 /* long type (also has VT_INT rsp. VT_LLONG) */ /* storage */ #define VT_EXTERN 0x00001000 /* extern definition */ #define VT_STATIC 0x00002000 /* static variable */ #define VT_TYPEDEF 0x00004000 /* typedef definition */ #define VT_INLINE 0x00008000 /* inline definition */ -/* currently unused: 0x0800, 0x000[1248]0000 */ +/* currently unused: 0x000[1248]0000 */ #define VT_STRUCT_SHIFT 20 /* shift for bitfield shift values (32 - 2*6) */ #define VT_STRUCT_MASK (((1 << (6+6)) - 1) << VT_STRUCT_SHIFT | VT_BITFIELD) @@ -906,7 +912,6 @@ struct filespec { #define VT_STORAGE (VT_EXTERN | VT_STATIC | VT_TYPEDEF | VT_INLINE) #define VT_TYPE (~(VT_STORAGE|VT_STRUCT_MASK)) - /* token values */ /* warning: the following compare tokens depend on i386 asm code */ @@ -947,6 +952,7 @@ struct filespec { #define TOK_PPNUM 0xbe /* preprocessor number */ #define TOK_PPSTR 0xbf /* preprocessor string */ #define TOK_LINENUM 0xc0 /* line number info */ +#define TOK_TWODOTS 0xa8 /* C++ token ? */ /* <-- */ #define TOK_UMULL 0xc2 /* unsigned 32x32 -> 64 mul */ @@ -961,15 +967,8 @@ struct filespec { #define TOK_PLCHLDR 0xcb /* placeholder token as defined in C99 */ #define TOK_NOSUBST 0xcc /* means following token has already been pp'd */ #define TOK_PPJOIN 0xcd /* A '##' in the right position to mean pasting */ - -#define TOK_CLONG 0xce /* long constant */ -#define TOK_CULONG 0xcf /* unsigned long constant */ - - -#if defined TCC_TARGET_X86_64 && !defined TCC_TARGET_PE - #define TCC_LONG_ARE_64_BIT -#endif - +#define TOK_CLONG 0xce /* long constant */ +#define TOK_CULONG 0xcf /* unsigned long constant */ #define TOK_SHL 0x01 /* shift left */ #define TOK_SAR 0x02 /* signed shift right */ -- cgit v1.3.1