4 * Define the assert macro for debug output.
6 * This file is part of the Mingw32 package.
9 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
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.
38 * If not debugging, assert does nothing.
40 #define assert(x) ((void)0)
42 #else /* debugging enabled */
45 * CRTDLL nicely supplies a function which does the actual output and
48 #ifndef __ATTRIB_NORETURN
50 #define _ATTRIB_NORETURN __attribute__ ((noreturn))
51 #else /* Not __GNUC__ */
52 #define _ATTRIB_NORETURN
56 void _assert(const char* szExpression, const char* szFileName, int nLine) _ATTRIB_NORETURN;
59 * Definition of the assert macro.
61 #define assert(x) if(!(x)) _assert( #x , __FILE__, __LINE__);
68 #endif /* Not _ASSERT_H_ */