From 3bb8b56a5d90c535e7dc466f924d00ce798c28e0 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Wed, 26 Feb 2014 02:36:06 +0000 Subject: PR16074, implement warnings to catch pointer to boolean true and pointer to null comparison when the pointer is known to be non-null. This catches the array to pointer decay, function to pointer decay and address of variables. This does not catch address of function since this has been previously used to silence a warning. Pointer to bool conversion is under -Wbool-conversion. Pointer to null comparison is under -Wtautological-pointer-compare, a sub-group of -Wtautological-compare. void foo() { int arr[5]; int x; // warn on these conditionals if (foo); if (arr); if (&x); if (foo == null); if (arr == null); if (&x == null); if (&foo); // no warning } llvm-svn: 202216 --- clang/test/Sema/const-eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/test/Sema/const-eval.c') diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c index 16d028eaf60..883cced9f3b 100644 --- a/clang/test/Sema/const-eval.c +++ b/clang/test/Sema/const-eval.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux %s +// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux %s -Wno-tautological-pointer-compare #define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];}); int x; -- cgit v1.2.3