Bug 171028

Summary: -Wformat warning on HistoryController.cpp:295:5
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebCore Misc.Assignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, buildbot, cdumez, dbates, japhet, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch dbates: review+, dbates: commit-queue-

Description Michael Catanzaro 2017-04-19 18:49:55 PDT
Cannot use enum as int without a cast:

[881/3415] Building CXX object Source/...ore.dir/loader/HistoryController.cpp.o
In file included from ../../Source/WTF/wtf/StdLibExtras.h:34:0,
                 from ../../Source/WTF/wtf/FastMalloc.h:26,
                 from ../../Source/WebCore/config.h:75,
                 from ../../Source/WebCore/loader/HistoryController.cpp:31:
../../Source/WebCore/loader/HistoryController.cpp: In member function ‘void WebCore::HistoryController::goToItem(WebCore::HistoryItem&, WebCore::FrameLoadType)’:
../../Source/WTF/wtf/Assertions.h:407:68: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘WebCore::FrameLoadType’ [-Wformat=]
 #define LOG(channel, ...) WTFLog(&LOG_CHANNEL(channel), __VA_ARGS__)
                                                                    ^
../../Source/WebCore/loader/HistoryController.cpp:295:5: note: in expansion of macro ‘LOG’
     LOG(History, "HistoryController %p goToItem %p type=%d", this, &targetItem, type);
     ^~~
Comment 1 Michael Catanzaro 2017-04-19 18:51:04 PDT
Created attachment 307539 [details]
Patch
Comment 2 Daniel Bates 2017-04-19 21:33:50 PDT
Comment on attachment 307539 [details]
Patch

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

I am assuming that -Wall does not include -Wformat and that we do not enable -Wformat on the Mac, iOS, or Windows bots as I have not seen this failure. We should look to enable -Wformat on these bots.

> Source/WebCore/ChangeLog:7
> +

Please explain the change.
Comment 3 Michael Catanzaro 2017-04-20 09:46:57 PDT
(In reply to Daniel Bates from comment #2)
> Comment on attachment 307539 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=307539&action=review
> 
> I am assuming that -Wall does not include -Wformat

No, -Wall does include -Wformat (at least in GCC).

> and that we do not enable
> -Wformat on the Mac, iOS, or Windows bots as I have not seen this failure.
> We should look to enable -Wformat on these bots.

I don't know about that. Certainly the Apple builds seem to be less-strict about such issues.

> > Source/WebCore/ChangeLog:7
> > +
> 
> Please explain the change.

Aw man. :P
Comment 4 Michael Catanzaro 2017-04-20 14:57:03 PDT
Committed r215580: <http://trac.webkit.org/changeset/215580>