summaryrefslogtreecommitdiff
path: root/include/linux/compiler-gcc.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-07-23 18:02:28 +0100
committerMark Brown <broonie@kernel.org>2018-07-23 18:02:28 +0100
commit0afdd676f6e575478634d961286094169adbc50d (patch)
treedc04a98e56287b9375626457c6cdd56062e5f899 /include/linux/compiler-gcc.h
parente594a0636b0213d058aec2406e13f276b70791ed (diff)
parenteef5ba1aa148ca5e6deb1e0aa1de797fa4e12cb7 (diff)
Merge branch 'i2c/smbus_xfer_unlock-immutable' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into regmap-4.19 for sccb dependency
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r--include/linux/compiler-gcc.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index f1a7492a5cc8..fd282c7d3e5e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -347,3 +347,28 @@
#if GCC_VERSION >= 50100
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
#endif
+
+/*
+ * Turn individual warnings and errors on and off locally, depending
+ * on version.
+ */
+#define __diag_GCC(version, severity, s) \
+ __diag_GCC_ ## version(__diag_GCC_ ## severity s)
+
+/* Severity used in pragma directives */
+#define __diag_GCC_ignore ignored
+#define __diag_GCC_warn warning
+#define __diag_GCC_error error
+
+/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */
+#if GCC_VERSION >= 40600
+#define __diag_str1(s) #s
+#define __diag_str(s) __diag_str1(s)
+#define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
+#endif
+
+#if GCC_VERSION >= 80000
+#define __diag_GCC_8(s) __diag(s)
+#else
+#define __diag_GCC_8(s)
+#endif