summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_error.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools_error.h')
-rw-r--r--tools/lib/h5tools_error.h50
1 files changed, 21 insertions, 29 deletions
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index b8e5339..b1ca00f 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -14,8 +14,8 @@
/*
* Header file for error values, etc.
*/
-#ifndef H5TOOLS_ERROR_H_
-#define H5TOOLS_ERROR_H_
+#ifndef H5TOOLS_ERROR_H
+#define H5TOOLS_ERROR_H
#include "H5Epublic.h"
#include "H5Eprivate.h" /* Error handling */
@@ -29,15 +29,6 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
H5TOOLS_DLLVAR hid_t H5E_tools_min_info_id_g;
H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
-/* Use FUNC to safely handle variations of C99 __func__ keyword handling */
-#ifdef H5_HAVE_C99_FUNC
-#define FUNC __func__
-#elif defined(H5_HAVE_FUNCTION)
-#define FUNC __FUNCTION__
-#else
-#error "We need __func__ or __FUNCTION__ to test function names!"
-#endif
-
/*
* H5TOOLS_INIT_ERROR macro, used to initialize error reporting.
*/
@@ -105,7 +96,8 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
do { \
if (enable_error_stack > 0) { \
if (estack_id >= 0 && err_cls >= 0) \
- H5Epush2(estack_id, __FILE__, FUNC, __LINE__, err_cls, maj_err_id, min_err_id, __VA_ARGS__); \
+ H5Epush2(estack_id, __FILE__, __func__, __LINE__, err_cls, maj_err_id, min_err_id, \
+ __VA_ARGS__); \
else { \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
@@ -175,7 +167,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
#define H5TOOLS_START_DEBUG(...) \
do { \
H5tools_INDENT_g += 2; \
- HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
HDfflush(stderr); \
@@ -183,7 +175,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
#define H5TOOLS_DEBUG(...) \
do { \
- HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
HDfflush(stderr); \
@@ -191,7 +183,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
#define H5TOOLS_ENDDEBUG(...) \
do { \
- HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
H5tools_INDENT_g -= 2; \
@@ -220,22 +212,22 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
/* Macro for "catching" flow of control when an error occurs. Note that the
* H5_LEAVE macro won't jump back here once it's past this point.
*/
-/* #define CATCH catch_except:; past_catch = TRUE; defined in H5Eprivate.h */
+#define CATCH \
+catch_except:; \
+ past_catch = TRUE;
/*
- * H5_LEAVE macro, used to facilitate control flow between a
- * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is
- * the return value.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
+ * H5_LEAVE macro, used to facilitate control flow in a function. The argument
+ * is the return value. The return value is assigned to a variable `ret_value'
+ * and control branches to the `catch_except' label, if we're not already past
+ * it.
*/
-/*
- * #define H5_LEAVE(v) { \
- * ret_value = v; \
- * if(!past_catch) \
- * goto catch_except; \
- * }
- * defined in H5Eprivate.h */
+#define H5_LEAVE(v) \
+ { \
+ ret_value = v; \
+ if (!past_catch) \
+ goto catch_except; \
+ }
/*
* H5TOOLS_THROW macro, used to facilitate error reporting within a function body.
@@ -250,4 +242,4 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
H5_LEAVE(ret_val) \
} while (0)
-#endif /* H5TOOLS_ERROR_H_ */
+#endif /* H5TOOLS_ERROR_H */