[cfe-dev] Static Analysis Warning?

Jordy Rose jediknil at belkadan.com
Fri Aug 27 15:46:22 PDT 2010


On Fri, 27 Aug 2010 17:39:12 -0500, Michael Price - Dev
<michael.b.price.dev at gmail.com> wrote:
> Consider:
> 
> #define FLOOR 1
> #define CEILING 1
> 
> int main (int argc, const char * argc[])
> {
>      printf("Hello, World! %d\n", useFloor() ? FLOOR : CEILING);
> 
>      return 0;
> }
> 
> where useFloor() returns a bool.
> 
> I would NOT want that flagged with a warning.

Good point, Michael. I think this would be more useful as a Sema warning
about identical expressions for both results of a ?:, not a value-sensitive
analyzer report. (Taking macros into account, of course; only warn if
neither expression involves a macro or both use identical macros.)



More information about the cfe-dev mailing list