aboutsummaryrefslogtreecommitdiff
path: root/include/lib/cassert.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/cassert.h')
-rw-r--r--include/lib/cassert.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/lib/cassert.h b/include/lib/cassert.h
new file mode 100644
index 000000000..8844e8b02
--- /dev/null
+++ b/include/lib/cassert.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef __CASSERT_H__
+#define __CASSERT_H__
+
+/*******************************************************************************
+ * Macro to flag a compile time assertion. It uses the preprocessor to generate
+ * an invalid C construct if 'cond' evaluates to false.
+ * The following compilation error is triggered if the assertion fails:
+ * "error: size of array 'msg' is negative"
+ ******************************************************************************/
+#define CASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1]
+
+#endif /* __CASSERT_H__ */