summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-05-10 12:50:21 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-05-10 12:52:20 +1000
commit07ed6d6f9275eb027e3d28d5d6a757687b49e719 (patch)
tree440a65113f71d6eb744aa1c9d803eed52dfa1caa /src
parent02fca305edb5762559df4c0ba0cd30d931a5fcc4 (diff)
Ensure enums are size int
Because otherwise things go boom, but unless you passed -fshort-enums this shouldn't happen anyway. And gcc's documentation says don't do that. So don't do that, or we'll scream at you. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Armin Krezović <krezovic.armin@gmail.com> Tested-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Diffstat (limited to 'src')
-rw-r--r--src/libinput.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libinput.c b/src/libinput.c
index 23255b0..f221b6a 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -43,6 +43,37 @@
if (!check_event_type(li_, __func__, type_, __VA_ARGS__, -1)) \
return retval_; \
+#define ASSERT_INT_SIZE(type_) \
+ static_assert(sizeof(type_) == sizeof(unsigned int), \
+ "sizeof(" #type_ ") must be sizeof(uint)")
+
+ASSERT_INT_SIZE(enum libinput_log_priority);
+ASSERT_INT_SIZE(enum libinput_device_capability);
+ASSERT_INT_SIZE(enum libinput_key_state);
+ASSERT_INT_SIZE(enum libinput_led);
+ASSERT_INT_SIZE(enum libinput_button_state);
+ASSERT_INT_SIZE(enum libinput_pointer_axis);
+ASSERT_INT_SIZE(enum libinput_pointer_axis_source);
+ASSERT_INT_SIZE(enum libinput_tablet_pad_ring_axis_source);
+ASSERT_INT_SIZE(enum libinput_tablet_pad_strip_axis_source);
+ASSERT_INT_SIZE(enum libinput_tablet_tool_type);
+ASSERT_INT_SIZE(enum libinput_tablet_tool_proximity_state);
+ASSERT_INT_SIZE(enum libinput_tablet_tool_tip_state);
+ASSERT_INT_SIZE(enum libinput_switch_state);
+ASSERT_INT_SIZE(enum libinput_switch);
+ASSERT_INT_SIZE(enum libinput_event_type);
+ASSERT_INT_SIZE(enum libinput_config_status);
+ASSERT_INT_SIZE(enum libinput_config_tap_state);
+ASSERT_INT_SIZE(enum libinput_config_tap_button_map);
+ASSERT_INT_SIZE(enum libinput_config_drag_state);
+ASSERT_INT_SIZE(enum libinput_config_drag_lock_state);
+ASSERT_INT_SIZE(enum libinput_config_send_events_mode);
+ASSERT_INT_SIZE(enum libinput_config_accel_profile);
+ASSERT_INT_SIZE(enum libinput_config_click_method);
+ASSERT_INT_SIZE(enum libinput_config_middle_emulation_state);
+ASSERT_INT_SIZE(enum libinput_config_scroll_method);
+ASSERT_INT_SIZE(enum libinput_config_dwt_state);
+
static inline bool
check_event_type(struct libinput *libinput,
const char *function_name,