]> git.proxmox.com Git - mirror_frr.git/blame - lib/zassert.h
tools: fix frr-reload.py daemon option
[mirror_frr.git] / lib / zassert.h
CommitLineData
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
17e38209
RW
22#ifdef __cplusplus
23extern "C" {
24#endif
25
d62a17ae 26extern void _zlog_assert_failed(const char *assertion, const char *file,
27 unsigned int line, const char *function)
28 __attribute__((noreturn));
cee3df1e 29
30#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
31#define __ASSERT_FUNCTION __func__
32#elif defined(__GNUC__)
33#define __ASSERT_FUNCTION __FUNCTION__
34#else
35#define __ASSERT_FUNCTION NULL
36#endif
37
d62a17ae 38#define zassert(EX) \
9d303b37
DL
39 ((void)((EX) ? 0 : (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
40 __ASSERT_FUNCTION), \
41 0)))
cee3df1e 42
43#undef assert
44#define assert(EX) zassert(EX)
45
17e38209
RW
46#ifdef __cplusplus
47}
48#endif
49
cee3df1e 50#endif /* _QUAGGA_ASSERT_H */