From: Fariborz Jahanian Date: Wed, 17 Oct 2012 23:19:22 +0000 (+0000) Subject: Adds couple of missing warning flags so warnings can be turned X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bea52dac0c2e717990109cfd4812bc3422378b1a;p=clang Adds couple of missing warning flags so warnings can be turned off. // rdar://12501960 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166150 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 6fc6cad5f9..97713ded94 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -209,6 +209,7 @@ def TautologicalCompare : DiagGroup<"tautological-compare", [TautologicalOutOfRangeCompare]>; def HeaderHygiene : DiagGroup<"header-hygiene">; def DuplicateDeclSpecifier : DiagGroup<"duplicate-decl-specifier">; +def CompareDistinctPointerType : DiagGroup<"compare-distinct-pointer-type">; // Preprocessor warnings. def : DiagGroup<"builtin-macro-redefined">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 3c420b9d2b..51bb9f51e1 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -4090,7 +4090,8 @@ def ext_typecheck_comparison_of_pointer_integer : ExtWarn< def err_typecheck_comparison_of_pointer_integer : Error< "comparison between pointer and integer (%0 and %1)">; def ext_typecheck_comparison_of_distinct_pointers : ExtWarn< - "comparison of distinct pointer types%diff{ ($ and $)|}0,1">; + "comparison of distinct pointer types%diff{ ($ and $)|}0,1">, + InGroup; def ext_typecheck_cond_incompatible_operands : ExtWarn< "incompatible operand types (%0 and %1)">; def err_cond_voidptr_arc : Error < @@ -4100,7 +4101,7 @@ def err_typecheck_comparison_of_distinct_pointers : Error< "comparison of distinct pointer types%diff{ ($ and $)|}0,1">; def ext_typecheck_comparison_of_distinct_pointers_nonstandard : ExtWarn< "comparison of distinct pointer types (%0 and %1) uses non-standard " - "composite pointer type %2">; + "composite pointer type %2">, InGroup; def err_typecheck_assign_const : Error<"read-only variable is not assignable">; def err_stmtexpr_file_scope : Error< "statement expression not allowed at file scope">; diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c index c027523aad..302abccc59 100644 --- a/test/Misc/warning-flags.c +++ b/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (156): +CHECK: Warnings without flags (154): CHECK-NEXT: ext_delete_void_ptr_operand CHECK-NEXT: ext_enum_friend CHECK-NEXT: ext_expected_semi_decl_list @@ -30,8 +30,6 @@ CHECK-NEXT: ext_new_paren_array_nonconst CHECK-NEXT: ext_plain_complex CHECK-NEXT: ext_pp_macro_redef CHECK-NEXT: ext_template_arg_extra_parens -CHECK-NEXT: ext_typecheck_comparison_of_distinct_pointers -CHECK-NEXT: ext_typecheck_comparison_of_distinct_pointers_nonstandard CHECK-NEXT: ext_typecheck_comparison_of_pointer_integer CHECK-NEXT: ext_typecheck_cond_incompatible_operands CHECK-NEXT: ext_typecheck_cond_incompatible_operands_nonstandard diff --git a/test/SemaCXX/no-warn-composite-pointer-type.cpp b/test/SemaCXX/no-warn-composite-pointer-type.cpp new file mode 100644 index 0000000000..b52914a2c3 --- /dev/null +++ b/test/SemaCXX/no-warn-composite-pointer-type.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-compare-distinct-pointer-type -verify %s +// rdar://12501960 + +void Foo(int **thing, const int **thingMax) +{ + if ((thing + 3) > thingMax) + return; +}