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

fix HDF5Reader build with MSVC #1577

Merged
merged 3 commits into from
Jun 30, 2019
Merged

Conversation

germasch
Copy link
Contributor

Sadly, variable-sized stack arrays are only a feature of C99, but not C++11,
so this patch uses std::vector instead.

This fixes #1485, the second issue there, at least hopefully so -- @ax3l, could you test this one, too, as I don't think the adios2 CI covers this case. (I changed the place identified by the error message from your report, and one more place with the same issue, but there may be more).

@chuckatkins, I haven't checked, but my guess is that the MSVC CI doesn't build ADIOS2 with HDF5, otherwise I would have expected to see this problem earlier. So that may be something for the future todo list.

@germasch germasch changed the base branch from master to release June 29, 2019 19:20
@germasch
Copy link
Contributor Author

@pnorbert, changed the base to release here, too. Same thing, though.

@germasch
Copy link
Contributor Author

Though, for this PR, it'd be good to hear back from @ax3l as to whether it really fixes the hdf5 engine build troubles he was seeing with MSVC, as I couldn't do that testing (and I think the adios2 CI doesn't, either.)

I'm pretty sure that it fixes the one particular error he posted, and I found one more similar occasion, but there may be issues beyond that.

Copy link
Contributor

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget the #include <vector> additions for this change :)

@ax3l
Copy link
Contributor

ax3l commented Jun 29, 2019

Ok, there is a little bit more in the HDF5 files that we need to address: https://ci.appveyor.com/project/conda-forge/staged-recipes/builds/25636465

%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(192): error C2065: 'uint': undeclared identifier
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(192): error C2146: syntax error: missing ';' before identifier 'totalAdiosSteps'
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(192): error C2065: 'totalAdiosSteps': undeclared identifier
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(196): error C2065: 'totalAdiosSteps': undeclared identifier
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(199): error C2065: 'totalAdiosSteps': undeclared identifier
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(230): warning C4244: '=': conversion from 'hsize_t' to 'unsigned int', possible loss of data
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(257): warning C4018: '<': signed/unsigned mismatch
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(281): warning C4244: '=': conversion from 'ssize_t' to 'herr_t', possible loss of data
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(298): error C2131: expression did not evaluate to a constant
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(298): note: failure was caused by non-constant arguments or reference to a non-constant symbol
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(298): note: see usage of 'heritage'
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(300): error C2131: expression did not evaluate to a constant
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(298): note: failure was caused by non-constant arguments or reference to a non-constant symbol
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(298): note: see usage of 'heritage'
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(381): warning C4244: '=': conversion from 'ssize_t' to 'herr_t', possible loss of data
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(596): warning C4018: '>=': signed/unsigned mismatch
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1038): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1130): warning C4018: '<': signed/unsigned mismatch
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1251): error C2131: expression did not evaluate to a constant
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1251): note: failure was caused by non-constant arguments or reference to a non-constant symbol
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1251): note: see usage of 'MAX_ATTR_NAME_SIZE'
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1309): error C2131: expression did not evaluate to a constant
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1309): note: failure was caused by non-constant arguments or reference to a non-constant symbol
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(1309): note: see usage of 'MAX_ATTR_NAME_SIZE'

@ax3l
Copy link
Contributor

ax3l commented Jun 30, 2019

Urgh, sorry I am of so little help. This fixed a lot again.

Here we go with two more: https://ci.appveyor.com/project/conda-forge/staged-recipes/builds/25641834

%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(936): error C2131: expression did not evaluate to a constant

%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(938): error C2664: 'adios2::core::Attribute<T[arraySize]> &adios2::core::IO::DefineAttribute<T[arraySize]>(const std::string &,const signed char (&)[arraySize],const std::string &,const std::string)': cannot convert argument 3 from 'hsize_t' to 'const std::string &'
        with
        [
            T=int8_t
        ]
%SRC_DIR%\source\adios2\toolkit\interop\hdf5\HDF5Common.cpp(938): note: Reason: cannot convert from 'hsize_t' to 'const std::string'

Sadly, variable-sized stack arrays are only a feature of C99, but not C++11,
so this patch uses std::vector instead.
including use of `uint` and more stack-allocated arrays
@germasch
Copy link
Contributor Author

Rebased onto latest release, and fixed more variable length arrays -- should have gotten all this time via -Werror=vla.

I should note that I'm doing these patches kinda in a rush, and sometimes not exactly sober, in between things like putting on a tuxedo and top hat to walk through 35 centigrade weather (maybe some Germans here understand...) Anyway, it certainly wouldn't be a bad idea to give these patches a good second look.

Copy link
Contributor

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't forget to #include <vector> in all of these files :-)

I should have gotten them all now via `-Werror=vla` (with clang)
@germasch
Copy link
Contributor Author

Please don't forget to #include <vector> in all of these files :-)

I'm pretty sure I did do all those includes this time ;)

I just force-pushed to re-run he AppVeyor CI, which I think hit just a random hiccup.

Copy link
Contributor

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and fixes the compile issues with MSVC! :)
Thanks a lot!

@williamfgc
Copy link
Contributor

williamfgc commented Jun 30, 2019

merging this PR (finally went through the CI) instead of #1587

@williamfgc williamfgc merged commit f3d18dd into ornladios:release Jun 30, 2019
chuckatkins pushed a commit to chuckatkins/ADIOS2 that referenced this pull request Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants