8b0a2b34b92f016b32ab0eedcf41e38d2831e056
[reactos.git] / posix / include / assert.h
1 /* $Id: assert.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
2 */
3 /*
4 * assert.h
5 *
6 * verify program assertion. Conforming to the Single UNIX(r) Specification
7 * Version 2, System Interface & Headers Issue 5
8 *
9 * This file is part of the ReactOS Operating System.
10 *
11 * Contributors:
12 * Created by KJK::Hyperion <noog@libero.it>
13 *
14 * THIS SOFTWARE IS NOT COPYRIGHTED
15 *
16 * This source code is offered for use in the public domain. You may
17 * use, modify or distribute it freely.
18 *
19 * This code is distributed in the hope that it will be useful but
20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21 * DISCLAMED. This includes but is not limited to warranties of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 *
24 */
25 #ifndef __ASSERT_H_INCLUDED__
26 #define __ASSERT_H_INCLUDED__
27
28 /* types */
29
30 /* constants */
31
32 /* prototypes */
33
34 /* macros */
35 #ifdef NDEBUG
36 #define assert(ignore) ((void) 0)
37 #else /* !NDEBUG */
38
39 #define assert(expression) \
40 #ifdef __PSXDLL__
41
42 /* headers for internal usage by psxdll.dll and ReactOS */
43 #include <psxdll/stdio.h>
44 #include <psxdll/stdlib.h>
45
46 #else /* ! __PSXDLL__ */
47
48 /* standard POSIX headers */
49 #include <stdio.h>
50 #include <stdlib.h>
51
52 #endif
53
54 if(!(expression)) \
55 { \
56 fputs("__FILE__, line __LINE__: assertion \"expression\" failed\n", stderr); \
57 abort(); \
58 }
59
60 #endif /* NDEBUG */
61
62 #endif /* __ASSERT_H_INCLUDED__ */
63
64 /* EOF */
65