summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2004-04-14 18:14:40 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2004-04-14 18:14:40 (GMT)
commit599adeb080baa29ead2431096c51c6be039f2901 (patch)
tree9592ecfd6b6c40839d82ce6bcd6ea70e46be2ce5 /src
parent7d8b8f129d03569a6af39e22a51fae6c36009e09 (diff)
downloadhdf5-599adeb080baa29ead2431096c51c6be039f2901.zip
hdf5-599adeb080baa29ead2431096c51c6be039f2901.tar.gz
hdf5-599adeb080baa29ead2431096c51c6be039f2901.tar.bz2
[svn-r8353] Purpose:
feature Description: H5check_version will print warning messages if the version does not match or if the lib version string is not consistent, even when $HDF5_DISABLE_VERSION_CHECK is set to 1. This will mess up tests that try to match output. Changed it so that if $HDF5_DISABLE_VERSION_CHECK is set to 2, no warning about version mismatch is printed. The lib version string warning is suppressed if $HDF5_DISABLE_VERSION_CHECK is set to any non-zero value. Platforms tested: Tested in sol only but pretty comprehensive to make the warnings do get suppressed. Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c108
1 files changed, 62 insertions, 46 deletions
diff --git a/src/H5.c b/src/H5.c
index 712e6c6..7afdeea 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -591,72 +591,88 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
if (checked)
HGOTO_DONE(SUCCEED)
- if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum ||
- H5_VERS_RELEASE!=relnum) {
- const char *s; /* Environment string for disabling version check */
+ { const char *s; /* Environment string for disabling version check */
/* Allow different versions of the header files and library? */
s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK");
if (s && HDisdigit(*s))
disable_version_check = (int)HDstrtol (s, NULL, 0);
+ }
- if(disable_version_check) {
+ if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum ||
+ H5_VERS_RELEASE!=relnum) {
+ switch (disable_version_check) {
+ case 0:
HDfputs ("Warning! The HDF5 header files included by this application "
"do not match the\nversion used by the HDF5 library to which "
"this application is linked. Data\ncorruption or "
"segmentation faults may occur if the application "
- "continues.\n'HDF5_DISABLE_VERSION_CHECK' "
- "environment variable set, application will\n"
- "continue.\n", stderr);
- } /* end if */
- else {
+ "is\nallowed to continue. You can, at your own risk, "
+ "disable this check by setting\nthe environment variable "
+ "'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
+ "Setting it to 2 will suppress the warning totally.\n",
+ stderr);
+ /* Mention the versions we are referring to */
+ HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n",
+ majnum, minnum, relnum,
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+
+ /* Bail out now. */
+ HDfputs ("Bye...\n", stderr);
+ HDabort ();
+ break;
+ case 2:
+ /* continue silently */
+ break;
+ default:
+ /* continue with a warning */
HDfputs ("Warning! The HDF5 header files included by this application "
"do not match the\nversion used by the HDF5 library to which "
"this application is linked. Data\ncorruption or "
"segmentation faults may occur if the application "
- "is\nallowed to continue. You can, at your own risk, "
- "disable this check by setting\nthe environment variable "
- "'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n", stderr);
- } /* end else */
-
- /* Mention the versions we are referring to */
- HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n",
- majnum, minnum, relnum,
- H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
-
- /* Bail out now, if the version check isn't disabled */
- if(!disable_version_check) {
- HDfputs ("Bye...\n", stderr);
- HDabort ();
- } /* end if */
+ "continues.\n'HDF5_DISABLE_VERSION_CHECK' "
+ "environment variable set, application will\n"
+ "continue.\n", stderr);
+ /* Mention the versions we are referring to */
+ HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n",
+ majnum, minnum, relnum,
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ break;
+ } /* end switch */
+
} /* end if */
/* Indicate that the version check has been performed */
checked = 1;
- /*
- *verify if H5_VERS_INFO is consistent with the other version information.
- *Check only the first sizeof(lib_str) char. Assume the information
- *will fit within this size or enough significance.
- */
- sprintf(lib_str, "HDF5 library version: %d.%d.%d",
- H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
- if (*substr){
- HDstrcat(lib_str, "-");
- HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
- } /* end if */
- if (HDstrcmp(lib_str, H5_lib_vers_info_g)){
- HDfputs ("Warning! Library version information error.\n"
- "The HDF5 library version information are not "
- "consistent in its source code.\nThis is NOT a fatal error "
- "but should be corrected.\n", stderr);
- HDfprintf (stderr, "Library version information are:\n"
- "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, "
- "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n",
- H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
- H5_VERS_SUBRELEASE, H5_VERS_INFO);
- } /* end if */
+ if (!disable_version_check){
+ /*
+ *verify if H5_VERS_INFO is consistent with the other version information.
+ *Check only the first sizeof(lib_str) char. Assume the information
+ *will fit within this size or enough significance.
+ */
+ sprintf(lib_str, "HDF5 library version: %d.%d.%d",
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ if (*substr){
+ HDstrcat(lib_str, "-");
+ HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
+ } /* end if */
+ if (HDstrcmp(lib_str, H5_lib_vers_info_g)){
+ HDfputs ("Warning! Library version information error.\n"
+ "The HDF5 library version information are not "
+ "consistent in its source code.\nThis is NOT a fatal error "
+ "but should be corrected. Setting the environment\n"
+ "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 "
+ "will suppress\nthis warning.\n",
+ stderr);
+ HDfprintf (stderr, "Library version information are:\n"
+ "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, "
+ "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n",
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ H5_VERS_SUBRELEASE, H5_VERS_INFO);
+ } /* end if */
+ }
done:
FUNC_LEAVE_API(ret_value)