History

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.

Michael Matz committed 6 years ago

Commit c0856451 parent 00fbf651 file · +9 −10Browse files

Unified · Split

tests/tcctest.c+9−10
@@ -3,8 +3,6 @@ · 2 unmodified lines
33 */
44 #include "config.h"
55
6−#if GCC_MAJOR >= 3
7−
86 /* Unfortunately, gcc version < 3 does not handle that! */
97 #define ALL_ISOC99
108
@@ -14,7 +12,11 @@ · 3 unmodified lines
1412 /* gcc 2.95.3 does not handle correctly CR in strings or after strays */
1513 #define CORRECT_CR_HANDLING
1614
17−#endif
15+/* __VA_ARGS__ and __func__ support */
16+#define C99_MACROS
17+
18+/* deprecated and no longer supported in gcc 3.3 */
19+//#define ACCEPT_CR_IN_STRINGS
1820
1921 #ifndef __TINYC__
2022 typedef __SIZE_TYPE__ uintptr_t;
@@ -37,12 +39,6 @@ typedef __SIZE_TYPE__ uintptr_t; · 16 unmodified lines
3739 #define LONG_DOUBLE_LITERAL(x) x ## L
3840 #endif
3941
40−/* deprecated and no longer supported in gcc 3.3 */
41−//#define ACCEPT_CR_IN_STRINGS
42−
43−/* __VA_ARGS__ and __func__ support */
44−#define C99_MACROS
45−
4642 /* test various include syntaxes */
4743
4844 #define TCCLIB_INC <tcclib.h>
@@ -2118,7 +2114,7 @@ void c99_bool_test(void) · 2069 unmodified lines
21182114 {
21192115 #ifdef BOOL_ISOC99
21202116 int a;
2121− _Bool b;
2117+ _Bool b, b2;
21222118
21232119 printf("bool_test:\n");
21242120 printf("sizeof(_Bool) = %d\n", sizeof(_Bool));
@@ -2128,6 +2124,9 @@ void c99_bool_test(void) · 3 unmodified lines
21282124 printf("b = %d\n", b);
21292125 b++;
21302126 printf("b = %d\n", b);
2127+ b2 = 0;
2128+ printf("sizeof(x ? _Bool : _Bool) = %d (should be sizeof int)\n",
2129+ sizeof((volatile)a ? b : b2));
21312130 #endif
21322131 }
21332132

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t