diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2016-05-12 11:54:34 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2016-05-12 11:54:34 -0700 |
commit | fa338b70a602d9f5657528d0322535959a92d4b0 (patch) | |
tree | a7ec8b8d61a1ff3657aff99316ec51a8b81726ad /upb/bindings/googlepb/bridge.cc | |
parent | e16ed470be7d0d459e85e1d7b43893358a625d34 (diff) |
Added UPB_ASSERT() that helps avoid unused var warnings.
* Added UPB_ASSERT() that helps avoid unused var warnings.
* Addressed PR comments.
* Fixed assert in the JIT.
Diffstat (limited to 'upb/bindings/googlepb/bridge.cc')
-rw-r--r-- | upb/bindings/googlepb/bridge.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/upb/bindings/googlepb/bridge.cc b/upb/bindings/googlepb/bridge.cc index c196140..adba3e7 100644 --- a/upb/bindings/googlepb/bridge.cc +++ b/upb/bindings/googlepb/bridge.cc @@ -18,7 +18,7 @@ #define ASSERT_STATUS(status) do { \ if (!upb_ok(status)) { \ fprintf(stderr, "upb status failure: %s\n", upb_status_errmsg(status)); \ - assert(upb_ok(status)); \ + UPB_ASSERT(upb_ok(status)); \ } \ } while (0) @@ -49,7 +49,7 @@ const goog::Message* TryGetFieldPrototype(const goog::Message& m, const goog::Message* GetFieldPrototype(const goog::Message& m, const goog::FieldDescriptor* f) { const goog::Message* ret = TryGetFieldPrototype(m, f); - assert(ret); + UPB_ASSERT(ret); return ret; } @@ -66,7 +66,7 @@ const EnumDef* DefBuilder::GetEnumDef(const goog::EnumDescriptor* ed) { for (int i = 0; i < ed->value_count(); i++) { const goog::EnumValueDescriptor* val = ed->value(i); bool success = e->AddValue(val->name(), val->number(), &status); - UPB_ASSERT_VAR(success, success); + UPB_ASSERT(success); } e->Freeze(&status); @@ -96,7 +96,7 @@ const MessageDef* DefBuilder::GetMaybeUnfrozenMessageDef( for (size_t i = 0; i < fields.size(); i++) { const goog::FieldDescriptor* proto2_f = fields[i]; - assert(proto2_f); + UPB_ASSERT(proto2_f); md->AddField(NewFieldDef(proto2_f, m), &status); } ASSERT_STATUS(&status); @@ -128,7 +128,7 @@ reffed_ptr<FieldDef> DefBuilder::NewFieldDef(const goog::FieldDescriptor* f, subm = TryGetFieldPrototype(*m, f); if (upb_f->type() == UPB_TYPE_MESSAGE) { - assert(subm); + UPB_ASSERT(subm); } else if (subm) { // Weak field: subm will be weak prototype even though the proto2 // descriptor does not indicate a submessage field. @@ -250,14 +250,14 @@ const Handlers* CodeCache::GetMaybeUnfrozenWriteHandlers( if (!proto2_f) { proto2_f = d->file()->pool()->FindExtensionByNumber(d, upb_f->number()); } - assert(proto2_f); + UPB_ASSERT(proto2_f); bool ok = WriteHandlers::AddFieldHandler(m, proto2_f, h); - UPB_ASSERT_VAR(ok, ok); + UPB_ASSERT(ok); if (upb_f->type() == UPB_TYPE_MESSAGE) { const goog::Message* prototype = GetFieldPrototype(m, proto2_f); - assert(prototype); + UPB_ASSERT(prototype); const upb::Handlers* sub_handlers = GetMaybeUnfrozenWriteHandlers(upb_f->message_subdef(), *prototype); h->SetSubHandlers(upb_f, sub_handlers); |