Open
Description
I don't know when it happened, and godbolt compiler explorer does not support Obj-C with clang, but clang's -Wunused-parameter
used to warn for unused Obj-C method parameters, but now it doesn't.
Example code:
@interface RRPoint
- (instancetype)initWithX:(double)inX Y:(double)inY Z:(double)inZ;
@end
@implementation RRPoint
- (instancetype)initWithX:(double)inX Y:(double)inY Z:(double)inZ
{
return self;
}
@end
int main (int argc, const char * argv[])
{
return 0;
}
Result with old AppleClang 10 (Xcode 10.1):
builder22:Desktop builder$ xcrun clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
builder22:Desktop builder$ xcrun clang -fsyntax-only -Wunused-parameter test.m
test.m:9:35: warning: unused parameter 'inX' [-Wunused-parameter]
- (instancetype)initWithX:(double)inX Y:(double)inY Z:(double)inZ
^
Yet with newer AppleClang and open source clang 19.1.3, there is no warning.
(Godbolt compiler explorer does support Obj-C with gcc, and gcc does still warn here, FWIW)