diff options
| author | Michael Matz <matz@suse.de> | 2016-07-13 15:37:36 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:08 +0100 |
| commit | b7e0b693a65793a5aeee51cf9fa58638376c6f06 (patch) | |
| tree | dcef22c357f914889f930807c88ccd6574893bfe /tests | |
| parent | 8a1a2a60336264a5f96fae4c7f02424c6928b7c3 (diff) | |
| download | tinycc-b7e0b693a65793a5aeee51cf9fa58638376c6f06.tar.gz tinycc-b7e0b693a65793a5aeee51cf9fa58638376c6f06.tar.bz2 | |
tccpp: Implement __BASE_FILE__ macro
Like __FILE__ but always refers to the command line file name also
from inside headers.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tcctest.c | 7 | ||||
| -rw-r--r-- | tests/tcctest.h | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c index 10033a4..025d12d 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -59,6 +59,8 @@ #include "tcclib.h" +#include "tcctest.h" + void intdiv_test(); void string_test(); void expr_test(); @@ -389,6 +391,11 @@ comment /* And again when the name and parenthes are separated by a comment. */ TEST2 /* the comment */ (); + + printf("%s\n", get_basefile_from_header()); + printf("%s\n", __BASE_FILE__); + printf("%s\n", get_file_from_header()); + printf("%s\n", __FILE__); } diff --git a/tests/tcctest.h b/tests/tcctest.h new file mode 100644 index 0000000..b301c7c --- /dev/null +++ b/tests/tcctest.h @@ -0,0 +1,9 @@ +static inline const char *get_basefile_from_header(void) +{ + return __BASE_FILE__; +} + +static inline const char *get_file_from_header(void) +{ + return __FILE__; +} |
