static_assert in c23 form

master
vhaudiquet 12 months ago
parent 0db4e4ee08
commit c40834b3bf
  1. 21
      drivers/g-wolves/g-wolves.h

@ -6,6 +6,7 @@
#include <wchar.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "devices/htx.h"
#include "devices/hts_plus.h"
@ -71,7 +72,7 @@ struct REPORT_DPI_SETTINGS
dpi_level_t levels[5];
uint8_t zeros[23];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_DPI_SETTINGS) == REPORT_MAX_SIZE, "Report DPI_SETTINGS not of right size");
static_assert(sizeof(struct REPORT_DPI_SETTINGS) == REPORT_MAX_SIZE, "Report DPI_SETTINGS not of right size");
struct REPORT_UNKNOWN_0
{
@ -82,7 +83,7 @@ struct REPORT_UNKNOWN_0
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_UNKNOWN_0) == REPORT_MAX_SIZE, "Report UNKNOWN_0 not of right size");
static_assert(sizeof(struct REPORT_UNKNOWN_0) == REPORT_MAX_SIZE, "Report UNKNOWN_0 not of right size");
struct REPORT_UNKNOWN_1
{
@ -93,7 +94,7 @@ struct REPORT_UNKNOWN_1
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_UNKNOWN_1) == REPORT_MAX_SIZE, "Report UNKNOWN_1 not of right size");
static_assert(sizeof(struct REPORT_UNKNOWN_1) == REPORT_MAX_SIZE, "Report UNKNOWN_1 not of right size");
struct REPORT_CLICK_DEBOUNCE_SETTINGS
{
@ -107,7 +108,7 @@ struct REPORT_CLICK_DEBOUNCE_SETTINGS
uint8_t zeros[REPORT_MAX_SIZE - 8];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_CLICK_DEBOUNCE_SETTINGS) == REPORT_MAX_SIZE, "Report CLICK_DEBOUNCE_SETTINGS not of right size");
static_assert(sizeof(struct REPORT_CLICK_DEBOUNCE_SETTINGS) == REPORT_MAX_SIZE, "Report CLICK_DEBOUNCE_SETTINGS not of right size");
struct REPORT_LIFT_OFF
{
@ -118,7 +119,7 @@ struct REPORT_LIFT_OFF
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_LIFT_OFF) == REPORT_MAX_SIZE, "Report LIFT_OFF not of right size");
static_assert(sizeof(struct REPORT_LIFT_OFF) == REPORT_MAX_SIZE, "Report LIFT_OFF not of right size");
struct REPORT_ANGLE_SNAP
{
@ -129,7 +130,7 @@ struct REPORT_ANGLE_SNAP
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_ANGLE_SNAP) == REPORT_MAX_SIZE, "Report ANGLE_SNAP not of right size");
static_assert(sizeof(struct REPORT_ANGLE_SNAP) == REPORT_MAX_SIZE, "Report ANGLE_SNAP not of right size");
struct REPORT_MOTION_SYNC
{
@ -139,7 +140,7 @@ struct REPORT_MOTION_SYNC
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_MOTION_SYNC) == REPORT_MAX_SIZE, "Report MOTION_SYNC not of right size");
static_assert(sizeof(struct REPORT_MOTION_SYNC) == REPORT_MAX_SIZE, "Report MOTION_SYNC not of right size");
struct REPORT_UNKNOWN_6
{
@ -154,7 +155,7 @@ struct REPORT_UNKNOWN_6
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 6];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_UNKNOWN_6) == REPORT_MAX_SIZE, "Report UNKNOWN_6 not of right size");
static_assert(sizeof(struct REPORT_UNKNOWN_6) == REPORT_MAX_SIZE, "Report UNKNOWN_6 not of right size");
struct REPORT_BATTERY
{
@ -165,7 +166,7 @@ struct REPORT_BATTERY
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 2];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_BATTERY) == REPORT_MAX_SIZE, "Report BATTERY not of right size");
static_assert(sizeof(struct REPORT_BATTERY) == REPORT_MAX_SIZE, "Report BATTERY not of right size");
struct REPORT_WIRELESS
{
@ -174,4 +175,4 @@ struct REPORT_WIRELESS
uint8_t mouse_connected; // 0 if disconnected, else 1
uint8_t zeros[REPORT_MAX_SIZE - sizeof(report_header_t) - 1];
} __attribute__((packed));
_Static_assert(sizeof(struct REPORT_WIRELESS) == REPORT_MAX_SIZE, "Report WIRELESS not of right size");
static_assert(sizeof(struct REPORT_WIRELESS) == REPORT_MAX_SIZE, "Report WIRELESS not of right size");

Loading…
Cancel
Save