Commit 16a2a017 authored by Xiao Shi's avatar Xiao Shi Committed by Facebook Github Bot

skip recording policy name in computeStats when RTTI is disabled

Summary:
If RTTI is disabled for the compilation unit, simply skip recording the type of
F14Policy in computeStats.

This diff also contains a few fixes for when folly is built without RTTI.

Reviewed By: nbronson

Differential Revision: D8523618

fbshipit-source-id: dfbfa93ec462c0ff72c06b9f65d61b081e361f41
parent 121274ac
......@@ -62,7 +62,8 @@ auto exceptionStr(const E& e) -> typename std::
#ifdef FOLLY_HAS_RTTI
return demangle(typeid(e));
#else
return "Exception (no RTTI available)";
(void)e;
return "Exception (no RTTI available) ";
#endif
}
......
......@@ -2157,7 +2157,9 @@ class F14Table : public Policy {
FOLLY_SAFE_DCHECK(n1 == size(), "");
FOLLY_SAFE_DCHECK(n2 == size(), "");
#if FOLLY_HAS_RTTI
stats.policy = typeid(Policy).name();
#endif
stats.size = size();
stats.valueSize = sizeof(value_type);
stats.bucketCount = bucket_count();
......
......@@ -432,7 +432,13 @@ std::ostream& operator<<(std::ostream& xo, F14TableStats const& stats) {
using f14::Histo;
xo << "{ " << std::endl;
xo << " policy: " << folly::demangle(stats.policy) << std::endl;
xo << " policy: "
#if FOLLY_HAS_RTTI
<< folly::demangle(stats.policy)
#else
<< "unknown (RTTI not availabe)"
#endif
<< std::endl;
xo << " size: " << stats.size << std::endl;
xo << " valueSize: " << stats.valueSize << std::endl;
xo << " bucketCount: " << stats.bucketCount << std::endl;
......
......@@ -320,7 +320,7 @@ void SymbolizePrinter::println(
namespace {
int getFD(const std::ios& stream) {
#ifdef __GNUC__
#if defined(__GNUC__) && FOLLY_HAS_RTTI
std::streambuf* buf = stream.rdbuf();
using namespace __gnu_cxx;
......@@ -336,6 +336,8 @@ int getFD(const std::ios& stream) {
return sbuf->fd();
}
}
#else
(void)stream;
#endif // __GNUC__
return -1;
}
......
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