Skip to content

Commit a0c60da

Browse files
committed
SERVER-23520 Add a C++14 canary builder
1 parent a5fd476 commit a0c60da

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

SConstruct

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,12 @@ add_option("experimental-decimal-support",
445445
nargs='?',
446446
)
447447

448+
add_option("cxx-std",
449+
choices=["11", "14"],
450+
default="11",
451+
help="Select the C++ langauge standard to build with",
452+
)
453+
448454
def find_mongo_custom_variables():
449455
files = []
450456
for path in sys.path:
@@ -1854,13 +1860,17 @@ def doConfigure(myenv):
18541860
conf.Finish()
18551861

18561862
if not myenv.ToolchainIs('msvc'):
1857-
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++11'):
1858-
myenv.ConfError('Compiler does not honor -std=c++11')
1863+
if get_option('cxx-std') == "11":
1864+
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++11'):
1865+
myenv.ConfError('Compiler does not honor -std=c++11')
1866+
elif get_option('cxx-std') == "14":
1867+
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++14'):
1868+
myenv.ConfError('Compiler does not honor -std=c++14')
18591869
if not AddToCFLAGSIfSupported(myenv, '-std=c99'):
18601870
myenv.ConfError("C++11 mode selected for C++ files, but can't enable C99 for C files")
18611871

18621872
if using_system_version_of_cxx_libraries():
1863-
print( 'WARNING: System versions of C++ libraries must be compiled with C++11 support' )
1873+
print( 'WARNING: System versions of C++ libraries must be compiled with C++11/14 support' )
18641874

18651875
# We appear to have C++11, or at least a flag to enable it. Check that the declared C++
18661876
# language level is not less than C++11, and that we can at least compile an 'auto'
@@ -1883,13 +1893,35 @@ def doConfigure(myenv):
18831893
context.Result(ret)
18841894
return ret
18851895

1896+
def CheckCxx14(context):
1897+
test_body = """
1898+
#ifndef _MSC_VER
1899+
#if __cplusplus < 201402L
1900+
#error
1901+
#endif
1902+
#endif
1903+
auto DeducedReturnTypesAreACXX14Feature() {
1904+
return 0;
1905+
}
1906+
"""
1907+
1908+
context.Message('Checking for C++14... ')
1909+
ret = context.TryCompile(textwrap.dedent(test_body), ".cpp")
1910+
context.Result(ret)
1911+
return ret
1912+
18861913
conf = Configure(myenv, help=False, custom_tests = {
18871914
'CheckCxx11' : CheckCxx11,
1915+
'CheckCxx14' : CheckCxx14,
18881916
})
18891917

18901918
if not conf.CheckCxx11():
18911919
myenv.ConfError('C++11 support is required to build MongoDB')
18921920

1921+
if get_option('cxx-std') == "14":
1922+
if not conf.CheckCxx14():
1923+
myenv.ConfError('C++14 does not appear to work with the current toolchain')
1924+
18931925
conf.Finish()
18941926

18951927
def CheckMemset_s(context):

etc/evergreen.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6030,8 +6030,8 @@ buildvariants:
60306030
distros:
60316031
- ubuntu1404-build
60326032

6033-
- name: enterprise-rhel-62-gcc-530
6034-
display_name: ~ Enterprise RHEL 6.2 GCC 5.3.0
6033+
- name: enterprise-debug-rhel-62-cxx14
6034+
display_name: ~ Enterprise RHEL 6.2 C++14 DEBUG
60356035
modules:
60366036
- enterprise
60376037
run_on:
@@ -6041,7 +6041,7 @@ buildvariants:
60416041
gorootvars: GOROOT=/opt/go PATH="/opt/go/bin:$PATH"
60426042
tooltags: "-tags 'ssl sasl'"
60436043
rlp_environment: MONGOD_UNITTEST_RLP_LANGUAGE_TEST_BTROOT=/opt/basis
6044-
compile_flags: --ssl MONGO_DISTMOD=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/v2/bin/gcc CXX=/opt/mongodbtoolchain/v2/bin/g++ CPPPATH="/opt/basis/rlp/rlp/include /opt/basis/rlp/utilities/include" --use-basis-tech-rosette-linguistics-platform=on
6044+
compile_flags: --allocator=system --ssl -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/v2/bin/gcc CXX=/opt/mongodbtoolchain/v2/bin/g++ CPPPATH="/opt/basis/rlp/rlp/include /opt/basis/rlp/utilities/include" --use-basis-tech-rosette-linguistics-platform=on --cxx-std=14
60456045
num_jobs_available: $(grep -c ^processor /proc/cpuinfo)
60466046
tasks:
60476047
- name: compile

src/mongo/client/fetcher_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ TEST_F(FetcherTest, SetNextActionToContinueWhenNextBatchIsNotAvailable) {
504504
Fetcher::NextAction* nextAction,
505505
BSONObjBuilder* getMoreBob) {
506506
ASSERT_OK(fetchResult.getStatus());
507-
Fetcher::QueryResponse batchData{fetchResult.getValue()};
507+
Fetcher::QueryResponse batchData = fetchResult.getValue();
508508

509509
ASSERT(nextAction);
510510
*nextAction = Fetcher::NextAction::kGetMore;
@@ -856,7 +856,7 @@ void shutdownDuringSecondBatch(const StatusWith<Fetcher::QueryResponse>& fetchRe
856856

857857
// First time during second batch
858858
ASSERT_OK(fetchResult.getStatus());
859-
Fetcher::QueryResponse batchData{fetchResult.getValue()};
859+
Fetcher::QueryResponse batchData = fetchResult.getValue();
860860
ASSERT_EQUALS(1U, batchData.documents.size());
861861
ASSERT_EQUALS(doc2, batchData.documents.front());
862862
ASSERT_TRUE(Fetcher::NextAction::kGetMore == *nextAction);

0 commit comments

Comments
 (0)