| 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 |
/* { dg-additional-options "-Wno-objc-root-class" } */ |
| 8 |
|
| 9 |
@interface TestMyTests |
| 10 |
- (void) testSpoon; |
| 11 |
@end |
| 12 |
|
| 13 |
extern void some_func (int *); /* { dg-line some_func_decl } */ |
| 14 |
|
| 15 |
@implementation TestMyTests |
| 16 |
- (void) testSpoon { |
| 17 |
volatile int i = 5; |
| 18 |
int q = 99; |
| 19 |
|
| 20 |
do { |
| 21 |
@try { |
| 22 |
typeof(i) j = 6; |
| 23 |
typeof(q) k = 66; |
| 24 |
some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */ |
| 25 |
/* { dg-message "but argument is of type" "" { target *-*-* } some_func_decl } */ |
| 26 |
some_func (&k); |
| 27 |
} |
| 28 |
@catch (id exc) { |
| 29 |
@throw; |
| 30 |
} |
| 31 |
} while(0); |
| 32 |
|
| 33 |
do { |
| 34 |
@try { |
| 35 |
typeof(i) j = 7; |
| 36 |
typeof(q) k = 77; |
| 37 |
some_func (&k); |
| 38 |
some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */ |
| 39 |
/* The following is disabled as it is already checked above and the testsuites seems |
| 40 |
to count multiple different identical errors on the same line only once */ |
| 41 |
/* dg-message "but argument is of type" "" { target *-*-* } some_func_decl */ |
| 42 |
} |
| 43 |
@catch (id exc) { |
| 44 |
@throw; |
| 45 |
} |
| 46 |
} while(0); |
| 47 |
|
| 48 |
do { |
| 49 |
@try { |
| 50 |
typeof(q) k = 88; |
| 51 |
typeof(i) j = 8; |
| 52 |
some_func (&j); /* { dg-warning "discards .volatile. qualifier from pointer target type" } */ |
| 53 |
/* The following is disabled as it is already checked above and the testsuites seems |
| 54 |
to count multiple different identical errors on the same line only once */ |
| 55 |
/* dg-message "but argument is of type" "" { target *-*-* } some_func_decl */ |
| 56 |
some_func (&k); |
| 57 |
} |
| 58 |
@catch (id exc) { |
| 59 |
@throw; |
| 60 |
} |
| 61 |
} while(0); |
| 62 |
|
| 63 |
} |
| 64 |
@end |