0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-23520 Add a C++14 canary builder

This commit is contained in:
Andrew Morrow 2016-04-18 15:12:34 -04:00
parent a5fd4769aa
commit a0c60da293
3 changed files with 40 additions and 8 deletions

View File

@ -445,6 +445,12 @@ add_option("experimental-decimal-support",
nargs='?',
)
add_option("cxx-std",
choices=["11", "14"],
default="11",
help="Select the C++ langauge standard to build with",
)
def find_mongo_custom_variables():
files = []
for path in sys.path:
@ -1854,13 +1860,17 @@ def doConfigure(myenv):
conf.Finish()
if not myenv.ToolchainIs('msvc'):
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++11'):
myenv.ConfError('Compiler does not honor -std=c++11')
if get_option('cxx-std') == "11":
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++11'):
myenv.ConfError('Compiler does not honor -std=c++11')
elif get_option('cxx-std') == "14":
if not AddToCXXFLAGSIfSupported(myenv, '-std=c++14'):
myenv.ConfError('Compiler does not honor -std=c++14')
if not AddToCFLAGSIfSupported(myenv, '-std=c99'):
myenv.ConfError("C++11 mode selected for C++ files, but can't enable C99 for C files")
if using_system_version_of_cxx_libraries():
print( 'WARNING: System versions of C++ libraries must be compiled with C++11 support' )
print( 'WARNING: System versions of C++ libraries must be compiled with C++11/14 support' )
# We appear to have C++11, or at least a flag to enable it. Check that the declared C++
# language level is not less than C++11, and that we can at least compile an 'auto'
@ -1883,13 +1893,35 @@ def doConfigure(myenv):
context.Result(ret)
return ret
def CheckCxx14(context):
test_body = """
#ifndef _MSC_VER
#if __cplusplus < 201402L
#error
#endif
#endif
auto DeducedReturnTypesAreACXX14Feature() {
return 0;
}
"""
context.Message('Checking for C++14... ')
ret = context.TryCompile(textwrap.dedent(test_body), ".cpp")
context.Result(ret)
return ret
conf = Configure(myenv, help=False, custom_tests = {
'CheckCxx11' : CheckCxx11,
'CheckCxx14' : CheckCxx14,
})
if not conf.CheckCxx11():
myenv.ConfError('C++11 support is required to build MongoDB')
if get_option('cxx-std') == "14":
if not conf.CheckCxx14():
myenv.ConfError('C++14 does not appear to work with the current toolchain')
conf.Finish()
def CheckMemset_s(context):

View File

@ -6030,8 +6030,8 @@ buildvariants:
distros:
- ubuntu1404-build
- name: enterprise-rhel-62-gcc-530
display_name: ~ Enterprise RHEL 6.2 GCC 5.3.0
- name: enterprise-debug-rhel-62-cxx14
display_name: ~ Enterprise RHEL 6.2 C++14 DEBUG
modules:
- enterprise
run_on:
@ -6041,7 +6041,7 @@ buildvariants:
gorootvars: GOROOT=/opt/go PATH="/opt/go/bin:$PATH"
tooltags: "-tags 'ssl sasl'"
rlp_environment: MONGOD_UNITTEST_RLP_LANGUAGE_TEST_BTROOT=/opt/basis
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
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
num_jobs_available: $(grep -c ^processor /proc/cpuinfo)
tasks:
- name: compile

View File

@ -504,7 +504,7 @@ TEST_F(FetcherTest, SetNextActionToContinueWhenNextBatchIsNotAvailable) {
Fetcher::NextAction* nextAction,
BSONObjBuilder* getMoreBob) {
ASSERT_OK(fetchResult.getStatus());
Fetcher::QueryResponse batchData{fetchResult.getValue()};
Fetcher::QueryResponse batchData = fetchResult.getValue();
ASSERT(nextAction);
*nextAction = Fetcher::NextAction::kGetMore;
@ -856,7 +856,7 @@ void shutdownDuringSecondBatch(const StatusWith<Fetcher::QueryResponse>& fetchRe
// First time during second batch
ASSERT_OK(fetchResult.getStatus());
Fetcher::QueryResponse batchData{fetchResult.getValue()};
Fetcher::QueryResponse batchData = fetchResult.getValue();
ASSERT_EQUALS(1U, batchData.documents.size());
ASSERT_EQUALS(doc2, batchData.documents.front());
ASSERT_TRUE(Fetcher::NextAction::kGetMore == *nextAction);