diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-04 16:16:50 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-04 16:16:50 +0200 |
commit | 04b9dc2d30cfc9b383029f6a4b02e2725108b0ae (patch) | |
tree | e117a998173b767f9fd009d49c4f8573d8b85432 /Libraries/LibC/assert.h | |
parent | 63814ffebf16291419745cd8ba29a4d2fd888563 (diff) | |
download | serenity-04b9dc2d30cfc9b383029f6a4b02e2725108b0ae.zip |
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
Diffstat (limited to 'Libraries/LibC/assert.h')
-rw-r--r-- | Libraries/LibC/assert.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Libraries/LibC/assert.h b/Libraries/LibC/assert.h new file mode 100644 index 0000000000..9c86d09f0f --- /dev/null +++ b/Libraries/LibC/assert.h @@ -0,0 +1,23 @@ +#pragma once + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +#ifdef DEBUG +__attribute__((noreturn)) void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func); +# define assert(expr) ((expr) ? (void)0 : __assertion_failed(# expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)) +# define ASSERT_NOT_REACHED() assert(false) +#else +# define assert(expr) +# define ASSERT_NOT_REACHED() CRASH() +#endif + +#define CRASH() \ + do { \ + asm volatile("ud2"); \ + } while (0) +#define ASSERT assert +#define RELEASE_ASSERT assert + +__END_DECLS |