From c10455780295f4a0710a1c44465ba3f4203d3528 Mon Sep 17 00:00:00 2001 From: Benny Baumann <BenBE@geshi.org> Date: Tue, 5 Jan 2021 01:49:42 +0100 Subject: [PATCH] add: Allow for temporarily disabling of compiler diagnostics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Workaround for an issue in GCC w.r.t. -Weffc++ on operator= … --- src/macros.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/macros.hpp b/src/macros.hpp index b5c38c1..16768ea 100644 --- a/src/macros.hpp +++ b/src/macros.hpp @@ -15,6 +15,15 @@ #define ATTR_LIKELY(x) __builtin_expect((x), 1) #define ATTR_UNLIKELY(x) __builtin_expect((x), 0) +#define COMPILER_PRAGMA(x) _Pragma(#x) + +#define COMPILER_SUPRESS(flag) \ + COMPILER_PRAGMA(GCC diagnostic push) \ + COMPILER_PRAGMA(GCC diagnostic ignored flag) + +#define COMPILER_RESTORE(flag) \ + COMPILER_PRAGMA(GCC diagnostic pop) // flag + #else #define ATTR_NONNULL_ALL @@ -30,6 +39,10 @@ #define ATTR_LIKELY(x) (x) #define ATTR_UNLIKELY(x) (x) +#define COMPILER_PRAGMA(x) +#define COMPILER_SUPRESS(flag) +#define COMPILER_RESTORE(flag) + #endif #define MARK_UNUSED(x) (void)(x) -- GitLab