1 // RUN: %clang_cc1 -std=c90 -fconst-strings -DCONST_STRINGS -verify %s
2 // RUN: %clang_cc1 -std=c90 -verify %s
3 // RUN: %clang_cc1 -std=c90 -fms-extensions -DMS -fconst-strings -DCONST_STRINGS -verify %s
4 // RUN: %clang_cc1 -std=c90 -fms-extensions -DMS -verify %s
6 // expected-no-diagnostics
8 #define IsEqual(L, R) (__builtin_strcmp(L, R) == 0)
10 const char *const FILE = __builtin_FILE();
11 const char *const FUNC
= __builtin_FUNCTION();
12 const unsigned LINE
= __builtin_LINE();
13 const unsigned COL
= __builtin_COLUMN();
16 char *const NCFILE
= __builtin_FILE();
17 char *const NCFUNC
= __builtin_FUNCTION();
19 char *const NCFNSG
= __builtin_FUNCSIG();
24 _Static_assert(IsEqual(__builtin_FILE(), __FILE__
), "");
25 _Static_assert(IsEqual(__builtin_FILE_NAME(), __FILE_NAME__
), "");
26 _Static_assert(__builtin_LINE() == __LINE__
, "");
27 _Static_assert(IsEqual("", __builtin_FUNCTION()), "");
29 _Static_assert(IsEqual("", __builtin_FUNCSIG()), "");
33 _Static_assert(__builtin_LINE() == 42, "");
34 _Static_assert(IsEqual(__builtin_FILE(), "my_file.c"), "");
35 _Static_assert(IsEqual(__builtin_FILE_NAME(), "my_file.c"), "");
37 _Static_assert(__builtin_COLUMN() == __builtin_strlen("_Static_assert(_"), "");
40 _Static_assert(IsEqual(__builtin_FUNCTION(), "foo"), "");
42 _Static_assert(IsEqual(__builtin_FUNCSIG(), "void __cdecl foo(void)"), "");
45 #endif // CONST_STRINGS