Fix C1021 fatal error when building DataSQLite with POCO_SQLITE_UNBUNDLED on MSVC - #5336
Merged
Merged
Conversation
The MSVC compiler in newer version does not support the preprocessor \#warning, instead, it should use \#pragma message. That alternative is compatible with both GCC and Clang compilers. Signed-off-by: Uilian Ries <uilianries@gmail.com>
4 tasks
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.
Hello Poco maintainers! 👋
Summary
When building Poco 1.15.2 on Conan via PR conan-io/conan-center-index#29722, a new compilation error came when building on Windows with MSVC and
POCO_UNBUNDLED=ON:Full build log: https://c3i.jfrog.io/artifactory/cci-build-logs/cci/prod/PR-29722/6/package_build_logs/build_log_poco_1_15_2_0adc2f8480994b99f01861be3ca8abd7_7c1918cef109f6ba5d4f8f80693ced80922aa350.txt
Note that it was not seen for version 1.14.2, which is distributed/built by Conan. It could be related to #4996, as we started to see it after 1.15.z only.
Cause of the Problem
MSVC does not support the
#warningpreprocessor directive (it is a GCC/Clang extension). When building with-DPOCO_SQLITE_UNBUNDLEDon Windows, the compiler emits a fatal error:References:
Proposed Fix
#pragma message(...)is supported by MSVC, GCC, and Clang, making it a portable drop-in replacement. The message text is preserved, prefixed withWARNING:to retain its intent.I applied the proposed patch on Conan side, so we can validate it on the CI as well:
Affected configuration
-DPOCO_SQLITE_UNBUNDLED