assert.h


    1 /*	Copyright (c) 1988 AT&T	*/
    2 /*	  All Rights Reserved  	*/
    3 
    4 /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
    5 /*	The copyright notice above does not evidence any   	*/
    6 /*	actual or intended publication of such source code.	*/
    7 
    8 #ifndef	_ASSERT_H
    9 #define	_ASSERT_H
    10 
    11 #pragma ident	"@(#)assert.h	1.9	92/07/14 SMI"	/* SVr4.0 1.6.1.4 */
    12 
    13 #ifdef	__cplusplus
    14 extern "C" {
    15 #endif
    16 
    17 #if defined(__STDC__)
    18 extern void __assert(const char *, const char *, int);
    19 #else
    20 extern void _assert();
    21 #endif
    22 
    23 #ifdef	__cplusplus
    24 }
    25 #endif
    26 
    27 #endif	/* _ASSERT_H */
    28 
    29 /*
    30  * Note that the ANSI C Standard requires all headers to be idempotent except
    31  *  which is explicitly required not to be idempotent (section 4.1.2).
    32  * Therefore, it is by intent that the header guards (#ifndef _ASSERT_H) do
    33  * not span this entire file.
    34  */
    35 
    36 #undef	assert
    37 
    38 #ifdef	NDEBUG
    39 
    40 #define	assert(EX) ((void)0)
    41 
    42 #else
    43 
    44 #if defined(__STDC__)
    45 #define	assert(EX) (void)((EX) || (__assert(#EX, __FILE__, __LINE__), 0))
    46 #else
    47 #define	assert(EX) (void)((EX) || (_assert("EX", __FILE__, __LINE__), 0))
    48 #endif	/* __STDC__ */
    49 
    50 #endif	/* NDEBUG */