1 /*
2  * cssc-assert.h: Part of GNU CSSC.
3  *
4  *
5  *  Copyright (C) 1997, 1999, 2001, 2007, 2008, 2009, 2010, 2011, 2014,
6  *  2019 Free Software Foundation, Inc.
7  *
8  *  This program is free software: you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation, either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  * CSSC was originally Based on MySC, by Ross Ridge, which was
22  * placed in the Public Domain.
23  */
24 #ifndef INC_CSSC_ASSERT_H
25 #define INC_CSSC_ASSERT_H 1
26 
27 #include "defaults.h"
28 
29 
30 NORETURN assert_failed(const char *file, int line, const char *func,
31                        const char *test) POSTDECL_NORETURN;
32 
33 #ifdef __GNUC__
34 #define ASSERT(test) ((test) ? (void) 0                                 \
35                              : assert_failed(__FILE__, __LINE__,        \
36                                              __PRETTY_FUNCTION__, #test))
37 #else
38 #define ASSERT(test) ((test) ? (void) 0                                 \
39                              : assert_failed(__FILE__, __LINE__, "", #test))
40 #endif
41 
42 #endif
43