]> git.cworth.org Git - notmuch/commitdiff
lib: define macro NODISCARD
authorDavid Bremner <david@tethera.net>
Mon, 23 May 2022 23:38:58 +0000 (20:38 -0300)
committerDavid Bremner <david@tethera.net>
Sat, 25 Jun 2022 15:55:02 +0000 (12:55 -0300)
In either C++17 (or later) mode, or when running cppcheck, this can be
used to selectively generate warnings about discarded return values.

lib/notmuch-private.h

index c63cfe5e698fa6f087c53cd52abc159360320622..1c2290b24847d8a55f957e2049c8cf3da64f78f8 100644 (file)
@@ -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