[cfe-commits] r160966 - in /cfe/trunk: lib/Analysis/PrintfFormatString.cpp lib/Analysis/ScanfFormatString.cpp lib/Sema/SemaChecking.cpp test/Sema/format-strings-scanf.c test/Sema/format-strings.c

Hans Wennborg hans at chromium.org
Tue Jul 31 00:49:41 PDT 2012


It does seem slightly over-pedantic of the warning to complain about
this, though. I'll take a look at it.

 - Hans

On Tue, Jul 31, 2012 at 8:42 AM, Chandler Carruth <chandlerc at google.com> wrote:
> I can find nothing in any spec which would shed light on what the correct
> behavior is for the warning, but it seems unlikely to be important to give
> fprintf a pointer to a volatile int as opposed to a normal int....
>
>
> On Tue, Jul 31, 2012 at 12:27 AM, Alexey Samsonov <samsonov at google.com>
> wrote:
>>
>> Hello Hans,
>>
>> After this patch one of our tests failed with the following error:
>>
>> error: format specifies type 'int *' but the argument has type 'volatile
>> int *' [-Werror,-Wformat]
>>   fprintf(stdout, "printing a string: %s%n\n", s, &a);
>>                                         ~~        ^~
>>
>> Do you think that we should fix the code, or Clang shouldn't produce the
>> warning in this case?
>>
>> On Mon, Jul 30, 2012 at 9:11 PM, Hans Wennborg <hans at hanshq.net> wrote:
>>>
>>> Author: hans
>>> Date: Mon Jul 30 12:11:32 2012
>>> New Revision: 160966
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=160966&view=rev
>>> Log:
>>> Make -Wformat check the argument type for %n.
>>>
>>> This makes Clang check that the corresponding argument for "%n" in a
>>> format string is a pointer to int.



More information about the cfe-commits mailing list