Bug 178209 - DataTransfer.cpp triggers -Wunused-but-set-variable
Summary: DataTransfer.cpp triggers -Wunused-but-set-variable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tomas Popela
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-12 05:53 PDT by Tomas Popela
Modified: 2018-12-03 23:33 PST (History)
8 users (show)

See Also:


Attachments
Patch (1.78 KB, patch)
2017-10-12 05:56 PDT, Tomas Popela
no flags Details | Formatted Diff | Diff
Patch (1.32 KB, patch)
2017-10-13 00:07 PDT, Tomas Popela
wenson_hsieh: review+
Details | Formatted Diff | Diff

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