aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/diagnostics.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/diagnostics.h b/include/diagnostics.h
index dbe6288..4161dff 100644
--- a/include/diagnostics.h
+++ b/include/diagnostics.h
@@ -68,6 +68,11 @@
DIAGNOSTIC_IGNORE ("-Wuser-defined-warnings")
# endif
+# if __has_warning ("-Wunused-but-set-variable")
+# define DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE \
+ DIAGNOSTIC_IGNORE ("-Wunused-but-set-variable")
+# endif
+
# define DIAGNOSTIC_ERROR_SWITCH \
DIAGNOSTIC_ERROR ("-Wswitch")
@@ -89,6 +94,11 @@
# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")
+# if __GNUC__ >= 5
+# define DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE \
+ DIAGNOSTIC_IGNORE ("-Wunused-but-set-variable")
+# endif
+
/* GCC 4.8's "diagnostic push/pop" seems broken when using this, -Wswitch
remains enabled at the error level even after a pop. Therefore, don't
use it for GCC < 5. */
@@ -130,6 +140,10 @@
# define DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS
#endif
+#ifndef DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE
+# define DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE
+#endif
+
#ifndef DIAGNOSTIC_ERROR_SWITCH
# define DIAGNOSTIC_ERROR_SWITCH
#endif