WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 44593
[Qt] Fix warnings in WebKit2 directory
https://bugs.webkit.org/show_bug.cgi?id=44593
Summary
[Qt] Fix warnings in WebKit2 directory
Csaba Osztrogonác
Reported
2010-08-25 01:47:01 PDT
Warnings on Qt Linux Release buildbot: ../../../WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp:61: warning: unused variable ‘numberOfBytesRead’ ../../../WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp:73: warning: unused variable ‘numberOfBytesRead’ ../../../WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp:126: warning: unused variable ‘bytesWritten’ ../../../WebKit2/Shared/qt/WebEventFactoryQt.cpp:176: warning: ‘state’ may be used uninitialized in this function ../../../WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp:54: warning: ‘npEvent’ is used uninitialized in this function Fix is coming soon.
Attachments
proposed fix
(3.48 KB, patch)
2010-08-25 02:03 PDT
,
Csaba Osztrogonác
no flags
Details
Formatted Diff
Diff
proposed fix
(3.87 KB, patch)
2010-08-25 04:53 PDT
,
Csaba Osztrogonác
no flags
Details
Formatted Diff
Diff
proposed fix
(3.88 KB, patch)
2010-08-25 05:13 PDT
,
Csaba Osztrogonác
no flags
Details
Formatted Diff
Diff
proposed fix
(3.91 KB, text/plain)
2010-08-30 08:24 PDT
,
Csaba Osztrogonác
no flags
Details
proposed fix again
(3.96 KB, patch)
2010-08-30 09:06 PDT
,
Csaba Osztrogonác
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Csaba Osztrogonác
Comment 1
2010-08-25 02:03:46 PDT
Created
attachment 65386
[details]
proposed fix
Andras Becsi
Comment 2
2010-08-25 03:55:47 PDT
Comment on
attachment 65386
[details]
proposed fix WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp: + Just try npEvent = NPEvent(), else the new could leak. If this gets implemented this should be initialized. WebKit2/Shared/qt/WebEventFactoryQt.cpp:200 + state = WebPlatformTouchPoint::TouchReleased; This initialization should be at the beginning, I think this would avoid confusion. The ASSERT is needed however. Otherwise LGTM, but I'm not a reviewer :)
Kenneth Rohde Christiansen
Comment 3
2010-08-25 04:03:46 PDT
Comment on
attachment 65386
[details]
proposed fix WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp:62 + (void)numberOfBytesRead; Isn't there a macro for that? Please check wtf. Qt normally uses Q_UNUSED
Csaba Osztrogonác
Comment 4
2010-08-25 04:53:34 PDT
Created
attachment 65398
[details]
proposed fix Updated version based on comments of Andras and Kenneth.
Early Warning System Bot
Comment 5
2010-08-25 05:08:52 PDT
Attachment 65398
[details]
did not build on qt: Build output:
http://queues.webkit.org/results/3769682
Csaba Osztrogonác
Comment 6
2010-08-25 05:11:35 PDT
Comment on
attachment 65398
[details]
proposed fix It isn't my day. :) Fix is coming soon.
Csaba Osztrogonác
Comment 7
2010-08-25 05:13:23 PDT
Created
attachment 65402
[details]
proposed fix Qt build fixed.
Andras Becsi
Comment 8
2010-08-25 05:31:05 PDT
(In reply to
comment #7
)
> Created an attachment (id=65402) [details] > proposed fix > > Qt build fixed.
LGTM.
Antonio Gomes
Comment 9
2010-08-25 06:28:13 PDT
Comment on
attachment 65402
[details]
proposed fix Looks good, but need another round.
> diff --git a/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp b/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp > index 3e77e46..aae977b 100644 > --- a/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp > +++ b/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp > @@ -59,6 +59,7 @@ void Connection::readyReadHandler() > while (m_socket->bytesAvailable()) { > if (!m_currentMessageSize) { > size_t numberOfBytesRead = m_socket->read(reinterpret_cast<char*>(m_readBuffer.data()), sizeof(size_t)); > + Q_UNUSED(numberOfBytesRead); > ASSERT(numberOfBytesRead);
combine both Q_UNUSED and ASSERT in a ASSERT_UNUSED
> m_currentMessageSize = *reinterpret_cast<size_t*>(m_readBuffer.data()); > } > @@ -71,6 +72,7 @@ void Connection::readyReadHandler() > } > > size_t numberOfBytesRead = m_socket->read(reinterpret_cast<char*>(m_readBuffer.data()), m_currentMessageSize); > + Q_UNUSED(numberOfBytesRead); > ASSERT(numberOfBytesRead);
Ditto.
> // The messageID is encoded at the end of the buffer. > @@ -124,7 +126,7 @@ bool Connection::sendOutgoingMessage(MessageID messageID, PassOwnPtr<ArgumentEnc > m_socket->write(reinterpret_cast<char*>(&bufferSize), sizeof(bufferSize)); > > qint64 bytesWritten = m_socket->write(reinterpret_cast<char*>(arguments->buffer()), arguments->bufferSize()); > - > + Q_UNUSED(bytesWritten); > ASSERT(bytesWritten == arguments->bufferSize());
Ditto.
> return true; > } > diff --git a/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/WebKit2/Shared/qt/WebEventFactoryQt.cpp > index bdd6a23..043b35e 100644 > --- a/WebKit2/Shared/qt/WebEventFactoryQt.cpp > +++ b/WebKit2/Shared/qt/WebEventFactoryQt.cpp > @@ -173,7 +173,7 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(QKeyEvent* event) > WebTouchEvent WebEventFactory::createWebTouchEvent(QTouchEvent* event) > { > WebEvent::Type type = webEventTypeForEvent(event); > - WebPlatformTouchPoint::TouchPointState state; > + WebPlatformTouchPoint::TouchPointState state = static_cast<WebPlatformTouchPoint::TouchPointState>(0); > unsigned int id; > WebEvent::Modifiers modifiers = modifiersForEvent(event->modifiers()); > double timestamp = WTF::currentTime(); > @@ -196,6 +196,9 @@ WebTouchEvent WebEventFactory::createWebTouchEvent(QTouchEvent* event) > case Qt::TouchPointStationary: > state = WebPlatformTouchPoint::TouchStationary; > break; > + default: > + ASSERT_NOT_REACHED(); > + break; > } > > m_touchPoints.append(WebPlatformTouchPoint(id, state, points.at(i).screenPos().toPoint().x(), > diff --git a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp > index b8bbb87..3f2ae4f 100644 > --- a/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp > +++ b/WebKit2/WebProcess/Plugins/Netscape/qt/NetscapePluginQt.cpp > @@ -47,7 +47,7 @@ void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirt > > NPEvent toNP(const WebMouseEvent& event) > { > - NPEvent npEvent; > + NPEvent npEvent = NPEvent(); > > notImplemented(); >
Strange it is need. I thought the default constructor would do this trick.
Csaba Osztrogonác
Comment 10
2010-08-25 07:12:26 PDT
ASSERT_UNUSED != Q_UNUSED + ASSERT , because Q_UNUSED differs for ICC and RVCT. Maybe ICC and RVCT don't like (void)x; So I think Q_UNUSED would be better here. 1.) #define ASSERT_UNUSED(variable, assertion) ((void)variable) 2.) #if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT) template <typename T> inline void qUnused(T &x) { (void)x; } # define Q_UNUSED(x) qUnused(x); #else # define Q_UNUSED(x) (void)x; #endif
>> NPEvent toNP(const WebMouseEvent& event) >> { >> - NPEvent npEvent; >> + NPEvent npEvent = NPEvent(); >> >> notImplemented(); >> > Strange it is need. I thought the default constructor would do this trick.
An NPEvent can be a QEvent (if XP_SYMBIAN), a struct (if XP_WIN or XP_OS2), XEvent (if XP_WIN) or a simple void* otherwise. Consequently we should initialize this local variable explicitly to make compilers happy.
Csaba Osztrogonác
Comment 11
2010-08-25 07:16:10 PDT
Comment on
attachment 65402
[details]
proposed fix r? again, because I think Q_UNUSED is correct.
Sam Weinig
Comment 12
2010-08-25 07:25:36 PDT
(In reply to
comment #11
)
> (From update of
attachment 65402
[details]
) > r? again, because I think Q_UNUSED is correct.
I don't see any reason to use Q_UNUSED, but it is your call. In most of platform specific code we use the WTF versions.
Csaba Osztrogonác
Comment 13
2010-08-25 07:34:08 PDT
(In reply to
comment #12
)
> I don't see any reason to use Q_UNUSED, but it is your call. In most of platform specific code we use the WTF versions.
I found 64 occurences of Q_UNUSED mainly in Qt API layers.
Csaba Osztrogonác
Comment 14
2010-08-30 06:24:01 PDT
ping? Kenneth or Antonio, could you review my patch, please? The question is ASSERT_UNUSED or (Q_UNUSED + ASSERT)?
Balazs Kelemen
Comment 15
2010-08-30 06:44:22 PDT
(In reply to
comment #14
)
> ping? > > Kenneth or Antonio, could you review my patch, please? > The question is ASSERT_UNUSED or (Q_UNUSED + ASSERT)?
Definitely ASSERT_UNUSED.
Antonio Gomes
Comment 16
2010-08-30 06:45:10 PDT
(In reply to
comment #14
)
> ping? > > Kenneth or Antonio, could you review my patch, please? > The question is ASSERT_UNUSED or (Q_UNUSED + ASSERT)?
Does not ASSERT_UNUSED build for you? I do not have a strong preference on it, but it looks like it was developed to cases like this.
Balazs Kelemen
Comment 17
2010-08-30 06:50:38 PDT
(In reply to
comment #15
)
> (In reply to
comment #14
) > > ping? > > > > Kenneth or Antonio, could you review my patch, please? > > The question is ASSERT_UNUSED or (Q_UNUSED + ASSERT)? > > Definitely ASSERT_UNUSED.
Ok, I did not read the bug before writing this, however I think if it is necessary than we should rather fix ASSET_UNUSED for ICC and RVCT.
Csaba Osztrogonác
Comment 18
2010-08-30 06:52:03 PDT
(In reply to
comment #16
)
> Does not ASSERT_UNUSED build for you? I do not have a strong preference on it, but it looks like it was developed to cases like this.
ASSERT_UNUSED build for me, but I can't test with ICC and RVCT. :( I think there is a reason why are 64 occurences of Q_UNUSED in WebKit trunk.
Csaba Osztrogonác
Comment 19
2010-08-30 06:54:21 PDT
(In reply to
comment #17
)
> Ok, I did not read the bug before writing this, however I think if it is necessary than we should rather fix ASSET_UNUSED for ICC and RVCT.
Good idea. ASSERT_UNUSED should call Q_UNUSED if PLATFORM(QT) is true.
Csaba Osztrogonác
Comment 20
2010-08-30 08:24:43 PDT
Created
attachment 65916
[details]
proposed fix ASSERT_UNUSED will call Q_UNUSED, so we don't need to call Q_UNUSED + ASSERT anymore:
https://bugs.webkit.org/show_bug.cgi?id=44870
Early Warning System Bot
Comment 21
2010-08-30 08:55:07 PDT
Attachment 65916
[details]
did not build on qt: Build output:
http://queues.webkit.org/results/3871154
Csaba Osztrogonác
Comment 22
2010-08-30 08:56:30 PDT
Comment on
attachment 65916
[details]
proposed fix one more round needed :S
Csaba Osztrogonác
Comment 23
2010-08-30 09:06:35 PDT
Created
attachment 65919
[details]
proposed fix again
Csaba Osztrogonác
Comment 24
2010-08-31 10:01:37 PDT
Comment on
attachment 65919
[details]
proposed fix again Clearing flags on attachment: 65919 Committed
r66495
: <
http://trac.webkit.org/changeset/66495
>
Csaba Osztrogonác
Comment 25
2010-08-31 10:01:48 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 26
2010-08-31 22:15:51 PDT
http://trac.webkit.org/changeset/66495
might have broken Leopard Intel Debug (Tests) The following changes are on the blame list:
http://trac.webkit.org/changeset/66493
http://trac.webkit.org/changeset/66494
http://trac.webkit.org/changeset/66495
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