mirror of
https://github.com/espressif/openthread.git
synced 2026-09-04 16:20:05 +00:00
[error] force error checking (#4784)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user