blob: e99632d0bf6b96e1bc74eed760fe0edb85c91e52 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
This file is part of libmicrohttpd
Copyright (C) 2017 Karlson2k (Evgeny Grin)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file microhttpd/mhd_assert.h
* @brief macros for mhd_assert()
* @author Karlson2k (Evgeny Grin)
*/
#ifndef MHD_ASSERT_H
#define MHD_ASSERT_H 1
#include "mhd_options.h"
#ifdef NDEBUG
# define mhd_assert(ignore) ((void) 0)
#else /* _DEBUG */
# ifdef HAVE_ASSERT
# include <assert.h>
# define mhd_assert(CHK) assert (CHK)
# else /* ! HAVE_ASSERT */
# include <stdio.h>
# include <stdlib.h>
# define mhd_assert(CHK) \
do { \
if (! (CHK)) { \
fprintf (stderr, "%s:%u Assertion failed: %s\nProgram aborted.\n", \
__FILE__, (unsigned) __LINE__, #CHK); \
fflush (stderr); abort (); } \
} while (0)
# endif /* ! HAVE_ASSERT */
#endif /* _DEBUG */
#endif /* ! MHD_ASSERT_H */
|