summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-01-24 15:57:39 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-01-24 15:57:39 (GMT)
commit5b92b4d362546c213f684e515451be116dd8d281 (patch)
treee5a310c64f9746ff1619a19940a18d279411d8af
parentbf89ea471133c84cc6af1e084da6b474ff04e467 (diff)
parent590aaff33046df99a4d88ba59e4b461e060b36e4 (diff)
downloadhdf5-5b92b4d362546c213f684e515451be116dd8d281.zip
hdf5-5b92b4d362546c213f684e515451be116dd8d281.tar.gz
hdf5-5b92b4d362546c213f684e515451be116dd8d281.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '590aaff33046df99a4d88ba59e4b461e060b36e4': Optimized the floating point comparisons a little bit. Fix for failing h5diff tests involving floating-point compares. Removed H5_DEC_ENUM Revert "Revert "Moved -Wunsuffixed-float-constants to the developer warnings."" Revert "Moved -Wunsuffixed-float-constants to the developer warnings." Moved -Wunsuffixed-float-constants to the developer warnings. Fixed a bug in testpar/t_cache.c concerning checking expected vs. actual cache entry reads and writes.
-rw-r--r--config/cmake/HDFCompilerFlags.cmake7
-rw-r--r--config/gnu-flags4
-rw-r--r--release_docs/INSTALL_Warnings.txt11
-rw-r--r--src/H5private.h22
-rw-r--r--src/H5trace.c2
-rw-r--r--test/cache.c2
-rw-r--r--test/cache_api.c8
-rw-r--r--test/direct_chunk.c2
-rw-r--r--test/dsets.c20
-rw-r--r--test/tattr.c4
-rw-r--r--testpar/t_cache.c4
-rw-r--r--tools/lib/h5diff_array.c42
-rw-r--r--tools/test/h5diff/h5diffgentest.c14
13 files changed, 67 insertions, 75 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 100ada3..ea85736 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -176,7 +176,12 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC)
# Append more extra warning flags that only gcc 4.5+ know about
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
- set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants")
+ set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init")
+ if (HDF5_ENABLE_DEV_WARNINGS)
+ set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunsuffixed-float-constants")
+ else ()
+ set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-unsuffixed-float-constants")
+ endif ()
endif ()
# Append more extra warning flags that only gcc 4.6+ know about
diff --git a/config/gnu-flags b/config/gnu-flags
index f23ad68..3ca74c1 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -251,7 +251,9 @@ if test "X-gcc" = "X-$cc_vendor"; then
# gcc 4.5
if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then
- H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants"
+ H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init"
+ DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsuffixed-float-constants"
+ NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-unsuffixed-float-constants"
fi
# gcc 4.6
diff --git a/release_docs/INSTALL_Warnings.txt b/release_docs/INSTALL_Warnings.txt
index 5fde45f..97b3f76 100644
--- a/release_docs/INSTALL_Warnings.txt
+++ b/release_docs/INSTALL_Warnings.txt
@@ -88,11 +88,13 @@ Autotools UNIX warnings added to H5_CFLAGS
-Waggregate-return
-Wmissing-format-attribute
-Wmissing-noreturn
+ -Wunsuffixed-float-constants (gcc 4.5+)
enable-developer-warnings=OFF
-Wno-inline
-Wno-aggregate-return
-Wno-missing-format-attribute
-Wno-missing-noreturn
+ -Wno-unsuffixed-float-constants (gcc 4.5+)
IF GCC <= 4.3
-Wno-long-long
@@ -128,7 +130,6 @@ IF GCC <= 4.6
-Wstrict-aliasing
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
IF GCC <= 4.7
-Wno-long-long
@@ -141,7 +142,6 @@ IF GCC <= 4.7
-Wstrict-aliasing
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
-Wdouble-promotion
-Wtrampolines
enable-developer-warnings=ON:
@@ -158,7 +158,6 @@ IF GCC <= 4.8
-Wpacked-bitfield-compat
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
-Wdouble-promotion
-Wtrampolines
-Wstack-usage=8192
@@ -205,7 +204,6 @@ IF GCC < 5
-Wpacked-bitfield-compat
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
-Wdouble-promotion
-Wtrampolines
-Wstack-usage=8192
@@ -231,7 +229,6 @@ IF GCC < 6
-Wpacked-bitfield-compat
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
-Wdouble-promotion
-Wtrampolines
-Wstack-usage=8192
@@ -259,7 +256,6 @@ IF GCC < 7
-Wpacked-bitfield-compat
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
-Wdouble-promotion
-Wtrampolines
-Wstack-usage=8192
@@ -322,10 +318,12 @@ IF GNU GCC
HDF5_ENABLE_DEV_WARNINGS=ON
-Winline
-Waggregate-return
+ -Wunsuffixed-float-constants (gcc 4.5+)
HDF5_ENABLE_DEV_WARNINGS=OFF
-Wno-unused-parameter
-Wno-inline
-Wno-aggregate-return
+ -Wno-unsuffixed-float-constants (gcc 4.5+)
========================================================================
@@ -383,7 +381,6 @@ HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=ON
IF GCC >= 4.5
-Wstrict-overflow=5
-Wjump-misses-init
- -Wunsuffixed-float-constants
========================================================================
diff --git a/src/H5private.h b/src/H5private.h
index c3375df..fbea9b8 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -534,28 +534,6 @@
#define H5_REQUEST_NULL NULL
/*
- * A macro to portably decrement enumerated types.
- */
-#ifndef H5_DEC_ENUM
-# define H5_DEC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)-1))
-#endif
-
-/* Double constant wrapper
- *
- * Quiets gcc warnings from -Wunsuffixed-float-constants.
- *
- * This is a really annoying warning since the standard specifies that
- * constants of type double do NOT get a suffix so there's no way
- * to specify a constant of type double. To quiet gcc, we specify floating
- * point constants as type long double and cast to double.
- *
- * Note that this macro only needs to be used where using a double
- * is important. For most code, suffixing constants with F will quiet the
- * compiler and not produce erroneous code.
- */
-#define H5_DOUBLE(S) ((double) S ## L)
-
-/*
* Methods to compare the equality of floating-point values:
*
* 1. H5_XXX_ABS_EQUAL - check if the difference is smaller than the
diff --git a/src/H5trace.c b/src/H5trace.c
index 4a24804..ec5c6a2 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -155,7 +155,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
/* Get time for event */
- if(H5_DBL_ABS_EQUAL(first_time.etime, H5_DOUBLE(0.0)))
+ if(H5_DBL_ABS_EQUAL(first_time.etime, 0.0))
H5_timer_begin(&first_time);
if(H5_debug_g.ttimes)
H5_timer_begin(&event_time);
diff --git a/test/cache.c b/test/cache.c
index a90f12b..349d048 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -19914,7 +19914,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
/* NOTE: upper_hr_threshold MUST be type double (not float)
* or the cache test will fail on 64-bit systems.
*/
- auto_size_ctl.upper_hr_threshold = H5_DOUBLE(0.999); /* for ease of testing */
+ auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */
auto_size_ctl.decrement = 0.5f;
diff --git a/test/cache_api.c b/test/cache_api.c
index 87d0025..ca2e0ca 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -1664,7 +1664,7 @@ init_invalid_configs(void) {
configs[13].lower_hr_threshold = 1.00000001f;
/* 14 -- increment too small */
- configs[14].increment = H5_DOUBLE(0.999999999999);
+ configs[14].increment = 0.999999999999;
/* 15 -- invalid flash_incr_mode */
configs[15].flash_incr_mode = (enum H5C_cache_flash_incr_mode)-1;
@@ -1697,7 +1697,7 @@ init_invalid_configs(void) {
/* 23 -- decrement too big */
configs[23].decr_mode = H5C_decr__threshold;
- configs[23].decrement = H5_DOUBLE(1.0000000001);
+ configs[23].decrement = 1.0000000001;
/* 24 -- epochs_before_eviction too small */
configs[24].epochs_before_eviction = 0;
@@ -1709,13 +1709,13 @@ init_invalid_configs(void) {
configs[26].empty_reserve = -0.0000000001f;
/* 27 -- empty_reserve too big */
- configs[27].empty_reserve = H5_DOUBLE(1.00000000001);
+ configs[27].empty_reserve = 1.00000000001;
/* 28 -- upper_hr_threshold too small */
configs[28].upper_hr_threshold = -0.000000001f;
/* 29 -- upper_hr_threshold too big */
- configs[29].upper_hr_threshold = H5_DOUBLE(1.00000001);
+ configs[29].upper_hr_threshold = 1.00000001;
/* 30 -- upper_hr_threshold <= lower_hr_threshold */
configs[30].lower_hr_threshold = 0.9f;
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 6cf27c8..2e6cc68 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -43,7 +43,7 @@
#define CHUNK_NX 4
#define CHUNK_NY 4
-#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0))
+#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*1.001)+12.0)
/* Temporary filter IDs used for testing */
#define H5Z_FILTER_BOGUS1 305
diff --git a/test/dsets.c b/test/dsets.c
index bbe2d0f..9926f10 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -3168,18 +3168,18 @@ test_nbit_double(hid_t file)
*/
double orig_data[2][5] = {
{
- H5_DOUBLE(1.6081706885101836e+60),
- H5_DOUBLE(-255.32099170994480),
- H5_DOUBLE(1.2677579992621376e-61),
- H5_DOUBLE(64568.289448797700),
- H5_DOUBLE(-1.0619721778839084e-75)
+ 1.6081706885101836e+60,
+ -255.32099170994480,
+ 1.2677579992621376e-61,
+ 64568.289448797700,
+ -1.0619721778839084e-75
},
{
- H5_DOUBLE(2.1499497833454840e+56),
- H5_DOUBLE(6.6562295504670740e-3),
- H5_DOUBLE(-1.5747263393432150),
- H5_DOUBLE(1.0711093225222612),
- H5_DOUBLE(-9.8971679387636870e-1)
+ 2.1499497833454840e+56,
+ 6.6562295504670740e-3,
+ -1.5747263393432150,
+ 1.0711093225222612,
+ -9.8971679387636870e-1
}};
double new_data[2][5];
size_t precision, offset;
diff --git a/test/tattr.c b/test/tattr.c
index bcd8698..dab03a7 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -542,7 +542,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
+ if(!H5_DBL_ABS_EQUAL(rdata, 0.0))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Fflush(fil, H5F_SCOPE_GLOBAL);
@@ -551,7 +551,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
+ if(!H5_DBL_ABS_EQUAL(rdata, 0.0))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 09d2ecc..954071d 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -4671,7 +4671,7 @@ verify_entry_reads(haddr_t addr,
}
}
- if ( ! success ) {
+ if ( success ) {
if ( reported_entry_reads != expected_entry_reads ) {
@@ -4778,7 +4778,7 @@ verify_entry_writes(haddr_t addr,
}
}
- if ( ! success ) {
+ if ( success ) {
if ( reported_entry_writes != expected_entry_writes ) {
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 6cfe3d2..3127870 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -4559,12 +4559,16 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
return FALSE;
}
- if (H5_DBL_ABS_EQUAL(value, expected))
- return TRUE;
-
- if (opts->use_system_epsilon)
- if (ABS((value-expected)) < DBL_EPSILON)
+ if (opts->use_system_epsilon) {
+ /* Check equality within some epsilon */
+ if (H5_DBL_ABS_EQUAL(value, expected))
+ return TRUE;
+ }
+ else {
+ /* Check bits */
+ if (!HDmemcmp(&value, &expected, sizeof(double)))
return TRUE;
+ }
return FALSE;
}
@@ -4603,12 +4607,16 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
return FALSE;
}
- if (H5_LDBL_ABS_EQUAL(value, expected))
- return TRUE;
-
- if (opts->use_system_epsilon)
- if (ABS((value-expected)) < DBL_EPSILON)
+ if (opts->use_system_epsilon) {
+ /* Check equality within some epsilon */
+ if (H5_LDBL_ABS_EQUAL(value, expected))
return TRUE;
+ }
+ else {
+ /* Check bits */
+ if (!HDmemcmp(&value, &expected, sizeof(long double)))
+ return TRUE;
+ }
return FALSE;
}
@@ -4645,12 +4653,16 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
return FALSE;
}
- if (H5_FLT_ABS_EQUAL(value, expected))
- return TRUE;
-
- if (opts->use_system_epsilon)
- if (ABS( (value-expected) ) < FLT_EPSILON)
+ if (opts->use_system_epsilon) {
+ /* Check equality within some epsilon */
+ if (H5_FLT_ABS_EQUAL(value, expected))
return TRUE;
+ }
+ else {
+ /* Check bits */
+ if (!HDmemcmp(&value, &expected, sizeof(float)))
+ return TRUE;
+ }
return FALSE;
}
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index 98001ff..1d5354f 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -432,14 +432,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
/* epsilon = 0.0000000000000001 = 1e-16
* system epsilon for double : DBL_EPSILON = 2.22045E-16
*/
- double data13[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE(
- 0.0000000000000001) }, { H5_DOUBLE(0.0000000000000001),
- H5_DOUBLE(0.0000000000000000) }, { H5_DOUBLE(
- 0.00000000000000033), H5_DOUBLE(0.0000000000000001) } };
- double data14[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE(
- 0.0000000000000004) }, { H5_DOUBLE(0.0000000000000002),
- H5_DOUBLE(0.0000000000000001) }, { H5_DOUBLE(
- 0.0000000000000001), H5_DOUBLE(0.00000000000000000) } };
+ double data13[3][2] = { { 0.0000000000000000, 0.0000000000000001 },
+ { 0.0000000000000001, 0.0000000000000000 },
+ { 0.00000000000000033, 0.0000000000000001 } };
+ double data14[3][2] = { { 0.0000000000000000, 0.0000000000000004 },
+ { 0.0000000000000002, 0.0000000000000001 },
+ { 0.0000000000000001, 0.00000000000000000 } };
write_dset(gid1, 2, dims2, "fp1", H5T_NATIVE_FLOAT, data11);
write_dset(gid1, 2, dims2, "fp2", H5T_NATIVE_FLOAT, data12);