[LLVMbugs] [Bug 15678] New: -Wformat-nonliteral is inconsistent

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 4 14:46:57 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15678

            Bug ID: 15678
           Summary: -Wformat-nonliteral is inconsistent
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bjhomer+llvm at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code generates a warning under -Wformat-nonliteral:

  NSString *template = NSLocalizedString(@"My name is %@", nil);
  NSString *str = [NSString stringWithFormat:template, @"John"];

However, the following code does not:

  NSString *str = [NSString stringWithFormat:NSLocalizedString(@"My name is
%@", nil), @"John"];

Note that in neither case is the parameter actually a string literal; the
return value of NSLocalizedString() is determined at runtime in either case.

I suspect that it should really warn in both cases, though that means I'll
probably have to turn off this warning for my project.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130404/a5cdc444/attachment.html>


More information about the llvm-bugs mailing list