diff options
| author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-04-08 02:31:00 +0200 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-04-08 02:31:00 +0200 |
| commit | fcdea94c3fddd42de30e6294b02fc3fa869c888e (patch) | |
| tree | 170c7320a73a56864c1f0e69324071b93420227e /libddekit/ddekit/assert.h | |
| parent | 19796a75ab8ba43b31e230ea169d5383c6392bfc (diff) | |
| parent | c0c35f90e218835ef0f8c0b67399ad6533763ed0 (diff) | |
Merge branch 'upstream-merged' of git.debian.org:/git/pkg-hurd/hurd into upstream-merged
Conflicts:
pfinet/ethernet.c
Diffstat (limited to 'libddekit/ddekit/assert.h')
| -rw-r--r-- | libddekit/ddekit/assert.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libddekit/ddekit/assert.h b/libddekit/ddekit/assert.h new file mode 100644 index 00000000..5d593662 --- /dev/null +++ b/libddekit/ddekit/assert.h @@ -0,0 +1,23 @@ +#ifndef _ddekit_assert_h +#define _ddekit_assert_h + +#include "ddekit/printf.h" +#include "ddekit/panic.h" + +/** \file ddekit/assert.h */ + +/** Assert that an expression is true and panic if not. + * \ingroup DDEKit_util + */ +#define Assert(expr) do \ + { \ + if (!(expr)) { \ + ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n"); \ + ddekit_printf(" File: %s:%d\n",__FILE__,__LINE__); \ + ddekit_printf(" Function: %s()\n", __FUNCTION__); \ + ddekit_panic("Assertion failed."); \ + }} while (0); + +#endif + +#define assert Assert |
