lib: define macro NODISCARD

In either C++17 (or later) mode, or when running cppcheck, this can be
used to selectively generate warnings about discarded return values.
This commit is contained in:
David Bremner 2022-05-23 20:38:58 -03:00
parent bc80ff829a
commit 7d5a9bd3ae

View file

@ -750,6 +750,12 @@ _notmuch_talloc_steal (const void *new_ctx, const T *ptr)
#undef talloc_steal #undef talloc_steal
#define talloc_steal _notmuch_talloc_steal #define talloc_steal _notmuch_talloc_steal
#endif #endif
#if __cplusplus >= 201703L || __cppcheck__
#define NODISCARD [[nodiscard]]
#else
#define NODISCARD /**/
#endif
#endif #endif
#endif #endif