bad793133d15fd36043ef512379fb3a4294921dd
[reactos.git] / include / msvcrt / assert.h
1 /* 
2  * assert.h
3  *
4  * Define the assert macro for debug output.
5  *
6  * This file is part of the Mingw32 package.
7  *
8  * Contributors:
9  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  *
11  *  THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  *  This source code is offered for use in the public domain. You may
14  *  use, modify or distribute it freely.
15  *
16  *  This code is distributed in the hope that it will be useful but
17  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  *  DISCLAIMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26
27 #ifndef _ASSERT_H_
28 #define _ASSERT_H_
29
30
31 #ifdef  __cplusplus
32 extern "C" {
33 #endif
34
35 #ifdef NDEBUG
36
37 /*
38  * If not debugging, assert does nothing.
39  */
40 #define assert(x)   ((void)0)
41
42 #else /* debugging enabled */
43
44 /*
45  * CRTDLL nicely supplies a function which does the actual output and
46  * call to abort.
47  */
48 #ifndef __ATTRIB_NORETURN
49 #ifdef  __GNUC__
50 #define _ATTRIB_NORETURN    __attribute__ ((noreturn))
51 #else   /* Not __GNUC__ */
52 #define _ATTRIB_NORETURN
53 #endif  /* __GNUC__ */
54 #endif
55
56 void _assert(const char* szExpression, const char* szFileName, int nLine) _ATTRIB_NORETURN;
57
58 /*
59  * Definition of the assert macro.
60  */
61 #define assert(x)   if(!(x)) _assert( #x , __FILE__, __LINE__);
62 #endif  /* NDEBUG */
63
64 #ifdef  __cplusplus
65 }
66 #endif
67
68 #endif /* Not _ASSERT_H_ */
69