_Static_assert() requires message

At least until C23, even if GCC allows it w/o errors being raised.
This commit is contained in:
Henry Gabryjelski committed 2025-09-03 16:38:42 -07:00
1 parent e6ed87072f
commit 12aef961a2
1 file changed
+3 -3
+3 -3
View File
@@ -717,9 +717,9 @@ static const uint8_t S12906b_odd_parity_bit_0[] = { 1, 2, 4, 5, 7, 8, 1
static const uint8_t S12906b_even_parity_bit_9[] = { 2, 3, 5, 6, 8, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35 };
static const uint8_t S12906b_even_parity_bit_10[] = { 1, 3, 4, 6, 7, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24, 26, 27, 29, 30, 32, 33, 35 };
#define S12906b_BITS_USED_BY_PARITY (22u)
_Static_assert((sizeof( S12906b_odd_parity_bit_0 ) / sizeof( S12906b_odd_parity_bit_0 [0])) == S12906b_BITS_USED_BY_PARITY);
_Static_assert((sizeof(S12906b_even_parity_bit_9 ) / sizeof(S12906b_even_parity_bit_9 [0])) == S12906b_BITS_USED_BY_PARITY);
_Static_assert((sizeof(S12906b_even_parity_bit_10) / sizeof(S12906b_even_parity_bit_10[0])) == S12906b_BITS_USED_BY_PARITY);
_Static_assert((sizeof( S12906b_odd_parity_bit_0 ) / sizeof( S12906b_odd_parity_bit_0 [0])) == S12906b_BITS_USED_BY_PARITY, "Wrong array length");
_Static_assert((sizeof(S12906b_even_parity_bit_9 ) / sizeof(S12906b_even_parity_bit_9 [0])) == S12906b_BITS_USED_BY_PARITY, "Wrong array length");
_Static_assert((sizeof(S12906b_even_parity_bit_10) / sizeof(S12906b_even_parity_bit_10[0])) == S12906b_BITS_USED_BY_PARITY, "Wrong array length");
static bool Pack_S12906b(int format_idx, wiegand_card_t *card, wiegand_message_t *packed, bool preamble) {
memset(packed, 0, sizeof(wiegand_message_t));