From 021e887de99444492b992805fcaf4acd9e72a781 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 14 Dec 2024 15:31:27 -0800 Subject: [PATCH] xcb.h: use __has_attribute to check for attribute((__packed__)) support Signed-off-by: Alan Coopersmith Part-of: --- src/xcb.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/xcb.h b/src/xcb.h index b4fb3fd..fd6b7b9 100644 --- a/src/xcb.h +++ b/src/xcb.h @@ -47,7 +47,11 @@ extern "C" { * @file xcb.h */ -#ifdef __GNUC__ +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with older compilers. */ +#endif + +#if defined(__GNUC__) || __has_attribute(__packed__) #define XCB_PACKED __attribute__((__packed__)) #else #define XCB_PACKED