From dc2ee3e3bc2668cb9fd1ca15f7769cded026c64c Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 30 Mar 2023 00:00:56 -0700 Subject: [PATCH] compiler.h: remove _may_alias_attribute This abstraction layer serves no purpose. Just use __attribute__((may_alias)) directly. --- include/wimlib/compiler.h | 3 --- src/lcpit_matchfinder.c | 4 ++-- src/resource.c | 4 ++-- src/write.c | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/wimlib/compiler.h b/include/wimlib/compiler.h index 612c058c..58f0692a 100644 --- a/include/wimlib/compiler.h +++ b/include/wimlib/compiler.h @@ -73,9 +73,6 @@ /* Prefetch into L1 cache for write. */ #define prefetchw(addr) __builtin_prefetch((addr), 1) -/* Declare that pointers to the annotated type may alias other pointers. */ -#define _may_alias_attribute __attribute__((may_alias)) - /* Hint that the annotated function is rarely called. */ #if GCC_PREREQ(4, 4) || __has_attribute(cold) # define _cold_attribute __attribute__((cold)) diff --git a/src/lcpit_matchfinder.c b/src/lcpit_matchfinder.c index b956859c..a1a1c02a 100644 --- a/src/lcpit_matchfinder.c +++ b/src/lcpit_matchfinder.c @@ -375,8 +375,8 @@ lcpit_advance_one_byte(const u32 cur_pos, static void expand_SA(void *p, u32 n) { - typedef u32 _may_alias_attribute aliased_u32_t; - typedef u64 _may_alias_attribute aliased_u64_t; + typedef u32 __attribute__((may_alias)) aliased_u32_t; + typedef u64 __attribute__((may_alias)) aliased_u64_t; aliased_u32_t *SA = p; aliased_u64_t *SA64 = p; diff --git a/src/resource.c b/src/resource.c index 0036c1b9..2fe57aff 100644 --- a/src/resource.c +++ b/src/resource.c @@ -333,8 +333,8 @@ read_compressed_wim_resource(const struct wim_resource_descriptor * const rdesc, /* Now fill in chunk_offsets from the entries we have read in * chunk_tab_data. We break aliasing rules here to avoid having * to allocate yet another array. */ - typedef le64 _may_alias_attribute aliased_le64_t; - typedef le32 _may_alias_attribute aliased_le32_t; + typedef le64 __attribute__((may_alias)) aliased_le64_t; + typedef le32 __attribute__((may_alias)) aliased_le32_t; u64 * chunk_offsets_p = chunk_offsets; if (alt_chunk_table) { diff --git a/src/write.c b/src/write.c index 2fa83f77..fa0b6913 100644 --- a/src/write.c +++ b/src/write.c @@ -506,8 +506,8 @@ end_chunk_table(struct write_blobs_ctx *ctx, u64 res_actual_size, 0 != (ctx->write_resource_flags & WRITE_RESOURCE_FLAG_SOLID)); - typedef le64 _may_alias_attribute aliased_le64_t; - typedef le32 _may_alias_attribute aliased_le32_t; + typedef le64 __attribute__((may_alias)) aliased_le64_t; + typedef le32 __attribute__((may_alias)) aliased_le32_t; if (chunk_entry_size == 4) { aliased_le32_t *entries = (aliased_le32_t*)ctx->chunk_csizes; -- 2.46.1