mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
add C++17 [[maybe_unused]] and [[no_discard]]
This commit is contained in:
parent
95ab3d05e0
commit
89892926c0
@ -213,6 +213,10 @@ typedef unsigned long long qgssize;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* This file has been generated automatically from *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
|
@ -548,4 +548,29 @@ typedef unsigned long long qgssize;
|
|||||||
#define FALLTHROUGH
|
#define FALLTHROUGH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// see https://infektor.net/posts/2017-01-19-using-cpp17-attributes-today.html#using-the-nodiscard-attribute
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
#define NODISCARD [[nodiscard]]
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define NODISCARD [[nodiscard]]
|
||||||
|
#elif __has_cpp_attribute(nodiscard)
|
||||||
|
#define NODISCARD [[nodiscard]]
|
||||||
|
#elif __has_cpp_attribute(gnu::warn_unused_result)
|
||||||
|
#define NODISCARD [[gnu::warn_unused_result]]
|
||||||
|
#else
|
||||||
|
#define NODISCARD Q_REQUIRED_RESULT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
#define MAYBE_UNUSED [[maybe_unused]]
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define MAYBE_UNUSED [[maybe_unused]]
|
||||||
|
#elif __has_cpp_attribute(gnu::unused)
|
||||||
|
#define NODISCARD [[gnu::unused]]
|
||||||
|
#else
|
||||||
|
#define NODISCARD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user