Skip to content

Commit 207a73e

Browse files
HDF5 Maintainersblowekamp
authored andcommitted
COMP: Patch HDF5 compilation issue with mingw and _Float16
This is change is pulled from commit b09008ea0379e7b113ffdde4402860ba467ace13 upstream. Define __STDC_WANT_IEC_60559_TYPES_EXT__ before including other headers (InsightSoftwareConsortium#5356) Some standard headers might implicitly include `float.h`. If that happens before `__STDC_WANT_IEC_60559_TYPES_EXT__` is defined, the macros that are needed for the `_Float16` data type (like `FLT16_MAX`) might not be defined. That is happening with mingw-w64 headers since the following change: mingw-w64/mingw-w64@b40b6a0 Define `__STDC_WANT_IEC_60559_TYPES_EXT__` before including other headers in `H5private.h` to make that scenario less likely.
1 parent 31fd9a2 commit 207a73e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

Modules/ThirdParty/HDF5/src/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,6 @@ set(
191191
CACHE INTERNAL
192192
"Enable support for non-standard programming language features"
193193
)
194-
set(
195-
HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16
196-
ON
197-
CACHE INTERNAL
198-
"Enable support for _Float16 C datatype"
199-
)
200194
set(
201195
HDF5_ENABLE_SUBFILING_VFD
202196
OFF

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#ifndef H5private_H
2121
#define H5private_H
2222

23+
/* Define __STDC_WANT_IEC_60559_TYPES_EXT__ for _FloatN support, if available.
24+
* Do that before including any other headers in case they include <float.h>
25+
* implicitly. */
26+
#define __STDC_WANT_IEC_60559_TYPES_EXT__
27+
2328
#include "H5public.h" /* Include Public Definitions */
2429

2530
#include <assert.h>
@@ -33,9 +38,6 @@
3338
#include <stdlib.h>
3439
#include <string.h>
3540
#include <time.h>
36-
37-
/* Define __STDC_WANT_IEC_60559_TYPES_EXT__ for _FloatN support, if available */
38-
#define __STDC_WANT_IEC_60559_TYPES_EXT__
3941
#include <float.h>
4042
#include <math.h>
4143

0 commit comments

Comments
 (0)