typeof(variable) *q = p; \
func(q); \
} \
+ /* Older compilers don't know retain attribute. */ \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
/* The actual destructor structure we place in a special section to find it */ \
_section_("SYSTEMD_STATIC_DESTRUCT") \
/* We pick pointer alignment, since that is apparently what gcc does for static variables */ \
_alignptr_ \
/* Make sure this is not dropped from the image because not explicitly referenced */ \
_used_ \
+ /* Prevent linker from garbage collection. */ \
+ _retain_ \
/* Make sure that AddressSanitizer doesn't pad this variable: we want everything in this section
* packed next to each other so that we can enumerate it. */ \
_variable_no_sanitize_address_ \
#define _pure_ __attribute__((__pure__))
#define _section_(x) __attribute__((__section__(x)))
#define _packed_ __attribute__((__packed__))
+#define _retain_ __attribute__((__retain__))
#define _used_ __attribute__((__used__))
#define _unused_ __attribute__((__unused__))
#define _cleanup_(x) __attribute__((__cleanup__(x)))
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
_section_("SYSTEMD_BUS_ERROR_MAP") \
_used_ \
- __attribute__((retain)) \
+ _retain_ \
_alignptr_ \
_variable_no_sanitize_address_
/* See static-destruct.h for an explanation of how this works. */
#define REGISTER_TEST(func, ...) \
- _section_("SYSTEMD_TEST_TABLE") _alignptr_ _used_ _variable_no_sanitize_address_ \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
+ _section_("SYSTEMD_TEST_TABLE") _alignptr_ _used_ _retain_ _variable_no_sanitize_address_ \
static const TestFunc UNIQ_T(static_test_table_entry, UNIQ) = { \
.f = (union f) &(func), \
.name = STRINGIFY(func), \