[cfe-commits] r156932 - /cfe/trunk/test/Analysis/string.c

Jordy Rose jediknil at belkadan.com
Wed May 16 13:37:19 PDT 2012


I should have known when I wrote the comment about requiring sizeof(size_t) > sizeof(1 == 1) that this was going to come back to haunt me. This worked before because we could early-exit and /avoid/ triggering warnings, but clang_analyzer_eval with -verify is a little stronger...

Moved the test to a C++ file in r156941. If any platform has sizeof(size_t) == sizeof(bool), we're in trouble, but I don't think we support any of those. :-)

Thanks for handling this, Anna.

Jordy


On May 16, 2012, at 14:46, Anna Zaks wrote:

> Author: zaks
> Date: Wed May 16 13:46:25 2012
> New Revision: 156932
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=156932&view=rev
> Log:
> [analyzer] Revert a regression committed in r156920.
> 
> This breaks the build with -triple i386-apple-darwin9.
> 
> Modified:
>    cfe/trunk/test/Analysis/string.c
> 
> Modified: cfe/trunk/test/Analysis/string.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/string.c?rev=156932&r1=156931&r2=156932&view=diff
> ==============================================================================
> --- cfe/trunk/test/Analysis/string.c (original)
> +++ cfe/trunk/test/Analysis/string.c Wed May 16 13:46:25 2012
> @@ -1062,12 +1062,11 @@
> 
>   // Constrain the length of x.
>   if (strlen(x) != value) return;
> -
>   // Test relational operators.
> -  clang_analyzer_eval(strlen(x) >= 2); // expected-warning{{TRUE}}
> -  clang_analyzer_eval(2 <= strlen(x)); // expected-warning{{TRUE}}
> +  if (strlen(x) < 2) { (void)*(char*)0; } // no-warning
> +  if (2 > strlen(x)) { (void)*(char*)0; } // no-warning
> 
>   // Test equality operators.
> -  clang_analyzer_eval(strlen(x) != 1); // expected-warning{{TRUE}}
> -  clang_analyzer_eval(1 != strlen(x)); // expected-warning{{TRUE}}
> +  if (strlen(x) == 1) { (void)*(char*)0; } // no-warning
> +  if (1 == strlen(x)) { (void)*(char*)0; } // no-warning
> }
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list