diff options
author | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2023-01-19 10:59:25 +0000 |
---|---|---|
committer | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2023-01-19 10:59:25 +0000 |
commit | 3d6be05f2cce4b82bb7e0d7678ad6387b366c30a (patch) | |
tree | afeb6c806bb7beaef498c484801a13edcfd07806 /lib/libcbor | |
parent | fc4b608c8d07ce266a6a2948e1c0d47c2ae0b226 (diff) |
Do not use unsupported __attribute__((warn_unused_result)) on gcc3.
This prevents building libfido2 stops with error on luna88k because it
is compiled with -Werror option.
ok, and better #if condition by miod@
Diffstat (limited to 'lib/libcbor')
-rw-r--r-- | lib/libcbor/src/cbor/common.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libcbor/src/cbor/common.h b/lib/libcbor/src/cbor/common.h index 6a6f969f23f..410ef24d517 100644 --- a/lib/libcbor/src/cbor/common.h +++ b/lib/libcbor/src/cbor/common.h @@ -83,7 +83,11 @@ extern bool _cbor_enable_assert; #define _CBOR_UNUSED(x) __attribute__((__unused__)) x // TODO(https://github.com/PJK/libcbor/issues/247): Prefer [[nodiscard]] if // available +#if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ >= 4) #define _CBOR_NODISCARD __attribute__((warn_unused_result)) +#else /* gcc3 can not treat warn_unused_result attribute */ +#define _CBOR_NODISCARD +#endif #elif defined(_MSC_VER) #define _CBOR_UNUSED(x) __pragma(warning(suppress : 4100 4101)) x #define _CBOR_NODISCARD |