summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaley Chen <waleycz@gmail.com>2016-06-22 10:55:52 -0400
committerWaley Chen <waleycz@gmail.com>2016-06-22 11:03:20 -0400
commit2f708de73326bfa6aef14169888c23ccdd3345d1 (patch)
tree9e29ecd42a9e28d9b12b751dc2611714ed196c2f
parenta009f41df2c3609b3c8dfd19ddc97ddbeef86984 (diff)
downloadmongo-2f708de73326bfa6aef14169888c23ccdd3345d1.tar.gz
SERVER-23974 Add clang 3.4 with libc++ canary builder
-rw-r--r--SConstruct36
-rw-r--r--etc/evergreen.yml17
-rw-r--r--src/mongo/db/pipeline/document_source_test.cpp2
-rw-r--r--src/mongo/db/query/query_solution.cpp2
-rw-r--r--src/mongo/dbtests/index_access_method_test.cpp8
-rw-r--r--src/mongo/s/commands/cluster_shard_collection_cmd.cpp2
6 files changed, 58 insertions, 9 deletions
diff --git a/SConstruct b/SConstruct
index 3af8e126bac..9963c67b489 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1494,7 +1494,7 @@ if env.TargetOSIs('posix'):
if not has_option("disable-warnings-as-errors"):
env.Append( CCFLAGS=["-Werror"] )
- env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual"] )
+ env.Append( CXXFLAGS=["-Woverloaded-virtual"] )
env.Append( LINKFLAGS=["-pthread"] )
# SERVER-9761: Ensure early detection of missing symbols in dependent libraries at program
@@ -1836,6 +1836,40 @@ def doConfigure(myenv):
# see: http://stackoverflow.com/questions/21755206/how-to-get-around-gcc-void-b-4-may-be-used-uninitialized-in-this-funct
AddToCXXFLAGSIfSupported(myenv, "-Wno-maybe-uninitialized")
+ # Check if we can set "-Wnon-virtual-dtor" when "-Werror" is set. The only time we can't set it is on
+ # clang 3.4, where a class with virtual function(s) and a non-virtual destructor throws a warning when
+ # it shouldn't.
+ def CheckNonVirtualDtor(context):
+
+ test_body = """
+ class Base {
+ public:
+ virtual void foo() const = 0;
+ protected:
+ ~Base() {};
+ };
+
+ class Derived : public Base {
+ public:
+ virtual void foo() const {}
+ };
+ """
+
+ context.Message('Checking -Wnon-virtual-dtor for false positives... ')
+ ret = context.TryCompile(textwrap.dedent(test_body), ".cpp")
+ context.Result(ret)
+ return ret
+
+ myenvClone = myenv.Clone()
+ myenvClone.Append( CCFLAGS=['-Werror'] )
+ myenvClone.Append( CXXFLAGS=["-Wnon-virtual-dtor"] )
+ conf = Configure(myenvClone, help=False, custom_tests = {
+ 'CheckNonVirtualDtor' : CheckNonVirtualDtor,
+ })
+ if conf.CheckNonVirtualDtor():
+ myenv.Append( CXXFLAGS=["-Wnon-virtual-dtor"] )
+ conf.Finish()
+
if get_option('runtime-hardening') == "on":
# Clang honors these flags, but doesn't actually do anything with them for compatibility, so we
# need to only do this for GCC. On clang, we do things differently. Note that we need to add
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index 3e83570dca6..02d89a38701 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -5432,7 +5432,22 @@ buildvariants:
distros:
- rhel55-test
-
+- name: enterprise-ubuntu1404-clang-3.4-libc
+ display_name: "~Enterprise Ubuntu 14.04 (Clang 3.4/libc++)"
+ modules:
+ - enterprise
+ - mongo-tools
+ run_on:
+ - ubuntu1404-test
+ batchtime: 1440 # 1 day
+ expansions:
+ gorootvars: GOROOT=/opt/go PATH="/opt/go/bin:$PATH"
+ tooltags: "-tags 'ssl sasl'"
+ compile_flags: --ssl CC=/usr/bin/clang CXX=/usr/bin/clang++ --libc++ -j$(grep -c ^processor /proc/cpuinfo)
+ tasks:
+ - name: compile
+ distros:
+ - ubuntu1404-build
###########################################
# SUSE buildvariants #
diff --git a/src/mongo/db/pipeline/document_source_test.cpp b/src/mongo/db/pipeline/document_source_test.cpp
index 2518d70f41d..9a9331d013e 100644
--- a/src/mongo/db/pipeline/document_source_test.cpp
+++ b/src/mongo/db/pipeline/document_source_test.cpp
@@ -3351,7 +3351,7 @@ TEST(ObjectForMatch, MissingFieldShouldNotAppearInResult) {
TEST(ObjectForMatch, ShouldSerializeNothingIfNothingIsNeeded) {
Document input(fromjson("{a: 1, b: {c: 1}}"));
BSONObj expected;
- ASSERT_EQUALS(expected, DocumentSourceMatch::getObjectForMatch(input, {}));
+ ASSERT_EQUALS(expected, DocumentSourceMatch::getObjectForMatch(input, std::set<std::string>{}));
}
TEST(ObjectForMatch, ShouldExtractEntireArrayFromPrefixOfDottedField) {
diff --git a/src/mongo/db/query/query_solution.cpp b/src/mongo/db/query/query_solution.cpp
index 05883f9cea6..df7af9c36d5 100644
--- a/src/mongo/db/query/query_solution.cpp
+++ b/src/mongo/db/query/query_solution.cpp
@@ -612,7 +612,7 @@ std::set<StringData> IndexScanNode::getFieldsWithStringBounds(const IndexBounds&
keyPatternIterator.next();
}
- return {};
+ return std::set<StringData>{};
}
std::set<StringData> ret;
diff --git a/src/mongo/dbtests/index_access_method_test.cpp b/src/mongo/dbtests/index_access_method_test.cpp
index f81a3039704..5460ce410f0 100644
--- a/src/mongo/dbtests/index_access_method_test.cpp
+++ b/src/mongo/dbtests/index_access_method_test.cpp
@@ -39,15 +39,15 @@ namespace {
using std::vector;
TEST(IndexAccessMethodSetDifference, EmptyInputsShouldHaveNoDifference) {
- BSONObjSet left = {};
- BSONObjSet right = {};
+ BSONObjSet left{};
+ BSONObjSet right{};
auto diff = IndexAccessMethod::setDifference(left, right);
ASSERT_EQ(0UL, diff.first.size());
ASSERT_EQ(0UL, diff.second.size());
}
TEST(IndexAccessMethodSetDifference, EmptyLeftShouldHaveNoDifference) {
- BSONObjSet left = {};
+ BSONObjSet left{};
BSONObjSet right = {BSON("" << 0)};
auto diff = IndexAccessMethod::setDifference(left, right);
ASSERT_EQ(0UL, diff.first.size());
@@ -56,7 +56,7 @@ TEST(IndexAccessMethodSetDifference, EmptyLeftShouldHaveNoDifference) {
TEST(IndexAccessMethodSetDifference, EmptyRightShouldReturnAllOfLeft) {
BSONObjSet left = {BSON("" << 0), BSON("" << 1)};
- BSONObjSet right = {};
+ BSONObjSet right{};
auto diff = IndexAccessMethod::setDifference(left, right);
ASSERT_EQ(2UL, diff.first.size());
ASSERT_EQ(0UL, diff.second.size());
diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
index 7d36ae20ee5..aeef7a5e300 100644
--- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
+++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
@@ -405,7 +405,7 @@ public:
ClientBasic::getCurrent(), nss.ns(), proposedKey, careAboutUnique);
Status status = grid.catalogClient(txn)->shardCollection(
- txn, nss.ns(), proposedShardKey, careAboutUnique, initSplits, {});
+ txn, nss.ns(), proposedShardKey, careAboutUnique, initSplits, std::set<ShardId>{});
if (!status.isOK()) {
return appendCommandStatus(result, status);
}