[CXX-1248] Document that Windows users should build libbson without extra alignment Created: 08/Mar/17  Updated: 09/Dec/22  Resolved: 12/Apr/21

Status: Closed
Project: C++ Driver
Component/s: Documentation
Affects Version/s: 3.1.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Daniel Lyubomirov Assignee: Benji Rewis (Inactive)
Resolution: Done Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows, Visual Studio 14 2015


Epic Link: CXX ABI
Quarter: FY24Q1

 Description   

Compiling the driver under Windows with Visual Studio 14 2015 produces the following warning

mongo-cxx-driver-r3.1.1\src\bsoncxx\builder\core.cpp(199): warning C4316: 'bsoncxx::v_noabi::builder::core::impl': object allocated on the heap may not be aligned 128



 Comments   
Comment by Githook User [ 12/Apr/21 ]

Author:

{'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}

Message: CXX-1248 Document disabling extra alignment on windows (#777)
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/142c5e39766cb0f5515d55f37b95acb20ca790e2

Comment by Benji Rewis (Inactive) [ 02/Apr/21 ]

new PR: https://github.com/mongodb/mongo-cxx-driver/pull/777

Comment by J Rassi [ 14/Apr/17 ]

Link to MSDN documentation for C4316: https://msdn.microsoft.com/en-us/library/dn448573.aspx

Comment by J Rassi [ 09/Mar/17 ]

daniel.lyubomirov, thanks for reporting this issue. I can confirm that this warning reproduces on our VS2015 builds in our continuous integration system, and am moving this ticket to the triaged state. We've scheduled time in the next two months to go through all of our VS2015 warnings (and warnings on other compilers, too) and file tickets for them as part of scoping the work for related ticket CXX-936, so we appreciate your help with reporting this one.

To fix this, we should ensure that any class that has a bson_t as a member (which is declared with __declspec(align(...)) when building with Visual Studio, and with __attribute__((aligned(...)) when building elsewhere) is overriding operator new and operator delete, so as to ensure that instances of those classes are correctly aligned when they are heap-allocated. Alternatively, we could ask the C driver team if they'd consider removing this alignment requirement for bson_t.

Generated at Wed Feb 07 22:01:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.