[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / source_location.c
blob94c09c7952dc6b30726c0c0adaab9d0ae1b787a6
1 // RUN: %clang_cc1 -std=c90 -fconst-strings -DCONST_STRINGS -verify %s
2 // RUN: %clang_cc1 -std=c90 -verify %s
4 // expected-no-diagnostics
6 #define IsEqual(L, R) (__builtin_strcmp(L, R) == 0)
8 const char *const FILE = __builtin_FILE();
9 const char *const FUNC = __builtin_FUNCTION();
10 const unsigned LINE = __builtin_LINE();
11 const unsigned COL = __builtin_COLUMN();
13 #ifndef CONST_STRINGS
14 char *const NCFILE = __builtin_FILE();
15 char *const NCFUNC = __builtin_FUNCTION();
16 #endif
18 #ifdef CONST_STRINGS
19 _Static_assert(IsEqual(__builtin_FILE(), __FILE__), "");
20 _Static_assert(__builtin_LINE() == __LINE__, "");
21 _Static_assert(IsEqual("", __builtin_FUNCTION()), "");
23 #line 42 "my_file.c"
24 _Static_assert(__builtin_LINE() == 42, "");
25 _Static_assert(IsEqual(__builtin_FILE(), "my_file.c"), "");
27 _Static_assert(__builtin_COLUMN() == __builtin_strlen("_Static_assert(_"), "");
29 void foo(void) {
30 _Static_assert(IsEqual(__builtin_FUNCTION(), "foo"), "");
32 #endif // CONST_STRINGS