update project structures
[lunaix-os.git] / lunaix-os / includes / lunaix / spike.h
index fa4e797ddad4898649f9a290832c370ce8a774b1..e39c6119a96c5ba1dd868ed65eb6b20d3fd45980 100644 (file)
 // 获取v最近的最小k倍数
 #define ROUNDDOWN(v, k)     ((v) & ~((k) - 1))
 
-static void inline spin() {
+inline static void spin() {
     while(1);
 }
 
+#ifdef __LUNAIXOS_DEBUG__
+#define assert(cond)                                  \
+    if (!(cond)) {                                    \
+        __assert_fail(#cond, __FILE__, __LINE__);     \
+    }
+
+#define assert_msg(cond, msg)                         \
+    if (!(cond)) {                                    \
+        __assert_fail(msg, __FILE__, __LINE__);   \
+    }
+void __assert_fail(const char* expr, const char* file, unsigned int line) __attribute__((noinline, noreturn));
+#else
+#define assert(cond) //assert nothing
+#define assert_msg(cond, msg)  //assert nothing
+#endif
+
+
+
 #endif /* __LUNAIX_SPIKE_H */