qmic/tests/num_too_big.qmi
Alex Elder ad480502eb parser: properly support 64-bit numbers
The language supports specifying 64-bit unsigned values, but the num
field of the token structure is not guaranteed to be 64 bits wide.
Change its type to be unsigned long long, and change the code that
parses numbers to use strtoull() so we can actually accept a 64-bit
value.

This is also true of the value field of the token type.  Change it
to unsigned long long as well (and format it as unsigned).

Check the return value of strtoull(), and if the result is out of
range, report an error.

Signed-off-by: Alex Elder <elder@linaro.org>
Message-Id: <20211001232338.769309-23-elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-10-04 12:29:38 -05:00

23 lines
432 B
Plaintext

package test;
# This value requires more than 32 bits to represent
const TEST_NUMBER = 0x123456789;
struct qmi_result {
u16 result;
u16 error;
};
request test_request {
required u8 test_number = 0x12;
} = 0x100000000;
response test_response {
required qmi_result r = 2;
} = 040000000000;
indication test_indication {
# This value requires more than 64 bits to represent
optional u64 value = 0x12345678987654321;
} = 0x7;