mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 05:36:23 +02:00
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>
This commit is contained in:
@@ -63,6 +63,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -257,6 +258,14 @@ extern int optind;
|
|||||||
extern int opterr;
|
extern int opterr;
|
||||||
extern int optopt;
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user