diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-08-08 19:04:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-08 19:04:01 (GMT) |
commit | 5d63aca604713973ef6079deb0da247efa0e077a (patch) | |
tree | 636c395c3631c2c1b235d1932ac71f801b606489 /src/H5private.h | |
parent | 57926d549ef75c532badc7ad3318170f7130295b (diff) | |
download | hdf5-5d63aca604713973ef6079deb0da247efa0e077a.zip hdf5-5d63aca604713973ef6079deb0da247efa0e077a.tar.gz hdf5-5d63aca604713973ef6079deb0da247efa0e077a.tar.bz2 |
Turns off clang optimizations on a couple of onion VFD functions (#1976)
Ancient clang (7.7.3 on OS X) emits problematic code with -O2 or -O3
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/H5private.h b/src/H5private.h index 3130bb1..19c3d33 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -289,6 +289,18 @@ # define H5_ATTR_MALLOC /*void*/ # endif +/* Turns off optimizations for a function. Goes after the return type. + * Not generally needed in the library, but ancient versions of clang + * (7.3.3, possibly others) have trouble with some of the onion VFD decode + * functions and need the optimizer turned off. This macro can go away when + * we figure out what's going on and can engineer another solution. + */ +# if defined(__clang__) +# define H5_ATTR_NO_OPTIMIZE __attribute__((optnone)) +# else +# define H5_ATTR_NO_OPTIMIZE /*void*/ +# endif + #else # define H5_ATTR_FORMAT(X, Y, Z) /*void*/ # define H5_ATTR_UNUSED /*void*/ @@ -302,6 +314,7 @@ # define H5_ATTR_PURE /*void*/ # define H5_ATTR_FALLTHROUGH /*void*/ # define H5_ATTR_MALLOC /*void*/ +# define H5_ATTR_NO_OPTIMIZE /*void*/ #endif /* clang-format on */ |