Closed Bug 1148506 Opened 5 years ago Closed 5 years ago

TestCodeGenBinding.cpp:10424:10: warning: unused variable 'result' [-Wunused-variable], in DOMProxyHandler::delete_

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Noticed two "unused variable" build warnings, for generated file TestCodeGenBinding.cpp:

obj/dom/bindings/TestCodeGenBinding.cpp:10424:10: warning: unused variable 'result' [-Wunused-variable]
     bool result;
          ^
..and...

obj/dom/bindings/TestCodeGenBinding.cpp:43418:10: warning: unused variable 'result' [-Wunused-variable]
     bool result;
          ^

(Same warning, just different line numbers.)

Both warnings are in a function with this function-signature:
bool
DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, JS::ObjectOpResult& opresult) const
The first warning is pointing to code that looks like this:
====
  if (IsArrayIndex(index)) {
    bool deleteSucceeded;
    bool result;
    bool found = false;
    mozilla::dom::TestIndexedDeleterWithRetvalInterface* self = UnwrapProxy(proxy);
    deleteSucceeded = self->IndexedDeleter(index, found);
    MOZ_ASSERT(!JS_IsExceptionPending(cx));
    if (!found) {
      deleteSucceeded = true;
    }
    return deleteSucceeded ? opresult.succeed() : opresult.failCantDelete();
  }

  return dom::DOMProxyHandler::delete_(cx, proxy, id, opresult);
====

As you can see, "result" is declared & then never used.
This became dead code in bug 1113369 part 5, where we started using deleteSucceeded for the operation result.  Should be able to just replace the

  decls = "bool result;\n"

bit in getDeleterBody with decls = "".
Blocks: 1113369
Attached patch fix v1Splinter Review
This just does what comment 2 suggests.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8593010 - Flags: review?(jorendorff)
(I verified that this doesn't break my build, and the warning goes away.)
Comment on attachment 8593010 [details] [diff] [review]
fix v1

Review of attachment 8593010 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you.
Attachment #8593010 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/b67384fd7f83
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.