util: Use the gcc_struct attribute for packed structures in mingw

Actually set the packing behavior as the intended one when using this attribute,
even on mingw.

Otherwise, the default behavior is to use the ms_struct which makes the structures
use more space in some situations.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23338>
This commit is contained in:
Corentin Noël 2023-05-31 17:48:36 +02:00 committed by Marge Bot
parent b06be7c002
commit 86532fa21d

View file

@ -204,7 +204,11 @@ do { \
* packed, to trade off performance for space.
*/
#ifdef HAVE_FUNC_ATTRIBUTE_PACKED
# if defined(__MINGW32__) || defined(__MINGW64__)
# define PACKED __attribute__((gcc_struct,__packed__))
# else
# define PACKED __attribute__((__packed__))
# endif
#else
#define PACKED
#endif