This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / include / crtdll / 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  *  DISCLAMED. 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 #ifdef  __cplusplus
31 extern "C" {
32 #endif
33
34 #ifdef NDEBUG
35
36 /*
37  * If not debugging, assert does nothing.
38  */
39 #define assert(x)       ((void)0);
40
41 #else /* debugging enabled */
42
43 /*
44  * CRTDLL nicely supplies a function which does the actual output and
45  * call to abort.
46  */
47 #ifndef  __ATTRIB_NORETURN
48 #ifdef  __GNUC__
49 #define _ATTRIB_NORETURN        __attribute__ ((noreturn))
50 #else   /* Not __GNUC__ */
51 #define _ATTRIB_NORETURN
52 #endif  /* __GNUC__ */
53 #endif
54
55 void    _assert (const char* szExpression, const char* szFileName, int nLine) 
56 _ATTRIB_NORETURN
57 ;
58
59 /*
60  * Definition of the assert macro.
61  */
62 #define assert(x)       if(!(x)) _assert( #x , __FILE__, __LINE__);
63 #endif  /* NDEBUG */
64
65 #ifdef  __cplusplus
66 }
67 #endif
68
69 #endif