Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/c-c++-common/Wtautological-compare-ranges.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
/* { dg-do compile } */ /* { dg-options "-Wtautological-compare -fdiagnostics-show-caret" } */ #define FOO foo void fn1 (int foo) { if (foo == foo); /* { dg-warning "self-comparison always evaluates to true" } */ /* { dg-begin-multiline-output "" } if (foo == foo); ^~ { dg-end-multiline-output "" { target c } } */ /* { dg-begin-multiline-output "" } if (foo == foo); ~~~ ^~ ~~~ { dg-end-multiline-output "" { target c++ } } */ } void fn2 (int foo) { if (FOO == FOO); /* { dg-warning "self-comparison always evaluates to true" } */ /* { dg-begin-multiline-output "" } if (FOO == FOO); ^~ { dg-end-multiline-output "" } */ } void fn3 (int foo) { if ((foo & 16) == 10); /* { dg-warning "bitwise comparison always evaluates to false" } */ /* { dg-begin-multiline-output "" } if ((foo & 16) == 10); ^~ { dg-end-multiline-output "" { target c } } */ /* { dg-begin-multiline-output "" } if ((foo & 16) == 10); ~~~~~~~~~~ ^~ ~~ { dg-end-multiline-output "" { target c++ } } */ }