From 4571d99edb945cc3d7a00a53017437ad1030cd4b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 18 Feb 2025 21:10:51 +0100 Subject: [PATCH] Fix: Build error with GCC 11.1 after recent changes Remove the padding optimization, it's not significant with the size of this struct. And by removing the extra padding for bias the size is the same as before. Pull Request: https://projects.blender.org/blender/blender/pulls/134769 --- source/blender/blenlib/intern/boxpack_2d.cc | 24 ++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/source/blender/blenlib/intern/boxpack_2d.cc b/source/blender/blenlib/intern/boxpack_2d.cc index f7a9f3cb0e1..623393832eb 100644 --- a/source/blender/blenlib/intern/boxpack_2d.cc +++ b/source/blender/blenlib/intern/boxpack_2d.cc @@ -20,10 +20,6 @@ #include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */ -#ifdef __GNUC__ -# pragma GCC diagnostic error "-Wpadded" -#endif - /* de-duplicate as we pack */ #define USE_MERGE /* use strip-free */ @@ -38,11 +34,14 @@ struct BoxVert { float x; float y; - int free : 8; /* vert status */ - uint used : 1; - uint _pad : 23; + int free; /* vert status */ + bool used; uint index; +#ifdef USE_PACK_BIAS + float bias; +#endif + BoxPack *trb; /* top right box */ BoxPack *blb; /* bottom left box */ BoxPack *brb; /* bottom right box */ @@ -51,17 +50,8 @@ struct BoxVert { /* Store last intersecting boxes here * speedup intersection testing */ BoxPack *isect_cache[4]; - -#ifdef USE_PACK_BIAS - float bias; - int _pad2; -#endif }; -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wpadded" -#endif - /* free vert flags */ #define EPSILON 0.0000001f #define EPSILON_MERGE 0.00001f @@ -459,7 +449,7 @@ void BLI_box_pack_2d( tot_y = max_ff(box_ymax_get(box), tot_y); /* Place the box */ - vert->free &= (signed char)~quad_flag(j); + vert->free &= ~quad_flag(j); switch (j) { case TR: