
C89 had a questionable feature where the compiler would implicitly declare a function that the user called but was never previously declared. The resulting function would be globally declared as extern int func(); -- a function without a prototype which accepts zero or more arguments. C99 removed support for this questionable feature due to severe security concerns. However, there was no deprecation period; C89 had the feature, C99 didn't. So Clang (and GCC) both supported the functionality as an extension in C99 and later modes. C2x no longer supports that function signature as it now requires all functions to have a prototype, and given the known security issues with the feature, continuing to support it as an extension is not tenable. This patch changes the diagnostic behavior for the -Wimplicit-function-declaration warning group depending on the language mode in effect. We continue to warn by default in C89 mode (due to the feature being dangerous to use). However, because this feature will not be supported in C2x mode, we've diagnosed it as being invalid for so long, the security concerns with the feature, and the trivial workaround for users (declare the function), we now default the extension warning to an error in C99-C17 mode. This still gives users an easy workaround if they are extensively using the extension in those modes (they can disable the warning or use -Wno-error to downgrade the error), but the new diagnostic makes it more clear that this feature is not supported and should be avoided. In C2x mode, we no longer allow an implicit function to be defined and treat the situation the same as any other lookup failure. Differential Revision: https://reviews.llvm.org/D122983
64 lines
1.8 KiB
Objective-C
64 lines
1.8 KiB
Objective-C
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
|
|
|
|
int printf(const char *, ...);
|
|
|
|
@interface I0 {
|
|
@public
|
|
_Complex float iv0;
|
|
}
|
|
|
|
@property(assign) _Complex float p0;
|
|
|
|
-(_Complex float) im0;
|
|
-(void) setIm0: (_Complex float) a0;
|
|
@end
|
|
|
|
@implementation I0
|
|
@dynamic p0;
|
|
|
|
-(id) init {
|
|
self->iv0 = 5.0 + 2.0i;
|
|
return self;
|
|
}
|
|
|
|
-(_Complex float) im0 {
|
|
printf("im0: %.2f + %.2fi\n", __real iv0, __imag iv0);
|
|
return iv0 + (.1 + .2i);
|
|
}
|
|
-(void) setIm0: (_Complex float) a0 {
|
|
printf("setIm0: %.2f + %.2fi\n", __real a0, __imag a0);
|
|
iv0 = a0 + (.3 + .4i);
|
|
}
|
|
|
|
-(_Complex float) p0 {
|
|
printf("p0: %.2f + %.2fi\n", __real iv0, __imag iv0);
|
|
return iv0 + (.5 + .6i);
|
|
}
|
|
-(void) setP0: (_Complex float) a0 {
|
|
printf("setP0: %.2f + %.2fi\n", __real a0, __imag a0);
|
|
iv0 = a0 + (.7 + .8i);
|
|
}
|
|
@end
|
|
|
|
void f0(I0 *a0) {
|
|
float l0 = __real a0.im0;
|
|
float l1 = __imag a0->iv0;
|
|
_Complex float l2 = (a0.im0 = a0.im0);
|
|
_Complex float l3 = a0->iv0;
|
|
_Complex float l4 = (a0->iv0 = a0->iv0);
|
|
_Complex float l5 = a0->iv0;
|
|
_Complex float l6 = (a0.p0 = a0.p0);
|
|
_Complex float l7 = a0->iv0;
|
|
_Complex float l8 = [a0 im0];
|
|
printf("l0: %.2f + %.2fi\n", __real l0, __imag l0);
|
|
printf("l1: %.2f + %.2fi\n", __real l1, __imag l1);
|
|
printf("l2: %.2f + %.2fi\n", __real l2, __imag l2);
|
|
printf("l3: %.2f + %.2fi\n", __real l3, __imag l3);
|
|
printf("l4: %.2f + %.2fi\n", __real l4, __imag l4);
|
|
printf("l5: %.2f + %.2fi\n", __real l5, __imag l5);
|
|
printf("l6: %.2f + %.2fi\n", __real l6, __imag l6);
|
|
printf("l7: %.2f + %.2fi\n", __real l7, __imag l7);
|
|
printf("l8: %.2f + %.2fi\n", __real l8, __imag l8);
|
|
}
|