error.h 760 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef ERROR_H
  2. # define ERROR_H
  3. /* OSQP error handling */
  4. # ifdef __cplusplus
  5. extern "C" {
  6. # endif // ifdef __cplusplus
  7. # include "types.h"
  8. /* OSQP error macro */
  9. # if __STDC_VERSION__ >= 199901L
  10. /* The C99 standard gives the __func__ macro, which is preferred over __FUNCTION__ */
  11. # define osqp_error(error_code) _osqp_error(error_code, __func__);
  12. #else
  13. # define osqp_error(error_code) _osqp_error(error_code, __FUNCTION__);
  14. #endif
  15. /**
  16. * Internal function to print error description and return error code.
  17. * @param Error code
  18. * @param Function name
  19. * @return Error code
  20. */
  21. c_int _osqp_error(enum osqp_error_type error_code,
  22. const char * function_name);
  23. # ifdef __cplusplus
  24. }
  25. # endif // ifdef __cplusplus
  26. #endif // ifndef ERROR_H