diff options
Diffstat (limited to 'xC-gen-proto.awk')
-rw-r--r-- | xC-gen-proto.awk | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/xC-gen-proto.awk b/xC-gen-proto.awk index d5f19fb..de8e9b8 100644 --- a/xC-gen-proto.awk +++ b/xC-gen-proto.awk @@ -15,7 +15,7 @@ # Booleans are one byte each. # Strings must be valid UTF-8, use u8<> to lift that restriction. # String and array lengths are encoded as u32. -# Enumeration values automatically start at 1, and are encoded as i32. +# Enumeration values automatically start at 1, and are encoded as i8. # Any struct or union field may be a variable-length array. # # Message framing is done externally, but also happens to prefix u32 lengths. @@ -189,6 +189,8 @@ function defenum( name, ident, value, cg) { value = readnumber() if (!value) fatal("enumeration values cannot be zero") + if (value < -128 || value > 127) + fatal("enumeration value out of range") expect(accept(",")) append(EnumValues, name, SUBSEP ident) if (EnumValues[name, ident]++) |