Closed Bug 1254247 Opened 4 years ago Closed 4 years ago

MOZ_MUST_USE treats expressions evaluating to lvalue references as MUST_USE

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(firefox48 fixed)

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: tnikkel, Assigned: nika)

References

Details

Attachments

(1 file)

Bug 1214037 didn't seem to fix this problem for making DrawResult a must use type.

Here is one of many try pushes
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d89631512db0

The code

  DrawResult result = SUCCESS;
  result &= FunctionReturnDrawResult();

always seems to get flagged as not using the value (in many places). Trivially changing it to

  DrawResult result = SUCCESS;
  DrawResult resul2 = FunctionReturnDrawResult();
  result = result & result2;

makes the error go away. However this code still triggers the error

  DrawResult result = SUCCESS;
  result = result & FunctionReturnDrawResult();
Flags: needinfo?(michael)
Just chiming in: I too would really like to see this fixed. It let us prevent some important classes of errors that are definitely visible to our users as rendering issues.
Depends on: 1255540
Turns out that these expressions contained temporaries, which meant that the expression was wrapped. With this patch those wrappers are now ignored.

Sorry for the delay, I'm in my last 3 weeks of class, and have remarkably little time to do this sort of stuff.

try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=83f03890f8fd
Attachment #8729701 - Flags: review?(ehsan)
Flags: needinfo?(michael)
Assignee: nobody → michael
Attachment #8729701 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/79af3a479ce9
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Thanks!
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.