aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-05-23 20:38:58 -0300
committerDavid Bremner <david@tethera.net>2022-06-25 12:55:02 -0300
commit7d5a9bd3aeed339cb1f1415a9da8fc09c74ca485 (patch)
treefdf3274eb4af14df5f0c2accb9224c357b19d476
parentbc80ff829ac205c68dfab45a21d4732cf5b8c2d0 (diff)
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.
-rw-r--r--lib/notmuch-private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index c63cfe5e..1c2290b2 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -750,6 +750,12 @@ _notmuch_talloc_steal (const void *new_ctx, const T *ptr)
#undef talloc_steal
#define talloc_steal _notmuch_talloc_steal
#endif
+
+#if __cplusplus >= 201703L || __cppcheck__
+#define NODISCARD [[nodiscard]]
+#else
+#define NODISCARD /**/
+#endif
#endif
#endif