]>
Commit | Line | Data |
---|---|---|
2cac1093 | 1 | /* |
46f4a4d2 PJ |
2 | * This file is part of Quagga. |
3 | * | |
4 | * Quagga is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License as published by the | |
6 | * Free Software Foundation; either version 2, or (at your option) any | |
7 | * later version. | |
8 | * | |
9 | * Quagga is distributed in the hope that it will be useful, but | |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
896014f4 DL |
14 | * You should have received a copy of the GNU General Public License along |
15 | * with this program; see the file COPYING; if not, write to the Free Software | |
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
2cac1093 | 17 | */ |
18 | ||
cee3df1e | 19 | #ifndef _QUAGGA_ASSERT_H |
20 | #define _QUAGGA_ASSERT_H | |
21 | ||
d62a17ae | 22 | extern void _zlog_assert_failed(const char *assertion, const char *file, |
23 | unsigned int line, const char *function) | |
24 | __attribute__((noreturn)); | |
cee3df1e | 25 | |
26 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
27 | #define __ASSERT_FUNCTION __func__ | |
28 | #elif defined(__GNUC__) | |
29 | #define __ASSERT_FUNCTION __FUNCTION__ | |
30 | #else | |
31 | #define __ASSERT_FUNCTION NULL | |
32 | #endif | |
33 | ||
d62a17ae | 34 | #define zassert(EX) \ |
9d303b37 DL |
35 | ((void)((EX) ? 0 : (_zlog_assert_failed(#EX, __FILE__, __LINE__, \ |
36 | __ASSERT_FUNCTION), \ | |
37 | 0))) | |
cee3df1e | 38 | |
39 | #undef assert | |
40 | #define assert(EX) zassert(EX) | |
41 | ||
42 | #endif /* _QUAGGA_ASSERT_H */ |