summaryrefslogtreecommitdiff
path: root/futility/futility.h
diff options
context:
space:
mode:
Diffstat (limited to 'futility/futility.h')
-rw-r--r--futility/futility.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/futility/futility.h b/futility/futility.h
index 005a0ce7..a1417c01 100644
--- a/futility/futility.h
+++ b/futility/futility.h
@@ -35,4 +35,18 @@ struct futil_cmd_t {
/* This is the list of pointers to all commands. */
extern struct futil_cmd_t *futil_cmds[];
+/* Size of an array */
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
+#endif
+
+/* Test an important condition at compile time, not run time */
+#ifndef BUILD_ASSERT
+#define _BA1_(cond, line) \
+ extern int __build_assertion_ ## line[1 - 2*!(cond)] \
+ __attribute__ ((unused))
+#define _BA0_(c, x) _BA1_(c, x)
+#define BUILD_ASSERT(cond) _BA0_(cond, __LINE__)
+#endif
+
#endif /* VBOOT_REFERENCE_FUTILITY_H_ */