fix: make the public headers compile with MSVC - #252
Open
cruzzil wants to merge 1 commit into
Open
Conversation
Use ptrdiff_t instead of the POSIX-only ssize_t for the max_depth parameter of asdf_value_find_ex and asdf_find_iter_init_ex, and build the option flag bitmasks with 1ULL instead of 1UL, which overflows where unsigned long is 32 bits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #251.
asdf_value_find_exandasdf_find_iter_init_extakemax_depthasptrdiff_tinstead of the POSIX-onlyssize_t, which MSVC's CRT does not define.<sys/types.h>was included inasdf/value.honly for that type, so it is dropped; no other public header uses it.asdf/emitter.h,asdf/parser.handasdf/log.huse1ULLinstead of1UL. This is not only a Windows issue: on any LLP64 targetunsigned longis 32 bits, soASDF_EMITTER_OPT_LAST = 1UL << 62is undefined behaviour, and the accompanying1UL << 63static assertion has never tested what it reads as there.No ABI change:
ptrdiff_tandssize_tare the same pointer-sized signed integer on every platform libasdf currently supports.Built and ran the test suite on Linux/gcc; all tests pass.