OSDN Git Service

* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / Wunused-value-1.c
1 /* Test -Wunused-value.  Bug 23113.  */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do compile } */
4 /* { dg-options "-Wunused-value" } */
5
6 int f (void);
7 void g (void);
8 int *p;
9
10 void
11 h (void)
12 {
13   1 + f (); /* { dg-warning "value computed is not used" } */
14   f () + f (); /* { dg-warning "value computed is not used" } */
15   f () + f (), f (); /* { dg-warning "value computed is not used" } */
16   (char) f (); /* { dg-warning "value computed is not used" } */
17   g ();
18   f ();
19   (void) f ();
20   *p++; /* { dg-warning "value computed is not used" } */
21   ++*p;
22   (*p ? f() : 0);
23   ({ f(); });
24   /* Statement expressions may be used in macro expansions which like
25      functions return values which may or may not be of use, so don't
26      warn for them but do warn inside them.  */
27   ({ f() + 1; });
28   ({ f(); 0; });
29   ({ f() + 1; 0; }); /* { dg-warning "value computed is not used" } */
30   1 + ({ f(); }); /* { dg-warning "value computed is not used" } */
31 }