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 @@
1/*1/*
2 * TCC auto test program2 * TCC auto test program
3 */3 */
4#include "config.h"
5
6#if GCC_MAJOR >= 3
4 7
5/* Unfortunately, gcc version < 3 does not handle that! */8/* Unfortunately, gcc version < 3 does not handle that! */
6//#define ALL_ISOC999#define ALL_ISOC99
7 10
8/* only gcc 3 handles _Bool correctly */11/* only gcc 3 handles _Bool correctly */
9//#define BOOL_ISOC9912#define BOOL_ISOC99
10
11#define C99_MACROS
12 13
13/* gcc 2.95.3 does not handle correctly CR in strings or after strays */14/* gcc 2.95.3 does not handle correctly CR in strings or after strays */
14//#define CORRECT_CR_HANDLING15#define CORRECT_CR_HANDLING
16
17#endif
18
19/* __VA_ARGS__ and __func__ support */
20#define C99_MACROS
15 21
16/* test various include syntaxes */22/* test various include syntaxes */
17 23
@@ -228,8 +234,21 @@ void macro_test(void) · 210 unmodified lines
228 printf("a=%d\n", a);234 printf("a=%d\n", a);
229 }235 }
230 236
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
231 /* comment with stray handling *\246 /* comment with stray handling *\
232/247/
248 /* this is a valid *\/ comment */
249 /* this is a valid comment *\*/
250 // this is a valid\
251comment
233}252}
234 253
235int op(a,b)254int op(a,b)
@@ -258,6 +277,11 @@ void ps(char *s) · 22 unmodified lines
258 }277 }
259}278}
260 279
280const char foo1_string[] = "\
281bar\n\
282test\14\
2831";
284
261void string_test()285void string_test()
262{286{
263 int b;287 int b;
@@ -266,6 +290,7 @@ void string_test() · 2 unmodified lines
266 printf("\x41\x42\x43\x3a\n");290 printf("\x41\x42\x43\x3a\n");
267 printf("c=%c\n", 'r');291 printf("c=%c\n", 'r');
268 printf("wc=%C 0x%lx %C\n", L'a', L'\x1234', L'c');292 printf("wc=%C 0x%lx %C\n", L'a', L'\x1234', L'c');
293 printf("foo1_string='%s'\n", foo1_string);
269#if 0294#if 0
270 printf("wstring=%S\n", L"abc");295 printf("wstring=%S\n", L"abc");
271 printf("wstring=%S\n", L"abc" L"def" "ghi");296 printf("wstring=%S\n", L"abc" L"def" "ghi");
@@ -1647,9 +1672,22 @@ void old_style_f(a,b,c) · 1375 unmodified lines
1647 printf("a=%d b=%d b=%f\n", a, b, c);1672 printf("a=%d b=%d b=%f\n", a, b, c);
1648}1673}
1649 1674
1675void decl_func1(int cmpfn())
1676{
1677 printf("cmpfn=%lx\n", (long)cmpfn);
1678}
1679
1680void decl_func2(cmpfn)
1681int cmpfn();
1682{
1683 printf("cmpfn=%lx\n", (long)cmpfn);
1684}
1685
1650void old_style_function(void)1686void old_style_function(void)
1651{1687{
1652 old_style_f((void *)1, 2, 3.0);1688 old_style_f((void *)1, 2, 3.0);
1689 decl_func1(NULL);
1690 decl_func2(NULL);
1653}1691}
1654 1692
1655void sizeof_test(void)1693void 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