(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
Wmultistatement-macros-7.c
       1  /* PR c/80116 */
       2  /* { dg-options "-Wmultistatement-macros" } */
       3  /* { dg-do compile } */
       4  
       5  #define SWAP(X, Y)      \
       6    tmp = X; /* { dg-warning "macro expands to multiple statements" } */ \
       7    X = Y;                \
       8    Y = tmp
       9  
      10  #define BODY_AND_IF(COND, X, Y)  \
      11    if (COND) SWAP (X, Y) /* { dg-message "in expansion of macro .SWAP." } */
      12  
      13  void
      14  fn (int x, int y)
      15  {
      16    int tmp;
      17    BODY_AND_IF (1, x, y); /* { dg-message "in expansion of macro .BODY_AND_IF." } */
      18  }