]> wimlib.net Git - wimlib/commitdiff
compiler.h: remove _aligned_attribute
authorEric Biggers <ebiggers3@gmail.com>
Thu, 30 Mar 2023 07:00:56 +0000 (00:00 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 30 Mar 2023 07:16:51 +0000 (00:16 -0700)
This abstraction layer serves no purpose.  Just use
__attribute__((aligned(n))) directly.

14 files changed:
include/wimlib/compiler.h
include/wimlib/decompress_common.h
include/wimlib/inode.h
include/wimlib/xattr.h
src/dentry.c
src/header.c
src/lzms_compress.c
src/lzx_compress.c
src/lzx_decompress.c
src/tagged_items.c
src/test_support.c
src/win32_apply.c
src/win32_capture.c
src/xpress_decompress.c

index d164184d2a090eded0fd45db9bb7f2e61b68b6db..2013cd12b100c2c49e4bda5efb77647bb3222af4 100644 (file)
  * struct itself may be misaligned.  */
 #define _packed_attribute      __attribute__((packed))
 
-/* Declare that the annotated variable, or variables of the annotated type, are
- * to be aligned on n-byte boundaries.  */
-#define _aligned_attribute(n)  __attribute__((aligned(n)))
-
 /* Declare that pointers to the annotated type may alias other pointers.  */
 #define _may_alias_attribute   __attribute__((may_alias))
 
index c42912674f972108faea215c0da49d5cbf47e753..46fce94fda6224716b0411baed52b1371c8ea98d 100644 (file)
@@ -403,7 +403,7 @@ read_huffsym(struct input_bitstream *is, const u16 decode_table[],
 #define DECODE_TABLE(name, num_syms, table_bits, max_codeword_len) \
        u16 name[DECODE_TABLE_SIZE((num_syms), (table_bits), \
                                   (max_codeword_len))] \
-               _aligned_attribute(DECODE_TABLE_ALIGNMENT)
+               __attribute__((aligned(DECODE_TABLE_ALIGNMENT)))
 
 /*
  * Declare the temporary "working_space" array needed for building the decode
index 56b177e84119f45c89a41c25e49fb6f885692e96..23b304ee2deb6dce488677fd814cf0d3893fd113 100644 (file)
@@ -229,7 +229,7 @@ struct wim_inode {
 /* Optional extra data for a WIM inode  */
 struct wim_inode_extra {
        size_t size;    /* Size of the extra data in bytes  */
-       u8 data[] _aligned_attribute(8); /* The extra data  */
+       u8 data[] __attribute__((aligned(8))); /* The extra data  */
 };
 
 /*
index 2d297245aaf3a808115989d05d21d885fd876b3c..13fb21b8bf526327f1090b925e1401fc0cb5cdf6 100644 (file)
@@ -98,7 +98,7 @@ struct wimlib_xattr_entry_old {
        /* u8 value[0]; */
 
        /* then zero-padded to a 4-byte boundary */
-} _aligned_attribute(4);
+} __attribute__((aligned(4)));
 
 static inline size_t
 old_xattr_entry_size(const struct wimlib_xattr_entry_old *entry)
index 42241ef28c945b51dc9aa942d2e469cda0bc429f..3e09993c9ae88b715333e2d65e4b2f7ee9264b46 100644 (file)
@@ -194,7 +194,7 @@ struct wim_dentry_on_disk {
         * field) after 8-byte alignment, then the remaining space will be a
         * variable-length list of tagged metadata items.  See tagged_items.c
         * for more information.  */
-       /* u8 tagged_items[] _aligned_attribute(8); */
+       /* u8 tagged_items[] __attribute__((aligned(8))); */
 
 } _packed_attribute;
        /* If num_extra_streams != 0, then there are that many extra stream
index 3424edadf4d37394f760c0228b2d170bb7d246c9..b5cd441a890c787786444b7f2be1d6dd75f49dbc 100644 (file)
@@ -62,7 +62,7 @@
 int
 read_wim_header(WIMStruct *wim, struct wim_header *hdr)
 {
-       struct wim_header_disk disk_hdr _aligned_attribute(8);
+       struct wim_header_disk disk_hdr __attribute__((aligned(8)));
        struct filedes *in_fd = &wim->in_fd;
        const tchar *filename = wim->filename;
        int ret;
@@ -170,7 +170,7 @@ int
 write_wim_header(const struct wim_header *hdr, struct filedes *out_fd,
                 off_t offset)
 {
-       struct wim_header_disk disk_hdr _aligned_attribute(8);
+       struct wim_header_disk disk_hdr __attribute__((aligned(8)));
        int ret;
 
        disk_hdr.magic = cpu_to_le64(hdr->magic);
index 6843859b02ca240ec837105deff72ff3463ea009..5056cb3006a9eeefbda061994456db830f0d6243 100644 (file)
@@ -198,7 +198,7 @@ struct lzms_adaptive_state {
        u8 lz_rep_states[LZMS_NUM_LZ_REP_DECISIONS];
        u8 delta_state;
        u8 delta_rep_states[LZMS_NUM_DELTA_REP_DECISIONS];
-} _aligned_attribute(64);
+} __attribute__((aligned(64)));
 
 /*
  * This structure represents a byte position in the preprocessed input data and
@@ -251,7 +251,7 @@ struct lzms_optimum_node {
         * maintained per-position and are only updated occasionally.
         */
        struct lzms_adaptive_state state;
