aboutsummaryrefslogtreecommitdiff
path: root/src/util/basic_macros.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-11-03 01:03:33 -0500
committerkwolekr <kwolekr@minetest.net>2015-11-03 01:03:33 -0500
commit6ba4f3775e9b2a5bacb2537c058728a67222b67d (patch)
treeb859d8345bac65ca1e091eb0d5f1b8d982ba2095 /src/util/basic_macros.h
parentc2b5da735ea0c961d4f6521df9d96142c7143eee (diff)
downloadminetest-6ba4f3775e9b2a5bacb2537c058728a67222b67d.tar.gz
minetest-6ba4f3775e9b2a5bacb2537c058728a67222b67d.tar.bz2
minetest-6ba4f3775e9b2a5bacb2537c058728a67222b67d.zip
Silence 'unused typedef' warning for STATIC_ASSERT()
Diffstat (limited to 'src/util/basic_macros.h')
-rw-r--r--src/util/basic_macros.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util/basic_macros.h b/src/util/basic_macros.h
index 2a30a31d2..c100b4f25 100644
--- a/src/util/basic_macros.h
+++ b/src/util/basic_macros.h
@@ -38,9 +38,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
C(const C &); \
C &operator=(const C &)
+#ifndef _MSC_VER
+ #define UNUSED_ATTRIBUTE __attribute__ ((unused))
+#else
+ #define UNUSED_ATTRIBUTE
+#endif
+
// Fail compilation if condition expr is not met.
// Note that 'msg' must follow the format of a valid identifier, e.g.
// STATIC_ASSERT(sizeof(foobar_t) == 40), foobar_t_is_wrong_size);
-#define STATIC_ASSERT(expr, msg) typedef char msg[!!(expr) * 2 - 1]
+#define STATIC_ASSERT(expr, msg) \
+ UNUSED_ATTRIBUTE typedef char msg[!!(expr) * 2 - 1]
#endif