Closed Bug 1593551 Opened 5 years ago Closed 5 years ago

Replace MOZ_MUST_USE macro with C++17's standard [[nodiscard]] attribute

Categories

(Core :: MFBT, task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1571631

People

(Reporter: cpeterson, Unassigned)

References

Details

The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). After we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute.

https://searchfox.org/mozilla-central/rev/35873cfc312a6285f54aa5e4ec2d4ab911157522/mfbt/Attributes.h#392

https://en.cppreference.com/w/cpp/language/attributes/nodiscard

TBD whether the MOZ_ALLOCATOR macro can also be switched to [[nodiscard]]:

https://searchfox.org/mozilla-central/rev/35873cfc312a6285f54aa5e4ec2d4ab911157522/mfbt/Attributes.h#355

Alias: nodiscard
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.