-} _aligned_attribute(64);
+} __attribute__((aligned(64)));
 
 /* The main compressor structure  */
 struct lzms_compressor {
index 453f97d4f8351054e43010739b5fe601e684bc64..430e0dd414c0fc5aacb2f760ce03157e0bcb17ab 100644 (file)
@@ -287,7 +287,7 @@ struct lzx_sequence {
        u32 adjusted_offset_and_mainsym;
 #define SEQ_MAINSYM_BITS       10
 #define SEQ_MAINSYM_MASK       (((u32)1 << SEQ_MAINSYM_BITS) - 1)
-} _aligned_attribute(8);
+} __attribute__((aligned(8)));
 
 /*
  * This structure represents a byte position in the input buffer and a node in
@@ -333,7 +333,7 @@ struct lzx_optimum_node {
 #  define OPTIMUM_GAP_MATCH 0x80000000
 #endif
 
-} _aligned_attribute(8);
+} __attribute__((aligned(8)));
 
 /* The cost model for near-optimal parsing */
 struct lzx_costs {
@@ -1315,7 +1315,7 @@ lzx_should_end_block(struct lzx_block_split_stats *stats)
  */
 struct lzx_lru_queue {
        u64 R;
-} _aligned_attribute(8);
+} __attribute__((aligned(8)));
 
 #define LZX_QUEUE_OFFSET_SHIFT 21
 #define LZX_QUEUE_OFFSET_MASK  (((u64)1 << LZX_QUEUE_OFFSET_SHIFT) - 1)
index 5747d327270717ae6892c257374088e4dfec789d..bd63da78e6ad527b858d7ef9df9cd13a6e1bd75d 100644 (file)
@@ -115,7 +115,7 @@ struct lzx_decompressor {
         * bits of aligned offset blocks */
        u8 extra_offset_bits_minus_aligned[LZX_MAX_OFFSET_SLOTS];
 
-} _aligned_attribute(DECODE_TABLE_ALIGNMENT);
+} __attribute__((aligned(DECODE_TABLE_ALIGNMENT)));
 
 /* Read a Huffman-encoded symbol using the precode. */
 static forceinline unsigned
