summaryrefslogtreecommitdiff
path: root/util/spkmodem_decode
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-13 01:26:42 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:40 +0000
commita049f2df3956b48cf57cc412780c530af7c4c343 (patch)
tree9f7915055e9bb6f0b856e8c0e7ca9ef711fa4a92 /util/spkmodem_decode
parent681f580053e4672c1406143454a7d81d62dc62f1 (diff)
util/spkmodem-decode: static asserts
assert integer sizes, important in this program because we make several implicit assumptions about word sizes, and integers need to be of a certain size. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/spkmodem_decode')
-rw-r--r--util/spkmodem_decode/spkmodem-decode.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/spkmodem_decode/spkmodem-decode.c b/util/spkmodem_decode/spkmodem-decode.c
index a24c22d1..348840ac 100644
--- a/util/spkmodem_decode/spkmodem-decode.c
+++ b/util/spkmodem_decode/spkmodem-decode.c
@@ -63,6 +63,7 @@
#endif
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -257,6 +258,14 @@ extern int optind;
extern int opterr;
extern int optopt;
+typedef char static_assert_char_is_8_bits[(CHAR_BIT == 8) ? 1 : -1];
+typedef char static_assert_char_is_1[(sizeof(char) == 1) ? 1 : -1];
+typedef char static_assert_short[(sizeof(short) == 2) ? 1 : -1];
+typedef char static_assert_int_is_4[(sizeof(int) >= 4) ? 1 : -1];
+typedef char static_assert_twos_complement[
+ ((-1 & 3) == 3) ? 1 : -1
+];
+
int
main(int argc, char **argv)
{