]> git.proxmox.com Git - mirror_frr.git/blob - lib/zassert.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / zassert.h
1 /*
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 *
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
17 */
18
19 #ifndef _QUAGGA_ASSERT_H
20 #define _QUAGGA_ASSERT_H
21
22 extern void _zlog_assert_failed(const char *assertion, const char *file,
23 unsigned int line, const char *function)
24 __attribute__((noreturn));
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
34 #define zassert(EX) \
35 ((void)((EX) ? 0 : (_zlog_assert_failed(#EX, __FILE__, __LINE__, \
36 __ASSERT_FUNCTION), \
37 0)))
38
39 #undef assert
40 #define assert(EX) zassert(EX)
41
42 #endif /* _QUAGGA_ASSERT_H */