[cfe-commits] r146326 - in /cfe/trunk: include/clang/Analysis/Analyses/FormatString.h lib/Analysis/ScanfFormatString.cpp lib/Sema/SemaChecking.cpp test/Analysis/taint-generic.c test/Analysis/taint-tester.c test/Sema/format-strings-fixit.c test/Se

Nico Weber thakis at chromium.org
Fri Dec 23 16:33:28 PST 2011


Hi Hans,

I have some c++ code that also uses 'a' as modifier. It used to build
fine with clang, but now it no longer does:

$ cat test.cc
#include <stdio.h>
#include <stdlib.h>

int main() {
  char* buff;
  scanf("%a[^)]", &buff);
  printf("%s\n", buff);
  free(buff);
}
$ clang++ test.cc -o foo
test.cc:6:11: warning: conversion specifies type 'float *' but the
argument has type 'char **' [-Wformat]
  scanf("%a[^)]", &buff);
         ~^       ~~~~~
1 warning generated.

What's the motivation for not allowing this extension in more cases?
gcc seems to support it in c++, c++0x, and c (but not in c99).

Nico

On Thu, Dec 15, 2011 at 8:41 AM, Ted Kremenek <kremenek at apple.com> wrote:
> Perfect.  Thanks!
>
> On Dec 15, 2011, at 2:30 AM, Hans Wennborg wrote:
>
>> On Wed, Dec 14, 2011 at 9:29 PM, Ted Kremenek <kremenek at apple.com> wrote:
>>> Looks good to me.
>>>
>>> My main concern is that we should have a few more test cases where 'a' is used *incorrectly* just to make sure the parsing doesn't fall over in the other cases.
>>
>> I added a couple more tests and committed in r146649. Let me know if
>> there are any test cases I missed.
>>
>> Thanks,
>> Hans
>
> _______________________________________________
> 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