Fix sprintf issue on MacOS for non-XCode compilers #1510
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.
@chriskohlhoff @klemens-morgenstern
This should fix the sprintf issue on MacOS for good, in particular if XCode is not used but e.g. clang from brew (see #1148 for discussion).
The issue is the check of
ASIO_HAS_SNPRINTF
here:asio/asio/include/asio/detail/config.hpp
Lines 1411 to 1420 in 54e3a84
It only checks if
__apple_build_version__
is defined, however this variable isn't set when using non-XCode compilers on MacOS. Sincesnprintf
is available in MacOS since version 10.0, which was released in March 2001, is think the best option is to always setASIO_HAS_SNPRINTF
if__APPLE__
is detected.Note that is also fixes a missing instance where
sprintf_s
can be used via Microsoft RTL.Closes #1148 closes #1449 closes #1183