summaryrefslogtreecommitdiffstats
path: root/src/H5Eprivate.h
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-22 18:45:49 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-22 18:45:49 (GMT)
commitf695908160bbd455492d91ca9acb414c90c33d73 (patch)
treec8159412b05b3868c56d476a821ec1974346d20e /src/H5Eprivate.h
parent0d4ed0eb9a43e5bb471dad1be08f83ae703821d1 (diff)
downloadhdf5-f695908160bbd455492d91ca9acb414c90c33d73.zip
hdf5-f695908160bbd455492d91ca9acb414c90c33d73.tar.gz
hdf5-f695908160bbd455492d91ca9acb414c90c33d73.tar.bz2
Brings HSYS_GOTO_ERROR changes from develop
Diffstat (limited to 'src/H5Eprivate.h')
-rw-r--r--src/H5Eprivate.h56
1 files changed, 48 insertions, 8 deletions
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 130a8fd..9deb695 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -102,14 +102,54 @@ typedef struct H5E_t H5E_t;
/* Retrieve the error code description string and push it onto the error
* stack.
*/
-#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) { \
- int myerrno = errno; \
- HDONE_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, HDstrerror(myerrno)); \
-}
-#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) { \
- int myerrno = errno; \
- HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, HDstrerror(myerrno)); \
-}
+#ifndef H5_HAVE_WIN32_API
+#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HDONE_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
+ HDstrerror(myerrno)); \
+ }
+#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
+ HDstrerror(myerrno)); \
+ }
+#else /* H5_HAVE_WIN32_API */
+ /* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a
+ * 32-bit unsigned type. Note that on Windows, either errno or GetLastError() (but probably not both) will
+ * be useful depending on whether a C/POSIX or Win32 call failed. The other value will likely be zero,
+ * though I wouldn't count on that.
+ */
+#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ DWORD win_error = GetLastError(); \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HDONE_ERROR(majorcode, minorcode, retcode, \
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
+ myerrno, HDstrerror(myerrno), win_error); \
+ }
+#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
+ { \
+ int myerrno = errno; \
+ DWORD win_error = GetLastError(); \
+ /* Other projects may rely on the description format to get the errno and any changes should be \
+ * considered as an API change \
+ */ \
+ HGOTO_ERROR(majorcode, minorcode, retcode, \
+ "%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
+ myerrno, HDstrerror(myerrno), win_error); \
+ }
+#endif /* H5_HAVE_WIN32_API */
#ifdef H5_HAVE_PARALLEL
/*