summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_array_test.cpp
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2017-06-18 23:22:02 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2017-06-18 23:46:57 -0400
commit9abef6f25aadfd04309cb2219068097f93dc961d (patch)
treef88c7f183f201813f363d5d68c1a4a76781ca7ef /src/mongo/db/matcher/expression_array_test.cpp
parenta5f0a84c79b6ce41fef33da920c62be0ecc8f07b (diff)
downloadmongo-9abef6f25aadfd04309cb2219068097f93dc961d.tar.gz
SERVER-27244 Status usage compile-time facilities.
There are numerous places in the codebase where `mongo::Status` or `mongo::StatusWith< T >` objects are returned and never checked. Many of these are innocuous, but many of them are potentially severe bugs. This change introduces facilities to permit compile-time warning of unchecked `Status` and `StatusWith` usage on clang compilers. It introduces an `ignore` function which is useful to state that a specific "ignored status" case was intentional. It not presently an error, in clang builds, to forget to check a `Status` -- this will come in a later commit. This also introduces a `transitional_ignore` function, which allows for easy continual auditing of the codebase for current "whitelisted" unchecked-status instances. All present "ignored status" cases have been marked `transitional_ignore`.
Diffstat (limited to 'src/mongo/db/matcher/expression_array_test.cpp')
-rw-r--r--src/mongo/db/matcher/expression_array_test.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/matcher/expression_array_test.cpp b/src/mongo/db/matcher/expression_array_test.cpp
index 6a7f36cebed..894fbbd9e49 100644
--- a/src/mongo/db/matcher/expression_array_test.cpp
+++ b/src/mongo/db/matcher/expression_array_test.cpp
@@ -305,7 +305,7 @@ TEST(AndOfElemMatch, MatchesElement) {
// and1 = { a : 1, b : 1 }
unique_ptr<ElemMatchObjectMatchExpression> elemMatch1(new ElemMatchObjectMatchExpression());
- elemMatch1->init("x", and1.release());
+ elemMatch1->init("x", and1.release()).transitional_ignore();
// elemMatch1 = { x : { $elemMatch : { a : 1, b : 1 } } }
BSONObj baseOperanda2 = BSON("a" << 2);
@@ -322,7 +322,7 @@ TEST(AndOfElemMatch, MatchesElement) {
// and2 = { a : 2, b : 2 }
unique_ptr<ElemMatchObjectMatchExpression> elemMatch2(new ElemMatchObjectMatchExpression());
- elemMatch2->init("x", and2.release());
+ elemMatch2->init("x", and2.release()).transitional_ignore();
// elemMatch2 = { x : { $elemMatch : { a : 2, b : 2 } } }
unique_ptr<AndMatchExpression> andOfEM(new AndMatchExpression());
@@ -357,7 +357,7 @@ TEST(AndOfElemMatch, Matches) {
ASSERT(lt1->init("", baseOperandlt1["$lt"]).isOK());
unique_ptr<ElemMatchValueMatchExpression> elemMatch1(new ElemMatchValueMatchExpression());
- elemMatch1->init("x");
+ elemMatch1->init("x").transitional_ignore();
elemMatch1->add(gt1.release());
elemMatch1->add(lt1.release());
// elemMatch1 = { x : { $elemMatch : { $gt : 1 , $lt : 10 } } }
@@ -371,7 +371,7 @@ TEST(AndOfElemMatch, Matches) {
ASSERT(lt2->init("", baseOperandlt2["$lt"]).isOK());
unique_ptr<ElemMatchValueMatchExpression> elemMatch2(new ElemMatchValueMatchExpression());
- elemMatch2->init("x");
+ elemMatch2->init("x").transitional_ignore();
elemMatch2->add(gt2.release());
elemMatch2->add(lt2.release());
// elemMatch2 = { x : { $elemMatch : { $gt : 101 , $lt : 110 } } }
@@ -453,9 +453,9 @@ TEST(SizeMatchExpression, Equivalent) {
SizeMatchExpression e2;
SizeMatchExpression e3;
- e1.init("a", 5);
- e2.init("a", 6);
- e3.init("v", 5);
+ e1.init("a", 5).transitional_ignore();
+ e2.init("a", 6).transitional_ignore();
+ e3.init("v", 5).transitional_ignore();
ASSERT(e1.equivalent(&e1));
ASSERT(!e1.equivalent(&e2));