Software APIs
Macros
dif_warn_unused_result.h File Reference

Unused Result Warning Macro for DIFs. More...

Go to the source code of this file.

Macros

#define DIF_WARN_UNUSED_RESULT   __attribute__((warn_unused_result))
 Attribute for functions which return errors that must be acknowledged. More...
 

Detailed Description

Unused Result Warning Macro for DIFs.

Definition in file dif_warn_unused_result.h.

Macro Definition Documentation

#define DIF_WARN_UNUSED_RESULT   __attribute__((warn_unused_result))

Attribute for functions which return errors that must be acknowledged.

This attribute must be used to mark all DIFs which return an error value of some kind, to ensure that callers do not accidentally drop the error on the ground.

Normally, the standard way to drop such a value on the ground explicitly is with the syntax (void)expr;, in analogy with the behavior of C++'s [[nodiscard]] attribute. However, GCC does not implement this, so the idiom if (expr) {} should be used instead, for the time being. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509.

Definition at line 32 of file dif_warn_unused_result.h.