From c085645f981bcefb52d0d42712cbbdc350c12453 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 15 Apr 2020 02:06:44 +0200 Subject: [PATCH] Expect c99 support in tcctest.c the support for the macro GCC_MAJOR is gone since 2017, and it's fairly doubtful that anyone serious is using gcc 2.95. Also adds a test for the ternary ops typing rules: 'x?bool:bool' has to promote to int. --- tests/tcctest.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/tcctest.c b/tests/tcctest.c index 40bf3fd..25a5e96 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -3,8 +3,6 @@ */ #include "config.h" -#if GCC_MAJOR >= 3 - /* Unfortunately, gcc version < 3 does not handle that! */ #define ALL_ISOC99 @@ -14,7 +12,11 @@ /* gcc 2.95.3 does not handle correctly CR in strings or after strays */ #define CORRECT_CR_HANDLING -#endif +/* __VA_ARGS__ and __func__ support */ +#define C99_MACROS + +/* deprecated and no longer supported in gcc 3.3 */ +//#define ACCEPT_CR_IN_STRINGS #ifndef __TINYC__ typedef __SIZE_TYPE__ uintptr_t; @@ -37,12 +39,6 @@ typedef __SIZE_TYPE__ uintptr_t; #define LONG_DOUBLE_LITERAL(x) x ## L #endif -/* deprecated and no longer supported in gcc 3.3 */ -//#define ACCEPT_CR_IN_STRINGS - -/* __VA_ARGS__ and __func__ support */ -#define C99_MACROS - /* test various include syntaxes */ #define TCCLIB_INC @@ -2118,7 +2114,7 @@ void c99_bool_test(void) { #ifdef BOOL_ISOC99 int a; - _Bool b; + _Bool b, b2; printf("bool_test:\n"); printf("sizeof(_Bool) = %d\n", sizeof(_Bool)); @@ -2128,6 +2124,9 @@ void c99_bool_test(void) printf("b = %d\n", b); b++; printf("b = %d\n", b); + b2 = 0; + printf("sizeof(x ? _Bool : _Bool) = %d (should be sizeof int)\n", + sizeof((volatile)a ? b : b2)); #endif }