1  /* { dg-do compile } */
       2  /* { dg-options "-Wno-attributes -fdiagnostics-show-caret" } */
       3  
       4  extern void __emit_warning (const char *message);
       5  
       6  __attribute__((always_inline))
       7  static void depth_0 (void)
       8  {
       9    __emit_warning ("message");
      10  }
      11  
      12  __attribute__((always_inline))
      13  static void depth_1 (void)
      14  {
      15    depth_0 ();
      16  }
      17  
      18  __attribute__((always_inline))
      19  static void depth_2 (void)
      20  {
      21    depth_1 ();
      22  }
      23  
      24  __attribute__((always_inline))
      25  static void depth_3 (void)
      26  {
      27    depth_2 ();
      28  }
      29  
      30  __attribute__((always_inline))
      31  static void depth_4 (void)
      32  {
      33    depth_3 ();
      34  }
      35  
      36  int main()
      37  {
      38    depth_4 ();
      39    return 0;
      40  }
      41  
      42  /* Verify that the diagnostic subsytem describes the chain of inlining
      43     when reporting the warning, for an example showing many levels of
      44     inlining.  */
      45  
      46  /* { dg-regexp "In function 'depth_0'," "" } */
      47  /* { dg-regexp "    inlined from 'depth_1' at .+/diagnostic-test-inlining-4.c:15:3," "" } */
      48  /* { dg-regexp "    inlined from 'depth_2' at .+/diagnostic-test-inlining-4.c:21:3," "" } */
      49  /* { dg-regexp "    inlined from 'depth_3' at .+/diagnostic-test-inlining-4.c:27:3," "" } */
      50  /* { dg-regexp "    inlined from 'depth_4' at .+/diagnostic-test-inlining-4.c:33:3," "" } */
      51  /* { dg-regexp "    inlined from 'main' at .+/diagnostic-test-inlining-4.c:38:3:" "" } */
      52  /* { dg-warning "3: message" "" { target *-*-* } 9 } */
      53  /* { dg-begin-multiline-output "" }
      54     __emit_warning ("message");
      55     ^~~~~~~~~~~~~~~~~~~~~~~~~~
      56     { dg-end-multiline-output "" } */