-
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eae9c12
Format bson-atomic.c
eramongodb 5b0dbb3
Remove test suite signal handlers for C90 compatibility
eramongodb 9f9f48b
Replace snprintf with bson_snprintf
eramongodb 77bbfee
Address missing _InterlockedExchangePointer on x86 with VS 2013
eramongodb 7af0dbe
Fix typos in comments
eramongodb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. I keep mistakening "Interlocked" as "Intrinsic". Will fix. 😑 |
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900 && defined(_M_IX86) | ||||||
#define BSON_EMULATE_PTR | ||||||
#endif | ||||||
|
||||||
#define DEF_ATOMIC_OP( \ | ||||||
MSVC_Intrinsic, GNU_Intrinsic, GNU_Legacy_Intrinsic, Order, ...) \ | ||||||
do { \ | ||||||
|
@@ -433,6 +439,11 @@ _bson_emul_atomic_int_compare_exchange_weak (int volatile *val, | |||||
int new_value, | ||||||
enum bson_memory_order); | ||||||
|
||||||
BSON_EXPORT (void *) | ||||||
_bson_emul_atomic_ptr_exchange (void *volatile *val, | ||||||
void *v, | ||||||
enum bson_memory_order); | ||||||
|
||||||
BSON_EXPORT (void) | ||||||
bson_thrd_yield (void); | ||||||
|
||||||
|
@@ -608,8 +619,10 @@ bson_atomic_ptr_exchange (void *volatile *ptr, | |||||
void *new_value, | ||||||
enum bson_memory_order ord) | ||||||
{ | ||||||
#if defined(BSON_EMULATE_PTR) | ||||||
return _bson_emul_atomic_ptr_exchange (ptr, new_value, ord); | ||||||
#elif defined(BSON_USE_LEGACY_GCC_ATOMICS) | ||||||
/* The older __sync_val_compare_and_swap also takes oldval */ | ||||||
#if defined(BSON_USE_LEGACY_GCC_ATOMICS) | ||||||
DEF_ATOMIC_OP (_InterlockedExchangePointer, | ||||||
, | ||||||
__sync_val_compare_and_swap, | ||||||
|
@@ -750,6 +763,8 @@ BSON_EXPORT (int32_t) bson_atomic_int_add (volatile int32_t *p, int32_t n); | |||||
BSON_GNUC_DEPRECATED_FOR ("bson_atomic_int64_fetch_add") | ||||||
BSON_EXPORT (int64_t) bson_atomic_int64_add (volatile int64_t *p, int64_t n); | ||||||
|
||||||
|
||||||
#undef BSON_EMULATE_PTR | ||||||
#undef BSON_EMULATE_INT32 | ||||||
#undef BSON_EMULATE_INT | ||||||
|
||||||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,6 @@ | |
#include "test-libmongoc.h" | ||
#include "test-conveniences.h" | ||
|
||
#ifdef _WIN32 | ||
#define snprintf _snprintf | ||
#endif | ||
|
||
static void | ||
test_mongoc_uri_new (void) | ||
{ | ||
|
@@ -1579,7 +1575,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_t *uri; | ||
bson_error_t err; | ||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://CN=client,OU=kerneluser,O=10Gen,L=New York City," | ||
"ST=New York,[email protected]/?" | ||
|
@@ -1617,7 +1613,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true&%s=key.pem&%s=ca.pem", | ||
tls, | ||
|
@@ -1650,7 +1646,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf ( | ||
bson_snprintf ( | ||
url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=true", tls); | ||
uri = mongoc_uri_new (url_buffer); | ||
|
||
|
@@ -1670,7 +1666,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true&%s=pa$$word!&%s=encrypted.pem", | ||
tls, | ||
|
@@ -1703,7 +1699,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true&%s=true", | ||
tls, | ||
|
@@ -1730,7 +1726,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=foo.pem", | ||
tlsCertificateKeyFile); | ||
|
@@ -1740,7 +1736,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=foo.pem", | ||
tlsCAFile); | ||
|
@@ -1750,7 +1746,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true", | ||
tlsAllowInvalidCertificates); | ||
|
@@ -1764,7 +1760,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true", | ||
tlsAllowInvalidHostnames); | ||
|
@@ -1778,7 +1774,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=false&%s=foo.pem", | ||
tls, | ||
|
@@ -1789,7 +1785,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=false&%s=foo.pem", | ||
tls, | ||
|
@@ -1800,7 +1796,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=false&%s=true", | ||
tls, | ||
|
@@ -1815,7 +1811,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
mongoc_uri_destroy (uri); | ||
|
||
|
||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=false&%s=false", | ||
tls, | ||
|
@@ -1837,7 +1833,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
|
||
/* Mixing options okay so long as they match */ | ||
capture_logs (true); | ||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true&%s=true", | ||
tls, | ||
|
@@ -1849,7 +1845,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
|
||
/* Same option with different values okay, latter overrides */ | ||
capture_logs (true); | ||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true&%s=false", | ||
tls, | ||
|
@@ -1869,7 +1865,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
|
||
/* Mixing options not okay if values differ */ | ||
capture_logs (false); | ||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb://localhost/?%s=true&%s=false", | ||
tls, | ||
|
@@ -1892,7 +1888,7 @@ test_mongoc_uri_tls_ssl (const char *tls, | |
|
||
/* No conflict appears with implicit tls=true via SRV */ | ||
capture_logs (false); | ||
snprintf (url_buffer, | ||
bson_snprintf (url_buffer, | ||
sizeof (url_buffer), | ||
"mongodb+srv://a.b.c/?%s=foo.pem", | ||
tlsCAFile); | ||
|
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.
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.