This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Add [[nodiscard]] extensions in <math.h>
ClosedPublic

Authored by philnik on Jan 2 2023, 1:08 PM.

Details

Summary

There are quite a few functions marked [[gnu::const]] inside the compiler. This patch adds [[nodiscard]] to libc++-provided overloads of these functions to match the diagnostics produced.

Diff Detail

Event Timeline

philnik created this revision.Jan 2 2023, 1:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 2 2023, 1:08 PM
philnik requested review of this revision.Jan 2 2023, 1:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 2 2023, 1:08 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante added inline comments.Jan 7 2023, 4:25 AM
libcxx/test/libcxx/diagnostics/math_nodiscard_extensions.verify.cpp
20

Can you update the documentation for the nodiscard extension?

philnik updated this revision to Diff 487087.Jan 7 2023, 6:23 AM
philnik marked an inline comment as done.

Address comments

ldionne accepted this revision.Jan 12 2023, 8:40 AM
This revision is now accepted and ready to land.Jan 12 2023, 8:40 AM
This revision was automatically updated to reflect the committed changes.