]> granicus.if.org Git - clang/commitdiff
Adds couple of missing warning flags so warnings can be turned
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 17 Oct 2012 23:19:22 +0000 (23:19 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 17 Oct 2012 23:19:22 +0000 (23:19 +0000)
off. // rdar://12501960

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166150 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/Misc/warning-flags.c
test/SemaCXX/no-warn-composite-pointer-type.cpp [new file with mode: 0644]

index 6fc6cad5f9014ac7533507e123da6b9b861f8648..97713ded9415618ef3afd64b754d1f5673cc42ad 100644 (file)
@@ -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">;
index 3c420b9d2b6e5fdb7a7c61797572e9cfcdea5cfb..51bb9f51e1a58e146b42fef50de0bf8e9029b40a 100644 (file)
@@ -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<CompareDistinctPointerType>;
 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<CompareDistinctPointerType>;
 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">;
index c027523aad9529511c83a509cb76f30527abb839..302abccc59492441f8a7c87b2a2797afdc339b20 100644 (file)
@@ -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 (file)
index 0000000..b52914a
--- /dev/null
@@ -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;
+}