Commit 45ec0848 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Remove include of glog from various places

Summary: [Folly] Remove include of `glog` from various places.

Reviewed By: spalamarchuk

Differential Revision: D14494311

fbshipit-source-id: 122b63a726a08802d7b4ef6b55b304e9800c258d
parent 4a1b5a3a
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cctype> #include <cctype>
#include <climits> #include <climits>
#include <cstddef> #include <cstddef>
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include <utility> #include <utility>
#include <double-conversion/double-conversion.h> // V8 JavaScript implementation #include <double-conversion/double-conversion.h> // V8 JavaScript implementation
#include <glog/logging.h>
#include <folly/Demangle.h> #include <folly/Demangle.h>
#include <folly/Expected.h> #include <folly/Expected.h>
...@@ -700,7 +700,7 @@ toAppend( ...@@ -700,7 +700,7 @@ toAppend(
conv.ToFixed(value, int(numDigits), &builder); conv.ToFixed(value, int(numDigits), &builder);
break; break;
default: default:
CHECK(mode == DoubleToStringConverter::PRECISION); assert(mode == DoubleToStringConverter::PRECISION);
conv.ToPrecision(value, int(numDigits), &builder); conv.ToPrecision(value, int(numDigits), &builder);
break; break;
} }
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <cassert> #include <cassert>
#include <limits> #include <limits>
#include <glog/logging.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
...@@ -131,7 +129,7 @@ bool readFile( ...@@ -131,7 +129,7 @@ bool readFile(
size_t soFar = 0; // amount of bytes successfully read size_t soFar = 0; // amount of bytes successfully read
SCOPE_EXIT { SCOPE_EXIT {
DCHECK(out.size() >= soFar); // resize better doesn't throw assert(out.size() >= soFar); // resize better doesn't throw
out.resize(soFar); out.resize(soFar);
}; };
...@@ -175,7 +173,7 @@ bool readFile( ...@@ -175,7 +173,7 @@ bool readFile(
const char* file_name, const char* file_name,
Container& out, Container& out,
size_t num_bytes = std::numeric_limits<size_t>::max()) { size_t num_bytes = std::numeric_limits<size_t>::max()) {
DCHECK(file_name); assert(file_name);
const auto fd = openNoInt(file_name, O_RDONLY | O_CLOEXEC); const auto fd = openNoInt(file_name, O_RDONLY | O_CLOEXEC);
if (fd == -1) { if (fd == -1) {
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <folly/Format.h> #include <folly/Format.h>
#include <cassert>
#include <folly/ConstexprMath.h> #include <folly/ConstexprMath.h>
#include <folly/CppAttributes.h> #include <folly/CppAttributes.h>
#include <folly/container/Array.h> #include <folly/container/Array.h>
...@@ -208,7 +210,7 @@ void FormatValue<double>::formatHelper( ...@@ -208,7 +210,7 @@ void FormatValue<double>::formatHelper(
int len = builder.position(); int len = builder.position();
builder.Finalize(); builder.Finalize();
DCHECK_GT(len, 0); assert(len > 0);
// Add '+' or ' ' sign if needed // Add '+' or ' ' sign if needed
char* p = buf + 1; char* p = buf + 1;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define FOLLY_FORMAT_H_ #define FOLLY_FORMAT_H_
#include <cstdio> #include <cstdio>
#include <ios>
#include <stdexcept> #include <stdexcept>
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
...@@ -241,9 +242,9 @@ class Formatter : public BaseFormatter< ...@@ -241,9 +242,9 @@ class Formatter : public BaseFormatter<
/** /**
* Formatter objects can be written to streams. * Formatter objects can be written to streams.
*/ */
template <bool containerMode, class... Args> template <class C, bool containerMode, class... Args>
std::ostream& operator<<( std::ostream& operator<<(
std::ostream& out, std::basic_ostream<C>& out,
const Formatter<containerMode, Args...>& formatter) { const Formatter<containerMode, Args...>& formatter) {
auto writer = [&out](StringPiece sp) { auto writer = [&out](StringPiece sp) {
out.write(sp.data(), std::streamsize(sp.size())); out.write(sp.data(), std::streamsize(sp.size()));
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <folly/MacAddress.h> #include <folly/MacAddress.h>
#include <cassert>
#include <ostream> #include <ostream>
#include <folly/Exception.h> #include <folly/Exception.h>
...@@ -38,7 +39,7 @@ MacAddress::MacAddress(StringPiece str) { ...@@ -38,7 +39,7 @@ MacAddress::MacAddress(StringPiece str) {
MacAddress MacAddress::createMulticast(IPAddressV6 v6addr) { MacAddress MacAddress::createMulticast(IPAddressV6 v6addr) {
// This method should only be used for multicast addresses. // This method should only be used for multicast addresses.
DCHECK(v6addr.isMulticast()); assert(v6addr.isMulticast());
uint8_t bytes[SIZE]; uint8_t bytes[SIZE];
bytes[0] = 0x33; bytes[0] = 0x33;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <folly/SocketAddress.h> #include <folly/SocketAddress.h>
#include <cassert>
#include <cerrno> #include <cerrno>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
...@@ -585,7 +586,7 @@ size_t SocketAddress::hash() const { ...@@ -585,7 +586,7 @@ size_t SocketAddress::hash() const {
break; break;
} }
case AF_UNIX: case AF_UNIX:
DCHECK(external_); assert(external_);
break; break;
case AF_UNSPEC: case AF_UNSPEC:
default: default:
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
#pragma once #pragma once
#include <sys/types.h> #include <sys/types.h>
#include <cassert>
#include <cstddef> #include <cstddef>
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <glog/logging.h>
#include <folly/IPAddress.h> #include <folly/IPAddress.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/Range.h> #include <folly/Range.h>
...@@ -405,7 +405,7 @@ class SocketAddress { ...@@ -405,7 +405,7 @@ class SocketAddress {
socklen_t getActualSize() const; socklen_t getActualSize() const;
sa_family_t getFamily() const { sa_family_t getFamily() const {
DCHECK(external_ || AF_UNIX != storage_.addr.family()); assert(external_ || AF_UNIX != storage_.addr.family());
return external_ ? sa_family_t(AF_UNIX) : storage_.addr.family(); return external_ ? sa_family_t(AF_UNIX) : storage_.addr.family();
} }
......
...@@ -13,8 +13,11 @@ ...@@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <folly/chrono/Conv.h> #include <folly/chrono/Conv.h>
#include <glog/logging.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
using namespace folly; using namespace folly;
......
...@@ -16,10 +16,9 @@ ...@@ -16,10 +16,9 @@
#pragma once #pragma once
#include <cassert>
#include <string> #include <string>
#include <glog/logging.h>
#include <folly/Function.h> #include <folly/Function.h>
#include <folly/Optional.h> #include <folly/Optional.h>
#include <folly/Range.h> #include <folly/Range.h>
...@@ -83,7 +82,7 @@ class CompressionCounter { ...@@ -83,7 +82,7 @@ class CompressionCounter {
return makeCompressionCounterHandler( return makeCompressionCounterHandler(
codecType, codecName, level, key, counterType); codecType, codecName, level, key, counterType);
}; };
DCHECK(!initialize_.hasAllocatedMemory()); assert(!initialize_.hasAllocatedMemory());
} }
void operator+=(double sum) { void operator+=(double sum) {
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <algorithm> #include <algorithm>
#include <unordered_map> #include <unordered_map>
#include <glog/logging.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/FBString.h> #include <folly/FBString.h>
#include <folly/container/test/F14TestUtil.h> #include <folly/container/test/F14TestUtil.h>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <unordered_map> #include <unordered_map>
#include <glog/logging.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/FBString.h> #include <folly/FBString.h>
#include <folly/container/test/F14TestUtil.h> #include <folly/container/test/F14TestUtil.h>
......
...@@ -119,7 +119,6 @@ struct hash<::folly::dynamic> { ...@@ -119,7 +119,6 @@ struct hash<::folly::dynamic> {
apply(std::string); \ apply(std::string); \
break; \ break; \
default: \ default: \
CHECK(0); \
abort(); \ abort(); \
} \ } \
} while (0) } while (0)
......
...@@ -14,12 +14,14 @@ ...@@ -14,12 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
#include <folly/dynamic.h>
#include <numeric> #include <numeric>
#include <folly/container/Enumerate.h> #include <glog/logging.h>
#include <folly/dynamic.h>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/container/Enumerate.h>
#include <folly/hash/Hash.h> #include <folly/hash/Hash.h>
#include <folly/lang/Assume.h> #include <folly/lang/Assume.h>
#include <folly/lang/Exception.h> #include <folly/lang/Exception.h>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <folly/executors/thread_factory/ThreadFactory.h> #include <folly/executors/thread_factory/ThreadFactory.h>
#include <glog/logging.h>
#include <folly/String.h> #include <folly/String.h>
#include <folly/portability/SysResource.h> #include <folly/portability/SysResource.h>
#include <folly/portability/SysTime.h> #include <folly/portability/SysTime.h>
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <sstream> #include <sstream>
#include <glog/logging.h>
#include <folly/Optional.h> #include <folly/Optional.h>
namespace folly { namespace folly {
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <folly/experimental/EnvUtil.h> #include <folly/experimental/EnvUtil.h>
#include <glog/logging.h>
#include <folly/String.h> #include <folly/String.h>
#include <folly/portability/Stdlib.h> #include <folly/portability/Stdlib.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <random> #include <random>
#include <glog/logging.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/Random.h> #include <folly/Random.h>
#include <folly/String.h> #include <folly/String.h>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <iostream> #include <iostream>
#include <glog/logging.h>
#include <folly/FileUtil.h> #include <folly/FileUtil.h>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/experimental/io/FsUtil.h> #include <folly/experimental/io/FsUtil.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <boost/regex.hpp> #include <boost/regex.hpp>
#include <glog/logging.h>
#include <folly/Exception.h> #include <folly/Exception.h>
#include <folly/File.h> #include <folly/File.h>
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <iostream> #include <iostream>
#include <stdexcept> #include <stdexcept>
#include <glog/logging.h>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/experimental/io/HugePages.h> #include <folly/experimental/io/HugePages.h>
......
...@@ -597,7 +597,7 @@ bool Dwarf::findAddress( ...@@ -597,7 +597,7 @@ bool Dwarf::findAddress(
// it only if such behavior is requested via LocationInfoMode. // it only if such behavior is requested via LocationInfoMode.
return false; return false;
} else { } else {
DCHECK(mode == LocationInfoMode::FULL); FOLLY_SAFE_DCHECK(mode == LocationInfoMode::FULL, "unexpected mode");
// Fall back to the linear scan. // Fall back to the linear scan.
} }
} }
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <folly/experimental/symbolizer/Dwarf.h> #include <folly/experimental/symbolizer/Dwarf.h>
#include <glog/logging.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
using folly::symbolizer::Dwarf; using folly::symbolizer::Dwarf;
......
...@@ -13,10 +13,13 @@ ...@@ -13,10 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <vector> #include <vector>
#include <glog/logging.h>
#include <folly/FBVector.h> #include <folly/FBVector.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/gen/Base.h> #include <folly/gen/Base.h>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <folly/json.h> #include <folly/json.h>
#include <algorithm> #include <algorithm>
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include <type_traits> #include <type_traits>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <glog/logging.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/Portability.h> #include <folly/Portability.h>
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <folly/json_patch.h> #include <folly/json_patch.h>
#include <glog/logging.h>
#include <folly/container/Enumerate.h> #include <folly/container/Enumerate.h>
namespace { namespace {
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
*/ */
#include <folly/ssl/detail/SSLSessionImpl.h> #include <folly/ssl/detail/SSLSessionImpl.h>
#include <glog/logging.h>
#include <folly/portability/OpenSSL.h> #include <folly/portability/OpenSSL.h>
#include <folly/ssl/OpenSSLVersionFinder.h> #include <folly/ssl/OpenSSLVersionFinder.h>
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
*/ */
#include <folly/stats/TDigest.h> #include <folly/stats/TDigest.h>
#include <glog/logging.h>
#include <folly/stats/detail/DoubleRadixSort.h> #include <folly/stats/detail/DoubleRadixSort.h>
#include <algorithm> #include <algorithm>
......
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
#pragma once #pragma once
#include <cassert>
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include <glog/logging.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/Utility.h> #include <folly/Utility.h>
...@@ -55,7 +54,7 @@ class TDigest { ...@@ -55,7 +54,7 @@ class TDigest {
public: public:
explicit Centroid(double mean = 0.0, double weight = 1.0) explicit Centroid(double mean = 0.0, double weight = 1.0)
: mean_(mean), weight_(weight) { : mean_(mean), weight_(weight) {
DCHECK_GT(weight, 0); assert(weight > 0);
} }
inline double mean() const { inline double mean() const {
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <functional> #include <functional>
#include <utility> #include <utility>
#include <glog/logging.h>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/portability/GFlags.h> #include <folly/portability/GFlags.h>
#include <folly/portability/SysMman.h> #include <folly/portability/SysMman.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#pragma once #pragma once
#include <glog/logging.h> #include <cassert>
#include <folly/File.h> #include <folly/File.h>
#include <folly/Range.h> #include <folly/Range.h>
...@@ -40,8 +40,8 @@ class MemoryMapping { ...@@ -40,8 +40,8 @@ class MemoryMapping {
MUST_LOCK, MUST_LOCK,
}; };
/** /**
* Map a portion of the file indicated by filename in memory, causing a CHECK * Map a portion of the file indicated by filename in memory, causing SIGABRT
* failure on error. * on error.
* *
* By default, map the whole file. length=-1: map from offset to EOF. * By default, map the whole file. length=-1: map from offset to EOF.
* Unlike the mmap() system call, offset and length don't need to be * Unlike the mmap() system call, offset and length don't need to be
...@@ -204,7 +204,7 @@ class MemoryMapping { ...@@ -204,7 +204,7 @@ class MemoryMapping {
*/ */
template <class T> template <class T>
Range<T*> asWritableRange() const { Range<T*> asWritableRange() const {
DCHECK(options_.writable); // you'll segfault anyway... assert(options_.writable); // you'll segfault anyway...
size_t count = data_.size() / sizeof(T); size_t count = data_.size() / sizeof(T);
return Range<T*>(static_cast<T*>(static_cast<void*>(data_.data())), count); return Range<T*>(static_cast<T*>(static_cast<void*>(data_.data())), count);
} }
...@@ -213,7 +213,7 @@ class MemoryMapping { ...@@ -213,7 +213,7 @@ class MemoryMapping {
* A range of mutable bytes mapped by this mapping. * A range of mutable bytes mapped by this mapping.
*/ */
MutableByteRange writableRange() const { MutableByteRange writableRange() const {
DCHECK(options_.writable); // you'll segfault anyway... assert(options_.writable); // you'll segfault anyway...
return data_; return data_;
} }
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <cstdlib> #include <cstdlib>
#include <glog/logging.h>
#include <folly/FileUtil.h> #include <folly/FileUtil.h>
#include <folly/Random.h> #include <folly/Random.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#endif #endif
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/container/Foreach.h> #include <folly/container/Foreach.h>
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <folly/dynamic.h> #include <folly/dynamic.h>
#include <glog/logging.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/json.h> #include <folly/json.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <sstream> #include <sstream>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <glog/logging.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/Portability.h> #include <folly/Portability.h>
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <folly/File.h> #include <folly/File.h>
#include <glog/logging.h>
#include <folly/String.h> #include <folly/String.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <stdexcept> #include <stdexcept>
#include <glog/logging.h>
#include <folly/portability/GMock.h> #include <folly/portability/GMock.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
#include <folly/test/JsonMockUtil.h> #include <folly/test/JsonMockUtil.h>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <set> #include <set>
#include <boost/regex.hpp> #include <boost/regex.hpp>
#include <glog/logging.h>
#include <folly/FBVector.h> #include <folly/FBVector.h>
#include <folly/container/Array.h> #include <folly/container/Array.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment