[error] force error checking (#4784)

This commit is contained in:
kangping
2020-05-06 11:17:58 -07:00
committed by GitHub
parent 6e8f2c9913
commit 49f36f8c24
96 changed files with 792 additions and 741 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ extern "C" {
* This enumeration represents error codes used throughout OpenThread.
*
*/
typedef enum otError
typedef enum OT_MUST_USE_RESULT otError
{
/**
* No error.
+18
View File
@@ -63,6 +63,24 @@
extern "C" {
#endif
/**
* @def OT_MUST_USE_RESULT
*
* Compiler-specific indication that a class or enum must be used when it is
* the return value of a function.
*
* @note This is currently only available with clang (C++17 implements it
* as attribute [[nodiscard]]).
* @note To suppress the 'unused-result' warning/error, please use the
* '-Wno-unused-result' compiler option.
*
*/
#if defined(__clang__)
#define OT_MUST_USE_RESULT __attribute__((warn_unused_result))
#else
#define OT_MUST_USE_RESULT
#endif
/**
* @def OT_TOOL_PACKED_BEGIN
*