NEW 60128
Compiler warning "eventWasHandled may be used without initialized" in WebView/WebHTMLView.mm.
https://bugs.webkit.org/show_bug.cgi?id=60128
Summary Compiler warning "eventWasHandled may be used without initialized" in WebView...
Yongjun Zhang
Reported 2011-05-03 20:09:46 PDT
In [WebHTMLView doCommandBySelector:], the local variable eventWasHandled (declared in WebHTMLView.mm:5821) should be initialized.
Attachments
Initialize local variable eventWasHandled to avoid complier warning. (1.38 KB, patch)
2011-05-04 09:53 PDT, Yongjun Zhang
ap: review-
yongjun_zhang: commit-queue-
Yongjun Zhang
Comment 1 2011-05-04 09:53:17 PDT
Created attachment 92263 [details] Initialize local variable eventWasHandled to avoid complier warning.
Alexey Proskuryakov
Comment 2 2011-05-04 11:06:59 PDT
Comment on attachment 92263 [details] Initialize local variable eventWasHandled to avoid complier warning. What compiler is that? I don't think that the warning is correct.
Yongjun Zhang
Comment 3 2011-05-04 11:17:22 PDT
(In reply to comment #2) > (From update of attachment 92263 [details]) > What compiler is that? I don't think that the warning is correct. I think normally the compiler is smart enough to see eventWasHandled is covered in all if/else branches in [WebHTMLView doCommandBySelector:]. And the warning only happens when I ifdefed out the else block in WebHTMLView.mm:6689 since the compiler now sees one branch is missing and eventWasHandled could be uninitialized.
Eric Seidel (no email)
Comment 4 2011-05-04 11:18:43 PDT
Comment on attachment 92263 [details] Initialize local variable eventWasHandled to avoid complier warning. Rejecting attachment 92263 [details] from commit-queue. yongjun_zhang@apple.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
Alexey Proskuryakov
Comment 5 2011-05-04 11:54:03 PDT
Comment on attachment 92263 [details] Initialize local variable eventWasHandled to avoid complier warning. I'm not thrilled with this change, because it makes the code a little more fragile. If someone edits it and forgets to assign a result to the variable in one of the branches, the compiler will no longer come to the rescue. You should probably upstream a bigger chunk of code, and/or actually assign to the variable instead of simply ifdefing out one branch in your port. Marking r- for now, but you could convince me that it's fine to land as is.
Note You need to log in before you can comment on or make changes to this bug.