summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2018-05-05 00:09:51 +0000
committerEli Friedman <efriedma@codeaurora.org>2018-05-05 00:09:51 +0000
commitb6e64e734d80723c7e7c5b8e77f4b4a2d0a4c9e6 (patch)
treee5245e732e925e3fb5b4a25ad4083000ca9bf2ba
parentb77ab0966e2d87531df714b8e944ddad4d61852e (diff)
downloadbcm5719-llvm-b6e64e734d80723c7e7c5b8e77f4b4a2d0a4c9e6.tar.gz
bcm5719-llvm-b6e64e734d80723c7e7c5b8e77f4b4a2d0a4c9e6.zip
Add warning flag -Wordered-compare-function-pointers.
The C standard doesn't allow comparisons like "f1 < f2" (where f1 and f2 are function pointers), but we allow them as an extension. Add a warning flag to control this warning. Differential Revision: https://reviews.llvm.org/D46155 llvm-svn: 331570
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td3
-rw-r--r--clang/test/Misc/warning-flags.c3
2 files changed, 3 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f0a325c46f6..053f2fc85d3 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5932,7 +5932,8 @@ def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
"ordered comparison between pointer and zero (%0 and %1)">;
def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
- "ordered comparison of function pointers (%0 and %1)">;
+ "ordered comparison of function pointers (%0 and %1)">,
+ InGroup<DiagGroup<"ordered-compare-function-pointers">>;
def ext_typecheck_comparison_of_fptr_to_void : Extension<
"equality comparison between function pointer and void pointer (%0 and %1)">;
def err_typecheck_comparison_of_fptr_to_void : Error<
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index c8ee9bcfdac..4f9469f8e58 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/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 (77):
+CHECK: Warnings without flags (76):
CHECK-NEXT: ext_excess_initializers
CHECK-NEXT: ext_excess_initializers_in_char_array_initializer
CHECK-NEXT: ext_expected_semi_decl_list
@@ -31,7 +31,6 @@ CHECK-NEXT: ext_plain_complex
CHECK-NEXT: ext_template_arg_extra_parens
CHECK-NEXT: ext_typecheck_comparison_of_pointer_integer
CHECK-NEXT: ext_typecheck_cond_incompatible_operands
-CHECK-NEXT: ext_typecheck_ordered_comparison_of_function_pointers
CHECK-NEXT: ext_typecheck_ordered_comparison_of_pointer_integer
CHECK-NEXT: ext_using_undefined_std
CHECK-NEXT: pp_invalid_string_literal
OpenPOWER on IntegriCloud