On Fri, Apr 4, 2014 at 3:54 AM, Lubos Lunak <[email protected]> wrote:

>
>  This is a reduced version of the original patch for PR12463 that handles
> only
> string comparisons (I don't care about arrays enough to deal with the
> details
> and there the problem is unlikely to happen anyway, but the problem is more
> likely with strings if e.g. refactoring).


It seems a bit strange to treat arrays and string literals differently
(since string literals are basically just a weird way to write and name a
unique array). From your comments on the PR, I guess you're concerned about
false positives on this kind of case:

  #define ARRAY_COPY(x, y) do { if ((x) == (y)) { /* same array */ } else {
memcpy(&(x)[0], &(y)[0], min(sizeof(x), sizeof(y))); } } while (0)

... where it's intentional for x and y to be arrays. But for that code,
it'd be equally fine for y to be a string literal.

Do you have any numbers for true positives / false positives with this
diagnostic change?
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to