forked from OSchip/llvm-project
Split "discards qualifiers" warnings of -Wincompatible-pointer-types into subgroup.
This allows users to promote -Wincompatible-pointer-type warnings to errors but keep those for "discard qualifiers" as warnings (if they so desire). Addresses <rdar://problem/13062738>. llvm-svn: 173184
This commit is contained in:
parent
c6f1e56745
commit
c0da34e6ab
|
@ -124,7 +124,11 @@ def DanglingField : DiagGroup<"dangling-field">;
|
|||
def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">;
|
||||
def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;
|
||||
def : DiagGroup<"import">;
|
||||
def IncompatiblePointerTypes : DiagGroup<"incompatible-pointer-types">;
|
||||
def IncompatiblePointerTypesDiscardsQualifiers
|
||||
: DiagGroup<"incompatible-pointer-types-discards-qualifiers">;
|
||||
def IncompatiblePointerTypes
|
||||
: DiagGroup<"incompatible-pointer-types",
|
||||
[IncompatiblePointerTypesDiscardsQualifiers]>;
|
||||
def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">;
|
||||
def InvalidNoreturn : DiagGroup<"invalid-noreturn">;
|
||||
def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">;
|
||||
|
|
|
@ -4902,7 +4902,7 @@ def ext_typecheck_convert_discards_qualifiers : ExtWarn<
|
|||
"sending to parameter of different type}0,1"
|
||||
"|%diff{casting $ to type $|casting between types}0,1}2"
|
||||
" discards qualifiers">,
|
||||
InGroup<IncompatiblePointerTypes>;
|
||||
InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
|
||||
def ext_nested_pointer_qualifier_mismatch : ExtWarn<
|
||||
"%select{%diff{assigning to $ from $|assigning to different types}0,1"
|
||||
"|%diff{passing $ to parameter of type $|"
|
||||
|
@ -4916,7 +4916,7 @@ def ext_nested_pointer_qualifier_mismatch : ExtWarn<
|
|||
"sending to parameter of different type}0,1"
|
||||
"|%diff{casting $ to type $|casting between types}0,1}2"
|
||||
" discards qualifiers in nested pointer types">,
|
||||
InGroup<IncompatiblePointerTypes>;
|
||||
InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
|
||||
def warn_incompatible_vectors : Warning<
|
||||
"incompatible vector types "
|
||||
"%select{%diff{assigning to $ from $|assigning to different types}0,1"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// RUN: %clang -fsyntax-only %s -Xclang -verify -Werror=incompatible-pointer-types -Wno-error=incompatible-pointer-types-discards-qualifiers
|
||||
|
||||
// This test ensures that the subgroup of -Wincompatible-pointer-types warnings that
|
||||
// concern discarding qualifers can be promoted (or not promoted) to an error *separately* from
|
||||
// the other -Wincompatible-pointer-type warnings.
|
||||
//
|
||||
// <rdar://problem/13062738>
|
||||
//
|
||||
|
||||
void foo(char *s); // expected-note {{passing argument to parameter 's' here}}
|
||||
void baz(int *s); // expected-note {{passing argument to parameter 's' here}}
|
||||
|
||||
void bar(const char *s) {
|
||||
foo(s); // expected-warning {{passing 'const char *' to parameter of type 'char *' discards qualifiers}}
|
||||
baz(s); // expected-error {{incompatible pointer types passing 'const char *' to parameter of type 'int *'}}
|
||||
}
|
Loading…
Reference in New Issue