Looks good to me. I'd add this second case to test_writeback as well, to make 
sure that we don't regress on the "keep going" for scanf.

void test_writeback(int *x) {
  scanf("%n", (void*)0); // expected-warning{{format specifies type 'int *' but 
the argument has type 'void *'}}
  scanf("%n %c", x, x); // expected-warning{{format specifies type 'char *' but 
the argument has type 'int *'}}
}

Thanks, Hans!


On Jul 30, 2012, at 2:00 AM, Hans Wennborg <[email protected]> wrote:

> Hi all,
> 
> The attached patch makes Clang check that the corresponding argument
> for "%n" in a format string is int*.
> 
> Please take a look!
> 
> Thanks,
> Hans
> <wformat_check_n_argument_type.patch>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to