59 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s -DSILENCE2// RUN: %clang_cc1 -fsyntax-only -verify %s -Wbitwise-op-parentheses3// RUN: %clang_cc1 -fsyntax-only -verify %s -Wparentheses4// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -Wbitwise-op-parentheses 2>&1 | FileCheck %s5 6#ifdef SILENCE7// expected-no-diagnostics8#endif9 10void bitwise_op_parentheses(unsigned i) {11 (void)(i & i | i);12#ifndef SILENCE13 // expected-warning@-2 {{'&' within '|'}}14 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}15#endif16 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("17 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"18 19 (void)(i | i & i);20#ifndef SILENCE21 // expected-warning@-2 {{'&' within '|'}}22 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}23#endif24 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("25 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:19-[[@LINE-6]]:19}:")"26 27 (void)(i ^ i | i);28#ifndef SILENCE29 // expected-warning@-2 {{'^' within '|'}}30 // expected-note@-3 {{place parentheses around the '^' expression to silence this warning}}31#endif32 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("33 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"34 35 (void)(i | i ^ i);36#ifndef SILENCE37 // expected-warning@-2 {{'^' within '|'}}38 // expected-note@-3 {{place parentheses around the '^' expression to silence this warning}}39#endif40 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("41 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:19-[[@LINE-6]]:19}:")"42 43 (void)(i & i ^ i);44#ifndef SILENCE45 // expected-warning@-2 {{'&' within '^'}}46 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}47#endif48 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("49 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:15-[[@LINE-6]]:15}:")"50 51 (void)(i ^ i & i);52#ifndef SILENCE53 // expected-warning@-2 {{'&' within '^'}}54 // expected-note@-3 {{place parentheses around the '&' expression to silence this warning}}55#endif56 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("57 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:19-[[@LINE-6]]:19}:")"58}59