gcc/testsuite/gcc.dg/Wparentheses-1.c
raw| 1 | /* Copyright (C) 2001 Free Software Foundation, Inc. */ |
| 2 | |
| 3 | /* { dg-do compile } */ |
| 4 | /* { dg-options -Wparentheses } */ |
| 5 | |
| 6 | /* Source: Neil Booth, 1 Nov 2001. PR 3170, 3422 - bogus warnings |
| 7 | about suggesting parentheses. */ |
| 8 | |
| 9 | int foo (int a, int b) |
| 10 | { |
| 11 | int c = (a && b) || 0; /* { dg-bogus "suggest parentheses" } */ |
| 12 | c = a && b || 0; /* { dg-warning "suggest parentheses" } */ |
| 13 | |
| 14 | return (a && b && 1) || 0; /* { dg-bogus "suggest parentheses" } */ |
| 15 | } |