-
Notifications
You must be signed in to change notification settings - Fork 455
CDRIVER-4264 Address build failures on VS 2013 variants on Evergreen #932
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do we not have VS 2013 set as a default build task?
It appears not. A patch build verifying these changes (with minor discrepancies in the diff compared to this PR) are available here for reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/libbson/src/bson/bson-atomic.c
Outdated
@@ -48,7 +48,7 @@ bson_memory_barrier (void) | |||
} | |||
|
|||
/** | |||
* Some platforms do not support compiler intrinsics for atomic operations. | |||
* Some platforms do not support compiler ics for atomic operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Thank you for the catch.
src/libbson/src/bson/bson-atomic.h
Outdated
@@ -73,6 +73,12 @@ enum bson_memory_order { | |||
#define BSON_EMULATE_INT | |||
#endif | |||
|
|||
/* CDRIVER-4264 Contrary to documentation, VS 2013 targeting x86 does not | |||
* correctly/consistently provide _IntrinsicPointerExchange. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* correctly/consistently provide _IntrinsicPointerExchange. */ | |
* correctly/consistently provide _InterlockedExchangePointer. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I keep mistakening "Interlocked" as "Intrinsic". Will fix. 😑
Per CDRIVER-4264, there are three compilation errors preventing successful compilation on VS 2013 variants. This PR addresses each of these warnings:
'_Exit' undefined; assuming extern returning int
VS 2013 only provides partial support for the C99 standard. This support apparently does not extend to providing the
_Exit
function, which is a C99 feature. Given that its use in the test suite (to report the type of signal triggering failure) is not strictly necessary, I have opted for its removal.'snprintf' undefined; assuming extern returning int
snprintf
is also a C99 feature. Some files in libmongoc were directly invokingsnprintf
despite libbson providingbson_snprintf
to address standard / platform compatibility issues. These instances were substituted withbson_snprintf
.'_InterlockedExchangePointer': identifier not found
This issue only manifested when building with VS 2013 targeting x86 (i686). I do not yet fully understand the reason behind this issue. According to a Boost patch (note, "MSVC-12" == "VS 2013") in response to a report of similar build failures, the issue is apparently due to a conflict between the
<intrin.h>
and<winnt.h>
libraries when targeting x86 with VS 2013. This is in spite of Microsoft documentation indicating support for the intrinsic when targeting x86. Consequently, I have opted to emulating the intrinsic given VS 2013 and x86.