<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>140003</bug_id>
          
          <creation_ts>2014-12-29 19:24:26 -0800</creation_ts>
          <short_desc>[Cocoa] Enable the compiler to check format strings specified with UI_STRING and UI_STRING_KEY</short_desc>
          <delta_ts>2014-12-30 12:43:12 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>mitz</reporter>
          <assigned_to>mitz</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1058158</commentid>
    <comment_count>0</comment_count>
    <who name="">mitz</who>
    <bug_when>2014-12-29 19:24:26 -0800</bug_when>
    <thetext>Enable the compiler to emit a warning for something like [NSString stringWithFormat:UI_STRING(&quot;%d files&quot;, &quot;label next to file upload button&quot;), @&quot;not an int&quot;] based on %d not matching the NSString parameter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058160</commentid>
    <comment_count>1</comment_count>
      <attachid>243817</attachid>
    <who name="">mitz</who>
    <bug_when>2014-12-29 19:34:59 -0800</bug_when>
    <thetext>Created attachment 243817
Add format_arg attributes to UI_STRING and UI_STRING_KEY</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058161</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-12-29 19:36:13 -0800</bug_when>
    <thetext>Attachment 243817 did not pass style-queue:


ERROR: Source/WebKit/mac/Misc/WebLocalizableStrings.h:47:  The parameter name &quot;bundle&quot; adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebKit/mac/Misc/WebLocalizableStrings.h:54:  The parameter name &quot;bundle&quot; adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058190</commentid>
    <comment_count>3</comment_count>
      <attachid>243817</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-12-30 10:05:54 -0800</bug_when>
    <thetext>Comment on attachment 243817
Add format_arg attributes to UI_STRING and UI_STRING_KEY

View in context: https://bugs.webkit.org/attachment.cgi?id=243817&amp;action=review

&gt; Source/WebKit/mac/ChangeLog:9
&gt; +        that takes their &quot;string&quot; parameter as a &quot;value&quot; &quot;parameter and has an attribute telling

Extra quote here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058191</commentid>
    <comment_count>4</comment_count>
      <attachid>243817</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-12-30 10:09:07 -0800</bug_when>
    <thetext>Comment on attachment 243817
Add format_arg attributes to UI_STRING and UI_STRING_KEY

View in context: https://bugs.webkit.org/attachment.cgi?id=243817&amp;action=review

&gt; Source/WebKit/mac/Misc/WebLocalizableStrings.h:52
&gt; +static inline NS_FORMAT_ARGUMENT(3) NSString *WebLocalizedStringWithValue(WebLocalizableStringsBundle *bundle, const char* key, const char* value)
&gt; +{
&gt; +    return WebLocalizedString(bundle, key);
&gt; +}

On reflection, I don’t think it’s good for WebLocalizedStringWithValue inlines to be inside extern &quot;C&quot;; I also don’t like the formatting with the #if right up against the functions, but blank lines between the two functions. I’d move WebLocalizedStringWithValue down below. And I’d even consider using a macro for the NS/CF_FORMAT_ARGUMENT so we don’t have to repeat the WebLocalizedStringWithValue function twice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058192</commentid>
    <comment_count>5</comment_count>
    <who name="">mitz</who>
    <bug_when>2014-12-30 10:13:09 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; Comment on attachment 243817 [details]
&gt; Add format_arg attributes to UI_STRING and UI_STRING_KEY
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=243817&amp;action=review
&gt; 
&gt; &gt; Source/WebKit/mac/Misc/WebLocalizableStrings.h:52
&gt; &gt; +static inline NS_FORMAT_ARGUMENT(3) NSString *WebLocalizedStringWithValue(WebLocalizableStringsBundle *bundle, const char* key, const char* value)
&gt; &gt; +{
&gt; &gt; +    return WebLocalizedString(bundle, key);
&gt; &gt; +}
&gt; 
&gt; On reflection, I don’t think it’s good for WebLocalizedStringWithValue
&gt; inlines to be inside extern &quot;C&quot;; I also don’t like the formatting with the
&gt; #if right up against the functions, but blank lines between the two
&gt; functions. I’d move WebLocalizedStringWithValue down below.

OK.

&gt; And I’d even
&gt; consider using a macro for the NS/CF_FORMAT_ARGUMENT so we don’t have to
&gt; repeat the WebLocalizedStringWithValue function twice.

Wouldn’t we still need to repeat at least the function signature because of the return types being different?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058193</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-12-30 10:21:07 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; &gt; And I’d even
&gt; &gt; consider using a macro for the NS/CF_FORMAT_ARGUMENT so we don’t have to
&gt; &gt; repeat the WebLocalizedStringWithValue function twice.
&gt; 
&gt; Wouldn’t we still need to repeat at least the function signature because of
&gt; the return types being different?

Might need a typedef too, yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1058199</commentid>
    <comment_count>7</comment_count>
    <who name="">mitz</who>
    <bug_when>2014-12-30 12:43:12 -0800</bug_when>
    <thetext>Committed &lt;http://trac.webkit.org/r177825&gt;.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>243817</attachid>
            <date>2014-12-29 19:34:59 -0800</date>
            <delta_ts>2014-12-30 10:05:54 -0800</delta_ts>
            <desc>Add format_arg attributes to UI_STRING and UI_STRING_KEY</desc>
            <filename>bug-140003-20141229193501.patch</filename>
            <type>text/plain</type>
            <size>3208</size>
            <attacher>mitz</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJLaXQvbWFjL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2Uv
V2ViS2l0L21hYy9DaGFuZ2VMb2cJKHJldmlzaW9uIDE3NzgyMCkKKysrIFNvdXJjZS9XZWJLaXQv
bWFjL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE3IEBACisyMDE0LTEyLTI5
ICBEYW4gQmVybnN0ZWluICA8bWl0ekBhcHBsZS5jb20+CisKKyAgICAgICAgW0NvY29hXSBFbmFi
bGUgdGhlIGNvbXBpbGVyIHRvIGNoZWNrIGZvcm1hdCBzdHJpbmdzIHNwZWNpZmllZCB3aXRoIFVJ
X1NUUklORyBhbmQgVUlfU1RSSU5HX0tFWQorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9y
Zy9zaG93X2J1Zy5jZ2k/aWQ9MTQwMDAzCisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChP
T1BTISkuCisKKyAgICAgICAgKiBNaXNjL1dlYkxvY2FsaXphYmxlU3RyaW5ncy5oOiBNYWRlIFVJ
X1NUUklORyBhbmQgVUlfU1RSSU5HX0tFWSBjYWxsIGEgbmV3I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I2RlZmluZSBV
SV9TVFJJTkdfS0VZKHN0cmluZywga2V5LCBjb21tZW50KSBXZWJMb2NhbGl6ZWRTdHJpbmcoMCwg
a2V5KQorI2RlZmluZSBVSV9TVFJJTkcoc3RyaW5nLCBjb21tZW50KSBXZWJMb2NhbGl6ZWRTdHJp
bmdXaXRoVmFsdWUoMCwgc3RyaW5nLCBzdHJpbmcpCisjZGVmaW5lIFVJX1NUUklOR19LRVkoc3Ry
aW5nLCBrZXksIGNvbW1lbnQpIFdlYkxvY2FsaXplZFN0cmluZ1dpdGhWYWx1ZSgwLCBrZXksIHN0
cmluZykKIAogI2VuZGlmCg==
</data>
<flag name="review"
          id="268731"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>