Bug 178209

Summary: DataTransfer.cpp triggers -Wunused-but-set-variable
Product: WebKit Reporter: Tomas Popela <tpopela>
Component: WebCore Misc.Assignee: Tomas Popela <tpopela>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, buildbot, cdumez, dbates, esprehn+autocc, kangil.han, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch wenson_hsieh: review+

Description Tomas Popela 2017-10-12 05:53:58 PDT
../../Source/WebCore/dom/DataTransfer.cpp: In member function ‘WTF::Vector<WTF::Ref<WebCore::File> > WebCore::DataTransfer::filesFromPasteboardAndItemList() const’:
../../Source/WebCore/dom/DataTransfer.cpp:289:10: warning: variable ‘addedFilesFromPasteboard’ set but not used [-Wunused-but-set-variable]
     bool addedFilesFromPasteboard = false;
          ^~~~~~~~~~~~~~~~~~~~~~~~
../../Source/WebCore/dom/DataTransfer.cpp:298:10: warning: variable ‘itemListContainsItems’ set but not used [-Wunused-but-set-variable]
     bool itemListContainsItems = false;
          ^~~~~~~~~~~~~~~~~~~~~
Comment 1 Tomas Popela 2017-10-12 05:56:31 PDT
Created attachment 323523 [details]
Patch
Comment 2 Alex Christensen 2017-10-12 13:29:27 PDT
Comment on attachment 323523 [details]
Patch

We could also solve this with ASSERT_DISABLED or ASSERT_UNUSED
Comment 3 Tomas Popela 2017-10-12 21:14:33 PDT
(In reply to Alex Christensen from comment #2)
> Comment on attachment 323523 [details]
> Patch
> 
> We could also solve this with ASSERT_DISABLED or ASSERT_UNUSED

I knew there was a better way.. ASSERT_UNUSED is more cleaner solution.
Comment 4 Tomas Popela 2017-10-13 00:07:55 PDT
Created attachment 323643 [details]
Patch
Comment 5 Wenson Hsieh 2017-10-13 08:30:50 PDT
Comment on attachment 323643 [details]
Patch

I don't think processedFiles is a great name for this local variable...perhaps make this something like:

bool containsItemsAndFiles = itemListContainsItems && addedFilesFromPasteboard;

...and then ASSERT_UNUSED(containsItemsAndFiles, !containsItemsAndFiles);?
Comment 6 Tomas Popela 2017-10-15 21:17:06 PDT
Committed r223334: <https://trac.webkit.org/changeset/223334>
Comment 7 Radar WebKit Bug Importer 2017-10-15 21:18:24 PDT
<rdar://problem/35001133>