diff --git a/src/xrt/include/xrt/xrt_compiler.h b/src/xrt/include/xrt/xrt_compiler.h index 43a22c42b..a79cad28b 100644 --- a/src/xrt/include/xrt/xrt_compiler.h +++ b/src/xrt/include/xrt/xrt_compiler.h @@ -64,6 +64,18 @@ #endif +/* + * To make sure return values are checked. + */ +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define XRT_CHECK_RESULT __attribute__((warn_unused_result)) +#elif defined(_MSC_VER) && (_MSC_VER >= 1700) +#define XRT_CHECK_RESULT _Check_return_ +#else +#define XRT_CHECK_RESULT +#endif + + /* * To stop inlining. */