Added proper error about broken 0-values for enums.

pull/13171/head
Joshua Haberman 14 years ago
parent b037b3e8f7
commit 6881b2c5cb
  1. 2
      Makefile
  2. 6
      src/upb_def.c

@ -157,7 +157,7 @@ src/descriptor.pb: src/descriptor.proto
descriptorgen: src/descriptor.pb src/upbc
@# Regenerate descriptor_const.h
./tools/upbc -o src/descriptor src/descriptor.pb
./src/upbc -o src/descriptor src/descriptor.pb
cd src && xxd -i descriptor.pb > descriptor.c
src/upbc: src/upbc.c $(LIBUPB)

@ -476,6 +476,12 @@ static upb_flow_t upb_enumdef_EnumValueDescriptorProto_value(void *_b,
break;
case GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NUMBER_FIELDNUM:
b->number = upb_value_getint32(val);
if (b->number == 0) {
upb_seterr(&b->status, UPB_ERROR,
"Enums with a value of 0 are currently broken; see "
"http://code.google.com/p/upb/issues/detail?id=1.");
return UPB_BREAK;
}
b->saw_number = true;
break;
default:

Loading…
Cancel
Save