[cfe-commits] r156092 - /cfe/trunk/lib/Sema/SemaChecking.cpp

Jordy Rose jediknil at belkadan.com
Thu May 3 13:05:16 PDT 2012


On May 3, 2012, at 15:55, jahanian wrote:

> 
> On May 3, 2012, at 12:47 PM, Bob Wilson wrote:
> 
>> Author: bwilson
>> Date: Thu May  3 14:47:19 2012
>> New Revision: 156092
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=156092&view=rev
>> Log:
>> Disable -Wformat-extra-args for arguments defined in system headers.
>> 
>> Some of the NSAssert macros in OS X 10.7 are implemented in a way that
>> adds extra arguments that trigger the -Wformat-extra-args warning.
>> Earlier versions of clang failed to detect those -Wformat issues, but now
>> that clang is reporting those problems, we need to quiet them since there's
>> nothing to be done to fix them.  <rdar://problem/11317765>
>> 
>> I don't know how to write a testcase for this.  Suggestions welcome.
>> Patch by Ted Kremenek!
> 
> You can do something like:
> 
> # 1 "<command line>"
> # 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3

Possibly cleaner way: a couple files in the test suite have header helpers that include this:

#pragma clang system_header

So you can make a fake header and then include it in a test file. Downside is it takes two files, but I'm not sure offhand if Fariborz's way will be considered a system header on all systems. (He's worked on Clang longer than I have, though.)

Jordy





More information about the cfe-commits mailing list