[winpr,platform] fix WINPR_ATTR_MALLOC for older GCC

This commit is contained in:
Armin Novak
2026-02-26 08:56:07 +01:00
parent 96be117f97
commit e6c17b13cd

View File

@@ -626,7 +626,11 @@ WINPR_PRAGMA_DIAG_POP
#define WINPR_ATTR_MALLOC(deallocator, ptrindex) \
__attribute__((malloc, warn_unused_result)) /** @since version 3.3.0 */
#endif
#elif defined(__GNUC__) && (__GNUC__ > 10)
#elif defined(__GNUC__)
#if (__GNUC__ <= 10)
#define WINPR_ATTR_MALLOC(deallocator, ptrindex) \
__attribute__((malloc, warn_unused_result)) /** @since version 3.3.0 */
#else
#if defined(__cplusplus) && (__cplusplus >= 201703L)
#define WINPR_ATTR_MALLOC(deallocator, ptrindex) \
[[gnu::malloc(deallocator, ptrindex), nodiscard]] /** @since version 3.3.0 */
@@ -637,6 +641,7 @@ WINPR_PRAGMA_DIAG_POP
#define WINPR_ATTR_MALLOC(deallocator, ptrindex) \
__attribute__((malloc(deallocator, ptrindex), warn_unused_result)) /** @since version 3.3.0 */
#endif
#endif
#elif defined(_MSC_VER)
#define WINPR_ATTR_MALLOC(deallocator, ptrindex) __declspec(restrict) /** @since version 3.3.0 */
#endif