Enable the “Typecheck calls to…” warning for NSLog and stringWithFormat:
| Originator: | boredzo | ||
| Number: | rdar://7375186 | Date Originated: | 2009-11-07T19:31-0800 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | 4.2.1/5646 |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Summary: The “Typecheck calls to printf/scanf” warning should also check calls to NSLog and CFStringCreateWithFormat and messages to +[NSString stringWithFormat:] and -[NSString initWithFormat:] (and all of those APIs' I-have-a-va_list-already siblings). Steps to Reproduce: 1. Write a statement that calls NSLog with arguments that don't match the format string; for example: NSLog(@"Hello %s!", [NSString stringWithString:@"world"]); 2. Turn on the “Typecheck calls to printf/scanf” warning. 3. Compile the code. Expected Results: The compiler raises the warning for the bogus NSLog call. Actual Results: The compiler doesn't know about NSLog, so it doesn't examine its arguments. Regression: No. Notes: The version and build number I entered are those of GCC, from Xcode 3.2. I also tested with Clang. That doesn't do it, either.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!