diff options
author | Bram Bonné <brambonne@google.com> | 2020-11-10 17:16:42 +0100 |
---|---|---|
committer | Bram Bonné <brambonne@google.com> | 2020-11-11 10:30:14 +0100 |
commit | ad16ab54738553d09f9e7d62a4872491675e94bb (patch) | |
tree | 5194b7e953ea72b6a31104d7ccdb008dfd93a258 | |
parent | 843849541c44e4dc762f10749eb9d826b0e9f495 (diff) | |
download | libcppbor-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
-rw-r--r-- | rules.mk | 2 | ||||
-rw-r--r-- | src/cppbor_parse.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
@@ -18,7 +18,7 @@ LOCAL_DIR := $(GET_LOCAL_DIR) MODULE := $(LOCAL_DIR) -MODULE_CPPFLAGS := -std=c++17 -frtti +MODULE_CPPFLAGS := -std=c++17 MODULE_SRCS := \ $(LOCAL_DIR)/src/cppbor.cpp \ 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) { |