This commit is contained in:
Niels Lohmann 2019-01-20 11:12:20 +01:00
parent d359fd3a8d
commit e36593e960
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
2 changed files with 16 additions and 8 deletions

View file

@ -38,10 +38,14 @@
#endif
// allow for portable nodiscard warnings
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(nodiscard)
#define JSON_NODISCARD [[nodiscard]]
#elif defined(__has_cpp_attribute) && __has_cpp_attribute(gnu::warn_unused_result)
#elif __has_cpp_attribute(gnu::warn_unused_result)
#define JSON_NODISCARD [[gnu::warn_unused_result]]
#else
#define JSON_NODISCARD
#endif
#else
#define JSON_NODISCARD
#endif

View file

@ -153,10 +153,14 @@ using json = basic_json<>;
#endif
// allow for portable nodiscard warnings
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(nodiscard)
#define JSON_NODISCARD [[nodiscard]]
#elif defined(__has_cpp_attribute) && __has_cpp_attribute(gnu::warn_unused_result)
#elif __has_cpp_attribute(gnu::warn_unused_result)
#define JSON_NODISCARD [[gnu::warn_unused_result]]
#else
#define JSON_NODISCARD
#endif
#else
#define JSON_NODISCARD
#endif