Skip to content

Commit 1f3f7fe

Browse files
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>
1 parent 69f3cde commit 1f3f7fe

File tree

3 files changed

+21
-180
lines changed

3 files changed

+21
-180
lines changed

release_docs/RELEASE.txt

+14
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ New Features
4949

5050
Configuration:
5151
-------------
52+
- Removal of pre-VS2015 work-arounds
53+
54+
HDF5 now requires Visual Studio 2015 or greater, so old work-around
55+
code and definitions have been removed, including:
56+
57+
* <inttypes.h>
58+
* snprintf and vsnprintf
59+
* llround, llroundf, lround, lroundf, round, roundf
60+
* strtoll and strtoull
61+
* va_copy
62+
* struct timespec
63+
64+
(DER - 2021/03/22)
65+
5266
- On macOS, Universal Binaries can now be built, allowing native execution on
5367
both Intel and Apple Silicon (ARM) based Macs.
5468

src/H5system.c

-75
Original file line numberDiff line numberDiff line change
@@ -581,32 +581,6 @@ Wgetlogin(void)
581581
return NULL;
582582
}
583583

584-
int
585-
c99_snprintf(char *str, size_t size, const char *format, ...)
586-
{
587-
int count;
588-
va_list ap;
589-
590-
HDva_start(ap, format);
591-
count = c99_vsnprintf(str, size, format, ap);
592-
HDva_end(ap);
593-
594-
return count;
595-
}
596-
597-
int
598-
c99_vsnprintf(char *str, size_t size, const char *format, va_list ap)
599-
{
600-
int count = -1;
601-
602-
if (size != 0)
603-
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
604-
if (count == -1)
605-
count = _vscprintf(format, ap);
606-
607-
return count;
608-
}
609-
610584
/*-------------------------------------------------------------------------
611585
* Function: Wflock
612586
*
@@ -658,55 +632,6 @@ Wflock(int fd, int operation)
658632
return 0;
659633
} /* end Wflock() */
660634

