Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -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: "", \
Expand Down
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -9048,7 +9048,7 @@ def ext_typecheck_convert_incompatible_pointer : ExtWarn<
"; take the address with &|"
"; remove *|"
"; remove &}3">,
InGroup<IncompatiblePointerTypes>;
InGroup<IncompatiblePointerTypes>, DefaultError;
def err_typecheck_convert_incompatible_pointer : Error<
"incompatible pointer types "
"%select{%diff{assigning to $ from $|assigning to different types}0,1"
Expand Down
2 changes: 1 addition & 1 deletion clang/test/APINotes/nullability.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

4 changes: 2 additions & 2 deletions clang/test/APINotes/nullability.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions clang/test/APINotes/types.m
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/AST/ByteCode/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdatomic.h>
Expand Down
2 changes: 1 addition & 1 deletion clang/test/AST/ByteCode/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/OSAtomic_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/bsd-string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion clang/test/Analysis/novoidtypecrash.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ x;
y(void **z) { // no-crash
*z = x;
int *w;
y(&w);
y((void**)&w);
*w;
}

Expand Down
6 changes: 3 additions & 3 deletions clang/test/Analysis/override-werror.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion clang/test/Analysis/uninit-vals-union.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -verify -Wno-unused %s
// expected-no-diagnostics

typedef union {
int y;
Expand All @@ -8,6 +9,6 @@ typedef struct { int x; } A;

void foo(void) {
U u = {};
A *a = &u; // expected-warning{{incompatible pointer types}}
A *a = (A*)&u;
a->x; // no-crash
}
2 changes: 1 addition & 1 deletion clang/test/C/C23/n3007.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions clang/test/C/C2y/n3369.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/C/drs/dr0xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */ }
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CodeGen/2008-03-05-syncPtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion clang/test/CodeGen/X86/cmpccxadd-builtins-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *'}}
}
12 changes: 6 additions & 6 deletions clang/test/CodeGen/X86/math-builtins.c
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
19 changes: 13 additions & 6 deletions clang/test/CodeGen/arm64-microsoft-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/CodeGen/builtin-rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
int printf(const char *, ...);

int foo(void) {
return printf(printf);
return printf((const char*)printf);
}
2 changes: 1 addition & 1 deletion clang/test/CodeGen/ms-intrinsics-underaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion clang/test/CodeGen/ubsan-pass-object-size.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGen/vla.c
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
2 changes: 1 addition & 1 deletion clang/test/CodeGen/vlt_to_pointer.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions clang/test/FixIt/fixit-objc-arc.m
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Frontend/fixed_point_unknown_conversions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *'}}
}
2 changes: 1 addition & 1 deletion clang/test/Index/preamble.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Index/warning-flags.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Loading
Loading