OSDN Git Service

2011-01-08 Dominique d'Humieres <dominiq@lps.ens.fr>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / try-catch-12.m
1 /* Ensure that variables declared volatile by the user (as opposed to
2    synthesized by the EH-volatization machinery) _do_ trigger 
3    "discards qualifiers from target pointer type" warnings.  */
4
5 /* { dg-options "-fobjc-exceptions" } */
6 /* { dg-do compile } */
7
8 @interface TestMyTests
9 - (void) testSpoon;
10 @end
11
12 extern void some_func (int *);
13
14 @implementation TestMyTests
15 - (void) testSpoon {
16   volatile int i = 5;
17   int q = 99;
18
19   do {
20     @try {
21       typeof(i) j = 6;
22       typeof(q) k = 66;
23       some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */
24       /* { dg-message "but argument is of type" "" { target *-*-* } 12 } */
25       some_func (&k);
26     }
27     @catch (id exc) {
28       @throw;
29     }
30   } while(0);
31
32   do {
33     @try {
34       typeof(i) j = 7;
35       typeof(q) k = 77;
36       some_func (&k);
37       some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */
38       /* The following is disabled as it is already checked above and the testsuites seems 
39          to count multiple different identical errors on the same line only once */
40       /* dg-message "but argument is of type" "" { target *-*-* } 12 */
41     }
42     @catch (id exc) {
43       @throw;
44     }
45   } while(0);
46
47   do {
48     @try {
49       typeof(q) k = 88;
50       typeof(i) j = 8;
51       some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */
52       /* The following is disabled as it is already checked above and the testsuites seems 
53          to count multiple different identical errors on the same line only once */
54       /* dg-message "but argument is of type" "" { target *-*-* } 12 */
55       some_func (&k);
56     }
57     @catch (id exc) {
58       @throw;
59     }
60   } while(0);
61       
62 }
63 @end