1 |
/* assert.h - Dummy assert declaration for libc-pars. |
/* assert.h - Assert declaration for libc-parts. |
2 |
Copyright (C) 2003 Free Software Foundation, Inc. |
Copyright (C) 2003, 2005 Free Software Foundation, Inc. |
3 |
Written by Johan Rydberg. |
Written by Neal H. Walfield <neal@gnu.org>. |
4 |
|
|
5 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
6 |
|
|
22 |
#ifndef _ASSERT_H |
#ifndef _ASSERT_H |
23 |
#define _ASSERT_H 1 |
#define _ASSERT_H 1 |
24 |
|
|
25 |
/* Asserts aren't supported at the moment. */ |
int printf (const char *fmt, ...); |
26 |
#ifndef assert |
|
27 |
#define assert(expr) do { } while (0) |
#ifndef NDEBUG |
28 |
|
#define assert(expr) \ |
29 |
|
do { \ |
30 |
|
if (! (expr)) \ |
31 |
|
{ \ |
32 |
|
printf ("%s:%s:%d: Assert failed!\n", \ |
33 |
|
__FILE__, __func__, __LINE__); \ |
34 |
|
for (;;); \ |
35 |
|
} \ |
36 |
|
} while (0) |
37 |
|
#else |
38 |
|
#define assert(expr) do { } while (0) |
39 |
#endif |
#endif |
40 |
#define assert_perror(err) assert(err == 0) |
#define assert_perror(err) assert(err == 0) |
41 |
|
|
42 |
#endif /* assert.h */ |
#endif /* _ASSERT_H */ |