Page MenuHomeFreeBSD

cdefs(9): encourage __nodiscard over __result_use_check
ClosedPublic

Authored by brooks on Fri, Jun 26, 12:16 PM.
Tags
None
Referenced Files
F161917464: D57881.diff
Wed, Jul 8, 12:28 AM
Unknown Object (File)
Sun, Jul 5, 8:38 PM
Unknown Object (File)
Sun, Jul 5, 8:35 PM
Unknown Object (File)
Sun, Jul 5, 5:47 PM
Unknown Object (File)
Sun, Jul 5, 5:42 PM
Unknown Object (File)
Sun, Jul 5, 4:43 PM
Unknown Object (File)
Sun, Jul 5, 4:40 PM
Unknown Object (File)
Sat, Jul 4, 10:05 PM
Subscribers

Details

Summary

nodiscard is closer to (and sometimes expands to) nodiscard from
C23 and C++17 so prefer it to the homegrown
result_use_check.

When nodiscard does expand to nodiscard it must appear entierly
before the function declaration (or between the function name
and argument list) so relocate as appropriate. This differs from
attribute((warn_unused_result)) used by result_use_check which
is more flexible.

Sponsored by: DARPA, AFRL

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable