[meta] Remove redundant nullptr checks of return value of infallible new
Categories
(Core :: XPCOM, task)
Tracking
()
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.
Comment 1•2 years ago
|
||
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).
Reporter | ||
Comment 2•2 years ago
|
||
(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.
Comment 3•1 year ago
|
||
All depending bugs have been fixed.
Is it time to close this bug?
Comment 4•1 year ago
|
||
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.
Description
•