Commit 1c841a35 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Remove include of glog from Range.h

Summary: [Folly] Remove include of `glog` from `Range.h`.

Reviewed By: lbrandy, Orvid

Differential Revision: D14114164

fbshipit-source-id: e227609e9214ab39ff272e44519d34f3047fe025
parent 20a8a095
...@@ -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>
...@@ -699,7 +700,7 @@ toAppend( ...@@ -699,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;
} }
......
...@@ -129,7 +129,7 @@ bool readFile( ...@@ -129,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);
}; };
...@@ -173,7 +173,7 @@ bool readFile( ...@@ -173,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,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#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>
...@@ -403,7 +405,7 @@ class SocketAddress { ...@@ -403,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,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#pragma once #pragma once
#include <cassert>
#include <string> #include <string>
#include <folly/Function.h> #include <folly/Function.h>
...@@ -80,7 +81,7 @@ class CompressionCounter { ...@@ -80,7 +81,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>
......
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include <cassert>
#include <string> #include <string>
#include <glog/logging.h>
#include <folly/Likely.h> #include <folly/Likely.h>
namespace folly { namespace folly {
...@@ -56,7 +55,7 @@ class StringPieceLite { ...@@ -56,7 +55,7 @@ class StringPieceLite {
return size() == 0; return size() == 0;
} }
const char& operator[](size_t i) const { const char& operator[](size_t i) const {
DCHECK_GT(size(), i); assert(size() > i);
return b_[i]; return b_[i];
} }
template <typename Range> template <typename Range>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <folly/detail/RangeSse42.h> #include <folly/detail/RangeSse42.h>
#include <glog/logging.h> #include <cassert>
#include <folly/Portability.h> #include <folly/Portability.h>
...@@ -73,9 +73,9 @@ static inline size_t nextAlignedIndex(const char* arr) { ...@@ -73,9 +73,9 @@ static inline size_t nextAlignedIndex(const char* arr) {
size_t qfind_first_byte_of_needles16( size_t qfind_first_byte_of_needles16(
const StringPieceLite haystack, const StringPieceLite haystack,
const StringPieceLite needles) { const StringPieceLite needles) {
DCHECK_GT(haystack.size(), 0u); assert(haystack.size() > 0u);
DCHECK_GT(needles.size(), 0u); assert(needles.size() > 0u);
DCHECK_LE(needles.size(), 16u); assert(needles.size() <= 16u);
if ((needles.size() <= 2 && haystack.size() >= 256) || if ((needles.size() <= 2 && haystack.size() >= 256) ||
// must bail if we can't even SSE-load a single segment of haystack // must bail if we can't even SSE-load a single segment of haystack
(haystack.size() < 16 && (haystack.size() < 16 &&
...@@ -119,8 +119,8 @@ size_t scanHaystackBlock( ...@@ -119,8 +119,8 @@ size_t scanHaystackBlock(
const StringPieceLite haystack, const StringPieceLite haystack,
const StringPieceLite needles, const StringPieceLite needles,
uint64_t blockStartIdx) { uint64_t blockStartIdx) {
DCHECK_GT(needles.size(), 16u); // should handled by *needles16() method assert(needles.size() > 16u); // should handled by *needles16() method
DCHECK( assert(
blockStartIdx + 16 <= haystack.size() || blockStartIdx + 16 <= haystack.size() ||
(page_for(haystack.data() + blockStartIdx) == (page_for(haystack.data() + blockStartIdx) ==
page_for(haystack.data() + blockStartIdx + 15))); page_for(haystack.data() + blockStartIdx + 15)));
......
...@@ -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>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
// specializations. // specializations.
#include <folly/experimental/crypto/detail/LtHashInternal.h> #include <folly/experimental/crypto/detail/LtHashInternal.h>
#include <glog/logging.h>
#ifdef __AVX2__ #ifdef __AVX2__
#include <immintrin.h> #include <immintrin.h>
#include <sodium.h> #include <sodium.h>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
// specializations. // specializations.
#include <folly/experimental/crypto/detail/LtHashInternal.h> #include <folly/experimental/crypto/detail/LtHashInternal.h>
#include <glog/logging.h>
#ifdef __SSE2__ #ifdef __SSE2__
#include <emmintrin.h> #include <emmintrin.h>
#include <sodium.h> #include <sodium.h>
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
// specializations. // specializations.
#include <folly/experimental/crypto/detail/LtHashInternal.h> #include <folly/experimental/crypto/detail/LtHashInternal.h>
#include <glog/logging.h>
#include <folly/Memory.h> #include <folly/Memory.h>
#include <folly/lang/Bits.h> #include <folly/lang/Bits.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;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <random> #include <random>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <glog/logging.h>
#include <folly/Random.h> #include <folly/Random.h>
#include <folly/experimental/FunctionScheduler.h> #include <folly/experimental/FunctionScheduler.h>
......
...@@ -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,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#pragma once #pragma once
#include <cassert>
#include <cmath> #include <cmath>
#include <vector> #include <vector>
...@@ -53,7 +54,7 @@ class TDigest { ...@@ -53,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 {
......
...@@ -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