(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Wparentheses-10.c
       1  /* Test operation of -Wparentheses.  Warnings for assignments used as
       2     truth-values shouldn't apply other than for plain assignment.  */
       3  /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
       4  
       5  /* { dg-do compile } */
       6  /* { dg-options "-Wparentheses -std=gnu99" } */
       7  
       8  int foo (int);
       9  
      10  int a, b, c;
      11  _Bool d;
      12  
      13  void
      14  bar (void)
      15  {
      16    if (a += b)
      17      foo (0);
      18    if (a -= a)
      19      foo (1);
      20    if (b *= c)
      21      foo (2);
      22    else
      23      foo (3);
      24    if (b /= b)
      25      foo (4);
      26    else
      27      foo (5);
      28    while (c %= b)
      29      foo (6);
      30    while (c <<= c)
      31      foo (7);
      32    do foo (8); while (a >>= b);
      33    do foo (9); while (a &= a);
      34    for (;c ^= b;)
      35      foo (10);
      36    for (;c |= c;)
      37      foo (11);
      38    d = a += b;
      39    foo (12);
      40    d = a -= a;
      41    foo (13);
      42  }