Skip to content

Commit d997cb2

Browse files
muschellij2thewtex
authored andcommitted
COMP: Fix HDF5 HDopen definition for MinGW
To address: [ 73%] Building C object Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeFiles/hdf5-static.dir/H5Defl.c.obj In file included from C:\run\ITKR.Rcheck\00_pkg_src\ITKR\src\itks\Modules\ThirdParty\HDF5\src\itkhdf5\src\H5private.h:615:0, from C:\run\ITKR.Rcheck\00_pkg_src\ITKR\src\itks\Modules\ThirdParty\HDF5\src\itkhdf5\src\H5Defl.c:29: C:\run\ITKR.Rcheck\00_pkg_src\ITKR\src\itks\Modules\ThirdParty\HDF5\src\itkhdf5\src\H5Defl.c: In function 'H5D__efl_read': C:\run\ITKR.Rcheck\00_pkg_src\ITKR\src\itks\Modules\ThirdParty\HDF5\src\itkhdf5\src\H5win32defs.h:57:66: error: expected expression before ')' token #define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) ^ C:\run\ITKR.Rcheck\00_pkg_src\ITKR\src\itks\Modules\ThirdParty\HDF5\src\itkhdf5\src\H5Defl.c:291:18: note: in expansion of macro 'HDopen' if((fd = HDopen(full_name, O_RDONLY)) < 0) ^ Modules\ThirdParty\HDF5\src\itkhdf5\src\CMakeFiles\hdf5-static.dir\build.make:770: recipe for target 'Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeFiles/hdf5-static.dir/H5Defl.c.obj' failed in the ITK Windows / R build -- ITKR. Closes #66
1 parent b21c5f6 commit d997cb2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Modules/ThirdParty/HDF5/src/itkhdf5/src/H5win32defs.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ typedef __int64 h5_stat_size_t;
4747
#define HDmkdir(S,M) _mkdir(S)
4848
#define HDnanosleep(N, O) Wnanosleep(N, O)
4949
#define HDoff_t __int64
50-
/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
51-
* transformations when performing I/O. Note that this will
52-
* produce Unix-style text files, though.
53-
*
54-
* Also note that the variadic macro is using a VC++ extension
55-
* where the comma is dropped if nothing is passed to the ellipsis.
56-
*/
57-
#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
5850
#define HDread(F,M,Z) _read(F,M,Z)
5951
#define HDrmdir(S) _rmdir(S)
6052
#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
@@ -77,6 +69,15 @@ typedef __int64 h5_stat_size_t;
7769
#endif /* H5_HAVE_STRTOULL */
7870
#endif /* MSC_VER < 1800 */
7971

72+
/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
73+
* transformations when performing I/O. Note that this will
74+
* produce Unix-style text files, though.
75+
*
76+
* Also note that the variadic macro is using a VC++ extension
77+
* where the comma is dropped if nothing is passed to the ellipsis.
78+
*/
79+
#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__)
80+
8081
/*
8182
* The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
8283
*/
@@ -106,6 +107,9 @@ struct timespec
106107
#define HDroundf(V) Wroundf(V)
107108
#endif /* MSC_VER < 1700 */
108109

110+
#else
111+
// For MinGW, etc.
112+
#define HDopen(S,F,M) _open(S, F | _O_BINARY, M)
109113
#endif /* H5_HAVE_VISUAL_STUDIO */
110114

111115

0 commit comments

Comments
 (0)