Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/c-c++-common/Wunused-var-7.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/c-c++-common/Wunused-var-7.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,48 @@ +/* PR c++/44062 */ +/* { dg-do compile } */ +/* { dg-options "-Wunused" } */ + +void +foo (void) +{ + int a, b, c, d, e, f, g; + a = 1; + b = 2; + c = 3; + d = 4; + e = 5; + f = 6; + g = 7; + a; /* { dg-warning "no effect" } */ + b, 1; /* { dg-warning "no effect" } */ + (void) c; + (void) d, 1; /* { dg-warning "no effect" } */ + e, f, 1; /* { dg-warning "no effect" } */ + (void) g, f, 1; /* { dg-warning "no effect" } */ +} + +void +bar (void) +{ + int a; + int b; + int c; /* { dg-warning "set but not used" } */ + a = 1; + b = 2; + c = 3; + c = ({ a++, b; }); +} + +void +baz (void) +{ + int a; + int b; + int c; + int d; + a = 1; + b = 2; + c = 3; + d = 4; + d, ( a++, b ), c; /* { dg-warning "no effect" } */ +}