Skip to content
Permalink
Browse files

add C++17 [[maybe_unused]] and [[no_discard]]

  • Loading branch information
3nids committed Feb 28, 2018
1 parent 95ab3d0 commit 89892926c039fad4fa1f6ce2ee9089ac3f0e3f13
Showing with 29 additions and 0 deletions.
  1. +4 −0 python/core/qgis.sip.in
  2. +25 −0 src/core/qgis.h
@@ -213,6 +213,10 @@ typedef unsigned long long qgssize;







/************************************************************************
* This file has been generated automatically from *
* *
@@ -548,4 +548,29 @@ typedef unsigned long long qgssize;
#define FALLTHROUGH
#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




0 comments on commit 8989292

Please sign in to comment.
You can’t perform that action at this time.