(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
attr-fallthrough-2.c
       1  /* PR c/7652 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-Wall -Wextra -Wno-unused -Wno-implicit-fallthrough" } */
       4  
       5  extern void bar (int);
       6  void
       7  fn (int i)
       8  {
       9    switch (i)
      10    {
      11    case 1:
      12      bar (1);
      13      __attribute__((used));
      14      /* { dg-warning "empty declaration" "" { target c } .-1 } */
      15      /* { dg-warning "ignored" "" { target c++ } .-2 } */
      16    case 2:
      17      bar (1);
      18      __attribute__((foo));
      19      /* { dg-warning "empty declaration" "" { target c } .-1 } */
      20      /* { dg-warning "ignored" "" { target c++ } .-2 } */
      21    case 3:
      22      bar (1);
      23      __attribute__((fallthrough)) /* { dg-warning "not followed" "" { target c } } */
      24    case 4: /* { dg-error "expected" } */
      25      bar (1);
      26      __attribute__((fallthrough)) 1;
      27      /* { dg-error "expected" "" { target c } .-1 } */
      28      /* { dg-warning "not followed" "" { target *-*-* } .-2 } */
      29    case 5:
      30      bar (1);
      31      __attribute__((fallthrough)) int i; /* { dg-warning "ignored|not followed" } */
      32    case 6:
      33      bar (1);
      34      __attribute__((fallthrough ("x"))); /* { dg-warning "specified with a parameter" } */
      35    case 7:
      36      bar (1);
      37      __attribute__((fallthrough, fallthrough)); /* { dg-warning "specified multiple times" } */
      38    case 8:
      39      bar (1);
      40      __attribute__((fallthrough));
      41    case 9:
      42      __attribute__((fallthrough));
      43      /* { dg-warning "not preceding" "" { target *-*-* } .-1 } */
      44      bar (1);
      45    case 10:
      46      bar (1);
      47      __attribute__((unused, fallthrough)); /* { dg-warning "attribute ignored" } */
      48    case 11:
      49      bar (1);
      50      __attribute__((fallthrough, unused)); /* { dg-warning "attribute ignored" } */
      51    default:
      52      bar (99);
      53    }
      54  }