aboutsummaryrefslogtreecommitdiff
path: root/src/cppbor_parse.cpp
diff options
context:
space:
mode:
authorBram Bonné <brambonne@google.com>2020-11-10 17:16:42 +0100
committerBram Bonné <brambonne@google.com>2020-11-11 10:30:14 +0100
commitad16ab54738553d09f9e7d62a4872491675e94bb (patch)
tree5194b7e953ea72b6a31104d7ccdb008dfd93a258 /src/cppbor_parse.cpp
parent843849541c44e4dc762f10749eb9d826b0e9f495 (diff)
downloadlibcppbor-ad16ab54738553d09f9e7d62a4872491675e94bb.tar.gz
Allow building libcppbor with -fno-rtti
Bug: 171373138 Test: trusty/vendor/google/aosp/scripts/build.py generic-arm64-test-debug Test: m -j Change-Id: Ib8ef8528ed21dc5043cf6fbc2d048c1a657e7be3
Diffstat (limited to 'src/cppbor_parse.cpp')
-rw-r--r--src/cppbor_parse.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cppbor_parse.cpp b/src/cppbor_parse.cpp
index 5cffe15..33d2ab6 100644
--- a/src/cppbor_parse.cpp
+++ b/src/cppbor_parse.cpp
@@ -280,7 +280,9 @@ class FullParseClient : public ParseClient {
// Starting a new compound data item, i.e. a new parent. Save it on the parent stack.
// It's safe to save a raw pointer because the unique_ptr is guaranteed to stay in
// existence until the corresponding itemEnd() call.
- assert(dynamic_cast<CompoundItem*>(item.get()));
+ #if __has_feature(cxx_rtti)
+ assert(dynamic_cast<CompoundItem*>(item.get()));
+ #endif
mParentStack.push(static_cast<CompoundItem*>(item.get()));
return this;
} else {
@@ -319,7 +321,9 @@ class FullParseClient : public ParseClient {
private:
void appendToLastParent(std::unique_ptr<Item> item) {
auto parent = mParentStack.top();
- assert(dynamic_cast<IncompleteItem*>(parent));
+ #if __has_feature(cxx_rtti)
+ assert(dynamic_cast<IncompleteItem*>(parent));
+ #endif
if (parent->type() == ARRAY) {
static_cast<IncompleteArray*>(parent)->add(std::move(item));
} else if (parent->type() == MAP) {