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
3 */3 */
4#include "config.h"4#include "config.h"
5 5
6#if GCC_MAJOR >= 3
7
8/* Unfortunately, gcc version < 3 does not handle that! */6/* Unfortunately, gcc version < 3 does not handle that! */
9#define ALL_ISOC997#define ALL_ISOC99
10 8
@@ -14,7 +12,11 @@ · 3 unmodified lines
14/* gcc 2.95.3 does not handle correctly CR in strings or after strays */12/* gcc 2.95.3 does not handle correctly CR in strings or after strays */
15#define CORRECT_CR_HANDLING13#define CORRECT_CR_HANDLING
16 14
17#endif15/* __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
18 20
19#ifndef __TINYC__21#ifndef __TINYC__
20typedef __SIZE_TYPE__ uintptr_t;22typedef __SIZE_TYPE__ uintptr_t;
@@ -37,12 +39,6 @@ typedef __SIZE_TYPE__ uintptr_t; · 16 unmodified lines
37#define LONG_DOUBLE_LITERAL(x) x ## L39#define LONG_DOUBLE_LITERAL(x) x ## L
38#endif40#endif
39 41
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
46/* test various include syntaxes */42/* test various include syntaxes */
47 43
48#define TCCLIB_INC <tcclib.h>44#define TCCLIB_INC <tcclib.h>
@@ -2118,7 +2114,7 @@ void c99_bool_test(void) · 2069 unmodified lines
2118{2114{
2119#ifdef BOOL_ISOC992115#ifdef BOOL_ISOC99
2120 int a;2116 int a;
2121 _Bool b;2117 _Bool b, b2;
2122 2118
2123 printf("bool_test:\n");2119 printf("bool_test:\n");
2124 printf("sizeof(_Bool) = %d\n", sizeof(_Bool));2120 printf("sizeof(_Bool) = %d\n", sizeof(_Bool));
@@ -2128,6 +2124,9 @@ void c99_bool_test(void) · 3 unmodified lines
2128 printf("b = %d\n", b);2124 printf("b = %d\n", b);
2129 b++;2125 b++;
2130 printf("b = %d\n", b);2126 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));
2131#endif2130#endif
2132}2131}
2133 2132

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