661-
/*-------------------------------------------------------------------------
662-
* Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf
663-
*
664-
* Purpose: Wrapper function for round functions for use with VS2012
665-
* and earlier.
666-
*
667-
* Return: The rounded value that was passed in.
668-
*
669-
* Programmer: Dana Robinson
670-
* December 2016
671-
*
672-
*-------------------------------------------------------------------------
673-
*/
674-
long long
675-
Wllround(double arg)
676-
{
677-
return (long long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
678-
}
679-
680-
long long
681-
Wllroundf(float arg)
682-
{
683-
return (long long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
684-
}
685-
686-
long
687-
Wlround(double arg)
688-
{
689-
return (long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
690-
}
691-
692-
long
693-
Wlroundf(float arg)
694-
{
695-
return (long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
696-
}
697-
698-
double
699-
Wround(double arg)
700-
{
701-
return arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5);
702-
}
703-
704-
float
705-
Wroundf(float arg)
706-
{
707-
return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
708-
}
709-
710635
/*-------------------------------------------------------------------------
711636
* Function: H5_get_utf16_str
712637
*

src/H5win32defs.h

+7-105
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,18 @@
1111
* help@hdfgroup.org. *
1212
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1313

14-
/* Programmer: Scott Wegner
15-
* June 3, 2008
16-
*
17-
* Purpose: This file is used to map HDF macros to Windows functions. This
14+
/* Purpose: This file is used to map HDF macros to Windows functions. This
1815
* should get included H5private mappings, so as to override them.
1916
* Any macro not mapped here, however, will receive a similar mapping
2017
* inside H5private.h
2118
*
2219
*/
23-
#ifndef H5_HAVE_INTTYPES_H
24-
/* The following definitions should be suitable for 64-bit Windows, which is
25-
* LLP64, and for 32-bit Windows, which is ILP32. Those are the only
26-
* platforms where <inttypes.h> is likely to be missing. VS2015 and later
27-
* *may* provide these definitions.
28-
*/
29-
#ifdef _WIN64
30-
#define PRIdPTR "lld"
31-
#define PRIoPTR "llo"
32-
#define PRIuPTR "llu"
33-
#define PRIxPTR "llx"
34-
#define PRIXPTR "llX"
35-
#else /* _WIN64 */
36-
#define PRIdPTR "ld"
37-
#define PRIoPTR "lo"
38-
#define PRIuPTR "lu"
39-
#define PRIxPTR "lx"
40-
#define PRIXPTR "lX"
41-
#endif /* _WIN64 */
42-
43-
#define PRId8 "d"
44-
#define PRIo8 "o"
45-
#define PRIu8 "u"
46-
#define PRIx8 "x"
47-
#define PRIX8 "X"
48-
#define PRId16 "d"
49-
#define PRIo16 "o"
50-
#define PRIu16 "u"
51-
#define PRIx16 "x"
52-
#define PRIX16 "X"
53-
#define PRId32 "d"
54-
#define PRIo32 "o"
55-
#define PRIu32 "u"
56-
#define PRIx32 "x"
57-
#define PRIX32 "X"
58-
#define PRId64 "lld"
59-
#define PRIo64 "llo"
60-
#define PRIu64 "llu"
61-
#define PRIx64 "llx"
62-
#define PRIX64 "llX"
63-
#define PRIdMAX "lld"
64-
#define PRIoMAX "llo"
65-
#define PRIuMAX "llu"
66-
#define PRIxMAX "llx"
67-
#define PRIXMAX "llX"
68-
#endif
6920

70-
/*
71-
* _MSC_VER = 1900 VS2015
72-
* _MSC_VER = 1800 VS2013
73-
* _MSC_VER = 1700 VS2012
21+
/* _MSC_VER = 192x VS2019
22+
* _MSC_VER = 191x VS2017
23+
* _MSC_VER = 1900 VS2015
24+
* _MSC_VER = 1800 VS2013
25+
* _MSC_VER = 1700 VS2012
7426
*/
7527
#ifdef H5_HAVE_WIN32_API
7628

@@ -119,22 +71,8 @@ typedef __int64 h5_stat_size_t;
11971

12072
#ifdef H5_HAVE_VISUAL_STUDIO
12173

122-
#if (_MSC_VER < 1800)
123-
#ifndef H5_HAVE_STRTOLL
124-
#define HDstrtoll(S, R, N) _strtoi64(S, R, N)
125-
#endif /* H5_HAVE_STRTOLL */
126-
#ifndef H5_HAVE_STRTOULL
127-
#define HDstrtoull(S, R, N) _strtoui64(S, R, N)
128-
#endif /* H5_HAVE_STRTOULL */
129-
/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are
130-
* just pointers into the stack in those CRTs, the usual work-around
131-
* is to just define the operation as a pointer copy.
132-
*/
133-
#define HDva_copy(D, S) ((D) = (S))
134-
#endif /* MSC_VER < 1800 */
135-
13674
/*
137-
* The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
75+
* The (void*) cast just avoids a compiler warning in MSVC
13876
*/
13977
#define HDmemset(X, C, Z) memset((void *)(X), C, Z)
14078

@@ -143,26 +81,6 @@ struct timezone {
14381
int tz_dsttime;
14482
};
14583

146-
/* time.h before VS2015 does not include timespec */
147-
#if (_MSC_VER < 1900)
148-
struct timespec {
149-
time_t tv_sec; /* Seconds - >= 0 */
150-
long tv_nsec; /* Nanoseconds - [0, 999999999] */
151-
};
152-
#endif /* MSC_VER < 1900 */
153-
154-
#if (_MSC_VER <= 1700)
155-
/* The isnan function needs underscore in VS2012 and earlier */
156-
#define HDisnan(X) _isnan(X)
157-
/* The round functions do not exist in VS2012 and earlier */
158-
#define HDllround(V) Wllround(V)
159-
#define HDllroundf(V) Wllroundf(V)
160-
#define HDlround(V) Wlround(V)
161-
#define HDlroundf(V) Wlroundf(V)
162-
#define HDround(V) Wround(V)
163-
#define HDroundf(V) Wroundf(V)
164-
#endif /* MSC_VER < 1700 */
165-
16684
#endif /* H5_HAVE_VISUAL_STUDIO */
16785

16886
#ifdef __cplusplus
@@ -172,25 +90,11 @@ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
17290
H5_DLL int Wsetenv(const char *name, const char *value, int overwrite);
17391
H5_DLL int Wflock(int fd, int operation);
17492
H5_DLL char * Wgetlogin(void);
175-
H5_DLL int c99_snprintf(char *str, size_t size, const char *format, ...);
176-
H5_DLL int c99_vsnprintf(char *str, size_t size, const char *format, va_list ap);
17793
H5_DLL herr_t H5_expand_windows_env_vars(char **env_var);
17894
H5_DLL wchar_t *H5_get_utf16_str(const char *s);
17995
H5_DLL int Wopen_utf8(const char *path, int oflag, ...);
18096
H5_DLL int Wremove_utf8(const char *path);
18197
H5_DLL int H5_get_win32_times(H5_timevals_t *tvs);
182-
183-
/* Round functions only needed for VS2012 and earlier.
184-
* They are always built to ensure they don't go stale and
185-
* can be deleted (along with their #defines, above) when we
186-
* drop VS2012 support.
187-
*/
188-
H5_DLL long long Wllround(double arg);
189-
H5_DLL long long Wllroundf(float arg);
190-
H5_DLL long Wlround(double arg);
191-
H5_DLL long Wlroundf(float arg);
192-
H5_DLL double Wround(double arg);
193-
H5_DLL float Wroundf(float arg);
19498
#ifdef __cplusplus
19599
}
196100
#endif /* __cplusplus */
@@ -199,8 +103,6 @@ H5_DLL float Wroundf(float arg);
199103
#define HDsetenv(N, V, O) Wsetenv(N, V, O)
200104
#define HDflock(F, L) Wflock(F, L)
201105
#define HDgetlogin() Wgetlogin()
202-
#define HDsnprintf c99_snprintf /*varargs*/
203-
#define HDvsnprintf c99_vsnprintf /*varargs*/
204106

205107
/* Non-POSIX functions */
206108

0 commit comments

Comments
 (0)