From 950eb6f7413db56ebf97ed95a299f84af6a47b97 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 15 Oct 2024 02:40:20 +0100 Subject: [PATCH] misc: fix build on arm32 Instead of using memcmp to compare windows_options, and thus relying on the struct being laid out without padding, just compare the fields one-by-one. Fixes #1355 Signed-off-by: Yuxuan Shui --- CHANGELOG.md | 6 ++++++ src/config.h | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1483104232..bf65e9bbc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 12.x (unreleased) + +## Build fixes + +* Fix build on arm32 (#1355) + # 12.3 (2024-Oct-14) ## Improvements diff --git a/src/config.h b/src/config.h index 369579acb8..b1d0f251e1 100644 --- a/src/config.h +++ b/src/config.h @@ -199,9 +199,6 @@ struct window_maybe_options { struct win_script animations[ANIMATION_TRIGGER_COUNT]; }; -// Make sure `window_options` has no implicit padding. -#pragma GCC diagnostic push -#pragma GCC diagnostic error "-Wpadded" /// Like `window_maybe_options`, but all fields are guaranteed to be set. struct window_options { double opacity; @@ -220,13 +217,18 @@ struct window_options { struct win_script animations[ANIMATION_TRIGGER_COUNT]; }; -#pragma GCC diagnostic pop static inline bool win_options_no_damage(const struct window_options *a, const struct window_options *b) { // Animation changing does not immediately change how window is rendered, so - // they don't cause damage. - return memcmp(a, b, offsetof(struct window_options, animations)) == 0; + // they don't cause damage; all other options do. + return a->opacity == b->opacity && a->dim == b->dim && + a->corner_radius == b->corner_radius && a->unredir == b->unredir && + a->transparent_clipping == b->transparent_clipping && + a->shadow == b->shadow && a->invert_color == b->invert_color && + a->blur_background == b->blur_background && a->fade == b->fade && + a->clip_shadow_above == b->clip_shadow_above && a->paint == b->paint && + a->full_shadow == b->full_shadow && a->shader == b->shader; } /// Structure representing all options.