assert.h revision 203964
11638Srgrimes/*-
21638Srgrimes * Copyright (c) 1992, 1993
31638Srgrimes *	The Regents of the University of California.  All rights reserved.
41638Srgrimes * (c) UNIX System Laboratories, Inc.
51638Srgrimes * All or some portions of this file are derived from material licensed
61638Srgrimes * to the University of California by American Telephone and Telegraph
71638Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81638Srgrimes * the permission of UNIX System Laboratories, Inc.
91638Srgrimes *
101638Srgrimes * Redistribution and use in source and binary forms, with or without
111638Srgrimes * modification, are permitted provided that the following conditions
121638Srgrimes * are met:
131638Srgrimes * 1. Redistributions of source code must retain the above copyright
141638Srgrimes *    notice, this list of conditions and the following disclaimer.
151638Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161638Srgrimes *    notice, this list of conditions and the following disclaimer in the
171638Srgrimes *    documentation and/or other materials provided with the distribution.
181638Srgrimes * 3. Neither the name of the University nor the names of its contributors
191638Srgrimes *    may be used to endorse or promote products derived from this software
201638Srgrimes *    without specific prior written permission.
211638Srgrimes *
221638Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231638Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241638Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251638Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261638Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271638Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281638Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291638Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301638Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311638Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321638Srgrimes * SUCH DAMAGE.
331638Srgrimes *
34108533Sschweikh *	@(#)assert.h	8.2 (Berkeley) 1/21/94
35108533Sschweikh * $FreeBSD: head/include/assert.h 203964 2010-02-16 19:39:50Z imp $
361638Srgrimes */
371638Srgrimes
381638Srgrimes#include <sys/cdefs.h>
391638Srgrimes
401638Srgrimes/*
411638Srgrimes * Unlike other ANSI header files, <assert.h> may usefully be included
421638Srgrimes * multiple times, with and without NDEBUG defined.
431638Srgrimes */
441638Srgrimes
451638Srgrimes#undef assert
461638Srgrimes#undef _assert
471638Srgrimes
481638Srgrimes#ifdef NDEBUG
491638Srgrimes#define	assert(e)	((void)0)
501638Srgrimes#define	_assert(e)	((void)0)
511638Srgrimes#else
521638Srgrimes#define	_assert(e)	assert(e)
531638Srgrimes
541638Srgrimes#define	assert(e)	((e) ? (void)0 : __assert(__func__, __FILE__, \
551638Srgrimes			    __LINE__, #e))
561638Srgrimes#endif /* NDEBUG */
571638Srgrimes
581638Srgrimes#ifndef _ASSERT_H_
591638Srgrimes#define _ASSERT_H_
601638Srgrimes__BEGIN_DECLS
611638Srgrimesvoid __assert(const char *, const char *, int, const char *);
621638Srgrimes__END_DECLS
631638Srgrimes#endif /* !_ASSERT_H_ */
641638Srgrimes