xref: /llvm-project/clang/test/Sema/warn-strict-prototypes.m (revision d364307542d19ec5b0f4f5ee9adc5a3b7c8639a5)
1// RUN: %clang_cc1 -fsyntax-only -Wstrict-prototypes -verify -fblocks %s
2
3@interface Foo
4
5@property (nonatomic, copy) void (^noProtoBlock)(); // expected-warning {{a block declaration without a prototype is deprecated}}
6@property (nonatomic, copy) void (^block)(void); // no warning
7
8- doStuff:(void (^)()) completionHandler; // expected-warning {{a block declaration without a prototype is deprecated}}
9- doOtherStuff:(void (^)(void)) completionHandler; // no warning
10
11@end
12
13void foo() { // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}}
14  void (^block)() = // expected-warning {{a block declaration without a prototype is deprecated}}
15                    ^void(int arg) { // no warning
16  };
17  void (^block2)(void) = ^void() {
18  };
19  void (^block3)(void) = ^ { // no warning
20  };
21}
22
23void (*(^(*(^block4)()) // expected-warning {{a block declaration without a prototype is deprecated}}
24     ()) // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}}
25     ()) // expected-warning {{a block declaration without a prototype is deprecated}}
26     (); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}}
27