diff --git a/CMakeLists.txt b/CMakeLists.txt index 783410a88..a7fe20caf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,9 @@ include(SetFreeRDPCMakeInstallDir) include(Doxygen) include(GetSysconfDir) +# FreeRDP internal builds should always check results +add_compile_definitions(WINPR_DEFINE_ATTR_NODISCARD) + # Soname versioning set(BUILD_NUMBER 0) if($ENV{BUILD_NUMBER}) diff --git a/winpr/include/winpr/platform.h b/winpr/include/winpr/platform.h index 64fe8c068..a8119fab6 100644 --- a/winpr/include/winpr/platform.h +++ b/winpr/include/winpr/platform.h @@ -75,6 +75,7 @@ #define WINPR_FALLTHROUGH (void)0; #endif +#if defined(WINPR_DEFINE_ATTR_NODISCARD) #if defined(__clang__) #define WINPR_ATTR_NODISCARD __attribute__((warn_unused_result)) #elif defined(__GNUC__) && (__GNUC__ >= 7) @@ -82,6 +83,9 @@ #else #define WINPR_ATTR_NODISCARD #endif +#else +#define WINPR_ATTR_NODISCARD +#endif #if defined(__clang__) #define WINPR_PRAGMA_DIAG_PUSH WINPR_DO_PRAGMA(clang diagnostic push)