FNFT
include
private
fnft__errwarn.h
Go to the documentation of this file.
1
/*
2
* This file is part of FNFT.
3
*
4
* FNFT is free software; you can redistribute it and/or
5
* modify it under the terms of the version 2 of the GNU General
6
* Public License as published by the Free Software Foundation.
7
*
8
* FNFT is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Contributors:
17
* Sander Wahls (TU Delft) 2017-2018.
18
*/
19
27
#ifndef FNFT__ERRWARN_H
28
#define FNFT__ERRWARN_H
29
30
#include "
fnft_errwarn.h
"
31
36
#define FNFT__WARN(msg) fnft__warn_aux(__func__, __LINE__, msg);
37
42
#define FNFT__E_NOMEM FNFT__ERRMSG(FNFT_EC_NOMEM, "Out of memory.")
43
48
#define FNFT__E_INVALID_ARGUMENT(name) FNFT__ERRMSG(FNFT_EC_INVALID_ARGUMENT, FNFT__E_INVALID_ARGUMENT_(name))
49
57
#define FNFT__E_SUBROUTINE(ec) FNFT__ERRMSG(-abs(ec), "Subroutine failure.")
58
63
#define FNFT__E_DIV_BY_ZERO FNFT__ERRMSG(FNFT_EC_DIV_BY_ZERO, "Division by zero.")
64
69
#define FNFT__E_TEST_FAILED FNFT__ERRMSG(FNFT_EC_TEST_FAILED, "Test failed.")
70
75
#define FNFT__E_OTHER(msg) FNFT__ERRMSG(FNFT_EC_OTHER, msg)
76
82
#define FNFT__E_NOT_YET_IMPLEMENTED(name,msg) FNFT__ERRMSG(FNFT_EC_NOT_YET_IMPLEMENTED, FNFT__E_NOT_YET_IMPLEMENTED_(name,msg))
83
88
#define FNFT__E_SANITY_CHECK_FAILED(msg) FNFT__ERRMSG(FNFT_EC_SANITY_CHECK_FAILED, FNFT__E_SANITY_CHECK_FAILED_(msg))
89
94
#define FNFT__E_ASSERTION_FAILED FNFT__ERRMSG(FNFT_EC_ASSERTION_FAILED, "Assertion failed.")
95
101
#define FNFT__CHECK_RETCODE(ret_code, label) {if (ret_code!=FNFT_SUCCESS) {ret_code=FNFT__E_SUBROUTINE(ret_code);goto label;}}
102
103
#ifdef FNFT_ENABLE_SHORT_NAMES
104
#define WARN(msg) FNFT__WARN(msg)
105
#define E_NOMEM FNFT__E_NOMEM
106
#define E_INVALID_ARGUMENT(name) FNFT__E_INVALID_ARGUMENT(name)
107
#define E_SUBROUTINE(ec) FNFT__E_SUBROUTINE(ec)
108
#define E_DIV_BY_ZERO FNFT__E_DIV_BY_ZERO
109
#define E_TEST_FAILED FNFT__E_TEST_FAILED
110
#define E_OTHER(msg) FNFT__E_OTHER(msg)
111
#define E_NOT_YET_IMPLEMENTED(name,msg) FNFT__E_NOT_YET_IMPLEMENTED(name,msg)
112
#define E_SANITY_CHECK_FAILED(msg) FNFT__E_SANITY_CHECK_FAILED(msg)
113
#define E_ASSERTION_FAILED FNFT__E_ASSERTION_FAILED
114
#define CHECK_RETCODE(ret_code,label) FNFT__CHECK_RETCODE(ret_code,label)
115
#endif
116
117
/* --- Auxiliary macros and functions. Do not use directly. --- */
118
125
#define FNFT__ERRMSG(ec,msg) fnft__errmsg_aux(ec, __func__, __LINE__, msg);
126
132
#define FNFT__E_INVALID_ARGUMENT_(name) "Invalid argument "#name"."
133
139
#define FNFT__E_NOT_YET_IMPLEMENTED_(name,msg) "Not yet implemented ("#name"). "#msg
140
146
#define FNFT__E_SANITY_CHECK_FAILED_(msg) "Sanity check failed ("#msg")."
147
148
155
FNFT_INT
fnft__errmsg_aux
(
const
FNFT_INT
ec,
const
char
*func,
156
const
FNFT_INT
line,
const
char
*msg);
157
164
void
fnft__warn_aux
(
const
char
*func,
const
FNFT_INT
line,
const
char
*msg);
165
166
#endif
FNFT_INT
int32_t FNFT_INT
Definition:
fnft_numtypes.h:56
fnft__errmsg_aux
FNFT_INT fnft__errmsg_aux(const FNFT_INT ec, const char *func, const FNFT_INT line, const char *msg)
fnft_errwarn.h
Controls error messages.
fnft__warn_aux
void fnft__warn_aux(const char *func, const FNFT_INT line, const char *msg)
Generated by
1.8.18