diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c index 7d278647001d4..0779738004076 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/easily-swappable-parameters-implicits.c @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s bugprone-easily-swappable-parameters %t \ +// RUN: %check_clang_tidy %s --extra-arg=-Wno-error=incompatible-pointer-types bugprone-easily-swappable-parameters %t \ // RUN: -config='{CheckOptions: { \ // RUN: bugprone-easily-swappable-parameters.MinimumLength: 2, \ // RUN: bugprone-easily-swappable-parameters.IgnoredParameterNames: "", \ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index dbba8f5db0cef..c29ca5d0f3417 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -58,6 +58,9 @@ C/C++ Language Potentially Breaking Changes - The ``__has_builtin`` function now only considers the currently active target when being used with target offloading. +- The ``-Wincompatible-pointer-types`` diagnostic now defaults to an error; + it can still be downgraded to a warning by passing ``-Wno-error=incompatible-pointer-types``. (#GH74605) + C++ Specific Potentially Breaking Changes ----------------------------------------- - For C++20 modules, the Reduced BMI mode will be the default option. This may introduce diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 757404a3f5eac..409a8202d8a09 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -9048,7 +9048,7 @@ def ext_typecheck_convert_incompatible_pointer : ExtWarn< "; take the address with &|" "; remove *|" "; remove &}3">, - InGroup; + InGroup, DefaultError; def err_typecheck_convert_incompatible_pointer : Error< "incompatible pointer types " "%select{%diff{assigning to $ from $|assigning to different types}0,1" diff --git a/clang/test/APINotes/nullability.c b/clang/test/APINotes/nullability.c index e07fc2e5c1174..4b310d4fb0068 100644 --- a/clang/test/APINotes/nullability.c +++ b/clang/test/APINotes/nullability.c @@ -15,7 +15,7 @@ int main() { take_pointer_and_int(0, 0); // expected-warning{{null passed to a callee that requires a non-null argument}} - float *fp = global_int; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}} + float *fp = global_int; // expected-error{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}} return 0; } diff --git a/clang/test/APINotes/nullability.m b/clang/test/APINotes/nullability.m index 21ec6680fa714..2c32caf6260a6 100644 --- a/clang/test/APINotes/nullability.m +++ b/clang/test/APINotes/nullability.m @@ -11,10 +11,10 @@ int main() { A *a; #if SWIFT_VERSION_3_0 - float *fp = // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'A * _Nullable'}} + float *fp = // expected-error{{incompatible pointer types initializing 'float *' with an expression of type 'A * _Nullable'}} [a transform: 0 integer: 0]; #else - float *fp = // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'A *'}} + float *fp = // expected-error{{incompatible pointer types initializing 'float *' with an expression of type 'A *'}} [a transform: 0 integer: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} #endif diff --git a/clang/test/APINotes/types.m b/clang/test/APINotes/types.m index 752f102643284..9e78d406b9ed9 100644 --- a/clang/test/APINotes/types.m +++ b/clang/test/APINotes/types.m @@ -12,17 +12,17 @@ // CHECK-NEXT: } AnonEnumWithTypedefName void test(OverriddenTypes *overridden) { - int *ip1 = global_int_ptr; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'double (*)(int, int)'}} + int *ip1 = global_int_ptr; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'double (*)(int, int)'}} - int *ip2 = global_int_fun( // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'char *'}} - ip2, // expected-warning{{incompatible pointer types passing 'int *' to parameter of type 'double *'}} - ip2); // expected-warning{{incompatible pointer types passing 'int *' to parameter of type 'float *'}} + int *ip2 = global_int_fun( // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'char *'}} + ip2, // expected-error{{incompatible pointer types passing 'int *' to parameter of type 'double *'}} + ip2); // expected-error{{incompatible pointer types passing 'int *' to parameter of type 'float *'}} - int *ip3 = [overridden // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'char *'}} - methodToMangle: ip3 // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'double *'}} - second: ip3]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'float *'}} + int *ip3 = [overridden // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'char *'}} + methodToMangle: ip3 // expected-error{{incompatible pointer types sending 'int *' to parameter of type 'double *'}} + second: ip3]; // expected-error{{incompatible pointer types sending 'int *' to parameter of type 'float *'}} - int *ip4 = overridden.intPropertyToMangle; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'double *'}} + int *ip4 = overridden.intPropertyToMangle; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'double *'}} } // expected-note@SomeKit/SomeKit.h:42{{passing argument to parameter 'ptr' here}} diff --git a/clang/test/AST/ByteCode/atomic.c b/clang/test/AST/ByteCode/atomic.c index c8469d4a938b8..a93787ccd1e02 100644 --- a/clang/test/AST/ByteCode/atomic.c +++ b/clang/test/AST/ByteCode/atomic.c @@ -8,8 +8,8 @@ _Atomic int ai = 0; // FIXME: &ai is an address constant, so this should be accepted as an // initializer, but the bit-cast inserted due to the pointer conversion is // tripping up the test for whether the initializer is a constant expression. -// The warning is correct but the error is not. -_Atomic(int *) aip3 = &ai; // both-warning {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \ +// The first error is correct; the second is not. +_Atomic(int *) aip3 = &ai; // both-error {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \ // both-error {{initializer element is not a compile-time constant}} #include diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c index b6d2a69271afb..6681a4f427093 100644 --- a/clang/test/AST/ByteCode/c.c +++ b/clang/test/AST/ByteCode/c.c @@ -349,7 +349,7 @@ const unsigned char _str2[] = {S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7]}; const int compared = strcmp(_str, (const char *)_str2); // all-error {{initializer element is not a compile-time constant}} -const int compared2 = strcmp(strcmp, _str); // all-warning {{incompatible pointer types}} \ +const int compared2 = strcmp(strcmp, _str); // all-error {{incompatible pointer types}} \ // all-error {{initializer element is not a compile-time constant}} int foo(x) // all-warning {{a function definition without a prototype is deprecated in all versions of C}} diff --git a/clang/test/Analysis/OSAtomic_mac.c b/clang/test/Analysis/OSAtomic_mac.c index 5cf7e93014323..9e3fef782de34 100644 --- a/clang/test/Analysis/OSAtomic_mac.c +++ b/clang/test/Analysis/OSAtomic_mac.c @@ -15,7 +15,7 @@ int *invalidSLocOnRedecl(void) { // something like "The "compare" part of CompareAndSwap depends on an // undefined value". int *b; - OSAtomicCompareAndSwapPtrBarrier(0, 0, &b); // no-crash + OSAtomicCompareAndSwapPtrBarrier(0, 0, (void**)&b); // no-crash return b; } diff --git a/clang/test/Analysis/bsd-string.c b/clang/test/Analysis/bsd-string.c index 93b2214786009..0c22dd0719132 100644 --- a/clang/test/Analysis/bsd-string.c +++ b/clang/test/Analysis/bsd-string.c @@ -137,5 +137,5 @@ void f11(void) { int a, b; void unknown_val_crash(void) { // We're unable to evaluate the integer-to-pointer cast. - strlcat(&b, a, 0); // no-crash + strlcat((char*)&b, a, 0); // no-crash } diff --git a/clang/test/Analysis/novoidtypecrash.c b/clang/test/Analysis/novoidtypecrash.c index 5af30c2010438..325dd505a4201 100644 --- a/clang/test/Analysis/novoidtypecrash.c +++ b/clang/test/Analysis/novoidtypecrash.c @@ -3,7 +3,7 @@ x; y(void **z) { // no-crash *z = x; int *w; - y(&w); + y((void**)&w); *w; } diff --git a/clang/test/Analysis/override-werror.c b/clang/test/Analysis/override-werror.c index e84c20fc0696f..1aeed80492cca 100644 --- a/clang/test/Analysis/override-werror.c +++ b/clang/test/Analysis/override-werror.c @@ -5,9 +5,9 @@ // -Werror. This allows basic warnings not to interfere with producing // analyzer results. -char* f(int *p) { - return p; // expected-warning{{incompatible pointer types}} \ - werror-warning{{incompatible pointer types}} +void f(int *p) { + int; // expected-warning{{declaration does not declare anything}} \ + werror-warning{{declaration does not declare anything}} } void g(int *p) { diff --git a/clang/test/Analysis/uninit-vals-union.c b/clang/test/Analysis/uninit-vals-union.c index e16cccfc9115a..079632d642a3b 100644 --- a/clang/test/Analysis/uninit-vals-union.c +++ b/clang/test/Analysis/uninit-vals-union.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -verify -Wno-unused %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -verify -Wno-unused -Wno-error=incompatible-pointer-types %s typedef union { int y; diff --git a/clang/test/C/C23/n3007.c b/clang/test/C/C23/n3007.c index 34ec419b71b27..b8b84519fc19d 100644 --- a/clang/test/C/C23/n3007.c +++ b/clang/test/C/C23/n3007.c @@ -13,7 +13,7 @@ void test_qualifiers(int x, const int y, int * restrict z) { static auto c = 1UL; int* pa = &a; // expected-warning {{initializing 'int *' with an expression of type 'const int *' discards qualifiers}} const int* pb = &b; - int* pc = &c; // expected-warning {{incompatible pointer types initializing 'int *' with an expression of type 'unsigned long *'}} + int* pc = &c; // expected-error {{incompatible pointer types initializing 'int *' with an expression of type 'unsigned long *'}} const int ci = 12; auto yup = ci; diff --git a/clang/test/C/C2y/n3369.c b/clang/test/C/C2y/n3369.c index db26040d8cf44..dd3125709279d 100644 --- a/clang/test/C/C2y/n3369.c +++ b/clang/test/C/C2y/n3369.c @@ -100,11 +100,11 @@ void test_funcs() { int i5[5]; char c35[3][5]; test_func_fix_fix(5, &c35, &i3, NULL); - test_func_fix_fix(5, &c35, &i5, NULL); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}} + test_func_fix_fix(5, &c35, &i5, NULL); // expected-error {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}} test_func_fix_var(5, &c35, &i3, NULL); - test_func_fix_var(5, &c35, &i5, NULL); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}} + test_func_fix_var(5, &c35, &i5, NULL); // expected-error {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}} test_func_fix_uns(5, &c35, &i3, NULL); - test_func_fix_uns(5, &c35, &i5, NULL); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}} + test_func_fix_uns(5, &c35, &i5, NULL); // expected-error {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}} } void test_multidimensional_arrays() { diff --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c index c2b1a5b4bbecd..77ade3c351171 100644 --- a/clang/test/C/drs/dr0xx.c +++ b/clang/test/C/drs/dr0xx.c @@ -459,7 +459,7 @@ void dr088_1(void) { /* Distinct type from the file scope forward declaration. */ struct dr088_t_1; /* FIXME: this diagnostic could be improved to not be utterly baffling. */ - dr088_f((struct dr088_t_1 *)0); /* expected-warning {{incompatible pointer types passing 'struct dr088_t_1 *' to parameter of type 'struct dr088_t_1 *'}} */ + dr088_f((struct dr088_t_1 *)0); /* expected-error {{incompatible pointer types passing 'struct dr088_t_1 *' to parameter of type 'struct dr088_t_1 *'}} */ } void dr088_2(struct dr088_t_1 *p) { /* Pointer to incomplete type. */ } diff --git a/clang/test/CodeGen/2008-03-05-syncPtr.c b/clang/test/CodeGen/2008-03-05-syncPtr.c index 8968a7dc2678c..30dc4f26e1d3e 100644 --- a/clang/test/CodeGen/2008-03-05-syncPtr.c +++ b/clang/test/CodeGen/2008-03-05-syncPtr.c @@ -34,7 +34,7 @@ int* foo5(int** a, int* b) { int* foo6(int** a, int*** b) { - return __sync_lock_test_and_set (a, b); + return __sync_lock_test_and_set (a, (int*)b); } // CHECK-LABEL: define{{.*}} ptr @foo6 // CHECK: atomicrmw xchg {{.*}}, align 8 diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-cas-error.c b/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-cas-error.c index c35c54d6b1858..669ce43e23d16 100644 --- a/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-cas-error.c +++ b/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-cas-error.c @@ -6,7 +6,7 @@ void test_builtin_ppc_compare_and_swap() { volatile int a = 0; long b = 0, c = 0; - __compare_and_swap(&a, &b, c); // expected-warning {{incompatible pointer types passing 'long *' to parameter of type 'int *'}} + __compare_and_swap(&a, &b, c); // expected-error {{incompatible pointer types passing 'long *' to parameter of type 'int *'}} } @@ -14,6 +14,6 @@ void test_builtin_ppc_compare_and_swaplp() { volatile long a = 0; int b = 0, c = 0; - __compare_and_swaplp(&a, &b, c);// expected-warning {{incompatible pointer types passing 'int *' to parameter of type 'long *'}} + __compare_and_swaplp(&a, &b, c);// expected-error {{incompatible pointer types passing 'int *' to parameter of type 'long *'}} } diff --git a/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c b/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c index f7ecf12d0becf..d931c0eae01d4 100644 --- a/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c +++ b/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c @@ -12,5 +12,5 @@ long long test_cmpccxadd64(void *__A, long long __B, long long __C) { } long long test_cmpccxadd64_2(int *__A, long long __B, long long __C) { - return _cmpccxadd_epi64(__A, __B, __C, 3); // expected-warning {{incompatible pointer types passing 'int *' to parameter of type 'long long *'}} + return _cmpccxadd_epi64(__A, __B, __C, 3); // expected-error {{incompatible pointer types passing 'int *' to parameter of type 'long long *'}} } diff --git a/clang/test/CodeGen/X86/math-builtins.c b/clang/test/CodeGen/X86/math-builtins.c index 8a85d1f6c3a76..a56f8ba1ee385 100644 --- a/clang/test/CodeGen/X86/math-builtins.c +++ b/clang/test/CodeGen/X86/math-builtins.c @@ -1,9 +1,9 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm -disable-llvm-passes -O2 %s | FileCheck %s -check-prefix=NO__ERRNO -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm -disable-llvm-passes -O2 -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO -// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU -// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple x86_64-unknown-unknown -w -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple x86_64-unknown-unknown -w -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple x86_64-unknown-unknown -w -o - -emit-llvm -disable-llvm-passes -O2 %s | FileCheck %s -check-prefix=NO__ERRNO +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple x86_64-unknown-unknown -w -o - -emit-llvm -disable-llvm-passes -O2 -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple x86_64-unknown-unknown-gnu -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple x86_64-unknown-windows-msvc -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN // Test attributes and codegen of math builtins. diff --git a/clang/test/CodeGen/arm64-microsoft-intrinsics.c b/clang/test/CodeGen/arm64-microsoft-intrinsics.c index 51e0038b64cde..c0ff785883c71 100644 --- a/clang/test/CodeGen/arm64-microsoft-intrinsics.c +++ b/clang/test/CodeGen/arm64-microsoft-intrinsics.c @@ -4,14 +4,21 @@ // RUN: not %clang_cc1 -triple arm64-linux -Werror -S -o /dev/null %s 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-LINUX -// RUN: %clang_cc1 -triple arm64-darwin -Wno-implicit-function-declaration -fms-compatibility -emit-llvm -o - %s \ +// RUN: %clang_cc1 -triple arm64-darwin -Wno-implicit-function-declaration -fms-compatibility -emit-llvm -o - -DARM64_DARWIN %s \ // RUN: | FileCheck %s -check-prefix CHECK-MSCOMPAT -long test_InterlockedAdd(long volatile *Addend, long Value) { +// For some reason '_InterlockedAdd` on arm64-darwin takes an 'int*' rather than a 'long*'. +#ifdef ARM64_DARWIN +typedef int int32_t; +#else +typedef long int32_t; +#endif + +long test_InterlockedAdd(int32_t volatile *Addend, long Value) { return _InterlockedAdd(Addend, Value); } -long test_InterlockedAdd_constant(long volatile *Addend) { +long test_InterlockedAdd_constant(int32_t volatile *Addend) { return _InterlockedAdd(Addend, -1); } @@ -21,7 +28,7 @@ long test_InterlockedAdd_constant(long volatile *Addend) { // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]] // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd' -long test_InterlockedAdd_acq(long volatile *Addend, long Value) { +long test_InterlockedAdd_acq(int32_t volatile *Addend, long Value) { return _InterlockedAdd_acq(Addend, Value); } @@ -31,7 +38,7 @@ long test_InterlockedAdd_acq(long volatile *Addend, long Value) { // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]] // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_acq' -long test_InterlockedAdd_nf(long volatile *Addend, long Value) { +long test_InterlockedAdd_nf(int32_t volatile *Addend, long Value) { return _InterlockedAdd_nf(Addend, Value); } @@ -41,7 +48,7 @@ long test_InterlockedAdd_nf(long volatile *Addend, long Value) { // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]] // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_nf' -long test_InterlockedAdd_rel(long volatile *Addend, long Value) { +long test_InterlockedAdd_rel(int32_t volatile *Addend, long Value) { return _InterlockedAdd_rel(Addend, Value); } diff --git a/clang/test/CodeGen/builtin-attributes.c b/clang/test/CodeGen/builtin-attributes.c index 506b165fcf36e..212ff008e12a5 100644 --- a/clang/test/CodeGen/builtin-attributes.c +++ b/clang/test/CodeGen/builtin-attributes.c @@ -57,12 +57,15 @@ long double modfl(long double x, long double*) asm("modfl"); // CHECK: ret int f3(double x) { int e; + float f; + double d; + long double ld; frexp(x, &e); frexpf(x, &e); frexpl(x, &e); - modf(x, &e); - modff(x, &e); - modfl(x, &e); + modf(x, &d); + modff(x, &f); + modfl(x, &ld); __builtin_remquo(x, x, &e); __builtin_remquof(x, x, &e); __builtin_remquol(x, x, &e); diff --git a/clang/test/CodeGen/builtin-rename.c b/clang/test/CodeGen/builtin-rename.c index 0b71d88806237..0092e54ef37d9 100644 --- a/clang/test/CodeGen/builtin-rename.c +++ b/clang/test/CodeGen/builtin-rename.c @@ -4,5 +4,5 @@ int printf(const char *, ...); int foo(void) { - return printf(printf); + return printf((const char*)printf); } diff --git a/clang/test/CodeGen/ms-intrinsics-underaligned.c b/clang/test/CodeGen/ms-intrinsics-underaligned.c index 34e2afb09f4b9..5be8ed8c6a600 100644 --- a/clang/test/CodeGen/ms-intrinsics-underaligned.c +++ b/clang/test/CodeGen/ms-intrinsics-underaligned.c @@ -111,6 +111,6 @@ long test_InterlockedAdd(X *x) { // CHECK-AARCH64-LABEL: @test_InterlockedAdd64( // CHECK-AARCH64: atomicrmw {{.*}} align 8 long test_InterlockedAdd64(X *x) { - return _InterlockedAdd64(&x->c, 4); + return _InterlockedAdd64((volatile long long*)&x->c, 4); } #endif diff --git a/clang/test/CodeGen/ubsan-pass-object-size.c b/clang/test/CodeGen/ubsan-pass-object-size.c index b36b8bb409aef..c606d33128322 100644 --- a/clang/test/CodeGen/ubsan-pass-object-size.c +++ b/clang/test/CodeGen/ubsan-pass-object-size.c @@ -14,7 +14,8 @@ int foo(int *const p __attribute__((pass_object_size(0))), int n) { // CHECK: __ubsan_handle_out_of_bounds { - int **p = &p; // Shadow the parameter. The pass_object_size info is lost. + int **q = &p; + int **p = q; // Shadow the parameter. The pass_object_size info is lost. // CHECK-NOT: __ubsan_handle_out_of_bounds x = *p[n]; } diff --git a/clang/test/CodeGen/vla.c b/clang/test/CodeGen/vla.c index a22ba727df2fe..18aa744b5f6fe 100644 --- a/clang/test/CodeGen/vla.c +++ b/clang/test/CodeGen/vla.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -Wno-int-conversion -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,NULL-INVALID -// RUN: %clang_cc1 -Wno-int-conversion -triple i386-unknown-unknown %s -emit-llvm -fno-delete-null-pointer-checks -o - | FileCheck %s -check-prefixes=CHECK,NULL-VALID +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -Wno-int-conversion -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,NULL-INVALID +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -Wno-int-conversion -triple i386-unknown-unknown %s -emit-llvm -fno-delete-null-pointer-checks -o - | FileCheck %s -check-prefixes=CHECK,NULL-VALID int b(char* x); diff --git a/clang/test/CodeGen/vlt_to_pointer.c b/clang/test/CodeGen/vlt_to_pointer.c index f06a1607ef469..7b9e60ab51ae7 100644 --- a/clang/test/CodeGen/vlt_to_pointer.c +++ b/clang/test/CodeGen/vlt_to_pointer.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types %s -emit-llvm -o - | FileCheck %s int c[1][3*2]; // CHECK: @{{.+}} ={{.*}}global [1 x [6 x {{i[0-9]+}}]] zeroinitializer diff --git a/clang/test/CodeGenOpenCL/numbered-address-space.cl b/clang/test/CodeGenOpenCL/numbered-address-space.cl index bfbc1d6873551..2a3a90751bf31 100644 --- a/clang/test/CodeGenOpenCL/numbered-address-space.cl +++ b/clang/test/CodeGenOpenCL/numbered-address-space.cl @@ -1,5 +1,5 @@ // REQUIRES: amdgpu-registered-target -// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu tonga -emit-llvm -O0 -o - %s | FileCheck %s +// RUN: %clang_cc1 -cl-std=CL2.0 -Wno-error=incompatible-pointer-types -triple amdgcn-unknown-unknown -target-cpu tonga -emit-llvm -O0 -o - %s | FileCheck %s // Make sure using numbered address spaces doesn't trigger crashes when a // builtin has an address space parameter. diff --git a/clang/test/FixIt/fixit-objc-arc.m b/clang/test/FixIt/fixit-objc-arc.m index 763e8b7d29c86..36d3b941b45d9 100644 --- a/clang/test/FixIt/fixit-objc-arc.m +++ b/clang/test/FixIt/fixit-objc-arc.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -pedantic -verify %s +// RUN: %clang_cc1 -pedantic -verify %s -Wno-error=incompatible-pointer-types // RUN: cp %s %t -// RUN: not %clang_cc1 -pedantic -fobjc-arc -fixit -x objective-c %t -// RUN: %clang_cc1 -pedantic -fobjc-arc -Werror -x objective-c %t +// RUN: not %clang_cc1 -pedantic -fobjc-arc -fixit -x objective-c %t -Wno-error=incompatible-pointer-types +// RUN: %clang_cc1 -pedantic -fobjc-arc -Werror -x objective-c %t -Wno-error=incompatible-pointer-types @class A; @class NSString; diff --git a/clang/test/Frontend/fixed_point_unknown_conversions.c b/clang/test/Frontend/fixed_point_unknown_conversions.c index b80c571307ccf..3d3e684da41dc 100644 --- a/clang/test/Frontend/fixed_point_unknown_conversions.c +++ b/clang/test/Frontend/fixed_point_unknown_conversions.c @@ -26,11 +26,11 @@ void func(void) { accum = ic; // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}} accum = s; // expected-error{{assigning to '_Accum' from incompatible type 'struct S'}} accum = ptr; // expected-error{{assigning to '_Accum' from incompatible type 'int *'}} - accum_ptr = ptr; // expected-warning{{incompatible pointer types assigning to '_Accum *' from 'int *'}} + accum_ptr = ptr; // expected-error{{incompatible pointer types assigning to '_Accum *' from 'int *'}} dc = accum; // expected-error{{conversion between fixed point and '_Complex double' is not yet supported}} ic = accum; // expected-error{{conversion between fixed point and '_Complex int' is not yet supported}} s = accum; // expected-error{{assigning to 'struct S' from incompatible type '_Accum'}} ptr = accum; // expected-error{{assigning to 'int *' from incompatible type '_Accum'}} - ptr = accum_ptr; // expected-warning{{incompatible pointer types assigning to 'int *' from '_Accum *'}} + ptr = accum_ptr; // expected-error{{incompatible pointer types assigning to 'int *' from '_Accum *'}} } diff --git a/clang/test/Index/preamble.c b/clang/test/Index/preamble.c index 08e62ecf449b9..324436cfa190b 100644 --- a/clang/test/Index/preamble.c +++ b/clang/test/Index/preamble.c @@ -21,7 +21,7 @@ void f(int x) { // CHECK: preamble.h:5:10: IntegerLiteral= Extent=[5:10 - 5:11] // CHECK: preamble.c:8:5: FunctionDecl=wibble:8:5 Extent=[8:1 - 8:16] // CHECK: preamble.c:8:15: ParmDecl=:8:15 (Definition) Extent=[8:12 - 8:15] -// CHECK-DIAG: preamble.h:4:7:{4:9-4:13}: warning: incompatible pointer types assigning to 'int *' from 'float *' +// CHECK-DIAG: preamble.h:4:7:{4:9-4:13}: error: incompatible pointer types assigning to 'int *' from 'float *' // FIXME: Should see: // preamble.c:5:9: warning: macro is not used // CHECK-DIAG-NOT: preamble.c:6:9: warning: macro is not used diff --git a/clang/test/Index/warning-flags.c b/clang/test/Index/warning-flags.c index 1694c6abab562..d7501543ab8a6 100644 --- a/clang/test/Index/warning-flags.c +++ b/clang/test/Index/warning-flags.c @@ -1,5 +1,5 @@ int foo(void) { } -int *bar(float *f) { return f; } +void bar(void) { int; } // RUN: c-index-test -test-load-source all %s 2>&1|FileCheck -check-prefix=CHECK-BOTH-WARNINGS %s // RUN: c-index-test -test-load-source-reparse 5 all %s 2>&1|FileCheck -check-prefix=CHECK-BOTH-WARNINGS %s @@ -10,9 +10,9 @@ int *bar(float *f) { return f; } // RUN: c-index-test -test-load-source all -w -O4 %s 2>&1 | FileCheck -check-prefix=NOWARNINGS %s // CHECK-BOTH-WARNINGS: warning: non-void function does not return a value -// CHECK-BOTH-WARNINGS: warning: incompatible pointer types returning 'float *' from a function with result type 'int *' +// CHECK-BOTH-WARNINGS: warning: declaration does not declare anything // CHECK-SECOND-WARNING-NOT:non-void function does not return a value -// CHECK-SECOND-WARNING: warning: incompatible pointer types returning 'float *' from a function with result type 'int *' +// CHECK-SECOND-WARNING: warning: declaration does not declare anything // NOWARNINGS-NOT: warning: diff --git a/clang/test/Misc/remap-file.c b/clang/test/Misc/remap-file.c index d6b925a5e0ab0..45ccac910e11b 100644 --- a/clang/test/Misc/remap-file.c +++ b/clang/test/Misc/remap-file.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s -// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-NONEXIST %s -// RUN: %clang_cc1 -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S%{fs-sep}nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-NONEXIST %s +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S%{fs-sep}nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s // CHECK-EXIST: remap-file.c:1:28: warning: incompatible pointer types // CHECK-NONEXIST: nonexistent.c:1:28: warning: incompatible pointer types diff --git a/clang/test/Modules/diamond-pch.c b/clang/test/Modules/diamond-pch.c index b60420cb8ed0b..afa8f7a3cf643 100644 --- a/clang/test/Modules/diamond-pch.c +++ b/clang/test/Modules/diamond-pch.c @@ -13,7 +13,7 @@ void test_diamond(int i, float f, double d, char c) { right(&d); bottom(&c); bottom(&d); - // expected-warning@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}} + // expected-error@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}} // expected-note@Inputs/diamond_bottom.h:4{{passing argument to parameter 'x' here}} // Names in multiple places in the diamond. diff --git a/clang/test/Modules/diamond.c b/clang/test/Modules/diamond.c index 1e0641cafd87b..48a82ebf1722c 100644 --- a/clang/test/Modules/diamond.c +++ b/clang/test/Modules/diamond.c @@ -14,7 +14,7 @@ void test_diamond(int i, float f, double d, char c) { right(&d); bottom(&c); bottom(&d); - // expected-warning@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}} + // expected-error@-1{{incompatible pointer types passing 'double *' to parameter of type 'char *'}} // expected-note@Inputs/diamond_bottom.h:4{{passing argument to parameter 'x' here}} // Names in multiple places in the diamond. diff --git a/clang/test/Modules/serialized-diags.m b/clang/test/Modules/serialized-diags.m index 18bce06047e90..c961260e3d078 100644 --- a/clang/test/Modules/serialized-diags.m +++ b/clang/test/Modules/serialized-diags.m @@ -8,7 +8,7 @@ double *double_ptr = &float_val; // RUN: rm -rf %t %t.diag %t.out -// RUN: %clang -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only %s --serialize-diagnostics %t.diag > /dev/null 2>&1 +// RUN: %clang -Wno-error=incompatible-pointer-types -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only %s --serialize-diagnostics %t.diag > /dev/null 2>&1 // RUN: c-index-test -read-diagnostics %t.diag > %t.out 2>&1 // RUN: FileCheck --input-file=%t.out %s @@ -18,7 +18,7 @@ // CHECK: Number of diagnostics: 2 // RUN: rm -rf %t %t.diag_errors %t.out_errors -// RUN: not %clang -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only -DWITH_ERRORS %s --serialize-diagnostics %t.diag_errors > /dev/null 2>&1 +// RUN: not %clang -Wno-error=incompatible-pointer-types -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only -DWITH_ERRORS %s --serialize-diagnostics %t.diag_errors > /dev/null 2>&1 // RUN: c-index-test -read-diagnostics %t.diag_errors > %t.out_errors 2>&1 // RUN: FileCheck -check-prefix=CHECK-WITH-ERRORS --input-file=%t.out_errors %s diff --git a/clang/test/OpenMP/vla_crash.c b/clang/test/OpenMP/vla_crash.c index 6eaa3bdab564b..31cf097523f19 100644 --- a/clang/test/OpenMP/vla_crash.c +++ b/clang/test/OpenMP/vla_crash.c @@ -1,7 +1,7 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _ -// RUN: %clang_cc1 -verify -triple powerpc64le-unknown-linux-gnu -fopenmp -x c -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1 +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -verify -triple powerpc64le-unknown-linux-gnu -fopenmp -x c -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1 -// RUN: %clang_cc1 -verify -triple powerpc64le-unknown-linux-gnu -fopenmp-simd -x c -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}" +// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -verify -triple powerpc64le-unknown-linux-gnu -fopenmp-simd -x c -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}" int a; diff --git a/clang/test/PCH/functions.c b/clang/test/PCH/functions.c index fa2ba8d29c038..d06f56a207426 100644 --- a/clang/test/PCH/functions.c +++ b/clang/test/PCH/functions.c @@ -16,7 +16,7 @@ float *test_f1(int val, double x, double y) { } void test_g0(int *x, float * y) { - g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}} + g0(y); // expected-error{{incompatible pointer types passing 'float *' to parameter of type 'int *'}} // expected-note@functions.h:9{{passing argument to parameter here}} g0(x); } diff --git a/clang/test/PCH/objc_exprs.m b/clang/test/PCH/objc_exprs.m index 7dbe3195f8ea8..b927e8df59b08 100644 --- a/clang/test/PCH/objc_exprs.m +++ b/clang/test/PCH/objc_exprs.m @@ -6,19 +6,19 @@ // RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s // Expressions -int *A1 = (objc_string)0; // expected-warning {{aka 'NSString *'}} +int *A1 = (objc_string)0; // expected-error {{aka 'NSString *'}} char A2 = (objc_encode){}; // expected-error {{not a compile-time constant}} \ expected-error {{char[2]}} -int *A3 = (objc_protocol)0; // expected-warning {{aka 'Protocol *'}} +int *A3 = (objc_protocol)0; // expected-error {{aka 'Protocol *'}} // Types. -int *T0 = (objc_id_protocol_ty)0; // expected-warning {{aka 'id'}} +int *T0 = (objc_id_protocol_ty)0; // expected-error {{aka 'id'}} -int *T1 = (objc_interface_ty)0; // expected-warning {{aka 'itf *'}} -int *T2 = (objc_qual_interface_ty)0; // expected-warning {{aka 'itf *'}} +int *T1 = (objc_interface_ty)0; // expected-error {{aka 'itf *'}} +int *T2 = (objc_qual_interface_ty)0; // expected-error {{aka 'itf *'}} objc_selector_noArgs s1; objc_selector_oneArg s2; diff --git a/clang/test/PCH/objc_kindof.m b/clang/test/PCH/objc_kindof.m index 437c417104087..0d8ecc3455fd2 100644 --- a/clang/test/PCH/objc_kindof.m +++ b/clang/test/PCH/objc_kindof.m @@ -27,7 +27,7 @@ @interface NSNumber : NSObject #else void testPrettyPrint(int *ip) { - ip = kindof_NSObject_NSCopying; // expected-warning{{from '__kindof NSObject *'}} + ip = kindof_NSObject_NSCopying; // expected-error{{from '__kindof NSObject *'}} } #endif diff --git a/clang/test/PCH/variables.c b/clang/test/PCH/variables.c index 2c8c1368e173a..7bf06aed11629 100644 --- a/clang/test/PCH/variables.c +++ b/clang/test/PCH/variables.c @@ -31,7 +31,7 @@ int UNIQUE(a); // a1 #else int *ip2 = &x; -float *fp = &ip; // expected-warning{{incompatible pointer types}} +float *fp = &ip; // expected-error{{incompatible pointer types}} double z; // expected-error{{redefinition}} expected-note@14{{previous}} int z2 = 18; // expected-error{{redefinition}} expected-note@16{{previous}} double VeryHappy; // expected-error{{redefinition}} expected-note@19{{previous definition is here}} diff --git a/clang/test/Parser/declarators.c b/clang/test/Parser/declarators.c index 365d52bd48570..0a3580596646d 100644 --- a/clang/test/Parser/declarators.c +++ b/clang/test/Parser/declarators.c @@ -57,7 +57,7 @@ myenum c; // expected-error {{must use 'enum' tag to refer to type 'myenum' float *test7(void) { // We should recover 'b' by parsing it with a valid type of "struct xyz", which // allows us to diagnose other bad things done with y, such as this. - return &b.y; // expected-warning {{incompatible pointer types returning 'int *' from a function with result type 'float *'}} + return &b.y; // expected-error {{incompatible pointer types returning 'int *' from a function with result type 'float *'}} } struct xyz test8(void) { return a; } // a should be marked invalid, no diag. diff --git a/clang/test/Sema/MicrosoftExtensions.c b/clang/test/Sema/MicrosoftExtensions.c index cf7463d2e76eb..e13c71570408e 100644 --- a/clang/test/Sema/MicrosoftExtensions.c +++ b/clang/test/Sema/MicrosoftExtensions.c @@ -206,7 +206,7 @@ void myprintf(const char *f, ...) { vmyprintf(f, ap); ap = 0; } else { - __va_start(ap, f); // expected-warning {{incompatible pointer types passing 'my_va_list'}} + __va_start(ap, f); // expected-error {{incompatible pointer types passing 'my_va_list'}} } } diff --git a/clang/test/Sema/arm-neon-types.c b/clang/test/Sema/arm-neon-types.c index 499cd271293b7..48df609e2f7a1 100644 --- a/clang/test/Sema/arm-neon-types.c +++ b/clang/test/Sema/arm-neon-types.c @@ -31,10 +31,10 @@ int32x4_t test4(int32x4_t a, vSInt32 b) { // Warn for incompatible pointer types used with vld/vst intrinsics. int16x8_t test5(int *p) { - return vld1q_s16(p); // expected-warning {{incompatible pointer types}} + return vld1q_s16(p); // expected-error {{incompatible pointer types}} } void test6(float *p, int32x2_t v) { - return vst1_s32(p, v); // expected-warning {{incompatible pointer types}} + return vst1_s32(p, v); // expected-error {{incompatible pointer types}} } #define INCLUDE diff --git a/clang/test/Sema/atomic-expr.c b/clang/test/Sema/atomic-expr.c index 96571e3e68c87..9ef5510e41b35 100644 --- a/clang/test/Sema/atomic-expr.c +++ b/clang/test/Sema/atomic-expr.c @@ -159,7 +159,7 @@ void func_17(void) { _Atomic(const int *) acip = cip; _Atomic(const int *) bad_acip = vcip; // expected-warning {{initializing '_Atomic(const int *)' with an expression of type 'const volatile int *' discards qualifiers}} _Atomic(const int *) acip2 = cicp; - _Atomic(int *) aip = &i; // expected-warning {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \ + _Atomic(int *) aip = &i; // expected-error {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \ // the left operand has atomic ... pointer type, and (considering the type // the left operand would have after lvalue conversion) one operand is a @@ -220,7 +220,7 @@ _Atomic(const int *) acip2 = cvp; // expected-error {{initializer element is not // initializer, but the bit-cast inserted due to the pointer conversion is // tripping up the test for whether the initializer is a constant expression. // The warning is correct but the error is not. -_Atomic(int *) aip3 = &ai; /* expected-warning {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} +_Atomic(int *) aip3 = &ai; /* expected-error {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} expected-error {{initializer element is not a compile-time constant}} */ diff --git a/clang/test/Sema/atomic-ops.c b/clang/test/Sema/atomic-ops.c index aae7aced2628a..ddeb29e19f760 100644 --- a/clang/test/Sema/atomic-ops.c +++ b/clang/test/Sema/atomic-ops.c @@ -181,7 +181,7 @@ void f(_Atomic(int) *i, const _Atomic(int) *ci, __atomic_load(i, I, memory_order_relaxed); // expected-error {{must be a pointer to a trivially-copyable type}} __atomic_load(CI, I, memory_order_relaxed); - __atomic_load(I, i, memory_order_relaxed); // expected-warning {{passing '_Atomic(int) *' to parameter of type 'int *'}} + __atomic_load(I, i, memory_order_relaxed); // expected-error {{passing '_Atomic(int) *' to parameter of type 'int *'}} __atomic_load(I, *P, memory_order_relaxed); __atomic_load(I, *P, memory_order_relaxed, 42); // expected-error {{too many arguments}} (int)__atomic_load(I, I, memory_order_seq_cst); // expected-error {{operand of type 'void'}} @@ -213,7 +213,7 @@ void f(_Atomic(int) *i, const _Atomic(int) *ci, int exchange_4 = __atomic_exchange_n(I, 1, memory_order_seq_cst); __atomic_exchange(s1, s2, s2, memory_order_seq_cst); - __atomic_exchange(s1, I, P, memory_order_seq_cst); // expected-warning 2{{parameter of type 'struct S *'}} + __atomic_exchange(s1, I, P, memory_order_seq_cst); // expected-error 2{{parameter of type 'struct S *'}} (int)__atomic_exchange(s1, s2, s2, memory_order_seq_cst); // expected-error {{operand of type 'void'}} __atomic_exchange(I, I, I, memory_order_seq_cst); __atomic_exchange(CI, I, I, memory_order_seq_cst); // expected-error {{address argument to atomic operation must be a pointer to non-const type ('const int *' invalid)}} @@ -259,22 +259,22 @@ void f(_Atomic(int) *i, const _Atomic(int) *ci, _Bool cmpexch_1 = __c11_atomic_compare_exchange_strong(i, I, 1, memory_order_seq_cst, memory_order_seq_cst); _Bool cmpexch_2 = __c11_atomic_compare_exchange_strong(p, P, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(f, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} + _Bool cmpexch_3 = __c11_atomic_compare_exchange_strong(f, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{incompatible pointer types}} (void)__c11_atomic_compare_exchange_strong(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} _Bool cmpexchw_1 = __c11_atomic_compare_exchange_weak(i, I, 1, memory_order_seq_cst, memory_order_seq_cst); _Bool cmpexchw_2 = __c11_atomic_compare_exchange_weak(p, P, (int*)1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexchw_3 = __c11_atomic_compare_exchange_weak(f, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} + _Bool cmpexchw_3 = __c11_atomic_compare_exchange_weak(f, I, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{incompatible pointer types}} (void)__c11_atomic_compare_exchange_weak(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} _Bool cmpexch_4 = __atomic_compare_exchange_n(I, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst); - _Bool cmpexch_5 = __atomic_compare_exchange_n(I, P, 5, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{; dereference with *}} + _Bool cmpexch_5 = __atomic_compare_exchange_n(I, P, 5, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{; dereference with *}} _Bool cmpexch_6 = __atomic_compare_exchange_n(I, I, P, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{passing 'int **' to parameter of type 'int'}} (void)__atomic_compare_exchange_n(CI, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{address argument to atomic operation must be a pointer to non-const type ('const int *' invalid)}} (void)__atomic_compare_exchange_n(I, CI, 5, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} _Bool cmpexch_7 = __atomic_compare_exchange(I, I, 5, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{passing 'int' to parameter of type 'int *'}} - _Bool cmpexch_8 = __atomic_compare_exchange(I, P, I, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{; dereference with *}} + _Bool cmpexch_8 = __atomic_compare_exchange(I, P, I, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{; dereference with *}} _Bool cmpexch_9 = __atomic_compare_exchange(I, I, I, 0, memory_order_seq_cst, memory_order_seq_cst); (void)__atomic_compare_exchange(CI, I, I, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{address argument to atomic operation must be a pointer to non-const type ('const int *' invalid)}} (void)__atomic_compare_exchange(I, CI, I, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{passing 'const int *' to parameter of type 'int *' discards qualifiers}} @@ -375,7 +375,7 @@ void PR12527(void) { int *b = PR12527_a; } void PR16931(int* x) { // expected-note {{passing argument to parameter 'x' here}} typedef struct { _Atomic(_Bool) flag; } flag; flag flagvar = { 0 }; - PR16931(&flagvar); // expected-warning {{incompatible pointer types}} + PR16931(&flagvar); // expected-error {{incompatible pointer types}} } void memory_checks(_Atomic(int) *Ap, int *p, int val) { diff --git a/clang/test/Sema/attr-format.c b/clang/test/Sema/attr-format.c index 5a8b1ac9eca5c..5b9e4d02bbaf9 100644 --- a/clang/test/Sema/attr-format.c +++ b/clang/test/Sema/attr-format.c @@ -55,7 +55,7 @@ void callnull(void){ null(0, 0); // no error null(0, (char*)0); // no error null(0, (void*)0); // no error - null(0, (int*)0); // expected-warning {{incompatible pointer types}} + null(0, (int*)0); // expected-error {{incompatible pointer types}} } // FreeBSD kernel extensions diff --git a/clang/test/Sema/c2x-auto.c b/clang/test/Sema/c2x-auto.c index 97754b2fb836b..7d62db9ea6c28 100644 --- a/clang/test/Sema/c2x-auto.c +++ b/clang/test/Sema/c2x-auto.c @@ -74,7 +74,7 @@ void test_qualifiers(const int y) { static auto c = 1UL; int* pa = &a; // expected-warning {{initializing 'int *' with an expression of type 'const int *' discards qualifiers}} const int* pb = &b; - int* pc = &c; // expected-warning {{incompatible pointer types initializing 'int *' with an expression of type 'unsigned long *'}} + int* pc = &c; // expected-error {{incompatible pointer types initializing 'int *' with an expression of type 'unsigned long *'}} _Static_assert(_Generic(a, int : 1)); _Static_assert(_Generic(b, int : 1)); diff --git a/clang/test/Sema/conditional-expr.c b/clang/test/Sema/conditional-expr.c index b54b689ec4f05..77f92b79dfcbc 100644 --- a/clang/test/Sema/conditional-expr.c +++ b/clang/test/Sema/conditional-expr.c @@ -18,11 +18,11 @@ void foo(void) { dp = vp; vp = dp; - ip = dp; // expected-warning {{incompatible pointer types assigning to 'int *' from 'double *'}} - dp = ip; // expected-warning {{incompatible pointer types assigning to 'double *' from 'int *'}} + ip = dp; // expected-error {{incompatible pointer types assigning to 'int *' from 'double *'}} + dp = ip; // expected-error {{incompatible pointer types assigning to 'double *' from 'int *'}} dp = 0 ? (double *)0 : (void *)0; vp = 0 ? (double *)0 : (void *)0; - ip = 0 ? (double *)0 : (void *)0; // expected-warning {{incompatible pointer types assigning to 'int *' from 'double *'}} + ip = 0 ? (double *)0 : (void *)0; // expected-error {{incompatible pointer types assigning to 'int *' from 'double *'}} const int *cip; vp = (0 ? vp : cip); // expected-warning {{discards qualifiers}} diff --git a/clang/test/Sema/decl-type-merging.c b/clang/test/Sema/decl-type-merging.c index 7576cac7cba21..1c81a7886b875 100644 --- a/clang/test/Sema/decl-type-merging.c +++ b/clang/test/Sema/decl-type-merging.c @@ -9,8 +9,8 @@ int (*a)(int (*x)[], int (*y)[5]); void b(void) { int x[10], y[5]; a(&x, &y); - a(&y, &y); // expected-warning {{incompatible pointer}} - a(&x, &x); // expected-warning {{incompatible pointer}} + a(&y, &y); // expected-error {{incompatible pointer}} + a(&x, &x); // expected-error {{incompatible pointer}} } diff --git a/clang/test/Sema/enum.c b/clang/test/Sema/enum.c index 01e41d4ebe956..f0da5f097fa80 100644 --- a/clang/test/Sema/enum.c +++ b/clang/test/Sema/enum.c @@ -111,7 +111,7 @@ void PR8694(int* e) // expected-note {{passing argument to parameter 'e' here}} void crash(enum E *e) // expected-warning {{declaration of 'enum E' will not be visible outside of this function}} \ // expected-warning {{ISO C forbids forward references to 'enum' types}} { - PR8694(e); // expected-warning {{incompatible pointer types passing 'enum E *' to parameter of type 'int *'}} + PR8694(e); // expected-error {{incompatible pointer types passing 'enum E *' to parameter of type 'int *'}} } typedef enum { NegativeShort = (short)-1 } NegativeShortEnum; diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index af30ad5d15fe2..4bff30c313c8f 100644 --- a/clang/test/Sema/format-strings.c +++ b/clang/test/Sema/format-strings.c @@ -230,8 +230,8 @@ void check_wide_string(char* b, ...) va_list ap; va_start(ap,b); - printf(L"foo %d",2); // expected-warning {{incompatible pointer types}}, expected-warning {{should not be a wide string}} - vsprintf(b,L"bar %d",ap); // expected-warning {{incompatible pointer types}}, expected-warning {{should not be a wide string}} + printf(L"foo %d",2); // expected-error {{incompatible pointer types}}, expected-warning {{should not be a wide string}} + vsprintf(b,L"bar %d",ap); // expected-error {{incompatible pointer types}}, expected-warning {{should not be a wide string}} } void check_asterisk_precision_width(int x) { diff --git a/clang/test/Sema/function.c b/clang/test/Sema/function.c index 5d803e03b3af9..990631ee69cd5 100644 --- a/clang/test/Sema/function.c +++ b/clang/test/Sema/function.c @@ -107,8 +107,8 @@ void decays(int a[3][3]); // expected-note {{passing argument to parameter 'a' void no_decay(int (*a)[3]); // expected-note {{passing argument to parameter 'a' here}} void t22(int *ptr, int (*array)[3]) { - decays(ptr); // expected-warning {{incompatible pointer types passing 'int *' to parameter of type 'int (*)[3]'}} - no_decay(ptr); // expected-warning {{incompatible pointer types passing 'int *' to parameter of type 'int (*)[3]'}} + decays(ptr); // expected-error {{incompatible pointer types passing 'int *' to parameter of type 'int (*)[3]'}} + no_decay(ptr); // expected-error {{incompatible pointer types passing 'int *' to parameter of type 'int (*)[3]'}} decays(array); no_decay(array); } diff --git a/clang/test/Sema/merge-decls.c b/clang/test/Sema/merge-decls.c index 652cd8fd2454b..7bf9fdab0aa48 100644 --- a/clang/test/Sema/merge-decls.c +++ b/clang/test/Sema/merge-decls.c @@ -81,14 +81,14 @@ void test6_f(a) {} void test6_g() { int arr[10]; - test6_f(&arr); // expected-warning {{incompatible pointer types passing 'int (*)[10]' to parameter of type 'int (*)[11]}} + test6_f(&arr); // expected-error {{incompatible pointer types passing 'int (*)[10]' to parameter of type 'int (*)[11]}} } void test7_f(int (*)[10]); void test7_f(int (*)[]); // expected-note {{passing argument to parameter here}} void test7_g() { int x[5]; - test7_f(&x); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}} + test7_f(&x); // expected-error {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}} } char d; diff --git a/clang/test/Sema/nullability.c b/clang/test/Sema/nullability.c index 0401516233b6d..5af473ecc41b5 100644 --- a/clang/test/Sema/nullability.c +++ b/clang/test/Sema/nullability.c @@ -63,10 +63,10 @@ void acceptBlockPtr(_Nonnull int *(^)(void)); void testBlockFunctionPtrNullability(void) { float *fp; - fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * _Nonnull (*)(int, int)')}} + fp = (function_pointer_type_3)0; // expected-error{{from 'function_pointer_type_3' (aka 'int * _Nonnull (*)(int, int)')}} fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * _Nonnull (^)(int, int)')}} - fp = (function_pointer_type_4)0; // expected-warning{{from 'function_pointer_type_4' (aka 'int * _Nonnull (*)(int, int)')}} - fp = (function_pointer_type_5)0; // expected-warning{{from 'function_pointer_type_5' (aka 'void (*)(int * _Nonnull)')}} + fp = (function_pointer_type_4)0; // expected-error{{from 'function_pointer_type_4' (aka 'int * _Nonnull (*)(int, int)')}} + fp = (function_pointer_type_5)0; // expected-error{{from 'function_pointer_type_5' (aka 'void (*)(int * _Nonnull)')}} fp = (block_type_4)0; // expected-error{{from incompatible type 'block_type_4' (aka 'int_ptr _Nonnull (^)(int, int)')}} acceptFunctionPtr(0); // no-warning @@ -86,18 +86,18 @@ typedef int * _Nullable ambiguous_int_ptr; // Printing of nullability. float f; -int * _Nonnull ip_1 = &f; // expected-warning{{incompatible pointer types initializing 'int * _Nonnull' with an expression of type 'float *'}} +int * _Nonnull ip_1 = &f; // expected-error{{incompatible pointer types initializing 'int * _Nonnull' with an expression of type 'float *'}} // Check printing of nullability specifiers. void printing_nullability(void) { int * _Nonnull iptr; - float *fptr = iptr; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}} + float *fptr = iptr; // expected-error{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}} int * * _Nonnull iptrptr; - float **fptrptr = iptrptr; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int ** _Nonnull'}} + float **fptrptr = iptrptr; // expected-error{{incompatible pointer types initializing 'float **' with an expression of type 'int ** _Nonnull'}} int * _Nullable * _Nonnull iptrptr2; - float * *fptrptr2 = iptrptr2; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int * _Nullable * _Nonnull'}} + float * *fptrptr2 = iptrptr2; // expected-error{{incompatible pointer types initializing 'float **' with an expression of type 'int * _Nullable * _Nonnull'}} } // Check passing null to a _Nonnull argument. diff --git a/clang/test/Sema/pass-object-size.c b/clang/test/Sema/pass-object-size.c index 688290ca9890a..5360f4af71c25 100644 --- a/clang/test/Sema/pass-object-size.c +++ b/clang/test/Sema/pass-object-size.c @@ -58,7 +58,7 @@ void FunctionPtrs(void) { int P; (&NotOverloaded)(&P); //expected-error{{cannot take address of function 'NotOverloaded' because parameter 1 has pass_object_size attribute}} - (&IsOverloaded)(&P); //expected-warning{{incompatible pointer types passing 'int *' to parameter of type 'char *'}} + (&IsOverloaded)(&P); //expected-error{{incompatible pointer types passing 'int *' to parameter of type 'char *'}} } void mismatch(void *p __attribute__((pass_object_size(0)))); // expected-note {{previous declaration is here}} diff --git a/clang/test/Sema/ptrauth-atomic-ops.c b/clang/test/Sema/ptrauth-atomic-ops.c index 8872090d83b8d..a5411f2e197b3 100644 --- a/clang/test/Sema/ptrauth-atomic-ops.c +++ b/clang/test/Sema/ptrauth-atomic-ops.c @@ -50,7 +50,7 @@ void f() { __c11_atomic_store(ATOMIZE(non_addr_discriminatedauthenticated_ptr), 0, memory_order_relaxed); __c11_atomic_load(ATOMIZE(non_addr_discriminatedauthenticated_ptr), memory_order_seq_cst); __atomic_store(&j, ATOMIZE(non_addr_discriminatedauthenticated_ptr), memory_order_release); - // expected-warning@-1 {{incompatible pointer types passing 'volatile __ptrauth(2,0,200) _Atomic(int *) *' to parameter of type 'int *'}} + // expected-error@-1 {{incompatible pointer types passing 'volatile __ptrauth(2,0,200) _Atomic(int *) *' to parameter of type 'int *'}} __c11_atomic_exchange(ATOMIZE(j), ATOMIZE(non_addr_discriminatedauthenticated_ptr), memory_order_seq_cst); // expected-error@-1 {{incompatible pointer to integer conversion passing 'volatile __ptrauth(2,0,200) _Atomic(int *) *' to parameter of type 'typeof (j)' (aka 'int')}} __c11_atomic_fetch_add(ATOMIZE(non_addr_discriminatedauthenticated_ptr), ATOMIZE(j), memory_order_seq_cst); diff --git a/clang/test/Sema/ptrauth.c b/clang/test/Sema/ptrauth.c index b4e5214a7cb50..6c4b92b0104df 100644 --- a/clang/test/Sema/ptrauth.c +++ b/clang/test/Sema/ptrauth.c @@ -35,7 +35,7 @@ void test_strip(int *dp, int (*fp)(int)) { int (*fr)(int) = __builtin_ptrauth_strip(fp, VALID_CODE_KEY); fr = __builtin_ptrauth_strip(fp, INVALID_KEY); // expected-error {{does not identify a valid pointer authentication key for the current target}} - float *mismatch = __builtin_ptrauth_strip(dp, VALID_DATA_KEY); // expected-warning {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} + float *mismatch = __builtin_ptrauth_strip(dp, VALID_DATA_KEY); // expected-error {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} } void test_blend_discriminator(int *dp, int (*fp)(int), int value) { @@ -55,7 +55,7 @@ void test_string_discriminator(const char *str) { (void) __builtin_ptrauth_string_discriminator("test string"); // no warning __builtin_ptrauth_string_discriminator(str); // expected-error {{argument must be a string literal}} - __builtin_ptrauth_string_discriminator(L"wide test"); // expected-error {{argument must be a string literal}} expected-warning {{incompatible pointer types passing 'int[10]' to parameter of type 'const char *'}} + __builtin_ptrauth_string_discriminator(L"wide test"); // expected-error {{argument must be a string literal}} expected-error {{incompatible pointer types passing 'int[10]' to parameter of type 'const char *'}} void *mismatch = __builtin_ptrauth_string_discriminator("test string"); // expected-error {{incompatible integer to pointer conversion initializing 'void *' with an expression of type '__size_t'}} } @@ -77,7 +77,7 @@ void test_sign_unauthenticated(int *dp, int (*fp)(int)) { int (*fr)(int) = __builtin_ptrauth_sign_unauthenticated(fp, VALID_CODE_KEY, 0); fr = __builtin_ptrauth_sign_unauthenticated(fp, INVALID_KEY, 0); // expected-error {{does not identify a valid pointer authentication key for the current target}} - float *mismatch = __builtin_ptrauth_sign_unauthenticated(dp, VALID_DATA_KEY, 0); // expected-warning {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} + float *mismatch = __builtin_ptrauth_sign_unauthenticated(dp, VALID_DATA_KEY, 0); // expected-error {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} } void test_auth(int *dp, int (*fp)(int)) { @@ -96,7 +96,7 @@ void test_auth(int *dp, int (*fp)(int)) { int (*fr)(int) = __builtin_ptrauth_auth(fp, VALID_CODE_KEY, 0); fr = __builtin_ptrauth_auth(fp, INVALID_KEY, 0); // expected-error {{does not identify a valid pointer authentication key for the current target}} - float *mismatch = __builtin_ptrauth_auth(dp, VALID_DATA_KEY, 0); // expected-warning {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} + float *mismatch = __builtin_ptrauth_auth(dp, VALID_DATA_KEY, 0); // expected-error {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} } void test_auth_and_resign(int *dp, int (*fp)(int)) { @@ -119,7 +119,7 @@ void test_auth_and_resign(int *dp, int (*fp)(int)) { fr = __builtin_ptrauth_auth_and_resign(fp, INVALID_KEY, 0, VALID_CODE_KEY, dp); // expected-error {{does not identify a valid pointer authentication key for the current target}} fr = __builtin_ptrauth_auth_and_resign(fp, VALID_CODE_KEY, 0, INVALID_KEY, dp); // expected-error {{does not identify a valid pointer authentication key for the current target}} - float *mismatch = __builtin_ptrauth_auth_and_resign(dp, VALID_DATA_KEY, 0, VALID_DATA_KEY, dp); // expected-warning {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} + float *mismatch = __builtin_ptrauth_auth_and_resign(dp, VALID_DATA_KEY, 0, VALID_DATA_KEY, dp); // expected-error {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} } void test_sign_generic_data(int *dp) { @@ -152,7 +152,7 @@ int *t_cst_sig3 = __builtin_ptrauth_sign_constant(mismatched_type, VALID_DATA_KE int *t_cst_sig4 = __builtin_ptrauth_sign_constant(&dv, mismatched_type, 0); // expected-error {{passing 'struct A' to parameter of incompatible type 'int'}} int *t_cst_sig5 = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, mismatched_type); // expected-error {{extra discriminator must have pointer or integer type; type here is 'struct A'}} -float *t_cst_result = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); // expected-warning {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} +float *t_cst_result = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); // expected-error {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} int *t_cst_valid1 = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); int *t_cst_valid2 = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, __builtin_ptrauth_blend_discriminator(&dv, 0)); @@ -184,7 +184,7 @@ void test_sign_constant(int *dp, fp_t fp) { int *sig4 = __builtin_ptrauth_sign_constant(&dv, mismatched_type, 0); // expected-error {{passing 'struct A' to parameter of incompatible type 'int'}} int *sig5 = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, mismatched_type); // expected-error {{extra discriminator must have pointer or integer type; type here is 'struct A'}} - float *result = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); // expected-warning {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} + float *result = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); // expected-error {{incompatible pointer types initializing 'float *' with an expression of type 'int *'}} int *valid1 = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); int *valid2 = __builtin_ptrauth_sign_constant(&dv, VALID_DATA_KEY, __builtin_ptrauth_blend_discriminator(&dv, 0)); diff --git a/clang/test/Sema/static-array.c b/clang/test/Sema/static-array.c index 87efb4894f1bb..3574a106c7104 100644 --- a/clang/test/Sema/static-array.c +++ b/clang/test/Sema/static-array.c @@ -23,11 +23,11 @@ void f(int *p) { char d[4]; cat((int *)d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}} - cat(d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}} expected-warning {{incompatible pointer types}} + cat(d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}} expected-error {{incompatible pointer types}} char e[12]; cat((int *)e); - cat(e); // expected-warning {{incompatible pointer types}} + cat(e); // expected-error {{incompatible pointer types}} } diff --git a/clang/test/Sema/struct-compat.c b/clang/test/Sema/struct-compat.c index 3bc66b0b9d88e..eb735f0bcfc90 100644 --- a/clang/test/Sema/struct-compat.c +++ b/clang/test/Sema/struct-compat.c @@ -8,7 +8,7 @@ struct x; int a(struct x* b) { // Per C99 6.7.2.3, since the outer and inner "struct x"es have different // scopes, they don't refer to the same type, and are therefore incompatible -struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}} +struct x {int a;} *c = b; // expected-error {{incompatible pointer types}} } struct x {int a;} r; diff --git a/clang/test/Sema/var-redecl.c b/clang/test/Sema/var-redecl.c index 30f1fb229d8c8..f915403ba9255 100644 --- a/clang/test/Sema/var-redecl.c +++ b/clang/test/Sema/var-redecl.c @@ -54,7 +54,7 @@ void g18(void) { // expected-note{{'g18' declared here}} extern int g19; } int *p=&g19; // expected-error{{use of undeclared identifier 'g19'}} \ - // expected-warning{{incompatible pointer types}} + // expected-error{{incompatible pointer types}} // PR3645 static int a; diff --git a/clang/test/Sema/vector-assign.c b/clang/test/Sema/vector-assign.c index d7972ed8b4c7b..119a320585ef6 100644 --- a/clang/test/Sema/vector-assign.c +++ b/clang/test/Sema/vector-assign.c @@ -49,5 +49,5 @@ longlongvec; void test3a(longlongvec *); // expected-note{{passing argument to parameter here}} void test3(const unsigned *src) { - test3a(src); // expected-warning {{incompatible pointer types passing 'const unsigned int *' to parameter of type 'longlongvec *'}} + test3a(src); // expected-error {{incompatible pointer types passing 'const unsigned int *' to parameter of type 'longlongvec *'}} } diff --git a/clang/test/Sema/vla.c b/clang/test/Sema/vla.c index 54afe7c681bd0..c8b051e7b46de 100644 --- a/clang/test/Sema/vla.c +++ b/clang/test/Sema/vla.c @@ -82,9 +82,9 @@ void VLAPtrAssign(int size) { // This is well formed int (*p)[2][3][size][4][5] = array; // Last array dimension too large - int (*p2)[2][3][size][4][6] = array; // expected-warning {{incompatible pointer types}} + int (*p2)[2][3][size][4][6] = array; // expected-error {{incompatible pointer types}} // Second array dimension too large - int (*p3)[20][3][size][4][5] = array; // expected-warning {{incompatible pointer types}} + int (*p3)[20][3][size][4][5] = array; // expected-error {{incompatible pointer types}} // Not illegal in C, program _might_ be well formed if size == 3. int (*p4)[2][size][3][4][5] = array; diff --git a/clang/test/SemaObjC/arc-decls.m b/clang/test/SemaObjC/arc-decls.m index 2b4a9b0319def..3ff4fc0dd50dc 100644 --- a/clang/test/SemaObjC/arc-decls.m +++ b/clang/test/SemaObjC/arc-decls.m @@ -131,7 +131,7 @@ void test7(void) { id *px = &x; // expected-error {{pointer to non-const type 'id' with no explicit ownership}} I *y; - J **py = &y; // expected-error {{pointer to non-const type 'J *' with no explicit ownership}} expected-warning {{incompatible pointer types initializing}} + J **py = &y; // expected-error {{pointer to non-const type 'J *' with no explicit ownership}} expected-error {{incompatible pointer types initializing}} } void func(void) __attribute__((objc_ownership(none))); // expected-warning {{'objc_ownership' only applies to Objective-C object or block pointer types; type here is 'void (void)'}} diff --git a/clang/test/SemaObjC/arc-objcbridge-related-attribute.m b/clang/test/SemaObjC/arc-objcbridge-related-attribute.m index 7fd9f804a83e2..da291727e3d2b 100644 --- a/clang/test/SemaObjC/arc-objcbridge-related-attribute.m +++ b/clang/test/SemaObjC/arc-objcbridge-related-attribute.m @@ -24,9 +24,9 @@ - (NSColor *)backgroundColor; } NSColor * Test2(NSTextField *textField, CGColorRef1 newColor) { - foo(newColor); // expected-warning {{incompatible pointer types passing 'CGColorRef1' (aka 'struct CGColor1 *') to parameter of type 'NSColor *'}} - textField.backgroundColor = newColor; // expected-warning {{incompatible pointer types assigning to 'NSColor *__strong' from 'CGColorRef1' (aka 'struct CGColor1 *')}} - return newColor; // expected-warning {{incompatible pointer types returning 'CGColorRef1' (aka 'struct CGColor1 *') from a function with result type 'NSColor *'}} + foo(newColor); // expected-error {{incompatible pointer types passing 'CGColorRef1' (aka 'struct CGColor1 *') to parameter of type 'NSColor *'}} + textField.backgroundColor = newColor; // expected-error {{incompatible pointer types assigning to 'NSColor *__strong' from 'CGColorRef1' (aka 'struct CGColor1 *')}} + return newColor; // expected-error {{incompatible pointer types returning 'CGColorRef1' (aka 'struct CGColor1 *') from a function with result type 'NSColor *'}} } CGColorRef Test3(NSTextField *textField, CGColorRef newColor) { @@ -35,6 +35,6 @@ CGColorRef Test3(NSTextField *textField, CGColorRef newColor) { } CGColorRef2 Test4(NSTextField *textField, CGColorRef2 newColor) { - newColor = textField.backgroundColor; // expected-warning {{incompatible pointer types assigning}} - return textField.backgroundColor; // expected-warning {{incompatible pointer types returning}} + newColor = textField.backgroundColor; // expected-error {{incompatible pointer types assigning}} + return textField.backgroundColor; // expected-error {{incompatible pointer types returning}} } diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m index 7cc4d824ab52f..010d576f414f7 100644 --- a/clang/test/SemaObjC/arc.m +++ b/clang/test/SemaObjC/arc.m @@ -751,9 +751,9 @@ @interface NSMutableArray : NSArray @end typedef __strong NSMutableArray * PSNS; void test(NSArray *x) { - NSMutableArray *y = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} - __strong NSMutableArray *y1 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} - PSNS y2 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} + NSMutableArray *y = x; // expected-error {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} + __strong NSMutableArray *y1 = x; // expected-error {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} + PSNS y2 = x; // expected-error {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} } @class NSString; diff --git a/clang/test/SemaObjC/attr-objc-NSObject.m b/clang/test/SemaObjC/attr-objc-NSObject.m index 76a01dcef0163..6f5c369c56a7f 100644 --- a/clang/test/SemaObjC/attr-objc-NSObject.m +++ b/clang/test/SemaObjC/attr-objc-NSObject.m @@ -18,6 +18,6 @@ void good() { void bad() { BarRef object; NSArray *array; // expected-error {{type argument 'BarRef' (aka 'struct Bar *') is neither an Objective-C object nor a block type}} - [array containsObject:object]; // expected-warning {{incompatible pointer types sending 'BarRef' (aka 'struct Bar *') to parameter of type 'id'}} + [array containsObject:object]; // expected-error {{incompatible pointer types sending 'BarRef' (aka 'struct Bar *') to parameter of type 'id'}} [object description]; // expected-warning {{receiver type 'BarRef' (aka 'struct Bar *') is not 'id' or interface pointer, consider casting it to 'id'}} } diff --git a/clang/test/SemaObjC/check-objcbridge-related-attribute-lookup.m b/clang/test/SemaObjC/check-objcbridge-related-attribute-lookup.m index 89486f0336422..fe3851717ceae 100644 --- a/clang/test/SemaObjC/check-objcbridge-related-attribute-lookup.m +++ b/clang/test/SemaObjC/check-objcbridge-related-attribute-lookup.m @@ -20,21 +20,21 @@ - (NSColor *)backgroundColor; NSColor * Test1(NSTextField *textField, CGColorRef newColor) { textField.backgroundColor = newColor; // expected-error {{'CGColorRef' (aka 'struct CGColor *') must be explicitly converted to 'NSColor *'; use '+colorXWithCGColor:' method for this conversion}} \ - // expected-warning {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef' (aka 'struct CGColor *')}} + // expected-error {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef' (aka 'struct CGColor *')}} newColor = textField.backgroundColor; // expected-error {{'NSColor *' must be explicitly converted to 'CGColorRef' (aka 'struct CGColor *'); use '-CXGColor' method for this conversion}} \ - // expected-warning {{incompatible pointer types assigning to 'CGColorRef' (aka 'struct CGColor *') from 'NSColor *'}} + // expected-error {{incompatible pointer types assigning to 'CGColorRef' (aka 'struct CGColor *') from 'NSColor *'}} } NSColor * Test2(NSTextField *textField, CGColorRef1 newColor) { textField.backgroundColor = newColor; // expected-error {{could not find Objective-C class 'XNSColor' to convert 'CGColorRef1' (aka 'struct CGColor1 *') to 'NSColor *'}} \ - // expected-warning {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef1' (aka 'struct CGColor1 *')}} + // expected-error {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef1' (aka 'struct CGColor1 *')}} newColor = textField.backgroundColor ; // expected-error {{could not find Objective-C class 'XNSColor' to convert 'NSColor *' to 'CGColorRef1' (aka 'struct CGColor1 *')}} \ - // expected-warning {{incompatible pointer types assigning to 'CGColorRef1' (aka 'struct CGColor1 *') from 'NSColor *'}} + // expected-error {{incompatible pointer types assigning to 'CGColorRef1' (aka 'struct CGColor1 *') from 'NSColor *'}} } NSColor * Test3(NSTextField *textField, CGColorRef2 newColor) { textField.backgroundColor = newColor; // expected-error {{'PNsColor' must be name of an Objective-C class to be able to convert 'CGColorRef2' (aka 'struct CGColor2 *') to 'NSColor *'}} \ - // expected-warning {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef2' (aka 'struct CGColor2 *')}} + // expected-error {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef2' (aka 'struct CGColor2 *')}} newColor = textField.backgroundColor; // expected-error {{'PNsColor' must be name of an Objective-C class to be able to convert 'NSColor *' to 'CGColorRef2' (aka 'struct CGColor2 *')}} \ - // expected-warning {{incompatible pointer types assigning to 'CGColorRef2' (aka 'struct CGColor2 *') from 'NSColor *'}} + // expected-error {{incompatible pointer types assigning to 'CGColorRef2' (aka 'struct CGColor2 *') from 'NSColor *'}} } diff --git a/clang/test/SemaObjC/class-method-self.m b/clang/test/SemaObjC/class-method-self.m index 821160c884144..4c0bcc73c1f86 100644 --- a/clang/test/SemaObjC/class-method-self.m +++ b/clang/test/SemaObjC/class-method-self.m @@ -17,8 +17,8 @@ @implementation YY static XX *obj; + (void)classMethod { - [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} + [obj addObserver:self]; // expected-error {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} Class whatever; - [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} + [obj addObserver:whatever]; // expected-error {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} } @end diff --git a/clang/test/SemaObjC/comptypes-1.m b/clang/test/SemaObjC/comptypes-1.m index a18ebd13ce1b6..3829ad386ee3e 100644 --- a/clang/test/SemaObjC/comptypes-1.m +++ b/clang/test/SemaObjC/comptypes-1.m @@ -37,9 +37,9 @@ int main(void) warning, unless done from an 'id'. */ obj_c = obj; /* Ok */ obj_c = obj_p; // expected-warning {{assigning to 'MyClass *' from incompatible type 'id'}} - obj_c = obj_cp; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'MyOtherClass *'}} - obj_c = obj_C; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'Class'}} - obj_c = obj_CP; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'Class'}} + obj_c = obj_cp; // expected-error {{incompatible pointer types assigning to 'MyClass *' from 'MyOtherClass *'}} + obj_c = obj_C; // expected-error {{incompatible pointer types assigning to 'MyClass *' from 'Class'}} + obj_c = obj_CP; // expected-error {{incompatible pointer types assigning to 'MyClass *' from 'Class'}} /* Assigning to an 'id' variable should generate a warning if done from a 'MyClass *' (which doesn't implement @@ -48,28 +48,28 @@ int main(void) obj_p = obj; /* Ok */ obj_p = obj_c; // expected-warning {{assigning to 'id' from incompatible type 'MyClass *'}} obj_p = obj_cp; /* Ok */ - obj_p = obj_C; // expected-warning {{incompatible pointer types assigning to 'id' from 'Class'}} + obj_p = obj_C; // expected-error {{incompatible pointer types assigning to 'id' from 'Class'}} obj_p = obj_CP; // expected-warning {{assigning to 'id' from incompatible type 'Class'}} /* Assigning to a 'MyOtherClass *' variable should always generate a warning, unless done from an 'id' or an 'id' (since MyOtherClass implements MyProtocol). */ obj_cp = obj; /* Ok */ - obj_cp = obj_c; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'MyClass *'}} + obj_cp = obj_c; // expected-error {{incompatible pointer types assigning to 'MyOtherClass *' from 'MyClass *'}} obj_cp = obj_p; /* Ok */ - obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}} - obj_cp = obj_CP; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}} + obj_cp = obj_C; // expected-error {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}} + obj_cp = obj_CP; // expected-error {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}} obj_C = obj; // Ok - obj_C = obj_p; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id'}} - obj_C = obj_c; // expected-warning {{incompatible pointer types assigning to 'Class' from 'MyClass *'}} - obj_C = obj_cp; // expected-warning {{incompatible pointer types assigning to 'Class' from 'MyOtherClass *'}} + obj_C = obj_p; // expected-error {{incompatible pointer types assigning to 'Class' from 'id'}} + obj_C = obj_c; // expected-error {{incompatible pointer types assigning to 'Class' from 'MyClass *'}} + obj_C = obj_cp; // expected-error {{incompatible pointer types assigning to 'Class' from 'MyOtherClass *'}} obj_C = obj_CP; // Ok obj_CP = obj; // Ok obj_CP = obj_p; // expected-warning {{assigning to 'Class' from incompatible type 'id'}} - obj_CP = obj_c; // expected-warning {{incompatible pointer types assigning to 'Class' from 'MyClass *}} - obj_CP = obj_cp; // expected-warning {{incompatible pointer types assigning to 'Class' from 'MyOtherClass *'}} + obj_CP = obj_c; // expected-error {{incompatible pointer types assigning to 'Class' from 'MyClass *}} + obj_CP = obj_cp; // expected-error {{incompatible pointer types assigning to 'Class' from 'MyOtherClass *'}} obj_CP = obj_C; // Ok /* Any comparison involving an 'id' must be without warnings. */ diff --git a/clang/test/SemaObjC/comptypes-4.m b/clang/test/SemaObjC/comptypes-4.m index f1c2e54570c74..b939af2defead 100644 --- a/clang/test/SemaObjC/comptypes-4.m +++ b/clang/test/SemaObjC/comptypes-4.m @@ -12,7 +12,7 @@ int main(void) MyClass *obj_cp; obj_cp = obj_p; - obj_p = obj_cp; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'MyClass *'}} + obj_p = obj_cp; // expected-error {{incompatible pointer types assigning to 'MyClass *' from 'MyClass *'}} if (obj_cp == obj_p) foo(); diff --git a/clang/test/SemaObjC/comptypes-5.m b/clang/test/SemaObjC/comptypes-5.m index 4b50684938c9b..fdf075b387bd7 100644 --- a/clang/test/SemaObjC/comptypes-5.m +++ b/clang/test/SemaObjC/comptypes-5.m @@ -38,7 +38,7 @@ int main(void) obj_c_cat_p = obj_c_super_p; // ok. obj_c_cat_p = obj_c_super_p_q; // ok. - obj_c_super_p = obj_c_cat_p_q; // expected-warning {{incompatible pointer types}} + obj_c_super_p = obj_c_cat_p_q; // expected-error {{incompatible pointer types}} obj_c_cat_p_q = obj_c_super_p; return 0; } diff --git a/clang/test/SemaObjC/comptypes-6.m b/clang/test/SemaObjC/comptypes-6.m index 98cf488792123..0e1c3e31035c1 100644 --- a/clang/test/SemaObjC/comptypes-6.m +++ b/clang/test/SemaObjC/comptypes-6.m @@ -9,7 +9,7 @@ @interface Object @end static Derived *test(void) { - Derived *m = foo(); // expected-warning {{incompatible pointer types initializing 'Derived *' with an expression of type 'Object *'}} + Derived *m = foo(); // expected-error {{incompatible pointer types initializing 'Derived *' with an expression of type 'Object *'}} return m; } diff --git a/clang/test/SemaObjC/comptypes-7.m b/clang/test/SemaObjC/comptypes-7.m index 5de24837c7bf8..eac06c89e8809 100644 --- a/clang/test/SemaObjC/comptypes-7.m +++ b/clang/test/SemaObjC/comptypes-7.m @@ -25,26 +25,26 @@ int main(void) incompatible integer to/from pointer conversions default to an error. */ obj = i; // expected-error {{incompatible integer to pointer conversion assigning to 'id' from 'int'}} - obj = j; // expected-warning {{incompatible pointer types assigning to 'id' from 'int *'}} + obj = j; // expected-error {{incompatible pointer types assigning to 'id' from 'int *'}} obj_p = i; // expected-error {{incompatible integer to pointer conversion assigning to 'id' from 'int'}} - obj_p = j; // expected-warning {{incompatible pointer types assigning to 'id' from 'int *'}} + obj_p = j; // expected-error {{incompatible pointer types assigning to 'id' from 'int *'}} obj_c = i; // expected-error {{incompatible integer to pointer conversion assigning to 'MyClass *' from 'int'}} - obj_c = j; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'int *'}} + obj_c = j; // expected-error {{incompatible pointer types assigning to 'MyClass *' from 'int *'}} obj_C = i; // expected-error {{incompatible integer to pointer conversion assigning to 'Class' from 'int'}} - obj_C = j; // expected-warning {{incompatible pointer types assigning to 'Class' from 'int *'}} + obj_C = j; // expected-error {{incompatible pointer types assigning to 'Class' from 'int *'}} i = obj; // expected-error {{incompatible pointer to integer conversion assigning to 'int' from 'id'}} i = obj_p; // expected-error {{incompatible pointer to integer conversion assigning to 'int' from 'id'}} i = obj_c; // expected-error {{incompatible pointer to integer conversion assigning to 'int' from 'MyClass *'}} i = obj_C; // expected-error {{incompatible pointer to integer conversion assigning to 'int' from 'Class'}} - j = obj; // expected-warning {{incompatible pointer types assigning to 'int *' from 'id'}} - j = obj_p; // expected-warning {{incompatible pointer types assigning to 'int *' from 'id'}} - j = obj_c; // expected-warning {{incompatible pointer types assigning to 'int *' from 'MyClass *'}} - j = obj_C; // expected-warning {{incompatible pointer types assigning to 'int *' from 'Class'}} + j = obj; // expected-error {{incompatible pointer types assigning to 'int *' from 'id'}} + j = obj_p; // expected-error {{incompatible pointer types assigning to 'int *' from 'id'}} + j = obj_c; // expected-error {{incompatible pointer types assigning to 'int *' from 'MyClass *'}} + j = obj_C; // expected-error {{incompatible pointer types assigning to 'int *' from 'Class'}} if (obj == i) foo() ; // expected-warning {{comparison between pointer and integer ('id' and 'int')}} if (i == obj) foo() ; // expected-warning {{comparison between pointer and integer ('int' and 'id')}} diff --git a/clang/test/SemaObjC/conditional-expr-2.m b/clang/test/SemaObjC/conditional-expr-2.m index fdf3d1381a87f..23371aa463ab0 100644 --- a/clang/test/SemaObjC/conditional-expr-2.m +++ b/clang/test/SemaObjC/conditional-expr-2.m @@ -25,5 +25,5 @@ void foo (int i, NSKey *NSKeyValueCoding_NullValue, UpdatesList *nukedUpdatesLis obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}} key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}} key = i ? NSKeyValueCoding_NullValue : keysub; - keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}} + keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-error{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}} } diff --git a/clang/test/SemaObjC/conditional-expr.m b/clang/test/SemaObjC/conditional-expr.m index 71bdb1b2d341b..eb72c9b50d491 100644 --- a/clang/test/SemaObjC/conditional-expr.m +++ b/clang/test/SemaObjC/conditional-expr.m @@ -110,7 +110,7 @@ int f8(int a, A *x, A *y) { void f9(int a, A *x, A *y) { id l0 = (a ? x : y ); // Ok. y is of A object type and A is qualified by P0. A *l1 = (a ? x : y ); // Ok. y is of A object type and A is qualified by P0. - A *l2 = (a ? x : y ); // expected-warning {{incompatible pointer types initializing 'A *' with an expression of type 'A *'}} + A *l2 = (a ? x : y ); // expected-error {{incompatible pointer types initializing 'A *' with an expression of type 'A *'}} (void)[ (a ? x : y ) intProp ]; // Ok. Common type is A * and P0's property intProp is accessed. } @@ -123,9 +123,9 @@ void f11(int a, id x, id y) { } void f12(int a, A *x, A *y) { - A* l0 = (a ? x : y ); // expected-warning {{incompatible pointer types initializing 'A *' with an expression of type 'A *'}} + A* l0 = (a ? x : y ); // expected-error {{incompatible pointer types initializing 'A *' with an expression of type 'A *'}} } void f13(int a, B *x, E *y) { - int *ip = a ? x : y; // expected-warning{{expression of type 'A *'}} + int *ip = a ? x : y; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'A *'}} } diff --git a/clang/test/SemaObjC/id.m b/clang/test/SemaObjC/id.m index e599758dcafe7..dcebbec862f01 100644 --- a/clang/test/SemaObjC/id.m +++ b/clang/test/SemaObjC/id.m @@ -9,8 +9,8 @@ void foo(void) { // Test assignment compatibility of Class and id. No warning should be // produced. // Class and id are compatible. - S = T; // expected-warning {{incompatible pointer types assigning to 'id' from 'Class'}} - T = S; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id'}} + S = T; // expected-error {{incompatible pointer types assigning to 'id' from 'Class'}} + T = S; // expected-error {{incompatible pointer types assigning to 'Class' from 'id'}} R = T; T = R; R = S; S = R; } diff --git a/clang/test/SemaObjC/incompatible-protocol-qualified-types.m b/clang/test/SemaObjC/incompatible-protocol-qualified-types.m index 494d23e8b2678..b8264d1565fe5 100644 --- a/clang/test/SemaObjC/incompatible-protocol-qualified-types.m +++ b/clang/test/SemaObjC/incompatible-protocol-qualified-types.m @@ -21,15 +21,15 @@ @interface INTF @end INTF * Func2(INTF *p2) { - Func(p2); // expected-warning {{incompatible pointer types passing 'INTF *' to parameter of type 'INTF *'}} - return p2; // expected-warning {{incompatible pointer types returning 'INTF *' from a function with result type 'INTF *'}} + Func(p2); // expected-error {{incompatible pointer types passing 'INTF *' to parameter of type 'INTF *'}} + return p2; // expected-error {{incompatible pointer types returning 'INTF *' from a function with result type 'INTF *'}} } INTF * Func3(INTF *p2) { - return p2; // expected-warning {{incompatible pointer types returning 'INTF *' from a function with result type 'INTF *'}} + return p2; // expected-error {{incompatible pointer types returning 'INTF *' from a function with result type 'INTF *'}} } diff --git a/clang/test/SemaObjC/instancetype.m b/clang/test/SemaObjC/instancetype.m index 2fe2f5cd8c0b4..a9dd4c7b5d173 100644 --- a/clang/test/SemaObjC/instancetype.m +++ b/clang/test/SemaObjC/instancetype.m @@ -143,7 +143,7 @@ - (int)otherMethodInProto2; // expected-warning{{protocol method is expected to @implementation Subclass4 + (id)alloc { - return self; // expected-warning{{incompatible pointer types returning 'Class' from a function with result type 'Subclass4 *'}} + return self; // expected-error{{incompatible pointer types returning 'Class' from a function with result type 'Subclass4 *'}} } - (Subclass3 *)init { return 0; } // don't complain: we lost the related return type @@ -166,12 +166,12 @@ void test_instancetype_inherited(void) { @implementation Subclass2 - (instancetype)initSubclass2 { // expected-note {{explicitly declared 'instancetype'}} Subclass1 *sc1 = [[Subclass1 alloc] init]; - return sc1; // expected-warning{{incompatible pointer types returning 'Subclass1 *' from a function with result type 'Subclass2 *'}} + return sc1; // expected-error{{incompatible pointer types returning 'Subclass1 *' from a function with result type 'Subclass2 *'}} } - (void)methodOnSubclass2 {} - (id)self { Subclass1 *sc1 = [[Subclass1 alloc] init]; - return sc1; // expected-warning{{incompatible pointer types returning 'Subclass1 *' from a function with result type 'Subclass2 *'}} + return sc1; // expected-error{{incompatible pointer types returning 'Subclass1 *' from a function with result type 'Subclass2 *'}} } @end @@ -201,10 +201,10 @@ @implementation A4 { B4 *_b; } - (id) foo { - return _b; // expected-warning {{incompatible pointer types returning 'B4 *' from a function with result type 'A4 *'}} + return _b; // expected-error {{incompatible pointer types returning 'B4 *' from a function with result type 'A4 *'}} } - (id) bar { - return _b; // expected-warning {{incompatible pointer types returning 'B4 *' from a function with result type 'A4 *'}} + return _b; // expected-error {{incompatible pointer types returning 'B4 *' from a function with result type 'A4 *'}} } // This is really just to ensure that we don't crash. diff --git a/clang/test/SemaObjC/ivar-lookup.m b/clang/test/SemaObjC/ivar-lookup.m index d88299e58e0f5..8854b1c212da6 100644 --- a/clang/test/SemaObjC/ivar-lookup.m +++ b/clang/test/SemaObjC/ivar-lookup.m @@ -29,7 +29,7 @@ - (int*)method; @implementation A - (int*)method { - int *ip = [Ivar method]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'float *'}} + int *ip = [Ivar method]; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'float *'}} // Note that there is no warning in Objective-C++ return 0; } diff --git a/clang/test/SemaObjC/kindof.m b/clang/test/SemaObjC/kindof.m index 1462814e36984..84da9a7f5d33a 100644 --- a/clang/test/SemaObjC/kindof.m +++ b/clang/test/SemaObjC/kindof.m @@ -75,16 +75,16 @@ - (NSNumber *)numberByAddingNumber:(NSNumber *)number; // --------------------------------------------------------------------------- void test_pretty_print(int *ip) { __kindof NSObject *kindof_NSObject; - ip = kindof_NSObject; // expected-warning{{from '__kindof NSObject *'}} + ip = kindof_NSObject; // expected-error{{from '__kindof NSObject *'}} __kindof NSObject_ptr_typedef kindof_NSObject_ptr; - ip = kindof_NSObject_ptr; // expected-warning{{from '__kindof NSObject_ptr_typedef'}} + ip = kindof_NSObject_ptr; // expected-error{{from '__kindof NSObject_ptr_typedef'}} __kindof id *kindof_NSCopying; - ip = kindof_NSCopying; // expected-warning{{from '__kindof id *'}} + ip = kindof_NSCopying; // expected-error{{from '__kindof id *'}} __kindof NSObject_ptr_typedef *kindof_NSObject_ptr_typedef; - ip = kindof_NSObject_ptr_typedef; // expected-warning{{from '__kindof NSObject_ptr_typedef *'}} + ip = kindof_NSObject_ptr_typedef; // expected-error{{from '__kindof NSObject_ptr_typedef *'}} } // --------------------------------------------------------------------------- @@ -161,9 +161,9 @@ void test_downcast_conversions(void) { // Implicit downcasting. kindof_NSString_obj = kindof_NSObject_obj; - kindof_NSString_obj = NSObject_obj; // expected-warning{{assigning to '__kindof NSString *' from 'NSObject *'}} + kindof_NSString_obj = NSObject_obj; // expected-error{{assigning to '__kindof NSString *' from 'NSObject *'}} NSString_obj = kindof_NSObject_obj; - NSString_obj = NSObject_obj; // expected-warning{{assigning to 'NSString *' from 'NSObject *'}} + NSString_obj = NSObject_obj; // expected-error{{assigning to 'NSString *' from 'NSObject *'}} // Implicit downcasting with qualified id. __kindof id kindof_NSCopying_obj; @@ -184,7 +184,7 @@ void test_crosscast_conversions(void) { __kindof NSNumber *kindof_NSNumber_obj; NSNumber *NSNumber_obj; - NSString_obj = kindof_NSNumber_obj; // expected-warning{{from '__kindof NSNumber *'}} + NSString_obj = kindof_NSNumber_obj; // expected-error{{from '__kindof NSNumber *'}} } @interface NSCell : NSObject @@ -350,9 +350,9 @@ void implicit_convert_array(NSArray<__kindof NSString *> *kindofStringsArray, stringsArray = kindofStringsArray; // Other covariant and contravariant conversions still not permitted. - kindofStringsArray = mutStringsArray; // expected-warning{{incompatible pointer types}} - stringsArray = kindofMutStringsArray; // expected-warning{{incompatible pointer types}} - mutStringsArray = kindofStringsArray; // expected-warning{{incompatible pointer types}} + kindofStringsArray = mutStringsArray; // expected-error{{incompatible pointer types}} + stringsArray = kindofMutStringsArray; // expected-error{{incompatible pointer types}} + mutStringsArray = kindofStringsArray; // expected-error{{incompatible pointer types}} // Adding/removing nested __kindof is okay. NSArray *> *kindofStringsArrayArray; @@ -411,7 +411,7 @@ @interface NSDefaultGeneric : NSObject void testGeneric(NSGeneric *generic) { NSObject *NSObject_obj; // Assign from NSObject_obj to __kindof NSString*. - [generic test:NSObject_obj]; // expected-warning{{incompatible pointer types sending 'NSObject *' to parameter of type '__kindof NSString *'}} + [generic test:NSObject_obj]; // expected-error{{incompatible pointer types sending 'NSObject *' to parameter of type '__kindof NSString *'}} NSString *NSString_str; [generic test:NSString_str]; } @@ -421,29 +421,29 @@ void testGenericAssignment(void) { NSNumber *NSNumber_obj; NSGeneric *generic; - NSMutableString_str = generic.object; // expected-warning{{incompatible pointer types}} - NSNumber_obj = generic.object; // expected-warning{{incompatible pointer types}} + NSMutableString_str = generic.object; // expected-error{{incompatible pointer types}} + NSNumber_obj = generic.object; // expected-error{{incompatible pointer types}} NSMutableString_str = generic.kindof_object; - NSNumber_obj = generic.kindof_object; // expected-warning{{incompatible pointer types assigning to 'NSNumber *' from '__kindof NSString *'}} + NSNumber_obj = generic.kindof_object; // expected-error{{incompatible pointer types assigning to 'NSNumber *' from '__kindof NSString *'}} NSGeneric<__kindof NSString*> *kindof_generic; NSMutableString_str = kindof_generic.object; - NSNumber_obj = kindof_generic.object; // expected-warning{{incompatible pointer types assigning to 'NSNumber *' from '__kindof NSString *'}} + NSNumber_obj = kindof_generic.object; // expected-error{{incompatible pointer types assigning to 'NSNumber *' from '__kindof NSString *'}} NSMutableString_str = kindof_generic.kindof_object; - NSNumber_obj = kindof_generic.kindof_object; // expected-warning{{incompatible pointer types assigning to 'NSNumber *' from '__kindof __kindof NSString *'}} + NSNumber_obj = kindof_generic.kindof_object; // expected-error{{incompatible pointer types assigning to 'NSNumber *' from '__kindof __kindof NSString *'}} NSDefaultGeneric *default_generic; NSMutableString_str = default_generic.object; - NSNumber_obj = default_generic.object; // expected-warning{{incompatible pointer types}} + NSNumber_obj = default_generic.object; // expected-error{{incompatible pointer types}} NSMutableString_str = default_generic.kindof_object; - NSNumber_obj = default_generic.kindof_object; // expected-warning{{incompatible pointer types assigning to 'NSNumber *' from '__kindof __kindof NSString *'}} + NSNumber_obj = default_generic.kindof_object; // expected-error{{incompatible pointer types assigning to 'NSNumber *' from '__kindof __kindof NSString *'}} typedef NSString *Typedef_NSString; NSGeneric *typedef_generic; - NSMutableString_str = typedef_generic.object; // expected-warning{{incompatible pointer types}} - NSNumber_obj = typedef_generic.object; // expected-warning{{incompatible pointer types}} + NSMutableString_str = typedef_generic.object; // expected-error{{incompatible pointer types}} + NSNumber_obj = typedef_generic.object; // expected-error{{incompatible pointer types}} NSMutableString_str = typedef_generic.kindof_object; - NSNumber_obj = typedef_generic.kindof_object; // expected-warning{{incompatible pointer types assigning to 'NSNumber *' from '__kindof Typedef_NSString'}} + NSNumber_obj = typedef_generic.kindof_object; // expected-error{{incompatible pointer types assigning to 'NSNumber *' from '__kindof Typedef_NSString'}} } void testKindofNonObjectType(void) { diff --git a/clang/test/SemaObjC/method-prototype-scope.m b/clang/test/SemaObjC/method-prototype-scope.m index e1080cbfeaddd..2e4e1ce94ac90 100644 --- a/clang/test/SemaObjC/method-prototype-scope.m +++ b/clang/test/SemaObjC/method-prototype-scope.m @@ -18,7 +18,7 @@ @implementation Test - (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object // expected-warning {{redefinition of method parameter 'object'}} \ // expected-note {{previous declaration is here}} { - return object; // expected-warning {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}} + return object; // expected-error {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}} } - Func:(int)XXXX, id object { return object; } // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}} diff --git a/clang/test/SemaObjC/nullability.m b/clang/test/SemaObjC/nullability.m index 0ab97a2cfbb24..da53335bf99f5 100644 --- a/clang/test/SemaObjC/nullability.m +++ b/clang/test/SemaObjC/nullability.m @@ -64,7 +64,7 @@ void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, _Nonnull NSBar *bar) bar.property2 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar setProperty1: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar setProperty2: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} - int *ptr = bar.property1; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} + int *ptr = bar.property1; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} } // Check returning nil from a nonnull-returning method. @@ -82,7 +82,7 @@ - (NSFoo *)conflictingMethod1 { } - (NSFoo *)redundantMethod1 { int *ip = 0; - return ip; // expected-warning{{result type 'NSFoo * _Nonnull'}} + return ip; // expected-error{{result type 'NSFoo * _Nonnull'}} } @end @@ -95,8 +95,8 @@ - (NSFoo *)methodC:(NSFoo*)foo; @implementation NSMerge - (NSFoo *)methodA:(NSFoo*)foo { - int *ptr = foo; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} - return ptr; // expected-warning{{result type 'NSFoo * _Nonnull'}} + int *ptr = foo; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} + return ptr; // expected-error{{result type 'NSFoo * _Nonnull'}} } - (nullable NSFoo *)methodB:(null_unspecified NSFoo*)foo { // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'nonnull'}} \ @@ -106,7 +106,7 @@ - (nullable NSFoo *)methodB:(null_unspecified NSFoo*)foo { // expected-error{{nu - (nonnull NSFoo *)methodC:(nullable NSFoo*)foo { int *ip = 0; - return ip; // expected-warning{{result type 'NSFoo * _Nonnull'}} + return ip; // expected-error{{result type 'NSFoo * _Nonnull'}} } @end @@ -126,31 +126,31 @@ void test_receiver_merge(NSMergeReceiver *none, _Null_unspecified NSMergeReceiver *null_unspecified) { int *ptr; - ptr = [nullable returnsNullable]; // expected-warning{{'id _Nullable'}} - ptr = [nullable returnsNullUnspecified]; // expected-warning{{'id _Nullable'}} - ptr = [nullable returnsNonNull]; // expected-warning{{'id _Nullable'}} - ptr = [nullable returnsNone]; // expected-warning{{'id _Nullable'}} - - ptr = [nullable_result returnsNullable]; // expected-warning{{'id _Nullable'}} - ptr = [nullable_result returnsNullUnspecified]; // expected-warning{{'id _Nullable'}} - ptr = [nullable_result returnsNonNull]; // expected-warning{{'id _Nullable'}} - ptr = [nullable_result returnsNone]; // expected-warning{{'id _Nullable'}} - ptr = [nullable_result returnsNullableResult]; // expected-warning{{'id _Nullable_result'}} - - ptr = [null_unspecified returnsNullable]; // expected-warning{{'id _Nullable'}} - ptr = [null_unspecified returnsNullUnspecified]; // expected-warning{{'id _Null_unspecified'}} - ptr = [null_unspecified returnsNonNull]; // expected-warning{{'id _Null_unspecified'}} - ptr = [null_unspecified returnsNone]; // expected-warning{{'id'}} - - ptr = [nonnull returnsNullable]; // expected-warning{{'id _Nullable'}} - ptr = [nonnull returnsNullUnspecified]; // expected-warning{{'id _Null_unspecified'}} - ptr = [nonnull returnsNonNull]; // expected-warning{{'id _Nonnull'}} - ptr = [nonnull returnsNone]; // expected-warning{{'id'}} - - ptr = [none returnsNullable]; // expected-warning{{'id _Nullable'}} - ptr = [none returnsNullUnspecified]; // expected-warning{{'id'}} - ptr = [none returnsNonNull]; // expected-warning{{'id'}} - ptr = [none returnsNone]; // expected-warning{{'id'}} + ptr = [nullable returnsNullable]; // expected-error{{'id _Nullable'}} + ptr = [nullable returnsNullUnspecified]; // expected-error{{'id _Nullable'}} + ptr = [nullable returnsNonNull]; // expected-error{{'id _Nullable'}} + ptr = [nullable returnsNone]; // expected-error{{'id _Nullable'}} + + ptr = [nullable_result returnsNullable]; // expected-error{{'id _Nullable'}} + ptr = [nullable_result returnsNullUnspecified]; // expected-error{{'id _Nullable'}} + ptr = [nullable_result returnsNonNull]; // expected-error{{'id _Nullable'}} + ptr = [nullable_result returnsNone]; // expected-error{{'id _Nullable'}} + ptr = [nullable_result returnsNullableResult]; // expected-error{{'id _Nullable_result'}} + + ptr = [null_unspecified returnsNullable]; // expected-error{{'id _Nullable'}} + ptr = [null_unspecified returnsNullUnspecified]; // expected-error{{'id _Null_unspecified'}} + ptr = [null_unspecified returnsNonNull]; // expected-error{{'id _Null_unspecified'}} + ptr = [null_unspecified returnsNone]; // expected-error{{'id'}} + + ptr = [nonnull returnsNullable]; // expected-error{{'id _Nullable'}} + ptr = [nonnull returnsNullUnspecified]; // expected-error{{'id _Null_unspecified'}} + ptr = [nonnull returnsNonNull]; // expected-error{{'id _Nonnull'}} + ptr = [nonnull returnsNone]; // expected-error{{'id'}} + + ptr = [none returnsNullable]; // expected-error{{'id _Nullable'}} + ptr = [none returnsNullUnspecified]; // expected-error{{'id'}} + ptr = [none returnsNonNull]; // expected-error{{'id'}} + ptr = [none returnsNone]; // expected-error{{'id'}} } @@ -171,13 +171,13 @@ + (_Nonnull instancetype)returnInstanceOfMe2; @end void test_instancetype(InitializableClass * _Nonnull ic, id _Nonnull object) { - int *ip = [ic returnMe]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * _Nullable'}} - ip = [InitializableClass returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} - ip = [InitializableClass returnInstanceOfMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} - ip = [object returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} + int *ip = [ic returnMe]; // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * _Nullable'}} + ip = [InitializableClass returnMe]; // expected-error{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} + ip = [InitializableClass returnInstanceOfMe]; // expected-error{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} + ip = [object returnMe]; // expected-error{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} - ip = [ic returnMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} - ip = [InitializableClass returnInstanceOfMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nonnull'}} + ip = [ic returnMe2]; // expected-error{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} + ip = [InitializableClass returnInstanceOfMe2]; // expected-error{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nonnull'}} } // Check null_resettable getters/setters. @@ -192,14 +192,14 @@ @interface NSResettable @end void test_null_resettable(NSResettable *r, int *ip) { - [r setResettable1:ip]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * _Nullable'}} - r.resettable1 = ip; // expected-warning{{incompatible pointer types assigning to 'NSResettable * _Nullable' from 'int *'}} + [r setResettable1:ip]; // expected-error{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * _Nullable'}} + r.resettable1 = ip; // expected-error{{incompatible pointer types assigning to 'NSResettable * _Nullable' from 'int *'}} } @implementation NSResettable // expected-warning{{synthesized setter 'setResettable4:' for null_resettable property 'resettable4' does not handle nil}} - (NSResettable *)resettable1 { int *ip = 0; - return ip; // expected-warning{{result type 'NSResettable * _Nonnull'}} + return ip; // expected-error{{result type 'NSResettable * _Nonnull'}} } - (void)setResettable1:(NSResettable *)param { @@ -225,8 +225,8 @@ @interface MultiProp void testMultiProp(MultiProp *foo) { int *ip; - ip = foo.a; // expected-warning{{from 'id _Nullable'}} - ip = foo.d; // expected-warning{{from 'MultiProp * _Nullable'}} + ip = foo.a; // expected-error{{from 'id _Nullable'}} + ip = foo.d; // expected-error{{from 'MultiProp * _Nullable'}} ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^ _Nullable)(int)'}} } @@ -235,7 +235,7 @@ void testBlockLiterals(void) { (void)(^id _Nullable (void) { return 0; }); (void)(^ _Nullable id(void) { return 0; }); - int *x = (^ _Nullable id(void) { return 0; })(); // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'id _Nullable'}} + int *x = (^ _Nullable id(void) { return 0; })(); // expected-error{{incompatible pointer types initializing 'int *' with an expression of type 'id _Nullable'}} } // Check nullability of conditional expressions. diff --git a/clang/test/SemaObjC/objcbridge-related-attribute.m b/clang/test/SemaObjC/objcbridge-related-attribute.m index e56678436bf30..f281bc7f9ab22 100644 --- a/clang/test/SemaObjC/objcbridge-related-attribute.m +++ b/clang/test/SemaObjC/objcbridge-related-attribute.m @@ -24,9 +24,9 @@ - (NSColor *)backgroundColor; } NSColor * Test2(NSTextField *textField, CGColorRef1 newColor) { - foo(newColor); // expected-warning {{incompatible pointer types passing 'CGColorRef1'}} - textField.backgroundColor = newColor; // expected-warning {{incompatible pointer types assigning}} - return newColor; // expected-warning {{incompatible pointer types returning}} + foo(newColor); // expected-error {{incompatible pointer types passing 'CGColorRef1'}} + textField.backgroundColor = newColor; // expected-error {{incompatible pointer types assigning}} + return newColor; // expected-error {{incompatible pointer types returning}} } CGColorRef Test3(NSTextField *textField, CGColorRef newColor) { @@ -35,6 +35,6 @@ CGColorRef Test3(NSTextField *textField, CGColorRef newColor) { } CGColorRef2 Test4(NSTextField *textField, CGColorRef2 newColor) { - newColor = textField.backgroundColor; // expected-warning {{incompatible pointer types assigning}} - return textField.backgroundColor; // expected-warning {{incompatible pointer types returning}} + newColor = textField.backgroundColor; // expected-error {{incompatible pointer types assigning}} + return textField.backgroundColor; // expected-error {{incompatible pointer types returning}} } diff --git a/clang/test/SemaObjC/parameterized_classes.m b/clang/test/SemaObjC/parameterized_classes.m index 2b1dcc91a010f..b95bb4733c666 100644 --- a/clang/test/SemaObjC/parameterized_classes.m +++ b/clang/test/SemaObjC/parameterized_classes.m @@ -301,11 +301,11 @@ @interface PC15> : NSObject void testSpecializedTypePrinting(void) { int *ip; - ip = (typeArgs15*)0; // expected-warning{{'typeArgs15 *' (aka 'PC1 *')}} - ip = (typeArgsAndProtocolQuals4*)0; // expected-warning{{'typeArgsAndProtocolQuals4 *' (aka 'PC1 *')}} - ip = (typeArgsAndProtocolQuals5*)0; // expected-warning{{'typeArgsAndProtocolQuals5 *' (aka 'typeArgs15 *')}} + ip = (typeArgs15*)0; // expected-error{{'typeArgs15 *' (aka 'PC1 *')}} + ip = (typeArgsAndProtocolQuals4*)0; // expected-error{{'typeArgsAndProtocolQuals4 *' (aka 'PC1 *')}} + ip = (typeArgsAndProtocolQuals5*)0; // expected-error{{'typeArgsAndProtocolQuals5 *' (aka 'typeArgs15 *')}} ip = (typeArgsAndProtocolQuals6)0; // expected-error{{used type 'typeArgsAndProtocolQuals6' (aka 'typeArgs15')}} - ip = (typeArgsAndProtocolQuals6*)0;// expected-warning{{'typeArgsAndProtocolQuals6 *' (aka 'typeArgs15 *')}} + ip = (typeArgsAndProtocolQuals6*)0;// expected-error{{'typeArgsAndProtocolQuals6 *' (aka 'typeArgs15 *')}} } // -------------------------------------------------------------------------- diff --git a/clang/test/SemaObjC/parameterized_classes_arc.m b/clang/test/SemaObjC/parameterized_classes_arc.m index 623de5be3b4ce..f12842b73a400 100644 --- a/clang/test/SemaObjC/parameterized_classes_arc.m +++ b/clang/test/SemaObjC/parameterized_classes_arc.m @@ -31,18 +31,18 @@ void test1c(PC1 *obj) { // Test that this doesn't completely kill downstream type-checking. void test1d(PC1<__weak Forward*> *obj) { // expected-error {{type argument 'Forward *__weak' cannot be qualified with '__weak'}} - Forward2 *x = [obj get]; // expected-warning {{incompatible}} - [obj set: x]; // expected-warning {{incompatible}} + Forward2 *x = [obj get]; // expected-error {{incompatible}} + [obj set: x]; // expected-error {{incompatible}} } void test1e(PC1<__strong Forward*> *obj) { // expected-error {{type argument 'Forward *__strong' cannot be qualified with '__strong'}} - Forward2 *x = [obj get]; // expected-warning {{incompatible}} - [obj set: x]; // expected-warning {{incompatible}} + Forward2 *x = [obj get]; // expected-error {{incompatible}} + [obj set: x]; // expected-error {{incompatible}} } void test1f(PC1 *obj) { - Forward2 *x = [obj get]; // expected-warning {{incompatible}} - [obj set: x]; // expected-warning {{incompatible}} + Forward2 *x = [obj get]; // expected-error {{incompatible}} + [obj set: x]; // expected-error {{incompatible}} } // Typedefs are fine, just silently ignore them. @@ -54,8 +54,8 @@ void test1g(PC1 *obj) { typedef __strong Forward *StrongForward; void test1h(PC1 *obj) { - Forward2 *x = [obj get]; // expected-warning {{incompatible}} - [obj set: x]; // expected-warning {{incompatible}} + Forward2 *x = [obj get]; // expected-error {{incompatible}} + [obj set: x]; // expected-error {{incompatible}} } // These aren't really ARC-specific, but they're the same basic idea. diff --git a/clang/test/SemaObjC/parameterized_classes_subst.m b/clang/test/SemaObjC/parameterized_classes_subst.m index 98dd88c3bc98e..3358194845fc3 100644 --- a/clang/test/SemaObjC/parameterized_classes_subst.m +++ b/clang/test/SemaObjC/parameterized_classes_subst.m @@ -156,37 +156,37 @@ void test_message_send_result( NSArray<__kindof NSString *> *kindofStringArray, void (^block)(void)) { int *ip; - ip = [stringSet firstObject]; // expected-warning{{from 'NSString *'}} - ip = [mutStringSet firstObject]; // expected-warning{{from 'NSString *'}} - ip = [widgetSet firstObject]; // expected-warning{{from 'Widget *'}} - ip = [untypedMutSet firstObject]; // expected-warning{{from 'id'}} - ip = [mutStringArraySet firstObject]; // expected-warning{{from 'NSArray *'}} - ip = [set firstObject]; // expected-warning{{from 'id'}} - ip = [mutSet firstObject]; // expected-warning{{from 'id'}} - ip = [mutArraySet firstObject]; // expected-warning{{from 'id'}} - ip = [block firstObject]; // expected-warning{{from 'id'}} - - ip = [stringSet findObject:@"blah"]; // expected-warning{{from 'NSString *'}} + ip = [stringSet firstObject]; // expected-error{{from 'NSString *'}} + ip = [mutStringSet firstObject]; // expected-error{{from 'NSString *'}} + ip = [widgetSet firstObject]; // expected-error{{from 'Widget *'}} + ip = [untypedMutSet firstObject]; // expected-error{{from 'id'}} + ip = [mutStringArraySet firstObject]; // expected-error{{from 'NSArray *'}} + ip = [set firstObject]; // expected-error{{from 'id'}} + ip = [mutSet firstObject]; // expected-error{{from 'id'}} + ip = [mutArraySet firstObject]; // expected-error{{from 'id'}} + ip = [block firstObject]; // expected-error{{from 'id'}} + + ip = [stringSet findObject:@"blah"]; // expected-error{{from 'NSString *'}} // Class messages. - ip = [NSSet alloc]; // expected-warning{{from 'NSSet *'}} - ip = [NSSet alloc]; // expected-warning{{from 'NSSet *'}} - ip = [MutableSetOfArrays alloc]; // expected-warning{{from 'MutableSetOfArrays *'}} - ip = [MutableSetOfArrays alloc]; // expected-warning{{from 'MutableSetOfArrays *'}} - ip = [NSArray array]; // expected-warning{{from 'NSArray *'}} - ip = [NSArray array]; // expected-warning{{from 'NSArray *'}} + ip = [NSSet alloc]; // expected-error{{from 'NSSet *'}} + ip = [NSSet alloc]; // expected-error{{from 'NSSet *'}} + ip = [MutableSetOfArrays alloc]; // expected-error{{from 'MutableSetOfArrays *'}} + ip = [MutableSetOfArrays alloc]; // expected-error{{from 'MutableSetOfArrays *'}} + ip = [NSArray array]; // expected-error{{from 'NSArray *'}} + ip = [NSArray array]; // expected-error{{from 'NSArray *'}} - ip = [[NSMutableArray alloc] init]; // expected-warning{{from 'NSMutableArray *'}} + ip = [[NSMutableArray alloc] init]; // expected-error{{from 'NSMutableArray *'}} [[NSMutableArray alloc] initWithArray: stringArray]; // okay [[NSMutableArray alloc] initWithArray: stringArray]; // okay - [[NSMutableArray alloc] initWithArray: stringArray]; // expected-warning{{sending 'NSArray *' to parameter of type 'NSArray *'}} + [[NSMutableArray alloc] initWithArray: stringArray]; // expected-error{{sending 'NSArray *' to parameter of type 'NSArray *'}} - ip = [[[NSViewController alloc] init] view]; // expected-warning{{from '__kindof NSView *'}} + ip = [[[NSViewController alloc] init] view]; // expected-error{{from '__kindof NSView *'}} [[[[NSViewController alloc] init] view] toggle]; NSMutableString *mutStr = kindofStringArray[0]; - NSNumber *number = kindofStringArray[0]; // expected-warning{{of type '__kindof NSString *'}} + NSNumber *number = kindofStringArray[0]; // expected-error{{of type '__kindof NSString *'}} } void test_message_send_param( @@ -200,13 +200,13 @@ void test_message_send_param( void (^block)(void)) { Window *window; - [mutStringSet addObject: window]; // expected-warning{{parameter of type 'NSString *'}} - [widgetSet addObject: window]; // expected-warning{{parameter of type 'Widget *'}} + [mutStringSet addObject: window]; // expected-error{{parameter of type 'NSString *'}} + [widgetSet addObject: window]; // expected-error{{parameter of type 'Widget *'}} [untypedMutSet addObject: window]; // expected-warning{{parameter of incompatible type 'id'}} - [mutStringArraySet addObject: window]; // expected-warning{{parameter of type 'NSArray *'}} + [mutStringArraySet addObject: window]; // expected-error{{parameter of type 'NSArray *'}} [mutSet addObject: window]; // expected-warning{{parameter of incompatible type 'id'}} [mutArraySet addObject: window]; // expected-warning{{parameter of incompatible type 'id'}} - [typedefTypeParam test: window]; // expected-warning{{parameter of type 'NSString *'}} + [typedefTypeParam test: window]; // expected-error{{parameter of type 'NSString *'}} [block addObject: window]; // expected-warning{{parameter of incompatible type 'id'}} } @@ -224,18 +224,18 @@ void test_property_read( MutableSetOfArrays *mutArraySet, NSMutableDictionary *mutDict) { int *ip; - ip = stringSet.allObjects; // expected-warning{{from 'NSArray *'}} - ip = mutStringSet.allObjects; // expected-warning{{from 'NSArray *'}} - ip = widgetSet.allObjects; // expected-warning{{from 'NSArray *'}} - ip = untypedMutSet.allObjects; // expected-warning{{from 'NSArray *'}} - ip = mutStringArraySet.allObjects; // expected-warning{{from 'NSArray *> *'}} - ip = set.allObjects; // expected-warning{{from 'NSArray *'}} - ip = mutSet.allObjects; // expected-warning{{from 'NSArray *'}} - ip = mutArraySet.allObjects; // expected-warning{{from 'NSArray *'}} - - ip = mutDict.someRandomKey; // expected-warning{{from '__kindof id'}} - - ip = [[NSViewController alloc] init].view; // expected-warning{{from '__kindof NSView *'}} + ip = stringSet.allObjects; // expected-error{{from 'NSArray *'}} + ip = mutStringSet.allObjects; // expected-error{{from 'NSArray *'}} + ip = widgetSet.allObjects; // expected-error{{from 'NSArray *'}} + ip = untypedMutSet.allObjects; // expected-error{{from 'NSArray *'}} + ip = mutStringArraySet.allObjects; // expected-error{{from 'NSArray *> *'}} + ip = set.allObjects; // expected-error{{from 'NSArray *'}} + ip = mutSet.allObjects; // expected-error{{from 'NSArray *'}} + ip = mutArraySet.allObjects; // expected-error{{from 'NSArray *'}} + + ip = mutDict.someRandomKey; // expected-error{{from '__kindof id'}} + + ip = [[NSViewController alloc] init].view; // expected-error{{from '__kindof NSView *'}} } void test_property_write( @@ -248,14 +248,14 @@ void test_property_write( NSMutableDictionary *mutDict) { int *ip; - mutStringSet.allObjects = ip; // expected-warning{{to 'NSArray *'}} - widgetSet.allObjects = ip; // expected-warning{{to 'NSArray *'}} - untypedMutSet.allObjects = ip; // expected-warning{{to 'NSArray *'}} - mutStringArraySet.allObjects = ip; // expected-warning{{to 'NSArray *> *'}} - mutSet.allObjects = ip; // expected-warning{{to 'NSArray *'}} - mutArraySet.allObjects = ip; // expected-warning{{to 'NSArray *'}} + mutStringSet.allObjects = ip; // expected-error{{to 'NSArray *'}} + widgetSet.allObjects = ip; // expected-error{{to 'NSArray *'}} + untypedMutSet.allObjects = ip; // expected-error{{to 'NSArray *'}} + mutStringArraySet.allObjects = ip; // expected-error{{to 'NSArray *> *'}} + mutSet.allObjects = ip; // expected-error{{to 'NSArray *'}} + mutArraySet.allObjects = ip; // expected-error{{to 'NSArray *'}} - mutDict.someRandomKey = ip; // expected-warning{{to 'id'}} + mutDict.someRandomKey = ip; // expected-error{{to 'id'}} } // -------------------------------------------------------------------------- @@ -275,28 +275,28 @@ void test_subscripting( Widget *widget; Window *window; - ip = stringArray[0]; // expected-warning{{from 'NSString *'}} + ip = stringArray[0]; // expected-error{{from 'NSString *'}} - ip = mutStringArray[0]; // expected-warning{{from 'NSString *'}} - mutStringArray[0] = ip; // expected-warning{{parameter of type 'NSString *'}} + ip = mutStringArray[0]; // expected-error{{from 'NSString *'}} + mutStringArray[0] = ip; // expected-error{{parameter of type 'NSString *'}} - ip = array[0]; // expected-warning{{from 'id'}} + ip = array[0]; // expected-error{{from 'id'}} - ip = mutArray[0]; // expected-warning{{from 'id'}} - mutArray[0] = ip; // expected-warning{{parameter of type 'id'}} + ip = mutArray[0]; // expected-error{{from 'id'}} + mutArray[0] = ip; // expected-error{{parameter of type 'id'}} - ip = stringWidgetDict[string]; // expected-warning{{from 'Widget *'}} - widget = stringWidgetDict[widget]; // expected-warning{{to parameter of type 'NSString *'}} + ip = stringWidgetDict[string]; // expected-error{{from 'Widget *'}} + widget = stringWidgetDict[widget]; // expected-error{{to parameter of type 'NSString *'}} - ip = mutStringWidgetDict[string]; // expected-warning{{from 'Widget *'}} - widget = mutStringWidgetDict[widget]; // expected-warning{{to parameter of type 'NSString *'}} - mutStringWidgetDict[string] = ip; // expected-warning{{to parameter of type 'Widget *'}} - mutStringWidgetDict[widget] = widget; // expected-warning{{to parameter of type 'NSString *'}} + ip = mutStringWidgetDict[string]; // expected-error{{from 'Widget *'}} + widget = mutStringWidgetDict[widget]; // expected-error{{to parameter of type 'NSString *'}} + mutStringWidgetDict[string] = ip; // expected-error{{to parameter of type 'Widget *'}} + mutStringWidgetDict[widget] = widget; // expected-error{{to parameter of type 'NSString *'}} - ip = dict[string]; // expected-warning{{from 'id'}} + ip = dict[string]; // expected-error{{from 'id'}} - ip = mutDict[string]; // expected-warning{{from 'id'}} - mutDict[string] = ip; // expected-warning{{to parameter of type 'id'}} + ip = mutDict[string]; // expected-error{{from 'id'}} + mutDict[string] = ip; // expected-error{{to parameter of type 'id'}} widget = mutDict[window]; mutDict[window] = widget; // expected-warning{{parameter of incompatible type 'id'}} @@ -309,15 +309,15 @@ void test_instance_variable(NSArray *stringArray, NSArray *array) { int *ip; - ip = stringArray->data; // expected-warning{{from 'NSString **'}} - ip = array->data; // expected-warning{{from 'id *'}} + ip = stringArray->data; // expected-error{{from 'NSString **'}} + ip = array->data; // expected-error{{from 'id *'}} } @implementation WindowArray - (void)testInstanceVariable { int *ip; - ip = data; // expected-warning{{from 'Window **'}} + ip = data; // expected-error{{from 'Window **'}} } @end @@ -336,13 +336,13 @@ void test_implicit_conversions(NSArray *stringArray, stringArray = array; // Specialized -> specialized failure (same level). - stringArray = numberArray; // expected-warning{{incompatible pointer types assigning to 'NSArray *' from 'NSArray *'}} + stringArray = numberArray; // expected-error{{incompatible pointer types assigning to 'NSArray *' from 'NSArray *'}} // Specialized -> specialized (different levels). stringArray = mutStringArray; // Specialized -> specialized failure (different levels). - numberArray = mutStringArray; // expected-warning{{incompatible pointer types assigning to 'NSArray *' from 'NSMutableArray *'}} + numberArray = mutStringArray; // expected-error{{incompatible pointer types assigning to 'NSArray *' from 'NSMutableArray *'}} // Unspecialized -> specialized (different levels). stringArray = mutArray; @@ -366,10 +366,10 @@ void test_variance(NSCovariant1 *covariant1, NSContravariant1 *contravariant1, NSContravariant1 *contravariant2) { covariant1 = covariant2; // okay - covariant2 = covariant1; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} + covariant2 = covariant1; // expected-error{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} covariant3 = covariant4; // okay - covariant4 = covariant3; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} + covariant4 = covariant3; // expected-error{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} covariant5 = covariant1; // okay covariant1 = covariant5; // okay: id is promiscuous @@ -377,7 +377,7 @@ void test_variance(NSCovariant1 *covariant1, covariant5 = covariant3; // okay covariant3 = covariant5; // okay - contravariant1 = contravariant2; // expected-warning{{incompatible pointer types assigning to 'NSContravariant1 *' from 'NSContravariant1 *'}} + contravariant1 = contravariant2; // expected-error{{incompatible pointer types assigning to 'NSContravariant1 *' from 'NSContravariant1 *'}} contravariant2 = contravariant1; // okay } @@ -394,19 +394,19 @@ void test_ternary_operator(NSArray *stringArray, int *ip; id object; - ip = cond ? stringArray : mutStringArray; // expected-warning{{from 'NSArray *'}} - ip = cond ? mutStringArray : stringArray; // expected-warning{{from 'NSArray *'}} + ip = cond ? stringArray : mutStringArray; // expected-error{{from 'NSArray *'}} + ip = cond ? mutStringArray : stringArray; // expected-error{{from 'NSArray *'}} - ip = cond ? stringArray2 : mutStringArray; // expected-warning{{from 'NSArray *'}} - ip = cond ? mutStringArray : stringArray2; // expected-warning{{from 'NSArray *'}} + ip = cond ? stringArray2 : mutStringArray; // expected-error{{from 'NSArray *'}} + ip = cond ? mutStringArray : stringArray2; // expected-error{{from 'NSArray *'}} - ip = cond ? stringArray : mutArray; // expected-warning{{from 'NSArray *'}} + ip = cond ? stringArray : mutArray; // expected-error{{from 'NSArray *'}} - ip = cond ? stringArray2 : mutArray; // expected-warning{{from 'NSArray *'}} + ip = cond ? stringArray2 : mutArray; // expected-error{{from 'NSArray *'}} - ip = cond ? mutArray : stringArray; // expected-warning{{from 'NSArray *'}} + ip = cond ? mutArray : stringArray; // expected-error{{from 'NSArray *'}} - ip = cond ? mutArray : stringArray2; // expected-warning{{from 'NSArray *'}} + ip = cond ? mutArray : stringArray2; // expected-error{{from 'NSArray *'}} object = cond ? stringArray : numberArray; // expected-warning{{incompatible operand types ('NSArray *' and 'NSArray *')}} } @@ -417,16 +417,16 @@ void test_ternary_operator(NSArray *stringArray, @implementation NSStringArray - (void)useSuperMethod { int *ip; - ip = super.lastObject; // expected-warning{{from 'NSString *'}} - super.lastObject = ip; // expected-warning{{to 'NSString *'}} - ip = [super objectAtIndexedSubscript:0]; // expected-warning{{from 'NSString *'}} + ip = super.lastObject; // expected-error{{from 'NSString *'}} + super.lastObject = ip; // expected-error{{to 'NSString *'}} + ip = [super objectAtIndexedSubscript:0]; // expected-error{{from 'NSString *'}} } + (void)useSuperMethod { int *ip; - ip = super.array; // expected-warning{{from 'NSArray *'}} - super.array = ip; // expected-warning{{to 'NSArray *'}} - ip = [super array]; // expected-warning{{from 'NSArray *'}} + ip = super.array; // expected-error{{from 'NSArray *'}} + super.array = ip; // expected-error{{to 'NSArray *'}} + ip = [super array]; // expected-error{{from 'NSArray *'}} } @end @@ -443,8 +443,8 @@ - (void)setObject:(ObjectType)obj forKeyedSubscript:(KeyType )key; // void bar(MyMutableDictionary *stringsByString, NSNumber *n1, NSNumber *n2) { // We warn here when the key types do not match. - stringsByString[n1] = n2; // expected-warning{{incompatible pointer types sending 'NSNumber *' to parameter of type 'NSString *'}} \ - // expected-warning{{incompatible pointer types sending 'NSNumber *' to parameter of type 'NSString *'}} + stringsByString[n1] = n2; // expected-error{{incompatible pointer types sending 'NSNumber *' to parameter of type 'NSString *'}} \ + // expected-error{{incompatible pointer types sending 'NSNumber *' to parameter of type 'NSString *'}} } @interface MyTest : NSObject diff --git a/clang/test/SemaObjC/protocol-typecheck.m b/clang/test/SemaObjC/protocol-typecheck.m index 0166cc3c09f6e..9aa363f87cbf1 100644 --- a/clang/test/SemaObjC/protocol-typecheck.m +++ b/clang/test/SemaObjC/protocol-typecheck.m @@ -20,6 +20,6 @@ void func(void) { [obj setFlexElement:flexer]; // FIXME: GCC provides the following diagnostic (which is much better): // protocol-typecheck.m:21: warning: class 'NSObject ' does not implement the 'XCElementSpacerP' protocol - [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject *' to parameter of type 'NSObject *'}} + [obj setFlexElement2:flexer2]; // expected-error{{incompatible pointer types sending 'NSObject *' to parameter of type 'NSObject *'}} } diff --git a/clang/test/SemaObjC/protocol-warn.m b/clang/test/SemaObjC/protocol-warn.m index 2b900a4382d3f..51d0fda61c36a 100644 --- a/clang/test/SemaObjC/protocol-warn.m +++ b/clang/test/SemaObjC/protocol-warn.m @@ -50,5 +50,5 @@ @implementation UIWebPDFView { UIWebBrowserView *browserView; UIWebPDFView *pdfView; - return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView *' from a function with result type 'UIWebPDFView *'}} + return pdfView ? pdfView : browserView; // expected-error {{incompatible pointer types returning 'UIView *' from a function with result type 'UIWebPDFView *'}} } diff --git a/clang/test/SemaObjC/related-result-type-inference.m b/clang/test/SemaObjC/related-result-type-inference.m index 1eb7b17b67422..9035f5bf98384 100644 --- a/clang/test/SemaObjC/related-result-type-inference.m +++ b/clang/test/SemaObjC/related-result-type-inference.m @@ -66,7 +66,7 @@ void test_inference(void) { NSArray *arr = [[NSMutableArray alloc] init]; - NSMutableArray *marr = [arr retain]; // expected-warning{{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} + NSMutableArray *marr = [arr retain]; // expected-error{{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} } @implementation NSBlah @@ -192,6 +192,6 @@ @implementation UIViewController + (UIViewController *)newFilterViewControllerForType // expected-note {{compiler has implicitly changed method 'newFilterViewControllerForType' return type}} { UIViewController *filterVC; - return filterVC; // expected-warning {{incompatible pointer types casting 'UIViewController *' to type 'UIViewController *'}} + return filterVC; // expected-error {{incompatible pointer types casting 'UIViewController *' to type 'UIViewController *'}} } @end diff --git a/clang/test/SemaObjC/unqualified-to-qualified-class-warn.m b/clang/test/SemaObjC/unqualified-to-qualified-class-warn.m index cc56fcc9d20b8..67c5ac1e9854c 100644 --- a/clang/test/SemaObjC/unqualified-to-qualified-class-warn.m +++ b/clang/test/SemaObjC/unqualified-to-qualified-class-warn.m @@ -24,7 +24,7 @@ void functionTakingAClassConformingToAProtocol(AClass *instance) { // int main (void) { AClass *aobject = 0; BClass *bobject = 0; - functionTakingAClassConformingToAProtocol(aobject); // expected-warning {{incompatible pointer types passing 'AClass *' to parameter of type 'AClass *'}} + functionTakingAClassConformingToAProtocol(aobject); // expected-error {{incompatible pointer types passing 'AClass *' to parameter of type 'AClass *'}} functionTakingAClassConformingToAProtocol(bobject); // Shouldn't warn - does implement Fooable return 0; } diff --git a/clang/test/SemaObjC/warn-incompatible-builtin-types.m b/clang/test/SemaObjC/warn-incompatible-builtin-types.m index f69ca09b35673..882a3e1a50c93 100644 --- a/clang/test/SemaObjC/warn-incompatible-builtin-types.m +++ b/clang/test/SemaObjC/warn-incompatible-builtin-types.m @@ -9,8 +9,8 @@ void FUNC(void) { SEL s1, s2; id i, i1; Foo *f; - [f foo:f]; // expected-warning {{incompatible pointer types sending 'Foo *' to parameter of type 'Class'}} - c = f; // expected-warning {{incompatible pointer types assigning to 'Class' from 'Foo *'}} + [f foo:f]; // expected-error {{incompatible pointer types sending 'Foo *' to parameter of type 'Class'}} + c = f; // expected-error {{incompatible pointer types assigning to 'Class' from 'Foo *'}} c = i; @@ -20,22 +20,22 @@ void FUNC(void) { i = i1; - s1 = i; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'id'}} - i = s1; // expected-warning {{incompatible pointer types assigning to 'id' from 'SEL'}} + s1 = i; // expected-error {{incompatible pointer types assigning to 'SEL' from 'id'}} + i = s1; // expected-error {{incompatible pointer types assigning to 'id' from 'SEL'}} s1 = s2; - s1 = c; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'Class'}} + s1 = c; // expected-error {{incompatible pointer types assigning to 'SEL' from 'Class'}} - c = s1; // expected-warning {{incompatible pointer types assigning to 'Class' from 'SEL'}} + c = s1; // expected-error {{incompatible pointer types assigning to 'Class' from 'SEL'}} f = i; - f = c; // expected-warning {{incompatible pointer types assigning to 'Foo *' from 'Class'}} + f = c; // expected-error {{incompatible pointer types assigning to 'Foo *' from 'Class'}} - f = s1; // expected-warning {{incompatible pointer types assigning to 'Foo *' from 'SEL'}} + f = s1; // expected-error {{incompatible pointer types assigning to 'Foo *' from 'SEL'}} i = f; - s1 = f; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'Foo *'}} + s1 = f; // expected-error {{incompatible pointer types assigning to 'SEL' from 'Foo *'}} } diff --git a/clang/test/SemaObjC/warn-superclass-method-mismatch.m b/clang/test/SemaObjC/warn-superclass-method-mismatch.m index 52054739d53ec..d0e57864c5020 100644 --- a/clang/test/SemaObjC/warn-superclass-method-mismatch.m +++ b/clang/test/SemaObjC/warn-superclass-method-mismatch.m @@ -38,7 +38,7 @@ void f(Base *base, Sub *sub) { Base *b; [base method1:b]; // if base is actuall 'Sub' it will use [Sub method1] with wrong argument. - [base method2:b]; // expected-warning {{}} + [base method2:b]; // expected-error {{incompatible pointer types}} Sub *s; [base method2:s]; // if base is actually 'Sub' OK. Either way OK. diff --git a/clang/test/SemaObjCXX/blocks.mm b/clang/test/SemaObjCXX/blocks.mm index 0ae91ab985ac1..f1b5b301087eb 100644 --- a/clang/test/SemaObjCXX/blocks.mm +++ b/clang/test/SemaObjCXX/blocks.mm @@ -8,7 +8,7 @@ void foo(id (^objectCreationBlock)(void)) { void bar2(id(*)(void)); void foo2(id (*objectCreationBlock)(void)) { - return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)()' to parameter of type 'id (*)()'}} + return bar2(objectCreationBlock); // expected-error{{incompatible pointer types passing 'id (*)()' to parameter of type 'id (*)()'}} } void bar3(id(*)()); // expected-note{{candidate function}} diff --git a/clang/test/SemaObjCXX/objc-pointer-conv.mm b/clang/test/SemaObjCXX/objc-pointer-conv.mm index 611b7bc009ae5..d6073674b29b9 100644 --- a/clang/test/SemaObjCXX/objc-pointer-conv.mm +++ b/clang/test/SemaObjCXX/objc-pointer-conv.mm @@ -42,7 +42,7 @@ @interface DerivedFromI : I void accept_derived(DerivedFromI*); void test_base_to_derived(I* i) { - accept_derived(i); // expected-warning{{incompatible pointer types passing 'I *' to parameter of type 'DerivedFromI *'}} - DerivedFromI *di = i; // expected-warning{{incompatible pointer types initializing 'DerivedFromI *' with an expression of type 'I *'}} + accept_derived(i); // expected-error{{incompatible pointer types passing 'I *' to parameter of type 'DerivedFromI *'}} + DerivedFromI *di = i; // expected-error{{incompatible pointer types initializing 'DerivedFromI *' with an expression of type 'I *'}} DerivedFromI *di2 = (DerivedFromI *)i; } diff --git a/clang/test/SemaObjCXX/overload.mm b/clang/test/SemaObjCXX/overload.mm index 75423b431ae56..c848e3493f15c 100644 --- a/clang/test/SemaObjCXX/overload.mm +++ b/clang/test/SemaObjCXX/overload.mm @@ -51,13 +51,13 @@ void test0(A* a, B* b, id val) { } void test1(A* a) { - B* b = a; // expected-warning{{incompatible pointer types initializing 'B *' with an expression of type 'A *'}} - B *c; c = a; // expected-warning{{incompatible pointer types assigning to 'B *' from 'A *'}} + B* b = a; // expected-error{{incompatible pointer types initializing 'B *' with an expression of type 'A *'}} + B *c; c = a; // expected-error{{incompatible pointer types assigning to 'B *' from 'A *'}} } void test2(A** ap) { - B** bp = ap; // expected-warning{{incompatible pointer types initializing 'B **' with an expression of type 'A **'}} - bp = ap; // expected-warning{{incompatible pointer types assigning to 'B **' from 'A **'}} + B** bp = ap; // expected-error{{incompatible pointer types initializing 'B **' with an expression of type 'A **'}} + bp = ap; // expected-error{{incompatible pointer types assigning to 'B **' from 'A **'}} } int& cv(A*); @@ -97,7 +97,7 @@ void qualid_test(A *a, B *b, C *c) { void (*_NSExceptionRaiser(void))(NSException *) { objc_exception_functions_t exc_funcs; - return exc_funcs.throw_exc; // expected-warning{{incompatible pointer types returning 'void (*)(id)' from a function with result type 'void (*)(NSException *)'}} + return exc_funcs.throw_exc; // expected-error{{incompatible pointer types returning 'void (*)(id)' from a function with result type 'void (*)(NSException *)'}} } namespace test5 { diff --git a/clang/test/SemaObjCXX/parameterized_classes_subst.mm b/clang/test/SemaObjCXX/parameterized_classes_subst.mm index 8aacf21faf091..4658c3d617567 100644 --- a/clang/test/SemaObjCXX/parameterized_classes_subst.mm +++ b/clang/test/SemaObjCXX/parameterized_classes_subst.mm @@ -306,10 +306,10 @@ void test_variance(NSCovariant1 *covariant1, NSContravariant1 *contravariant1, NSContravariant1 *contravariant2) { covariant1 = covariant2; // okay - covariant2 = covariant1; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} + covariant2 = covariant1; // expected-error{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} covariant3 = covariant4; // okay - covariant4 = covariant3; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} + covariant4 = covariant3; // expected-error{{incompatible pointer types assigning to 'NSCovariant1 *' from 'NSCovariant1 *'}} covariant5 = covariant1; // okay covariant1 = covariant5; // okay: id is promiscuous @@ -317,7 +317,7 @@ void test_variance(NSCovariant1 *covariant1, covariant5 = covariant3; // okay covariant3 = covariant5; // okay - contravariant1 = contravariant2; // expected-warning{{incompatible pointer types assigning to 'NSContravariant1 *' from 'NSContravariant1 *'}} + contravariant1 = contravariant2; // expected-error{{incompatible pointer types assigning to 'NSContravariant1 *' from 'NSContravariant1 *'}} contravariant2 = contravariant1; // okay } diff --git a/clang/test/SemaObjCXX/related-result-type-inference.mm b/clang/test/SemaObjCXX/related-result-type-inference.mm index 675e6acbda143..9c25e07ab2033 100644 --- a/clang/test/SemaObjCXX/related-result-type-inference.mm +++ b/clang/test/SemaObjCXX/related-result-type-inference.mm @@ -65,7 +65,7 @@ void test_inference() { __typeof__(([NSBlah newUnrelated])) *unrelated2 = (Unrelated**)0; NSArray *arr = [[NSMutableArray alloc] init]; - NSMutableArray *marr = [arr retain]; // expected-warning{{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} - marr = [arr retain]; // expected-warning{{incompatible pointer types assigning to 'NSMutableArray *' from 'NSArray *'}} + NSMutableArray *marr = [arr retain]; // expected-error{{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}} + marr = [arr retain]; // expected-error{{incompatible pointer types assigning to 'NSMutableArray *' from 'NSArray *'}} arr = [marr retain]; } diff --git a/clang/test/SemaOpenACC/combined-construct-if-clause.c b/clang/test/SemaOpenACC/combined-construct-if-clause.c index d5e42d6105963..4de517cdb16b9 100644 --- a/clang/test/SemaOpenACC/combined-construct-if-clause.c +++ b/clang/test/SemaOpenACC/combined-construct-if-clause.c @@ -27,7 +27,7 @@ void BoolExpr(int *I, float *F) { #pragma acc kernels loop if (Array) for (unsigned i = 0; i < 5; ++i); - // expected-warning@+4{{incompatible pointer types assigning to 'int *' from 'float *'}} + // expected-error@+4{{incompatible pointer types assigning to 'int *' from 'float *'}} // expected-warning@+3{{using the result of an assignment as a condition without parentheses}} // expected-note@+2{{place parentheses around the assignment to silence this warning}} // expected-note@+1{{use '==' to turn this assignment into an equality comparison}} diff --git a/clang/test/SemaOpenACC/compute-construct-if-clause.c b/clang/test/SemaOpenACC/compute-construct-if-clause.c index 0064303e1e217..ca3b9b1c55f70 100644 --- a/clang/test/SemaOpenACC/compute-construct-if-clause.c +++ b/clang/test/SemaOpenACC/compute-construct-if-clause.c @@ -27,7 +27,7 @@ void BoolExpr(int *I, float *F) { #pragma acc kernels if (Array) while(0); - // expected-warning@+4{{incompatible pointer types assigning to 'int *' from 'float *'}} + // expected-error@+4{{incompatible pointer types assigning to 'int *' from 'float *'}} // expected-warning@+3{{using the result of an assignment as a condition without parentheses}} // expected-note@+2{{place parentheses around the assignment to silence this warning}} // expected-note@+1{{use '==' to turn this assignment into an equality comparison}} diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl index 70ad89eb3ce22..86435b7b15b34 100644 --- a/clang/test/SemaOpenCL/address-spaces.cl +++ b/clang/test/SemaOpenCL/address-spaces.cl @@ -144,7 +144,7 @@ void nested(__global int *g, __global int * __private *gg, __local int *l, __loc gg = g; // expected-error {{assigning '__global int *__private' to '__global int *__private *__private' changes address space of pointer}} gg = l; // expected-error {{assigning '__local int *__private' to '__global int *__private *__private' changes address space of pointer}} gg = ll; // expected-error {{assigning '__local int *__private *__private' to '__global int *__private *__private' changes address space of nested pointer}} - gg = gg_f; // expected-warning {{incompatible pointer types assigning to '__global int *__private *__private' from '__global float *__private *__private'}} + gg = gg_f; // expected-error {{incompatible pointer types assigning to '__global int *__private *__private' from '__global float *__private *__private'}} gg = (__global int * __private *)gg_f; l = g; // expected-error {{assigning '__global int *__private' to '__local int *__private' changes address space of pointer}} @@ -160,14 +160,13 @@ void nested(__global int *g, __global int * __private *gg, __local int *l, __loc ll = (__local int * __private *)gg_f; // expected-warning {{casting '__global float *__private *' to type '__local int *__private *' discards qualifiers in nested pointer types}} gg_f = g; // expected-error {{assigning '__global int *__private' to '__global float *__private *__private' changes address space of pointer}} - gg_f = gg; // expected-warning {{incompatible pointer types assigning to '__global float *__private *__private' from '__global int *__private *__private'}} + gg_f = gg; // expected-error {{incompatible pointer types assigning to '__global float *__private *__private' from '__global int *__private *__private'}} gg_f = l; // expected-error {{assigning '__local int *__private' to '__global float *__private *__private' changes address space of pointer}} gg_f = ll; // expected-error {{assigning '__local int *__private *__private' to '__global float *__private *__private' changes address space of nested pointer}} gg_f = (__global float * __private *)gg; - // FIXME: This doesn't seem right. This should be an error, not a warning. __local int * __global * __private * lll; - lll = gg; // expected-warning {{incompatible pointer types assigning to '__local int *__global *__private *__private' from '__global int *__private *__private'}} + lll = gg; // expected-error {{incompatible pointer types assigning to '__local int *__global *__private *__private' from '__global int *__private *__private'}} typedef __local int * l_t; typedef __global int * g_t; diff --git a/clang/test/SemaOpenCL/atomic-ops.cl b/clang/test/SemaOpenCL/atomic-ops.cl index babebba31e82b..59d8b32e9954f 100644 --- a/clang/test/SemaOpenCL/atomic-ops.cl +++ b/clang/test/SemaOpenCL/atomic-ops.cl @@ -68,12 +68,12 @@ void f(atomic_int *i, const atomic_int *ci, bool cmpexch_1 = __opencl_atomic_compare_exchange_strong(i, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); bool cmpexch_2 = __opencl_atomic_compare_exchange_strong(p, P, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); - bool cmpexch_3 = __opencl_atomic_compare_exchange_strong(f, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); // expected-warning {{incompatible pointer types passing '__generic int *__private' to parameter of type '__generic float *'}} + bool cmpexch_3 = __opencl_atomic_compare_exchange_strong(f, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); // expected-error {{incompatible pointer types passing '__generic int *__private' to parameter of type '__generic float *'}} (void)__opencl_atomic_compare_exchange_strong(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); // expected-warning {{passing 'const __generic int *__private' to parameter of type '__generic int *' discards qualifiers}} bool cmpexchw_1 = __opencl_atomic_compare_exchange_weak(i, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); bool cmpexchw_2 = __opencl_atomic_compare_exchange_weak(p, P, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); - bool cmpexchw_3 = __opencl_atomic_compare_exchange_weak(f, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); // expected-warning {{incompatible pointer types passing '__generic int *__private' to parameter of type '__generic float *'}} + bool cmpexchw_3 = __opencl_atomic_compare_exchange_weak(f, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); // expected-error {{incompatible pointer types passing '__generic int *__private' to parameter of type '__generic float *'}} (void)__opencl_atomic_compare_exchange_weak(i, CI, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group); // expected-warning {{passing 'const __generic int *__private' to parameter of type '__generic int *' discards qualifiers}} // Pointers to different address spaces are allowed. diff --git a/clang/test/SemaOpenCL/to_addr_builtin.cl b/clang/test/SemaOpenCL/to_addr_builtin.cl index 51721a6434518..f8e1189cf2b1c 100644 --- a/clang/test/SemaOpenCL/to_addr_builtin.cl +++ b/clang/test/SemaOpenCL/to_addr_builtin.cl @@ -115,7 +115,7 @@ void test(void) { #if (__OPENCL_C_VERSION__ < CL_VERSION_2_0) || (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && !defined(__opencl_c_generic_address_space)) // expected-error@-2{{use of undeclared identifier 'to_global'}} #else - // expected-warning@-4{{incompatible pointer types initializing '__global char *__private' with an expression of type '__global int *'}} + // expected-error@-4{{incompatible pointer types initializing '__global char *__private' with an expression of type '__global int *'}} // expected-warning@-5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance}} #endif @@ -123,7 +123,7 @@ void test(void) { #if (__OPENCL_C_VERSION__ < CL_VERSION_2_0) || (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && !defined(__opencl_c_generic_address_space)) // expected-error@-2{{use of undeclared identifier 'to_global'}} #else - // expected-warning@-4{{incompatible pointer types assigning to '__global float *__private' from '__global int *'}} + // expected-error@-4{{incompatible pointer types assigning to '__global float *__private' from '__global int *'}} // expected-warning@-5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance}} #endif diff --git a/compiler-rt/test/safestack/pthread-cleanup.c b/compiler-rt/test/safestack/pthread-cleanup.c index e177e376f21d2..c2645a6506c74 100644 --- a/compiler-rt/test/safestack/pthread-cleanup.c +++ b/compiler-rt/test/safestack/pthread-cleanup.c @@ -28,7 +28,7 @@ int main(int argc, char **argv) if (pthread_create(&t1, NULL, start, NULL)) abort(); - if (pthread_join(t1, &t1_buffer)) + if (pthread_join(t1, (void **)&t1_buffer)) abort(); // Stack has not yet been deallocated diff --git a/compiler-rt/test/tysan/violation-pr62544.c b/compiler-rt/test/tysan/violation-pr62544.c index 65dd333272116..d779abd668529 100644 --- a/compiler-rt/test/tysan/violation-pr62544.c +++ b/compiler-rt/test/tysan/violation-pr62544.c @@ -7,7 +7,7 @@ int printf(const char *, ...); int a, b, c; long d; int main() { - short *e = &a; + short *e = (short *)&a; int *f = &a; *f = 0; for (; b <= 9; b++) { diff --git a/lldb/test/API/functionalities/thread/exit_during_expression/main.c b/lldb/test/API/functionalities/thread/exit_during_expression/main.c index f633632e96cc4..c4a9d20627802 100644 --- a/lldb/test/API/functionalities/thread/exit_during_expression/main.c +++ b/lldb/test/API/functionalities/thread/exit_during_expression/main.c @@ -27,7 +27,7 @@ void *exiting_thread_func(void *unused) { } int main() { - char *exit_ptr; + void *exit_ptr; pthread_t exiting_thread; pthread_create(&exiting_thread, NULL, exiting_thread_func, NULL); diff --git a/lldb/test/API/functionalities/valobj_errors/hidden.c b/lldb/test/API/functionalities/valobj_errors/hidden.c index d3b93ce1ab9cf..616a2c330b9f3 100644 --- a/lldb/test/API/functionalities/valobj_errors/hidden.c +++ b/lldb/test/API/functionalities/valobj_errors/hidden.c @@ -1,4 +1,4 @@ struct Opaque { int i, j, k; } *global; -struct Opaque *getOpaque() { return &global; } +struct Opaque *getOpaque() { return (struct Opaque *)&global; }