diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-03-24 02:13:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 02:13:57 (GMT) |
commit | 1f3f7fe3aedf3d207d7bfa1b2870e87278378ad8 (patch) | |
tree | ff48216a6dce48120aa65326316746f919b60c76 | |
parent | 69f3cde9365a1190f624586e7e9736b7b4df55f1 (diff) | |
download | hdf5-1f3f7fe3aedf3d207d7bfa1b2870e87278378ad8.zip hdf5-1f3f7fe3aedf3d207d7bfa1b2870e87278378ad8.tar.gz hdf5-1f3f7fe3aedf3d207d7bfa1b2870e87278378ad8.tar.bz2 |
Removes support for pre-2015 Visual Studio (#496)
* Committing clang-format changes
* Removes work-around code for pre-2015 Visual Studio
HDF5 no longer provides an implementation for:
* <inttypes.h>
* snprintf and vsnprintf
* llround(f), lround(f), round(f)
* strtoll and strtoull
* va_copy
* struct timespec
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
-rw-r--r-- | release_docs/RELEASE.txt | 14 | ||||
-rw-r--r-- | src/H5system.c | 75 | ||||
-rw-r--r-- | src/H5win32defs.h | 112 |
3 files changed, 21 insertions, 180 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2af0273..8b6f488 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -49,6 +49,20 @@ New Features Configuration: ------------- + - Removal of pre-VS2015 work-arounds + + HDF5 now requires Visual Studio 2015 or greater, so old work-around + code and definitions have been removed, including: + + * <inttypes.h> + * snprintf and vsnprintf + * llround, llroundf, lround, lroundf, round, roundf + * strtoll and strtoull + * va_copy + * struct timespec + + (DER - 2021/03/22) + - On macOS, Universal Binaries can now be built, allowing native execution on both Intel and Apple Silicon (ARM) based Macs. diff --git a/src/H5system.c b/src/H5system.c index 745476d..caf2fc3 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -581,32 +581,6 @@ Wgetlogin(void) return NULL; } -int -c99_snprintf(char *str, size_t size, const char *format, ...) -{ - int count; - va_list ap; - - HDva_start(ap, format); - count = c99_vsnprintf(str, size, format, ap); - HDva_end(ap); - - return count; -} - -int -c99_vsnprintf(char *str, size_t size, const char *format, va_list ap) -{ - int count = -1; - - if (size != 0) - count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); - if (count == -1) - count = _vscprintf(format, ap); - - return count; -} - /*------------------------------------------------------------------------- * Function: Wflock * @@ -659,55 +633,6 @@ Wflock(int fd, int operation) } /* end Wflock() */ /*------------------------------------------------------------------------- - * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf - * - * Purpose: Wrapper function for round functions for use with VS2012 - * and earlier. - * - * Return: The rounded value that was passed in. - * - * Programmer: Dana Robinson - * December 2016 - * - *------------------------------------------------------------------------- - */ -long long -Wllround(double arg) -{ - return (long long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5)); -} - -long long -Wllroundf(float arg) -{ - return (long long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); -} - -long -Wlround(double arg) -{ - return (long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5)); -} - -long -Wlroundf(float arg) -{ - return (long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); -} - -double -Wround(double arg) -{ - return arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5); -} - -float -Wroundf(float arg) -{ - return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); -} - -/*------------------------------------------------------------------------- * Function: H5_get_utf16_str * * Purpose: Gets a UTF-16 string from an UTF-8 (or ASCII) string. diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 9cd0afb..88911b0 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -11,66 +11,18 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Scott Wegner - * June 3, 2008 - * - * Purpose: This file is used to map HDF macros to Windows functions. This +/* Purpose: This file is used to map HDF macros to Windows functions. This * should get included H5private mappings, so as to override them. * Any macro not mapped here, however, will receive a similar mapping * inside H5private.h * */ -#ifndef H5_HAVE_INTTYPES_H -/* The following definitions should be suitable for 64-bit Windows, which is - * LLP64, and for 32-bit Windows, which is ILP32. Those are the only - * platforms where <inttypes.h> is likely to be missing. VS2015 and later - * *may* provide these definitions. - */ -#ifdef _WIN64 -#define PRIdPTR "lld" -#define PRIoPTR "llo" -#define PRIuPTR "llu" -#define PRIxPTR "llx" -#define PRIXPTR "llX" -#else /* _WIN64 */ -#define PRIdPTR "ld" -#define PRIoPTR "lo" -#define PRIuPTR "lu" -#define PRIxPTR "lx" -#define PRIXPTR "lX" -#endif /* _WIN64 */ - -#define PRId8 "d" -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRId16 "d" -#define PRIo16 "o" -#define PRIu16 "u" -#define PRIx16 "x" -#define PRIX16 "X" -#define PRId32 "d" -#define PRIo32 "o" -#define PRIu32 "u" -#define PRIx32 "x" -#define PRIX32 "X" -#define PRId64 "lld" -#define PRIo64 "llo" -#define PRIu64 "llu" -#define PRIx64 "llx" -#define PRIX64 "llX" -#define PRIdMAX "lld" -#define PRIoMAX "llo" -#define PRIuMAX "llu" -#define PRIxMAX "llx" -#define PRIXMAX "llX" -#endif -/* - * _MSC_VER = 1900 VS2015 - * _MSC_VER = 1800 VS2013 - * _MSC_VER = 1700 VS2012 +/* _MSC_VER = 192x VS2019 + * _MSC_VER = 191x VS2017 + * _MSC_VER = 1900 VS2015 + * _MSC_VER = 1800 VS2013 + * _MSC_VER = 1700 VS2012 */ #ifdef H5_HAVE_WIN32_API @@ -119,22 +71,8 @@ typedef __int64 h5_stat_size_t; #ifdef H5_HAVE_VISUAL_STUDIO -#if (_MSC_VER < 1800) -#ifndef H5_HAVE_STRTOLL -#define HDstrtoll(S, R, N) _strtoi64(S, R, N) -#endif /* H5_HAVE_STRTOLL */ -#ifndef H5_HAVE_STRTOULL -#define HDstrtoull(S, R, N) _strtoui64(S, R, N) -#endif /* H5_HAVE_STRTOULL */ -/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are - * just pointers into the stack in those CRTs, the usual work-around - * is to just define the operation as a pointer copy. - */ -#define HDva_copy(D, S) ((D) = (S)) -#endif /* MSC_VER < 1800 */ - /* - * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO + * The (void*) cast just avoids a compiler warning in MSVC */ #define HDmemset(X, C, Z) memset((void *)(X), C, Z) @@ -143,26 +81,6 @@ struct timezone { int tz_dsttime; }; -/* time.h before VS2015 does not include timespec */ -#if (_MSC_VER < 1900) -struct timespec { - time_t tv_sec; /* Seconds - >= 0 */ - long tv_nsec; /* Nanoseconds - [0, 999999999] */ -}; -#endif /* MSC_VER < 1900 */ - -#if (_MSC_VER <= 1700) -/* The isnan function needs underscore in VS2012 and earlier */ -#define HDisnan(X) _isnan(X) -/* The round functions do not exist in VS2012 and earlier */ -#define HDllround(V) Wllround(V) -#define HDllroundf(V) Wllroundf(V) -#define HDlround(V) Wlround(V) -#define HDlroundf(V) Wlroundf(V) -#define HDround(V) Wround(V) -#define HDroundf(V) Wroundf(V) -#endif /* MSC_VER < 1700 */ - #endif /* H5_HAVE_VISUAL_STUDIO */ #ifdef __cplusplus @@ -172,25 +90,11 @@ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); H5_DLL int Wsetenv(const char *name, const char *value, int overwrite); H5_DLL int Wflock(int fd, int operation); H5_DLL char * Wgetlogin(void); -H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...); -H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); H5_DLL wchar_t *H5_get_utf16_str(const char *s); H5_DLL int Wopen_utf8(const char *path, int oflag, ...); H5_DLL int Wremove_utf8(const char *path); H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); - -/* Round functions only needed for VS2012 and earlier. - * They are always built to ensure they don't go stale and - * can be deleted (along with their #defines, above) when we - * drop VS2012 support. - */ -H5_DLL long long Wllround(double arg); -H5_DLL long long Wllroundf(float arg); -H5_DLL long Wlround(double arg); -H5_DLL long Wlroundf(float arg); -H5_DLL double Wround(double arg); -H5_DLL float Wroundf(float arg); #ifdef __cplusplus } #endif /* __cplusplus */ @@ -199,8 +103,6 @@ H5_DLL float Wroundf(float arg); #define HDsetenv(N, V, O) Wsetenv(N, V, O) #define HDflock(F, L) Wflock(F, L) #define HDgetlogin() Wgetlogin() -#define HDsnprintf c99_snprintf /*varargs*/ -#define HDvsnprintf c99_vsnprintf /*varargs*/ /* Non-POSIX functions */ |