Go to the documentation of this file.
29 #ifndef UNDERLING_ERROR_H
30 #define UNDERLING_ERROR_H
33 #include <underling/visibility.h>
91 int underling_errno) UNDERLING_API;
108 const char *reason) UNDERLING_API;
134 int underling_errno);
150 const char * reason);
205 #define UNDERLING_ERROR(reason, underling_errno) \
207 underling_error (reason, __FILE__, __LINE__, underling_errno) ; \
208 return underling_errno ; \
219 #define UNDERLING_ERROR_VAL(reason, underling_errno, value) \
221 underling_error (reason, __FILE__, __LINE__, underling_errno) ; \
232 #define UNDERLING_ERROR_VOID(reason, underling_errno) \
234 underling_error (reason, __FILE__, __LINE__, underling_errno) ; \
246 #define UNDERLING_ERROR_NULL(reason, underling_errno) \
247 UNDERLING_ERROR_VAL(reason, underling_errno, 0)
257 #define UNDERLING_ERROR_NULL_FMT(underling_errno, fmt, ...) \
259 char _err_buf[256]; \
260 snprintf(_err_buf, sizeof(_err_buf), fmt, __VA_ARGS__); \
261 underling_error (_err_buf, __FILE__, __LINE__, underling_errno) ; \
273 #define UNDERLING_ERROR_REPORT(reason, underling_errno) \
275 underling_error (reason, __FILE__, __LINE__, underling_errno) ; \
280 #define UNDERLING_MPICHKx_TEMPLATE(underling_error_macro,stmt) \
282 const int _chk_stat = (stmt); \
283 if (_chk_stat != MPI_SUCCESS) { \
284 char _chk_reason[MPI_MAX_ERROR_STRING + 64]; \
285 char _chk_mpistring[MPI_MAX_ERROR_STRING]; \
287 const int _chk_string_stat \
288 = MPI_Error_string(_chk_stat,_chk_mpistring,&_chk_len); \
289 snprintf(_chk_reason, sizeof(_chk_reason)/sizeof(_chk_reason[0]), \
290 "Encountered MPI error code %d: %s", _chk_stat, \
291 (_chk_string_stat == MPI_SUCCESS) \
292 ? _chk_mpistring : "UNKNOWN"); \
293 underling_error_macro(_chk_reason, UNDERLING_EFAILED); \
311 #define UNDERLING_MPICHKQ(stmt) \
312 UNDERLING_MPICHKx_TEMPLATE(UNDERLING_ERROR,stmt)
326 #define UNDERLING_MPICHKN(stmt) \
327 UNDERLING_MPICHKx_TEMPLATE(UNDERLING_ERROR_NULL,stmt)
341 #define UNDERLING_MPICHKV(stmt) \
342 UNDERLING_MPICHKx_TEMPLATE(UNDERLING_ERROR_VOID,stmt)
356 #define UNDERLING_MPICHKR(stmt) \
357 UNDERLING_MPICHKx_TEMPLATE(UNDERLING_ERROR_REPORT,stmt)
@ UNDERLING_ENOMEM
Memory allocation failed.
Definition: error.h:65
underling_error_handler_t * underling_set_error_handler_off(void)
An error handler implementation that disables all error reporting.
const char * underling_strerror(const int underling_errno)
Look up a human-readable error message for the given error status.
void underling_stream_handler_t(const char *label, const char *file, int line, const char *reason)
Defines the function prototype necessary for a stream handler.
Definition: error.h:147
FILE * underling_set_stream(FILE *new_stream)
Set the default stream for error message display.
@ UNDERLING_ESANITY
Sanity check failed - shouldn't happen.
Definition: error.h:64
underling_status
Standardized error status codes used throughout underling.
Definition: error.h:59
@ UNDERLING_EFAILED
Generic failure.
Definition: error.h:63
void underling_stream_printf(const char *label, const char *file, int line, const char *reason)
Print an error message to the current error stream.
@ UNDERLING_SUCCESS
Success.
Definition: error.h:60
void underling_error_handler_t(const char *reason, const char *file, int line, int underling_errno)
Defines the function prototype necessary for an error handler.
Definition: error.h:131
underling_stream_handler_t * underling_set_stream_handler(underling_stream_handler_t *new_handler)
Sets the current stream handler for the process.
@ UNDERLING_EINVAL
Invalid argument supplied by user.
Definition: error.h:62
void underling_error(const char *reason, const char *file, int line, int underling_errno)
Calls the error handler last set using underling_set_error_handler when invoked.
@ UNDERLING_EFAULT
Invalid pointer.
Definition: error.h:61
underling_error_handler_t * underling_set_error_handler(underling_error_handler_t *new_handler)
Sets the current error handler for the process.
Generated on Wed Jul 1 2026 13:22:57 for underling
by
doxygen
1.8.17