Bug 165650

Summary: Fix string specification in print format
Product: WebKit Reporter: Keith Rollin <krollin>
Component: WebKit Misc.Assignee: Keith Rollin <krollin>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Keith Rollin 2016-12-08 21:49:23 PST
As Alex noted in Bug 164527, Comment 40, the string specifications in format strings are not standard and don't build with non-Cocoa SDKs or even with Cocoa SDKs that are not recent enough.
Comment 1 Keith Rollin 2016-12-08 22:59:24 PST
Created attachment 296645 [details]
Patch
Comment 2 Keith Rollin 2016-12-08 23:03:21 PST
I thought about using "PRIs" instead of "STRING_SPECIFICATION" (as an analog to "PRId8", et al), but wasn't sure everyone would get the reference. Also, I've been encouraged by multiple parties to spell out my symbol names, so I went with "STRING_SPECIFICATION". But if there's support for "PRIs" (or perhaps "PRIsPUBLIC"), I could use that instead.
Comment 3 Alex Christensen 2016-12-09 00:20:22 PST
Comment on attachment 296645 [details]
Patch

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

We do use a lot of PRI* in places like NetworkCacheStatistics.cpp, but PRIs isn't standardized and I think this is indeed better.

> Source/WebKit2/NetworkProcess/capture/NetworkCaptureLogging.h:46
> +#define DEBUG_LOG(format, ...)          RELEASE_LOG(Network, "#PLT: %p - " STRING_SPECIFICATION "::" STRING_SPECIFICATION ": " format, this, DEBUG_LOG_EXPAND_AND_QUOTE(DEBUG_CLASS), __FUNCTION__, ##__VA_ARGS__)

http://www.cplusplus.com/reference/cstdio/printf/ calls this a "specifier" not a "specification".  Let's call them specifiers.  If they're called specifications somewhere I'm not familiar with, that's ok, too.
Comment 4 Keith Rollin 2016-12-09 11:32:35 PST
Created attachment 296664 [details]
Patch
Comment 5 WebKit Commit Bot 2016-12-09 13:59:51 PST
Comment on attachment 296664 [details]
Patch

Clearing flags on attachment: 296664

Committed r209625: <http://trac.webkit.org/changeset/209625>
Comment 6 WebKit Commit Bot 2016-12-09 13:59:55 PST
All reviewed patches have been landed.  Closing bug.