Austin Schuh | 9049e20 | 2022-02-20 17:34:16 -0800 | [diff] [blame^] | 1 | #ifndef ERROR_H |
| 2 | # define ERROR_H |
| 3 | |
| 4 | /* OSQP error handling */ |
| 5 | |
| 6 | # ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | # endif // ifdef __cplusplus |
| 9 | |
| 10 | # include "types.h" |
| 11 | |
| 12 | |
| 13 | /* OSQP error macro */ |
| 14 | # if __STDC_VERSION__ >= 199901L |
| 15 | /* The C99 standard gives the __func__ macro, which is preferred over __FUNCTION__ */ |
| 16 | # define osqp_error(error_code) _osqp_error(error_code, __func__); |
| 17 | #else |
| 18 | # define osqp_error(error_code) _osqp_error(error_code, __FUNCTION__); |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | |
| 23 | /** |
| 24 | * Internal function to print error description and return error code. |
| 25 | * @param Error code |
| 26 | * @param Function name |
| 27 | * @return Error code |
| 28 | */ |
| 29 | c_int _osqp_error(enum osqp_error_type error_code, |
| 30 | const char * function_name); |
| 31 | |
| 32 | |
| 33 | |
| 34 | # ifdef __cplusplus |
| 35 | } |
| 36 | # endif // ifdef __cplusplus |
| 37 | |
| 38 | #endif // ifndef ERROR_H |