Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
icalerror_p.h
1/*======================================================================
2 * FILE: icalerror_p.h
3 * CREATOR: eric 09 May 1999
4 *
5 * SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
6 * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
7 * ======================================================================*/
8
9#ifndef ICALERROR_P_H
10#define ICALERROR_P_H
11
12#include "libical_ical_export.h"
13
14#include <assert.h>
15
26typedef enum icalerrorenum
27{
29 ICAL_NO_ERROR = 0,
30
33
36
39
42
45
47 ICAL_INTERNAL_ERROR, /* Like assert --internal consist. prob */
48
51
54
57
59 ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror() */
61
72LIBICAL_ICAL_EXPORT void icalerror_stop_here(void);
73
80LIBICAL_ICAL_EXPORT void icalerror_crash_here(void);
81
82/* Assert with a message */
94
95#ifdef __GNUC__
96#define icalerror_assert(test, message) \
97 if (icalerror_get_errors_are_fatal() && !(test)) { \
98 icalerrprintf("%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message); \
99 icalerror_stop_here(); \
100 abort(); \
101 }
102#else /*__GNUC__*/
103#define icalerror_assert(test, message) \
104 if (icalerror_get_errors_are_fatal() && !(test)) { \
105 icalerrprintf("%s:%d: %s\n", __FILE__, __LINE__, message); \
106 icalerror_stop_here(); \
107 abort(); \
108 }
109#endif /*__GNUC__*/
110
132#define icalerror_check_arg_re(test, arg, error) \
133 if (!(test)) { \
134 icalerror_stop_here(); \
135 icalassert(0); \
136 return error; \
137 }
138
139/* Warning messages */
140
151
152#ifdef __GNUC__
153#define icalerror_warn(message) \
154 { \
155 icalerrprintf("%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message); \
156 }
157#else /* __GNU_C__ */
158#define icalerror_warn(message) \
159 { \
160 icalerrprintf("%s:%d: %s\n", __FILE__, __LINE__, message); \
161 }
162#endif /* __GNU_C__ */
163
164#endif
void icalerror_crash_here(void)
Triggered to abort the process.
Definition icalerror.c:73
icalerrorenum
Represents the different types of errors that can be triggered in libical.
Definition icalerror.h:64
@ ICAL_NEWFAILED_ERROR
Definition icalerror.h:72
@ ICAL_BADARG_ERROR
Definition icalerror.h:69
@ ICAL_FILE_ERROR
Definition icalerror.h:87
@ ICAL_ALLOCATION_ERROR
Definition icalerror.h:75
@ ICAL_INTERNAL_ERROR
Definition icalerror.h:84
@ ICAL_NO_ERROR
Definition icalerror.h:66
@ ICAL_MALFORMEDDATA_ERROR
Definition icalerror.h:78
@ ICAL_UNKNOWN_ERROR
Definition icalerror.h:96
@ ICAL_PARSE_ERROR
Definition icalerror.h:81
@ ICAL_UNIMPLEMENTED_ERROR
Definition icalerror.h:93
@ ICAL_USAGE_ERROR
Definition icalerror.h:90
void icalerror_stop_here(void)
Triggered before any error is called.
Definition icalerror.c:68