From c40834b3bfd42edee634701de1b7035de79b60c8 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Wed, 27 Sep 2023 16:22:57 +0200 Subject: [PATCH] static_assert in c23 form --- drivers/g-wolves/g-wolves.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/g-wolves/g-wolves.h b/drivers/g-wolves/g-wolves.h index abe104c..9f3d9ca 100644 --- a/drivers/g-wolves/g-wolves.h +++ b/drivers/g-wolves/g-wolves.h @@ -6,6 +6,7 @@ #include #include #include +#include #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");