summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-04 14:30:35 +0200
committercgzones <cgzones@googlemail.com>2020-10-06 11:20:07 +0200
commitdb472075a4fb82bf6a491848941a5b9c92526c39 (patch)
treecd09477d48f52b2acdb7c0e460cb2aac07d4be00 /Macros.h
parentad3acfc847e9d54f07a0684c19181d5f4c28fee4 (diff)
Enable -Wcast-qual compiler warning
Diffstat (limited to 'Macros.h')
-rw-r--r--Macros.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/Macros.h b/Macros.h
index 33e727d8..bb3a90e0 100644
--- a/Macros.h
+++ b/Macros.h
@@ -33,4 +33,20 @@
#endif /* __GNUC__ */
+// ignore casts discarding const specifier, e.g.
+// const char [] -> char * / void *
+// const char *[2]' -> char *const *
+#ifdef __clang__
+#define IGNORE_WCASTQUAL_BEGIN _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
+#define IGNORE_WCASTQUAL_END _Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+#define IGNORE_WCASTQUAL_BEGIN _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
+#define IGNORE_WCASTQUAL_END _Pragma("GCC diagnostic pop")
+#else
+#define IGNORE_WCASTQUAL_BEGIN
+#define IGNORE_WCASTQUAL_END
+#endif
+
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy