mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 05:16:40 +00:00

A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g., void func(); becomes void func(void); This is the third batch of tests being updated (there are a significant number of other tests left to be updated).
35 lines
789 B
Objective-C
35 lines
789 B
Objective-C
// RUN: %clang_cc1 -triple x86_64-apple-macos11 -fsyntax-only -fobjc-arc -fblocks -verify -Wunused-but-set-variable -Wno-objc-root-class %s
|
|
|
|
typedef struct dispatch_queue_s *dispatch_queue_t;
|
|
|
|
typedef void (^dispatch_block_t)(void);
|
|
|
|
void dispatch_async(dispatch_queue_t queue, dispatch_block_t block);
|
|
|
|
extern __attribute__((visibility("default"))) struct dispatch_queue_s _dispatch_main_q;
|
|
|
|
id getFoo(void);
|
|
|
|
@protocol P
|
|
|
|
@end
|
|
|
|
@interface I
|
|
|
|
@end
|
|
|
|
void test(void) {
|
|
// no diagnostics
|
|
__block id x = getFoo();
|
|
__block id<P> y = x;
|
|
__block I *z = (I *)x;
|
|
// diagnose non-block variables
|
|
id x2 = getFoo(); // expected-warning {{variable 'x2' set but not used}}
|
|
dispatch_async(&_dispatch_main_q, ^{
|
|
x = ((void *)0);
|
|
y = x;
|
|
z = ((void *)0);
|
|
});
|
|
x2 = getFoo();
|
|
}
|