summaryrefslogtreecommitdiff
path: root/upb/def.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2018-12-31 20:00:22 -0800
committerJoshua Haberman <jhaberman@gmail.com>2018-12-31 20:00:22 -0800
commitd0c8bb84f449e7fc94a85ac1594cb8090f3c9bb8 (patch)
treecfd26fa7b36463e81c3788f4c981dc7d1608e0f9 /upb/def.c
parent45d61f42990d2823a914680098c0e24c15ebf396 (diff)
WIP.
Diffstat (limited to 'upb/def.c')
-rw-r--r--upb/def.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/upb/def.c b/upb/def.c
index 83e5a99..aff8401 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -916,7 +916,7 @@ const upb_enumdef *upb_symtab_lookupenum(const upb_symtab *s, const char *sym) {
* this code is used to directly build defs from Ruby (for example) we do need
* to validate important constraints like uniqueness of names and numbers. */
-#define CHK(x) if (!(x)) { __builtin_trap(); return false; }
+#define CHK(x) if (!(x)) { return false; }
#define CHK_OOM(x) if (!(x)) { upb_upberr_setoom(ctx->status); return false; }
typedef struct {
@@ -1105,6 +1105,7 @@ static bool parse_default(const symtab_addctx *ctx, const char *str, size_t len,
case UPB_TYPE_BYTES:
/* XXX: need to interpret the C-escaped value. */
f->defaultval.str = newstr(ctx->alloc, str, len);
+ break;
case UPB_TYPE_MESSAGE:
/* Should not have a default value. */
return false;
@@ -1449,8 +1450,10 @@ static bool resolve_fielddef(const symtab_addctx *ctx, const char *prefix,
}
if (!parse_default(ctx, defaultval.data, defaultval.size, f)) {
- upb_status_seterrf(ctx->status, "couldn't parse default for field (%s)",
- f->full_name);
+ upb_status_seterrf(ctx->status,
+ "couldn't parse default '" UPB_STRINGVIEW_FORMAT
+ "' for field (%s)",
+ UPB_STRINGVIEW_ARGS(defaultval), f->full_name);
return false;
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback