WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
185631
TestWebKitAPI: Fix warnings found by new clang compiler
https://bugs.webkit.org/show_bug.cgi?id=185631
Summary
TestWebKitAPI: Fix warnings found by new clang compiler
David Kilzer (:ddkilzer)
Reported
2018-05-14 14:52:45 PDT
Building WebKit with a newer clang compiler emits a few new warnings in various TestWebKitAPI sources: Tools/TestWebKitAPI/Tests/WebKit/FindMatches.mm:88:18: error: explicitly assigning value of variable of type 'WKRect' to itself [-Werror,-Wself-assign-overloaded] rect = rect; ~~~~ ^ ~~~~ 1 error generated. In file included from Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:26: In file included from Tools/TestWebKitAPI/config.h:59: Debug/gtest.framework/Headers/gtest.h:1263:16: error: comparison of integers of different signs: 'const long' and 'const (anonymous enum at Debug/WebKit.framework/PrivateHeaders/WKWebViewPrivate.h:88:9)' [-Werror,-Wsign-compare] if (expected == actual) { ~~~~~~~~ ^ ~~~~~~ Debug/gtest.framework/Headers/gtest.h:1299:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<long, (anonymous enum at Debug/WebKit.framework/PrivateHeaders/WKWebViewPrivate.h:88:9)>' requested here return CmpHelperEQ(expected_expression, actual_expression, expected, ^ Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:663:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<long, (anonymous enum at Debug/WebKit.framework/PrivateHeaders/WKWebViewPrivate.h:88:9)>' requested here EXPECT_EQ([[change objectForKey:NSKeyValueChangeOldKey] integerValue], _WKRectEdgeAll); ^ In file included from Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:26: In file included from Tools/TestWebKitAPI/config.h:59: Debug/gtest.framework/Headers/gtest.h:1761:67: note: expanded from macro 'EXPECT_EQ' EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \ ^ 1 error generated. Tools/TestWebKitAPI/Tests/WTF/NakedPtr.cpp:175:13: error: explicitly assigning value of variable of type 'NakedPtr<TestWebKitAPI::RefLogger>' to itself [-Werror,-Wself-assign-overloaded] ptr = ptr; ~~~ ^ ~~~ 1 error generated. Tools/TestWebKitAPI/Tests/WTF/Poisoned.cpp:482:13: error: explicitly assigning value of variable of type 'Poisoned<TestWebKitAPI::(anonymous namespace)::TestPoisonA, TestWebKitAPI::RefLogger *>' (aka 'Poisoned<Poison<g_testPoisonA>, TestWebKitAPI::RefLogger *>') to itself [-Werror,-Wself-assign-overloaded] ptr = ptr; ~~~ ^ ~~~ 1 error generated. Tools/TestWebKitAPI/Tests/WTF/PoisonedRefPtr.cpp:307:13: error: explicitly assigning value of variable of type 'PoisonedRefPtr<TestWebKitAPI::(anonymous namespace)::PoisonE, TestWebKitAPI::RefLogger>' (aka 'WTF::RefPtr<TestWebKitAPI::RefLogger, WTF::PoisonedPtrTraits<WTF::Poison<&TestWebKitAPI::(anonymous namespace)::g_poisonE>, TestWebKitAPI::RefLogger> >') to itself [-Werror,-Wself-assign-overloaded] ptr = ptr; ~~~ ^ ~~~ Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp:263:13: error: explicitly assigning value of variable of type 'RefPtr<TestWebKitAPI::RefLogger>' to itself [-Werror,-Wself-assign-overloaded] ptr = ptr; ~~~ ^ ~~~ 1 error generated.
Attachments
Patch v1
(6.76 KB, patch)
2018-05-14 15:10 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Patch v2
(6.62 KB, patch)
2018-05-14 20:11 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-05-14 14:53:01 PDT
<
rdar://problem/40234123
>
David Kilzer (:ddkilzer)
Comment 2
2018-05-14 15:10:59 PDT
Created
attachment 340365
[details]
Patch v1
Michael Catanzaro
Comment 3
2018-05-14 15:33:21 PDT
Comment on
attachment 340365
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=340365&action=review
> Tools/TestWebKitAPI/Tests/WTF/NakedPtr.cpp:178 > +#pragma clang diagnostic ignored "-Wunknown-pragmas" > +#pragma clang diagnostic ignored "-Wself-assign-overloaded"
I think it would be good form to use two pops now to return the diagnostic stack to its original state, not that it matters.
> Tools/TestWebKitAPI/Tests/WebKit/FindMatches.mm:88 > + unusedRect = WKRectGetValue(reinterpret_cast<WKRectRef>(items));
Can you not just drop the return value? Or cast the result to void?
David Kilzer (:ddkilzer)
Comment 4
2018-05-14 15:40:56 PDT
Comment on
attachment 340365
[details]
Patch v1 Oops, need to fix the pragmas.
David Kilzer (:ddkilzer)
Comment 5
2018-05-14 15:44:06 PDT
Comment on
attachment 340365
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=340365&action=review
>> Tools/TestWebKitAPI/Tests/WTF/NakedPtr.cpp:178 >> +#pragma clang diagnostic ignored "-Wself-assign-overloaded" > > I think it would be good form to use two pops now to return the diagnostic stack to its original state, not that it matters.
That's not how #pragma clang diagnostic push works. See the next function below this.
>> Tools/TestWebKitAPI/Tests/WebKit/FindMatches.mm:88 >> + unusedRect = WKRectGetValue(reinterpret_cast<WKRectRef>(items)); > > Can you not just drop the return value? Or cast the result to void?
Since it returns a struct, I didn't check whether I could cast to void. I also toyed with adding some assertions (like EXPECT_TRUE(rect.size.width != 0 && rect.size.height != 0). Maybe I'll do that instead.
Michael Catanzaro
Comment 6
2018-05-14 18:41:45 PDT
Comment on
attachment 340365
[details]
Patch v1 View in context:
https://bugs.webkit.org/attachment.cgi?id=340365&action=review
>>> Tools/TestWebKitAPI/Tests/WTF/NakedPtr.cpp:178 >>> +#pragma clang diagnostic ignored "-Wself-assign-overloaded" >> >> I think it would be good form to use two pops now to return the diagnostic stack to its original state, not that it matters. > > That's not how #pragma clang diagnostic push works. See the next function below this.
Whoops, yes... one push, one pop, of course.
David Kilzer (:ddkilzer)
Comment 7
2018-05-14 20:11:16 PDT
Created
attachment 340390
[details]
Patch v2
WebKit Commit Bot
Comment 8
2018-05-15 09:45:03 PDT
Comment on
attachment 340390
[details]
Patch v2 Clearing flags on attachment: 340390 Committed
r231806
: <
https://trac.webkit.org/changeset/231806
>
WebKit Commit Bot
Comment 9
2018-05-15 09:45:05 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug