diff options
| author | matthias <uso.cosmo.ray@gmail.com> | 2017-07-10 17:44:53 +0200 |
|---|---|---|
| committer | matthias <uso.cosmo.ray@gmail.com> | 2017-07-21 19:30:31 +0200 |
| commit | fdc18d307aafce6e8833b0eb26c1313da88cfc9a (patch) | |
| tree | 9536081aa49531c8a31169e398bc5adeea9a05d2 /tcc.h | |
| parent | 0cc24d0e8487eaf53bb2849fef7e438a8e8fc94d (diff) | |
| download | tinycc-fdc18d307aafce6e8833b0eb26c1313da88cfc9a.tar.gz tinycc-fdc18d307aafce6e8833b0eb26c1313da88cfc9a.tar.bz2 | |
mutiples fix for _Generic
* check that _Generic don't match unsigned char * with char *
this case is usefull as with -funsigned-char, 'char *' are unsigned
* change VT_LONG so it's now a qualifier
VT_LONG are never use for code generation, but only durring parsing state,
in _Generic we need to be able to make diference between
'long' and 'long long'
So VT_LONG is now use as a type qualifier, it's old behaviour is still
here, but we can keep trace of what was a long and what wasn't
* add TOK_CLONG and TOK_CULONG
tcc was directly converting value like '7171L' into TOK_CLLONG or
TOK_CINT depending of the machine architecture.
because of that, we was unable to make diference between a long and a
long long, which doesn't work with _Generic.
So now 7171L is a TOK_CLONG, and we can handle _Generic properly
* check that _Generic can make diference between long and long long
* uncomment "type match twice" as it should now pass tests on any platforms
* add inside_generic global
the point of this variable is to use VT_LONG in comparaison only
when we are evaluating a _Generic.
problem is with my lastest patchs tcc can now make the diference between
a 'long long' and a 'long', but in 64 bit stddef.h typedef uint64_t as
typedef signed long long int int64_t and stdint.h as unsigned long int, so tcc
break when stdint.h and stddef.h are include together.
Another solution woud be to modifie include/stddef.h so it define uint64_t as
unsigned long int when processor is 64 bit, but this could break some
legacy code, so for now, VT_LONG are use only inside generc.
* check that _Generic parse first argument correctly
* check that _Generic evaluate correctly exresion like "f() / 2"
Diffstat (limited to 'tcc.h')
| -rw-r--r-- | tcc.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -849,7 +849,6 @@ struct filespec { #define VT_DOUBLE 9 /* IEEE double */ #define VT_LDOUBLE 10 /* IEEE long double */ #define VT_BOOL 11 /* ISOC99 boolean type */ -#define VT_LONG 12 /* long integer (NEVER USED as type, only during parsing) */ #define VT_QLONG 13 /* 128-bit integer. Only used for x86-64 ABI */ #define VT_QFLOAT 14 /* 128-bit float. Only used for x86-64 ABI */ @@ -860,6 +859,7 @@ 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 /* storage */ #define VT_EXTERN 0x00001000 /* extern definition */ @@ -939,7 +939,16 @@ struct filespec { #define TOK_TWOSHARPS 0xca /* ## preprocessing token */ #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 0xce /* A '##' in the right position to mean pasting */ +#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_SHL 0x01 /* shift left */ #define TOK_SAR 0x02 /* signed shift right */ |
