Closed
Bug 1480306
Opened 7 years ago
Closed 7 years ago
Doesn't compile: TokenStream.cpp:629:18: error: unused variable 'hasLineOfContext'
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox63 | --- | fixed |
People
(Reporter: jib, Assigned: jib)
References
Details
Attachments
(1 file)
I get this error using Apple LLVM version 8.0.0 (clang-800.0.42.1). Seems legit [1], or is this some new accepted convention?
15:35.20 In file included from /Users/Jan/moz/mozilla-central/obj-x86_64-apple-darwin12.2.1-opt/js/src/Unified_cpp_js_src7.cpp:11:
15:35.20 /Users/Jan/moz/mozilla-central/js/src/frontend/TokenStream.cpp:629:18: error: unused variable 'hasLineOfContext' [-Werror,-Wunused-variable]
15:35.20 if (bool hasLineOfContext = anyChars.fillExcludingContext(&err, offset)) {
15:35.20 ^
15:35.20 1 error generated.
15:35.21 make[4]: *** [Unified_cpp_js_src7.o] Error 1
[1] https://searchfox.org/mozilla-central/rev/d0a0ae30d534dc55e712bd3eedc1b4553ba56323/js/src/frontend/TokenStream.cpp#629
Assignee | ||
Updated•7 years ago
|
Flags: needinfo?(jwalden+bmo)
Comment hidden (mozreview-request) |
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8997504 [details]
Bug 1480306: Fix unused variable variable 'hasLineOfContext' in TokenStream.cpp.
https://reviewboard.mozilla.org/r/261244/#review268334
::: js/src/frontend/TokenStream.cpp:629
(Diff revision 1)
>
> ErrorMetadata err;
>
> TokenStreamAnyChars& anyChars = anyCharsAccess();
>
> - if (bool hasLineOfContext = anyChars.fillExcludingContext(&err, offset)) {
> + if (anyChars.fillExcludingContext(&err, offset)) {
Bah, I was afraid of this, but it wasn't breaking locally or on try, so...
The reason I did the existing thing is that the function name doesn't imply a clear semantics to the test. And as things are now, the calls to that function are a bit confusing to read for that reason. I didn't want to add more.
Could you instead move the decl/assign outside the if, then test the variable? Not as concise, but it keeps the meaning-ascribing bits I want here.
Attachment #8997504 -
Flags: review?(jwalden+bmo) → review-
Comment 3•7 years ago
|
||
Oh, FYI the syntax is legal and does indeed use the variable. IMO the warning is a compiler bug, but we go to war with the compilers we have...
Flags: needinfo?(jwalden+bmo)
Comment hidden (mozreview-request) |
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → jib
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8997504 [details]
Bug 1480306: Fix unused variable variable 'hasLineOfContext' in TokenStream.cpp.
https://reviewboard.mozilla.org/r/261244/#review268674
Attachment #8997504 -
Flags: review?(jwalden+bmo) → review+
Pushed by jbruaroey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8f69423e522d
Fix unused variable variable 'hasLineOfContext' in TokenStream.cpp. r=Waldo
Comment 7•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in
before you can comment on or make changes to this bug.
Description
•