From: Pavel P Date: Sun, 11 Feb 2024 15:02:37 +0000 (+0200) Subject: Fix `deflate_state` alignment with MS or clang-cl compilers X-Git-Tag: 2.2.0~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0456bce1cc3097db0db6db8568f9ff222683d64e;p=thirdparty%2Fzlib-ng.git Fix `deflate_state` alignment with MS or clang-cl compilers When building with clang-cl, compiler produces the following warning: zlib-ng/deflate.h(287,3): warning : attribute 'align' is ignored, place it after "struct" to apply attribute to type declaration [-Wignored-attributes] zlib-ng/zbuild.h(196,34): note: expanded from macro 'ALIGNED_' Repositioning align attribute after "struct" fixes the warning and aligns `deflate_state` correctly. --- diff --git a/deflate.h b/deflate.h index f49ea06b..0a1d34e1 100644 --- a/deflate.h +++ b/deflate.h @@ -117,7 +117,7 @@ typedef uint32_t (* update_hash_cb) (deflate_state *const s, uint32_t h, typedef void (* insert_string_cb) (deflate_state *const s, uint32_t str, uint32_t count); typedef Pos (* quick_insert_string_cb)(deflate_state *const s, uint32_t str); -struct internal_state { +struct ALIGNED_(8) internal_state { PREFIX3(stream) *strm; /* pointer back to this zlib stream */ unsigned char *pending_buf; /* output still pending */ unsigned char *pending_out; /* next pending byte to output to the stream */ @@ -297,7 +297,7 @@ struct internal_state { /* Reserved for future use and alignment purposes */ int32_t reserved[11]; -} ALIGNED_(8); +}; typedef enum { need_more, /* block not completed, need more input or more output */