benhamilton added a comment.

I filed rdar://38143508 to track this.

The fix won't be easy; I think `__attribute__((format_arg(X)))` isn't enough to 
capture how `-[NSBundle localizedStringForKey:value:table:]` works:

1. `__attribute__((format_arg(X)))` doesn't support multiple format arguments, 
and it appears to ignore everything but the last such declaration:

https://github.com/llvm-mirror/clang/blob/master/lib/Sema/SemaChecking.cpp#L5030

2. `NSLocalizedString()` and friends pass `@""` as the value argument, which 
raises `-Wformat-zero-length` if we tag it as a format argument:

  test.m:21:12: error: format string is empty [-Werror,-Wformat-zero-length]
            @"",
            ~^~
  test.m:14:46: note: expanded from macro 'NSLocalizedStringWithDefaultValue'
    [bundle localizedStringForKey:(key) value:(val) table:(tbl)]
                                               ^~~
  1 error generated.

This means we'll either need a new attribute which allows a zero-length format 
string, or a way to change format_arg to understand this "argument with default 
value" semantic.


Repository:
  rL LLVM

https://reviews.llvm.org/D25820



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to