| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wno-attributes -fdiagnostics-show-caret" } */ |
| 3 |
|
| 4 |
extern void __emit_warning (const char *message); |
| 5 |
|
| 6 |
#define INNER_WARNING(MSG) __emit_warning (MSG) |
| 7 |
|
| 8 |
#define OUTER_WARNING(MSG) INNER_WARNING (MSG) |
| 9 |
|
| 10 |
__attribute__((always_inline)) |
| 11 |
static void foo (void) |
| 12 |
{ |
| 13 |
OUTER_WARNING ("message"); |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__((always_inline)) |
| 17 |
static void bar (void) |
| 18 |
{ |
| 19 |
foo (); |
| 20 |
} |
| 21 |
|
| 22 |
int main() |
| 23 |
{ |
| 24 |
bar (); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
/* Verify that the diagnostic subsytem describes both the chains of |
| 29 |
inlining and of macro expansion when reporting the warning. */ |
| 30 |
|
| 31 |
/* { dg-regexp "In function 'foo'," "" } */ |
| 32 |
/* { dg-regexp " inlined from 'bar' at .+/diagnostic-test-inlining-2.c:19:3," "" } */ |
| 33 |
/* { dg-regexp " inlined from 'main' at .+/diagnostic-test-inlining-2.c:24:3:" "" } */ |
| 34 |
/* { dg-warning "28: message" "" { target c } 6 } */ |
| 35 |
/* { dg-begin-multiline-output "" } |
| 36 |
#define INNER_WARNING(MSG) __emit_warning (MSG) |
| 37 |
^~~~~~~~~~~~~~~~~~~~ |
| 38 |
{ dg-end-multiline-output "" } */ |
| 39 |
/* { dg-message "28: in expansion of macro 'INNER_WARNING'" "" { target c } 8 } */ |
| 40 |
/* { dg-begin-multiline-output "" } |
| 41 |
#define OUTER_WARNING(MSG) INNER_WARNING (MSG) |
| 42 |
^~~~~~~~~~~~~ |
| 43 |
{ dg-end-multiline-output "" } */ |
| 44 |
/* { dg-message "3: in expansion of macro 'OUTER_WARNING'" "" { target c } 13 } */ |
| 45 |
/* { dg-begin-multiline-output "" } |
| 46 |
OUTER_WARNING ("message"); |
| 47 |
^~~~~~~~~~~~~ |
| 48 |
{ dg-end-multiline-output "" } */ |