aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-04-16 23:02:16 +0200
committerSimon Warta <[email protected]>2017-04-16 23:06:17 +0200
commit109d29e83667ec99929b9356fb1e5c2685273eb6 (patch)
tree60b05d61e74221d462d5678f31589e66d7032142 /src/lib/utils
parentdf7da4a60d486038410f85b9979fd01e9a37213f (diff)
Let BOTAN_UNUSED take between 1 and 9 arguments
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/assert.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/lib/utils/assert.h b/src/lib/utils/assert.h
index c49ae62ee..ab459464e 100644
--- a/src/lib/utils/assert.h
+++ b/src/lib/utils/assert.h
@@ -1,6 +1,7 @@
/*
* Runtime assertion checking
* (C) 2010 Jack Lloyd
+* 2017 Simon Warta (Kullo GmbH)
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -87,9 +88,32 @@ BOTAN_NORETURN void BOTAN_DLL assertion_failure(const char* expr_str,
} while(0)
/**
-* Mark variable as unused
+* Mark variable as unused. Takes between 1 and 9 arguments and marks all as unused,
+* e.g. BOTAN_UNUSED(a); or BOTAN_UNUSED(x, y, z);
*/
-#define BOTAN_UNUSED(v) static_cast<void>(v)
+#define _BOTAN_UNUSED_IMPL1(a) static_cast<void>(a)
+#define _BOTAN_UNUSED_IMPL2(a, b) static_cast<void>(a); _BOTAN_UNUSED_IMPL1(b)
+#define _BOTAN_UNUSED_IMPL3(a, b, c) static_cast<void>(a); _BOTAN_UNUSED_IMPL2(b, c)
+#define _BOTAN_UNUSED_IMPL4(a, b, c, d) static_cast<void>(a); _BOTAN_UNUSED_IMPL3(b, c, d)
+#define _BOTAN_UNUSED_IMPL5(a, b, c, d, e) static_cast<void>(a); _BOTAN_UNUSED_IMPL4(b, c, d, e)
+#define _BOTAN_UNUSED_IMPL6(a, b, c, d, e, f) static_cast<void>(a); _BOTAN_UNUSED_IMPL5(b, c, d, e, f)
+#define _BOTAN_UNUSED_IMPL7(a, b, c, d, e, f, g) static_cast<void>(a); _BOTAN_UNUSED_IMPL6(b, c, d, e, f, g)
+#define _BOTAN_UNUSED_IMPL8(a, b, c, d, e, f, g, h) static_cast<void>(a); _BOTAN_UNUSED_IMPL7(b, c, d, e, f, g, h)
+#define _BOTAN_UNUSED_IMPL9(a, b, c, d, e, f, g, h, i) static_cast<void>(a); _BOTAN_UNUSED_IMPL8(b, c, d, e, f, g, h, i)
+#define _BOTAN_UNUSED_GET_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, IMPL_NAME, ...) IMPL_NAME
+
+#define BOTAN_UNUSED(...) _BOTAN_UNUSED_GET_IMPL(__VA_ARGS__, \
+ _BOTAN_UNUSED_IMPL9, \
+ _BOTAN_UNUSED_IMPL8, \
+ _BOTAN_UNUSED_IMPL7, \
+ _BOTAN_UNUSED_IMPL6, \
+ _BOTAN_UNUSED_IMPL5, \
+ _BOTAN_UNUSED_IMPL4, \
+ _BOTAN_UNUSED_IMPL3, \
+ _BOTAN_UNUSED_IMPL2, \
+ _BOTAN_UNUSED_IMPL1, \
+ unused dummy rest value \
+ ) /* we got an one of _BOTAN_UNUSED_IMPL*, now call it */ (__VA_ARGS__)
}