assert.h revision 228902
197403Sobrien/*- 297403Sobrien * Copyright (c) 1992, 1993 3169691Skan * The Regents of the University of California. All rights reserved. 4117397Skan * (c) UNIX System Laboratories, Inc. 597403Sobrien * All or some portions of this file are derived from material licensed 697403Sobrien * to the University of California by American Telephone and Telegraph 797403Sobrien * Co. or Unix System Laboratories, Inc. and are reproduced herein with 897403Sobrien * the permission of UNIX System Laboratories, Inc. 997403Sobrien * 1097403Sobrien * Redistribution and use in source and binary forms, with or without 1197403Sobrien * modification, are permitted provided that the following conditions 1297403Sobrien * are met: 1397403Sobrien * 1. Redistributions of source code must retain the above copyright 1497403Sobrien * notice, this list of conditions and the following disclaimer. 1597403Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1697403Sobrien * notice, this list of conditions and the following disclaimer in the 1797403Sobrien * documentation and/or other materials provided with the distribution. 1897403Sobrien * 3. Neither the name of the University nor the names of its contributors 19169691Skan * may be used to endorse or promote products derived from this software 2097403Sobrien * without specific prior written permission. 2197403Sobrien * 2297403Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2397403Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2497403Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2597403Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2697403Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2797403Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2897403Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2997403Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3097403Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3197403Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3297403Sobrien * SUCH DAMAGE. 3397403Sobrien * 3497403Sobrien * @(#)assert.h 8.2 (Berkeley) 1/21/94 3597403Sobrien * $FreeBSD: head/include/assert.h 228902 2011-12-26 18:57:59Z ed $ 36169691Skan */ 37169691Skan 38132720Skan#include <sys/cdefs.h> 39132720Skan 4097403Sobrien/* 4197403Sobrien * Unlike other ANSI header files, <assert.h> may usefully be included 4297403Sobrien * multiple times, with and without NDEBUG defined. 43169691Skan */ 44169691Skan 45132720Skan#undef assert 46132720Skan#undef _assert 47132720Skan 48132720Skan#ifdef NDEBUG 49169691Skan#define assert(e) ((void)0) 50169691Skan#define _assert(e) ((void)0) 51169691Skan#else 52169691Skan#define _assert(e) assert(e) 53132720Skan 54132720Skan#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ 55132720Skan __LINE__, #e)) 56132720Skan#endif /* NDEBUG */ 57132720Skan 58132720Skan#ifndef _ASSERT_H_ 59132720Skan#define _ASSERT_H_ 6097403Sobrien 61132720Skan#if __ISO_C_VISIBLE >= 2011 && (!defined(__cplusplus) || __cplusplus < 201103L) 62132720Skan#define static_assert _Static_assert 63132720Skan#endif 64132720Skan 6597403Sobrien__BEGIN_DECLS 66132720Skanvoid __assert(const char *, const char *, int, const char *) __dead2; 67132720Skan__END_DECLS 6897403Sobrien 69132720Skan#endif /* !_ASSERT_H_ */ 70132720Skan