History

better #line and #include tests

bellard committed 24 years ago

Commit acba7d11 parent 3a58c531 file · +29 −1Browse files

Unified · Split

tcctest.c+29−1
@@ -1,7 +1,6 @@
11 /*
22 * TCC auto test program
33 */
4−#include <tcclib.h>
54
65 /* Unfortunately, gcc version < 3 does not handle that! */
76 //#define ALL_ISOC99
@@ -11,6 +10,25 @@ · 3 unmodified lines
1110
1211 #define C99_MACROS
1312
13+/* test various include syntaxes */
14+
15+#define TCCLIB_INC <tcclib.h>
16+#define TCCLIB_INC1 <tcclib
17+#define TCCLIB_INC2 h>
18+#define TCCLIB_INC3 "tcclib"
19+
20+#include TCCLIB_INC
21+
22+#include TCCLIB_INC1.TCCLIB_INC2
23+
24+#include TCCLIB_INC1.h>
25+
26+#include TCCLIB_INC3 ".h"
27+
28+#include <tcclib.h>
29+
30+#include "tcclib.h"
31+
1432 void string_test();
1533 void expr_test();
1634 void macro_test();
@@ -158,6 +176,14 @@ void macro_test() · 141 unmodified lines
158176
159177 printf("__LINE__=%d __FILE__=%s\n",
160178 __LINE__, __FILE__);
179+#line 200
180+ printf("__LINE__=%d __FILE__=%s\n",
181+ __LINE__, __FILE__);
182+#line 203 "test"
183+ printf("__LINE__=%d __FILE__=%s\n",
184+ __LINE__, __FILE__);
185+#line 185 "tcctest.c"
186+
161187 /* not strictly preprocessor, but we test it there */
162188 #ifdef C99_MACROS
163189 printf("__func__ = %s\n", __func__);
@@ -428,7 +454,9 @@ void array_test(int a[4]) · 264 unmodified lines
428454 printf("sizeof(char) = %d\n", sizeof(char));
429455 printf("sizeof(unsigned char) = %d\n", sizeof(unsigned char));
430456 printf("sizeof(\"a\") = %d\n", sizeof("a"));
457+#ifdef C99_MACROS
431458 printf("sizeof(__func__) = %d\n", sizeof(__func__));
459+#endif
432460 printf("sizeof tab %d\n", sizeof(tab));
433461 printf("sizeof tab2 %d\n", sizeof tab2);
434462 tab[0] = 1;

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