Bug 165650 - Fix string specification in print format
Summary: Fix string specification in print format
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Rollin
Depends on:
Reported: 2016-12-08 21:49 PST by Keith Rollin
Modified: 2016-12-09 13:59 PST (History)
2 users (show)

See Also:

Patch (28.67 KB, patch)
2016-12-08 22:59 PST, Keith Rollin
no flags Details | Formatted Diff | Diff
Patch (28.40 KB, patch)
2016-12-09 11:32 PST, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
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]

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]
Comment 5 WebKit Commit Bot 2016-12-09 13:59:51 PST
Comment on attachment 296664 [details]

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.