Simple testcase for __LINE__, __FILE__ as well as #line.

This commit is contained in:
acqn
2022-08-24 16:39:44 +08:00
parent bb9c98f4c9
commit 1dbc5cb325
2 changed files with 95 additions and 0 deletions

14
test/val/bug1573.h Normal file
View File

@@ -0,0 +1,14 @@
/* Tests for predefined macros __LINE__ and __FILE__ as well as #line control */
#line __LINE__ INC_FILENAME_1
#define GET_LINE() __LINE__
char filename1[] = GET_FILE();
long line1 = GET_LINE();
#line 42
const char ans1[] = MKSTR(GET_LINE());
#line 40 INC_FILENAME_2
char filename2[] = GET_FILE();
const char ans2[] = \
MKSTR(GET_LINE());