From 21a5524d010d5ef0ab8b5cccd82df9484e484cb2 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sat, 26 Dec 2020 04:08:53 -0800 Subject: [PATCH] AK: Add NO_DISCARD macro to allow clang-format friendly class annotations clang-format seems to barf on these attributes, to make it easier to use these attributes and have clang-format not mangle the following code we can hide them behind a macro so clang-format doesn't have to handle it. --- AK/Platform.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AK/Platform.h b/AK/Platform.h index 9a8050ad70..1b02a3b500 100644 --- a/AK/Platform.h +++ b/AK/Platform.h @@ -51,6 +51,11 @@ #endif #define FLATTEN [[gnu::flatten]] +#ifdef NO_DISCARD +# undef NO_DISCARD +#endif +#define NO_DISCARD [[nodiscard]] + #ifndef __serenity__ # define PAGE_SIZE sysconf(_SC_PAGESIZE)