summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2017-02-14 15:33:01 -0500
committerAndrew Morrow <acm@mongodb.com>2017-02-27 23:42:02 -0500
commitc780b434f538f72dab32a120a7950c1480a95d49 (patch)
treeac62ddbb3af1dc4d677b2211fa2eae541198d6e4
parent9dfb28da2fbf9b1ba6b17ad873dde0db1863694f (diff)
downloadmongo-c780b434f538f72dab32a120a7950c1480a95d49.tar.gz
SERVER-27553 Remove print macro
-rw-r--r--src/mongo/db/commands/dbcommands.cpp7
-rw-r--r--src/mongo/db/pipeline/document_value_test.cpp7
-rw-r--r--src/mongo/db/sorter/sorter.cpp19
-rw-r--r--src/mongo/util/print.h36
4 files changed, 8 insertions, 61 deletions
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index b9e0fd07669..c536b367462 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -111,12 +111,10 @@
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/util/md5.hpp"
-#include "mongo/util/print.h"
#include "mongo/util/scopeguard.h"
namespace mongo {
-using std::endl;
using std::ostringstream;
using std::string;
using std::stringstream;
@@ -848,8 +846,9 @@ public:
Query q(query);
q.sort(sort);
unique_ptr<DBClientCursor> c = client.query(ns, q);
- while (c->more())
- PRINT(c->nextSafe());
+ while (c->more()) {
+ log() << c->nextSafe();
+ }
}
} cmdFileMD5;
diff --git a/src/mongo/db/pipeline/document_value_test.cpp b/src/mongo/db/pipeline/document_value_test.cpp
index bf6d3cca81d..92fd2f64067 100644
--- a/src/mongo/db/pipeline/document_value_test.cpp
+++ b/src/mongo/db/pipeline/document_value_test.cpp
@@ -39,11 +39,9 @@
#include "mongo/db/pipeline/value.h"
#include "mongo/db/pipeline/value_comparator.h"
#include "mongo/dbtests/dbtests.h"
-#include "mongo/util/print.h"
namespace DocumentTests {
-using std::endl;
using std::numeric_limits;
using std::string;
using std::vector;
@@ -178,7 +176,7 @@ public:
// Remove the second field.
md.setField("b", Value());
- PRINT(md.peek().toString());
+ log() << md.peek().toString();
ASSERT_EQUALS(2U, md.peek().size());
ASSERT(md.peek()["b"].missing());
ASSERT_EQUALS("a", getNthField(md.peek(), 0).first.toString());
@@ -1601,7 +1599,8 @@ private:
assertComparison(expectedResult, fromBson(a), fromBson(b));
}
void assertComparison(int expectedResult, const Value& a, const Value& b) {
- mongo::unittest::log() << "testing " << a.toString() << " and " << b.toString() << endl;
+ mongo::unittest::log() << "testing " << a.toString() << " and " << b.toString();
+
// reflexivity
ASSERT_EQUALS(0, cmp(a, a));
ASSERT_EQUALS(0, cmp(b, b));
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp
index 7f6e8866562..b15cb5cd980 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -63,7 +63,6 @@
#include "mongo/util/bufreader.h"
#include "mongo/util/destructor_guard.h"
#include "mongo/util/mongoutils/str.h"
-#include "mongo/util/print.h"
#include "mongo/util/unowned_ptr.h"
namespace mongo {
@@ -81,18 +80,6 @@ inline std::string myErrnoWithDescription() {
}
template <typename Data, typename Comparator>
-void compIsntSane(const Comparator& comp, const Data& lhs, const Data& rhs) {
- PRINT(typeid(comp).name());
- PRINT(lhs.first);
- PRINT(lhs.second);
- PRINT(rhs.first);
- PRINT(rhs.second);
- PRINT(comp(lhs, rhs));
- PRINT(comp(rhs, lhs));
- dassert(false);
-}
-
-template <typename Data, typename Comparator>
void dassertCompIsSane(const Comparator& comp, const Data& lhs, const Data& rhs) {
#if defined(MONGO_CONFIG_DEBUG_BUILD) && !defined(_MSC_VER)
// MSVC++ already does similar verification in debug mode in addition to using
@@ -113,10 +100,8 @@ void dassertCompIsSane(const Comparator& comp, const Data& lhs, const Data& rhs)
}
// test reflexivity
- if (!(comp(lhs, lhs) == 0))
- compIsntSane(comp, lhs, lhs);
- if (!(comp(rhs, rhs) == 0))
- compIsntSane(comp, rhs, rhs);
+ invariant(comp(lhs, lhs) == 0);
+ invariant(comp(rhs, rhs) == 0);
#endif
}
diff --git a/src/mongo/util/print.h b/src/mongo/util/print.h
deleted file mode 100644
index b9a0ade2e37..00000000000
--- a/src/mongo/util/print.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (C) 2015 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include <iostream>
-
-// PRINT(2+2); prints "2+2: 4"
-#define MONGO_PRINT(x) std::cout << #x ": " << (x) << std::endl
-#define PRINT MONGO_PRINT
-// PRINTFL; prints file:line
-#define MONGO_PRINTFL std::cout << __FILE__ ":" << __LINE__ << std::endl
-#define PRINTFL MONGO_PRINTFL