Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the new MSVC preprocessor #4078

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ New Features

Configuration:
-------------
- Added support for the new MSVC preprocessor

Microsoft added support for a new, standards-conformant preprocessor
to MSVC, which can be enabled with the /Zc:preprocessor option. This
preprocessor would trip over our HDopen() variadic function-like
macro, which uses a feature that only works with the legacy preprocessor.

ifdefs have been added that select the correct HDopen() form and
allow building HDF5 with the /Zc:preprocessor option.

The HDopen() macro is located in an internal header file and only
affects building the HDF5 library from source.

Fixes GitHub #2515

- Renamed HDF5_ENABLE_USING_MEMCHECKER to HDF5_USING_ANALYSIS_TOOL

The HDF5_USING_ANALYSIS_TOOL is used to indicate to test macros that
Expand Down
12 changes: 9 additions & 3 deletions src/H5win32defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ struct timezone {
#define HDlstat(S, B) _lstati64(S, B)
#define HDmkdir(S, M) _mkdir(S)

/* Note that the variadic HDopen macro is using a VC++ extension
* where the comma is dropped if nothing is passed to the ellipsis.
/* Note that with the traditional MSVC preprocessor, the variadic
* HDopen macro uses an MSVC-specific extension where the comma
* is dropped if nothing is passed to the ellipsis.
*
* MinGW and the newer, conforming MSVC preprocessor do not exhibit this
* behavior.
*/
#ifndef H5_HAVE_MINGW
#if (defined(_MSC_VER) && !defined(_MSVC_TRADITIONAL)) || _MSVC_TRADITIONAL
/* Using the MSVC traditional preprocessor */
#define HDopen(S, F, ...) Wopen_utf8(S, F, __VA_ARGS__)
#else
/* Using a standards conformant preprocessor */
#define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__)
#endif

Expand Down
Loading