Bug 171028 - -Wformat warning on HistoryController.cpp:295:5
Summary: -Wformat warning on HistoryController.cpp:295:5
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-19 18:49 PDT by Michael Catanzaro
Modified: 2017-04-20 14:57 PDT (History)
6 users (show)

See Also:


Attachments
Patch (1.43 KB, patch)
2017-04-19 18:51 PDT, Michael Catanzaro
dbates: review+
dbates: commit-queue-
Details | Formatted Diff | Diff

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