b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /****************************************************************************** |
| 2 | *(C) Copyright 2008 Marvell International Ltd. |
| 3 | * All Rights Reserved |
| 4 | ******************************************************************************/ |
| 5 | /***************************************************************************** |
| 6 | * Utility Library |
| 7 | * |
| 8 | * Error-handling utilities header file |
| 9 | * |
| 10 | *****************************************************************************/ |
| 11 | |
| 12 | #ifndef _UTL_ERROR_INCLUDED |
| 13 | #define _UTL_ERROR_INCLUDED |
| 14 | |
| 15 | #include <assert.h> |
| 16 | #include <errno.h> |
| 17 | |
| 18 | #include "utlTypes.h" |
| 19 | #include <string.h> |
| 20 | #include "utlTrace.h" |
| 21 | |
| 22 | /*--- Macros ----------------------------------------------------------------*/ |
| 23 | |
| 24 | #define utlHERE __FILE__, __func__, __LINE__ |
| 25 | |
| 26 | #define utlHERE_FILE file_path_p |
| 27 | #define utlHERE_FUNC func_name_p |
| 28 | #define utlHERE_LINE line_num |
| 29 | |
| 30 | #define utlHERE_DECLARATION const char *utlHERE_FILE UNUSED, const char *utlHERE_FUNC UNUSED, const size_t utlHERE_LINE UNUSED |
| 31 | |
| 32 | #define utlHERE_VALUES utlHERE_FILE, utlHERE_FUNC, utlHERE_LINE |
| 33 | |
| 34 | #define utlAssert(test) ((utlDoAssert(utlHERE, test, #test)) ? (void)0 : eeh_panic(__FILE__, __LINE__, __func__, #test)) |
| 35 | |
| 36 | #define utlError ERRMSG |
| 37 | #define utlSigError ERRMSG |
| 38 | |
| 39 | /*--- Prototypes ------------------------------------------------------------*/ |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
| 45 | extern bool utlDoAssert(utlHERE_DECLARATION, const int result, const char *assertion_p); |
| 46 | extern void utlDoError(utlHERE_DECLARATION, const char *msg_p, ...); |
| 47 | extern void utlDoSigError(utlHERE_DECLARATION, const char *msg_p, ...); |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | #endif /* _UTL_ERRNO_INCLUDED */ |
| 54 | |