Closed Bug 1836964 Opened 11 months ago Closed 11 months ago

Add a function which asserts if it is used.

Categories

(Core :: MFBT, task)

task

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

Details

(Whiteboard: [sp3])

Attachments

(1 file)

While dealing with template, I had one specialization over 3 of of the code, which would never be used in practice. The template specialization is worth keeping as it is hundreds of lines long and help guarantee that the code would remain identical across the specializations.

However, having this third specialization which should never be used in practice implies that we have to implement fake-implementation of various functions, to assert if these functions are ever called with the third specialization.

Unfortunately, this conflicts with other requirements we added in the past to ensure the lack of undefined behavior of top of C++ usage.

This bug is about adding an alternative to MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE() which works in the case of constructor initialization list, where a field is required to be initialized, but no sensible value exists to be used as a placeholder.

Attachment #9337674 - Attachment description: Bug 1836964 - Add mozilla::CrashIfUsed to abort if ever used. → Bug 1836964 - Add mozilla::MakeCompilerAssumeUnreachableFakeValue to abort if ever used.
Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c944bf501c2c
Add mozilla::MakeCompilerAssumeUnreachableFakeValue to abort if ever used. r=arai
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: