Debian Codegraph @

gcc/testsuite/c-c++-common/cpp/pragma-diagnostic-loc.c

raw
1 /* { dg-do preprocess } */
2 /* PR preprocessor/114423 */
3 /* Check that we now issue diagnostics at the location of the _Pragma
4 instead of an invalid location. If we someday manage to issue
5 diagnostics at better locations in the future, this will need
6 updating. */
7 _Pragma("GCC warning \"warning1\"") /* { dg-warning "1:warning1" } */
8 #define P _Pragma("GCC warning \"warning2\"") /* { dg-warning "11:warning2" } */
9 P /* { dg-note "in expansion of macro" } */
10 #define S "GCC warning \"warning3\""
11 /**/ _Pragma(S) /* { dg-warning "6:warning3" } */
12
13 /* This diagnostic uses a different code path (cpp_diagnostic_at() rather
14 than cpp_error_with_line()). Also make sure that the dg-note location
15 does not get overridden to the _Pragma location. */
16 #pragma GCC poison xyz /* { dg-note "poisoned here" } */
17 /* */ _Pragma("xyz") /* { dg-error "7:attempt to use poisoned" } */