aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Bonné <brambonne@google.com>2020-11-11 15:20:41 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-11-11 15:20:41 +0000
commit538fa921c7bd58edd1b845b7f925d7f833612cf4 (patch)
tree5194b7e953ea72b6a31104d7ccdb008dfd93a258
parent6e3a18c57179721084d8eb325cb55fa4f74cc396 (diff)
parentad16ab54738553d09f9e7d62a4872491675e94bb (diff)
downloadlibcppbor-538fa921c7bd58edd1b845b7f925d7f833612cf4.tar.gz
Allow building libcppbor with -fno-rtti am: ad16ab5473
Original change: https://android-review.googlesource.com/c/platform/external/libcppbor/+/1494476 Change-Id: I6b664e9fa49b98cc3c891d7058e0c299028c2d70
-rw-r--r--rules.mk2
-rw-r--r--src/cppbor_parse.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/rules.mk b/rules.mk
index 739fe23..5bcea52 100644
--- a/rules.mk
+++ b/rules.mk
@@ -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) {