File: diagnostic-test-inlining-2.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (48 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* { dg-do compile } */
/* { dg-options "-Wno-attributes -fdiagnostics-show-caret" } */

extern void __emit_warning (const char *message);

#define INNER_WARNING(MSG) __emit_warning (MSG)

#define OUTER_WARNING(MSG) INNER_WARNING (MSG)

__attribute__((always_inline))
static void foo (void)
{
  OUTER_WARNING ("message");
}

__attribute__((always_inline))
static void bar (void)
{
  foo ();
}

int main()
{
  bar ();
  return 0;
}

/* Verify that the diagnostic subsytem describes both the chains of
   inlining and of macro expansion when reporting the warning.  */

/* { dg-regexp "In function 'foo'," "" } */
/* { dg-regexp "    inlined from 'bar' at .+/diagnostic-test-inlining-2.c:19:3," "" } */
/* { dg-regexp "    inlined from 'main' at .+/diagnostic-test-inlining-2.c:24:3:" "" } */
/* { dg-warning "28: message" "" { target c } 6 } */
/* { dg-begin-multiline-output "" }
 #define INNER_WARNING(MSG) __emit_warning (MSG)
                            ^~~~~~~~~~~~~~~~~~~~
   { dg-end-multiline-output "" } */
/* { dg-message "28: in expansion of macro 'INNER_WARNING'" "" { target c } 8 } */
/* { dg-begin-multiline-output "" }
 #define OUTER_WARNING(MSG) INNER_WARNING (MSG)
                            ^~~~~~~~~~~~~
   { dg-end-multiline-output "" } */
/* { dg-message "3: in expansion of macro 'OUTER_WARNING'" "" { target c } 13 } */
/* { dg-begin-multiline-output "" }
   OUTER_WARNING ("message");
   ^~~~~~~~~~~~~
   { dg-end-multiline-output "" } */