From 60aa241594c24771f4d140cdb6c52a42c5144053 Mon Sep 17 00:00:00 2001 From: Moandor Date: Fri, 8 May 2020 01:36:06 +0800 Subject: [PATCH] [error] disable error checking enforcement for old versions of clang (#4932) With clang older than 3.9, the warn_unused_result feature works only with functions and classes, not enums. This disables it if the clang version is too old. --- include/openthread/platform/toolchain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/openthread/platform/toolchain.h b/include/openthread/platform/toolchain.h index 86c1efd65..bcd24f058 100644 --- a/include/openthread/platform/toolchain.h +++ b/include/openthread/platform/toolchain.h @@ -75,7 +75,7 @@ extern "C" { * '-Wno-unused-result' compiler option. * */ -#if defined(__clang__) +#if defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 9)) #define OT_MUST_USE_RESULT __attribute__((warn_unused_result)) #else #define OT_MUST_USE_RESULT