Fix WEBP_NODISCARD comment and C++ version

Change-Id: I8b94974a46b7ac7d9bce179a48655ba8d9700edf
This commit is contained in:
Vincent Rabaud 2024-07-09 11:09:09 +02:00
parent 66408c2c7c
commit c1c89f5189

View File

@ -38,11 +38,11 @@ typedef long long int int64_t;
#ifndef WEBP_NODISCARD
#if defined(WEBP_ENABLE_NODISCARD) && WEBP_ENABLE_NODISCARD
#if (defined(__cplusplus) && __cplusplus >= 201700L) || \
#if (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
#define WEBP_NODISCARD [[nodiscard]]
#else
// gcc's __has_attribute does not work for enums.
// gcc's __attribute__((warn_unused_result)) does not work for enums.
#if defined(__clang__) && defined(__has_attribute)
#if __has_attribute(warn_unused_result)
#define WEBP_NODISCARD __attribute__((warn_unused_result))