Closed Bug 1692829 Opened 10 months ago Closed 1 month ago

[meta] Remove redundant nullptr checks of return value of infallible new

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED

People

(Reporter: sg, Unassigned)

References

Details

(Keywords: meta)

new has been infallible for a long time. The code base still contains redundant checks for its return value against nullptr, which should be removed.

Depends on: 1692830
Depends on: 1692846

This sounds like something we should have a static analysis for (although there are some interesting details like the fact that for some code, operator new is not infallible).

(In reply to Mike Hommey [:glandium] from comment #1)

This sounds like something we should have a static analysis for (although there are some interesting details like the fact that for some code, operator new is not infallible).

Yes, that would be nice indeed. This analysis could also capture redundant checks for any function that is declared MOZ_NONNULL_RETURN. In many cases, we can use NotNull to achieve that on the type system level, but I guess operator new must return a plain pointer.

Depends on: 1692996
Depends on: 1693001
Depends on: 1693002
Depends on: 1693003
Depends on: 1696347
Depends on: 1696348
Depends on: 1696349
Depends on: 1696350
Depends on: 1696351
Depends on: 1696353
Depends on: 1696354
Depends on: 1696355
Depends on: 1696356

All depending bugs have been fixed.
Is it time to close this bug?

I'm sure there are still plenty of places where we are null checking the result of infallible new, but sg doesn't work on Firefox any more, so I think this particular effort to eliminate these checks has come to a close. If somebody wants to work on it again, they can file a new bug or reopen this one.

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.