PLASMA
Parallel Linear Algebra Software for Multicore Architectures
plasma_error.h
1
10#ifndef PLASMA_ERROR_H
11#define PLASMA_ERROR_H
12
13#include <stdio.h>
14#include <stdlib.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/******************************************************************************/
21#define plasma_warning(msg) \
22 plasma_warning_func_line_file(__func__, __LINE__, __FILE__, msg)
23
24#define plasma_error(msg) \
25 plasma_error_func_line_file(__func__, __LINE__, __FILE__, msg)
26
27#define plasma_error_with_code(msg, code) \
28 plasma_error_func_line_file_code(__func__, __LINE__, __FILE__, msg, \
29 code)
30
31#define plasma_fatal_error(msg) \
32 plasma_fatal_error_func_line_file(__func__, __LINE__, __FILE__, msg)
33
34/******************************************************************************/
35static inline void plasma_warning_func_line_file(
36 char const *func, int line, const char *file, const char *msg)
37{
38 fprintf(stderr,
39 "PLASMA WARNING at %d of %s() in %s: %s\n",
40 line, func, file, msg);
41}
42
43/******************************************************************************/
44static inline void plasma_error_func_line_file(
45 char const *func, int line, const char *file, const char *msg)
46{
47 fprintf(stderr,
48 "PLASMA ERROR at %d of %s() in %s: %s\n",
49 line, func, file, msg);
50}
51
52/******************************************************************************/
53static inline void plasma_error_func_line_file_code(
54 char const *func, int line, const char *file, const char *msg, int code)
55{
56 fprintf(stderr,
57 "PLASMA ERROR at %d of %s() in %s: %s %d\n",
58 line, func, file, msg, code);
59}
60
61/******************************************************************************/
62static inline void plasma_fatal_error_func_line_file(
63 char const *func, int line, const char *file, const char *msg)
64{
65 fprintf(stderr,
66 "PLASMA FATAL ERROR at %d of %s() in %s: %s\n",
67 line, func, file, msg);
68 exit(EXIT_FAILURE);
69}
70
71#ifdef __cplusplus
72} // extern "C"
73#endif
74
75#endif // PLASMA_ERROR_H