summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2022-04-05 17:20:24 +0300
committerToomas Soome <tsoome@me.com>2022-04-11 20:07:02 +0300
commit6de0af11ed5afd6a7c0ff23e31c1954813e3bf88 (patch)
tree4a3d82dbbca0a1984d15fb1f27db95d5852647d6 /usr
parent041297c2d66302c15134da1d1bdd91cf787a945a (diff)
downloadillumos-joyent-6de0af11ed5afd6a7c0ff23e31c1954813e3bf88.tar.gz
14622 want __maybe_unused
Reviewed by: Jason King <jason.brian.king+illumos@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/uts/common/sys/ccompile.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/usr/src/uts/common/sys/ccompile.h b/usr/src/uts/common/sys/ccompile.h
index e687fd99a3..94f7c9707b 100644
--- a/usr/src/uts/common/sys/ccompile.h
+++ b/usr/src/uts/common/sys/ccompile.h
@@ -158,6 +158,16 @@ extern "C" {
#define __packed __attribute__((__packed__))
#define __section(x) __attribute__((__section__(x)))
#define __unused __sun_attr__((__unused__))
+#ifdef DEBUG
+/* We want to discover unused variables in DEBUG build. */
+#define __maybe_unused
+#else
+/*
+ * In release build, disable warnings about variables
+ * which are used only for debugging.
+ */
+#define __maybe_unused __sun_attr__((__unused__))
+#endif
#define __used __attribute__((__used__))
#define __weak_symbol __attribute__((__weak__))
#define __HIDDEN __attribute__((visibility("hidden")))