Fixed assert() macro, fixed header
[reactos.git] / posix / include / assert.h
1 /* $Id: assert.h,v 1.3 2002/05/17 01:42:41 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 /* INCLUDES */
29
30 /* OBJECTS */
31
32 /* TYPES */
33
34 /* CONSTANTS */
35
36 /* PROTOTYPES */
37
38 /* MACROS */
39 #ifdef NDEBUG
40 #define assert(IGNORE) ((void) 0)
41 #else /* !NDEBUG */
42
43 #include <stdio.h>
44 #include <stdlib.h>
45
46 #define assert(EXPRESSION) \
47 if(!(EXPRESSION)) \
48 { \
49 fputs("__FILE__, line __LINE__: assertion \"EXPRESSION\" failed\n", stderr); \
50 abort(); \
51 }
52
53 #endif /* NDEBUG */
54
55 #endif /* __ASSERT_H_INCLUDED__ */
56
57 /* EOF */
58