OurOS
0.1
Operating System built by McGill Students
Loading...
Searching...
No Matches
assert.h
1
#ifndef _SYS_ASSERT_H
2
#define _SYS_ASSERT_H
3
4
#ifdef KERNEL
5
#include "console.h"
6
#include "color.h"
7
#define assert(expr) if (!(expr)) { \
8
cprintln("Assertion failed", WHITE); \
9
exit(1); \
10
}
11
12
#else
13
#include <stdio.h>
14
#define assert(expr) if (!(expr)) { \
15
printf("%s:%d assertion failed: %s\n", __FILE__, __LINE__, #expr); \
16
exit(1); \
17
}
18
19
#define assert_eq(e1,e2)\
20
__auto_type _e1 = (e1); \
21
__auto_type _e2 = (e2); \
22
if (_e1 != _e2) { \
23
printf("%s:%d assertion failed: %s != %s\n", __FILE__, __LINE__, #e1, #e2); \
24
exit(1); \
25
}
26
#endif
/* KERNEL */
27
28
#endif
/* _SYS_ASSERT_H */
libc
assert.h
Generated by
1.9.8