[SERVER-55474] Force large numeric literals to `long long` in BSON append calls (fix xcode build) Created: 24/Mar/21  Updated: 29/Oct/23  Resolved: 24/Mar/21

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2021-04-05
Participants:
Linked BF Score: 70

 Description   

ninja build/ninja/mongo/db/s/config/initial_split_policy_test.o:

PATH='/usr/local/bin:/opt/bin:/bin:/usr/bin' PATHOSX='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ @build/ninja/mongo/db/s/config/initial_split_policy_test.o.rsp
In file included from src/mongo/db/s/config/initial_split_policy_test.cpp:35:
In file included from src/mongo/db/s/config/config_server_test_fixture.h:32:
In file included from src/mongo/db/catalog_raii.h:33:
In file included from src/mongo/db/catalog/collection.h:43:
In file included from src/mongo/db/catalog/collection_options.h:37:
In file included from build/ninja/mongo/db/catalog/clustered_index_options_gen.h:19:
src/mongo/bson/bsonobjbuilder.h:1160:15: error: call to deleted member function 'append'
    _builder->append(_fieldName, value);
    ~~~~~~~~~~^~~~~~
src/mongo/db/s/config/initial_split_policy_test.cpp:1815:50: note: in instantiation of function template specialization 'mongo::BSONObjBuilderValueStream::operator<<<long>' requested here
        ChunkRange(BSON("y" << MINKEY), BSON("y" << -9117533237618642180)),
                                                 ^
src/mongo/bson/bsonobjbuilder.h:250:14: note: candidate function [with T = long, $1 = void, $2 = void] has been explicitly deleted
    Derived& append(StringData fieldName, const T& n) = delete;
             ^
src/mongo/bson/bsonobjbuilder.h:162:14: note: candidate function not viable: no known conversion from 'long' to 'mongo::BSONObj' for 2nd argument
    Derived& append(StringData fieldName, BSONObj subObj) {
             ^
src/mongo/bson/bsonobjbuilder.h:211:14: note: candidate function not viable: no known conversion from 'long' to 'mongo::BSONArray' for 2nd argument
    Derived& append(StringData fieldName, BSONArray arr) {
             ^
src/mongo/bson/bsonobjbuilder.h:306:14: note: candidate function not viable: no known conversion from 'long' to 'mongo::OID' for 2nd argument
    Derived& append(StringData fieldName, OID oid) {
             ^
 
etc...

These numeric literals are >32 bits wide so they are automatically `long`.
There's no BSONObjBuilder append overload for `long` anymore (this is xcode).
That's okay we can make them `long long`.



 Comments   
Comment by Githook User [ 24/Mar/21 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-55474 explicit LL suffix to fix XCode build
Branch: master
https://github.com/mongodb/mongo/commit/2675ca0d17d2d2e24d25fcea2f6c9f46ce1be2d4

Comment by Billy Donahue [ 24/Mar/21 ]

CR https://mongodbcr.appspot.com/787840003/

Generated at Thu Feb 08 05:36:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.