History

gcc 3 tests activated - new tests for 0.9.17

bellard committed 23 years ago

Commit d579dc41 parent cb960221 file · +43 −5Browse files

Unified · Split

tcctest.c+43−5
@@ -1,17 +1,23 @@
11 /*
22 * TCC auto test program
33 */
4+#include "config.h"
5+
6+#if GCC_MAJOR >= 3
47
58 /* Unfortunately, gcc version < 3 does not handle that! */
6−//#define ALL_ISOC99
9+#define ALL_ISOC99
710
811 /* only gcc 3 handles _Bool correctly */
9−//#define BOOL_ISOC99
10−
11−#define C99_MACROS
12+#define BOOL_ISOC99
1213
1314 /* gcc 2.95.3 does not handle correctly CR in strings or after strays */
14−//#define CORRECT_CR_HANDLING
15+#define CORRECT_CR_HANDLING
16+
17+#endif
18+
19+/* __VA_ARGS__ and __func__ support */
20+#define C99_MACROS
1521
1622 /* test various include syntaxes */
1723
@@ -228,8 +234,21 @@ void macro_test(void) · 210 unmodified lines
228234 printf("a=%d\n", a);
229235 }
230236
237+ /* macro function with argument outside the macro string */
238+#define MF_s MF_hello
239+#define MF_hello(msg) printf("%s\n",msg)
240+
241+#define MF_t printf("tralala\n"); MF_hello
242+
243+ MF_s("hi");
244+ MF_t("hi");
245+
231246 /* comment with stray handling *\
232247 /
248+ /* this is a valid *\/ comment */
249+ /* this is a valid comment *\*/
250+ // this is a valid\
251+comment
233252 }
234253
235254 int op(a,b)
@@ -258,6 +277,11 @@ void ps(char *s) · 22 unmodified lines
258277 }
259278 }
260279
280+const char foo1_string[] = "\
281+bar\n\
282+test\14\
283+1";
284+
261285 void string_test()
262286 {
263287 int b;
@@ -266,6 +290,7 @@ void string_test() · 2 unmodified lines
266290 printf("\x41\x42\x43\x3a\n");
267291 printf("c=%c\n", 'r');
268292 printf("wc=%C 0x%lx %C\n", L'a', L'\x1234', L'c');
293+ printf("foo1_string='%s'\n", foo1_string);
269294 #if 0
270295 printf("wstring=%S\n", L"abc");
271296 printf("wstring=%S\n", L"abc" L"def" "ghi");
@@ -1647,9 +1672,22 @@ void old_style_f(a,b,c) · 1375 unmodified lines
16471672 printf("a=%d b=%d b=%f\n", a, b, c);
16481673 }
16491674
1675+void decl_func1(int cmpfn())
1676+{
1677+ printf("cmpfn=%lx\n", (long)cmpfn);
1678+}
1679+
1680+void decl_func2(cmpfn)
1681+int cmpfn();
1682+{
1683+ printf("cmpfn=%lx\n", (long)cmpfn);
1684+}
1685+
16501686 void old_style_function(void)
16511687 {
16521688 old_style_f((void *)1, 2, 3.0);
1689+ decl_func1(NULL);
1690+ decl_func2(NULL);
16531691 }
16541692
16551693 void sizeof_test(void)

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