diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-10 14:39:23 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-10 16:06:35 +0200 |
commit | f3cc1373423b8bab3e2c364318d7e0857e79098a (patch) | |
tree | 1d5d5dbe070e0a73b17061dcdf5a3d7760784ea9 /xC-gen-proto.awk | |
parent | 8c8e06b0157c97ee1771f848ed363c6a0ed398be (diff) | |
download | xK-f3cc1373423b8bab3e2c364318d7e0857e79098a.tar.gz xK-f3cc1373423b8bab3e2c364318d7e0857e79098a.tar.xz xK-f3cc1373423b8bab3e2c364318d7e0857e79098a.zip |
xC-gen-proto: reduce enums to single bytes
That's already way more than we can possibly use.
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]++) |