-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deflate_state
alignment with MS or clang-cl compilers
#1663
Conversation
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.
Here's sample program showing that repositioning align attribute after "struct" doesn't affect alignment with https://coliru.stacked-crooked.com/a/cc7bafe2614a1b52 If you compile the same code with
|
Did you check to see if any other struts suffer this same problem? |
That's the only place, clang-cl has no other warnings also. |
Fixing align attribute, makes ms compiler warn: 'internal_state': Alignment specifier is less than actual alignment (16), and will be ignored. Increasing alignemnt fixes the warning
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1663 +/- ##
========================================
Coverage 83.24% 83.24%
========================================
Files 135 135
Lines 10927 10927
Branches 2815 2815
========================================
Hits 9096 9096
Misses 1129 1129
Partials 702 702 ☔ View full report in Codecov by Sentry. |
Note, I added one more commit to increase alignment to 16 bytes. Fixing attribute made ms compiler understand the request and it started to complain:
|
@Dead2 ping |
When building with clang-cl, compiler produces the following warning:
Repositioning align attribute after "struct" fixes the warning and aligns
deflate_state
correctly.