index 69eb6404a6a0ffc0547f81feb219d5cf8fa364e6..9343e02032444b3ebc1f8d43f4756a4afdcae4a2 100644 (file)
@@ -48,7 +48,7 @@ struct tagged_item_header {
        u8 data[0];
 
        /* then zero-padded to an 8-byte boundary */
-} _aligned_attribute(8);
+} __attribute__((aligned(8)));
 
 /*
  * Retrieve from @inode the first metadata item that is tagged with @tag and
index 91cb468ce980fe4f3fb715b1a5423a9255a0f6b2..a3434d5dea384266ece6ca503ec6dca31db844f2 100644 (file)
@@ -569,7 +569,7 @@ set_random_metadata(struct wim_inode *inode, struct generation_context *ctx)
 
        /* Security descriptor  */
        if (randbool()) {
-               char desc[8192] _aligned_attribute(8);
+               char desc[8192] __attribute__((aligned(8)));
                size_t size;
 
                size = generate_random_security_descriptor(desc, ctx);
index 5011efffbf1dcf4e14747ab6c77d62353bb0e373..70211cd31b40c34f13516a6c2ca863f6f5dc3f16 100644 (file)
@@ -1244,7 +1244,7 @@ remove_conflicting_short_name(const struct wim_dentry *dentry, struct win32_appl
        HANDLE h;
        size_t bufsize = offsetof(FILE_NAME_INFORMATION, FileName) +
                         (13 * sizeof(wchar_t));
-       u8 buf[bufsize] _aligned_attribute(8);
+       u8 buf[bufsize] __attribute__((aligned(8)));
        bool retried = false;
        FILE_NAME_INFORMATION *info = (FILE_NAME_INFORMATION *)buf;
 
@@ -1326,7 +1326,7 @@ set_short_name(HANDLE h, const struct wim_dentry *dentry,
        size_t bufsize = offsetof(FILE_NAME_INFORMATION, FileName) +
                         max(dentry->d_short_name_nbytes, sizeof(wchar_t)) +
                         sizeof(wchar_t);
-       u8 buf[bufsize] _aligned_attribute(8);
+       u8 buf[bufsize] __attribute__((aligned(8)));
        FILE_NAME_INFORMATION *info = (FILE_NAME_INFORMATION *)buf;
        NTSTATUS status;
        bool tried_to_remove_existing = false;
@@ -1634,7 +1634,7 @@ create_empty_streams(const struct wim_dentry *dentry,
                if (strm->stream_type == STREAM_TYPE_REPARSE_POINT &&
                    ctx->common.supported_features.reparse_points)
                {
-                       u8 buf[REPARSE_DATA_OFFSET] _aligned_attribute(8);
+                       u8 buf[REPARSE_DATA_OFFSET] __attribute__((aligned(8)));
                        struct reparse_buffer_disk *rpbuf =
                                (struct reparse_buffer_disk *)buf;
                        complete_reparse_point(rpbuf, inode, 0);
@@ -1843,7 +1843,7 @@ create_link(HANDLE h, const struct wim_dentry *dentry,
 
                size_t bufsize = offsetof(FILE_LINK_INFORMATION, FileName) +
                                 ctx->pathbuf.Length + sizeof(wchar_t);
-               u8 buf[bufsize] _aligned_attribute(8);
+               u8 buf[bufsize] __attribute__((aligned(8)));
                FILE_LINK_INFORMATION *info = (FILE_LINK_INFORMATION *)buf;
                NTSTATUS status;
 
@@ -2832,7 +2832,7 @@ set_xattrs(HANDLE h, const struct wim_inode *inode, struct win32_apply_ctx *ctx)
        u32 len;
        const struct wim_xattr_entry *entry;
        size_t bufsize = 0;
-       u8 _buf[1024] _aligned_attribute(4);
+       u8 _buf[1024] __attribute__((aligned(4)));
        u8 *buf = _buf;
        FILE_FULL_EA_INFORMATION *ea, *ea_prev;
        NTSTATUS status;
index f9fae537f9afa6ca1549e9709b5742ed81935a9b..331a0dce32e505c0d91932718ef98f54aebb271a 100644 (file)
@@ -330,7 +330,7 @@ read_winnt_stream_prefix(const struct windows_file *file,
        };
        HANDLE h;
        NTSTATUS status;
-       u8 buf[BUFFER_SIZE] _aligned_attribute(8);
+       u8 buf[BUFFER_SIZE] __attribute__((aligned(8)));
        u64 bytes_remaining;
        int ret;
 
@@ -512,7 +512,7 @@ winnt_get_short_name(HANDLE h, struct wim_dentry *dentry)
         * course has to create its own handle.  */
        NTSTATUS status;
        IO_STATUS_BLOCK iosb;
-       u8 buf[128] _aligned_attribute(8);
+       u8 buf[128] __attribute__((aligned(8)));
        const FILE_NAME_INFORMATION *info;
 
        status = NtQueryInformationFile(h, &iosb, buf, sizeof(buf),
@@ -537,7 +537,7 @@ winnt_load_security_descriptor(HANDLE h, struct wim_inode *inode,
                               struct winnt_scan_ctx *ctx)
 {
        SECURITY_INFORMATION requestedInformation;
-       u8 _buf[4096] _aligned_attribute(8);
+       u8 _buf[4096] __attribute__((aligned(8)));
        u8 *buf;
        ULONG bufsize;
        ULONG len_needed;
@@ -705,7 +705,7 @@ winnt_load_xattrs(HANDLE h, struct wim_inode *inode,
 {
        IO_STATUS_BLOCK iosb;
        NTSTATUS status;
-       u8 _buf[1024] _aligned_attribute(4);
+       u8 _buf[1024] __attribute__((aligned(4)));
        u8 *buf = _buf;
        const FILE_FULL_EA_INFORMATION *ea;
        struct wim_xattr_entry *entry;
@@ -1331,7 +1331,7 @@ winnt_scan_data_streams(HANDLE h, struct wim_inode *inode, u64 file_size,
                        struct winnt_scan_ctx *ctx)
 {
        int ret;
-       u8 _buf[4096] _aligned_attribute(8);
+       u8 _buf[4096] __attribute__((aligned(8)));
        u8 *buf;
        size_t bufsize;
        IO_STATUS_BLOCK iosb;
@@ -1654,7 +1654,8 @@ get_file_info(HANDLE h, struct file_info *info)
 static void
 get_volume_information(HANDLE h, struct winnt_scan_ctx *ctx)
 {
-       u8 _attr_info[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 128] _aligned_attribute(8);
+       u8 _attr_info[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 128]
+               __attribute__((aligned(8)));
        FILE_FS_ATTRIBUTE_INFORMATION *attr_info = (void *)_attr_info;
        FILE_FS_VOLUME_INFORMATION vol_info;
        struct file_info file_info;
index d6e606cb962df887311488d554e8e0e0b1bdd1ad..5d7d5086527f2f42ebbefdafada9ae5c5d28728c 100644 (file)
@@ -84,7 +84,7 @@ struct xpress_decompressor {
        };
        DECODE_TABLE_WORKING_SPACE(working_space, XPRESS_NUM_SYMBOLS,
                                   XPRESS_MAX_CODEWORD_LEN);
-} _aligned_attribute(DECODE_TABLE_ALIGNMENT);
+} __attribute__((aligned(DECODE_TABLE_ALIGNMENT)));
 
 static int
 xpress_decompress(const void *restrict compressed_data, size_t compressed_size,