clean: mark all Idxheader
packed explicitly
#1785
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #1576
This PR does absolutely nothing technically, because removing these packing compiler directives is OK 😅😅😅.
In both 32 & 64 bits machines, a
struct
with all 32bit fields will be already “packed” (This doesn't appear to be in the standard, but it is what all 3 major compilers do).However, this PR makes code's purpose clear (Not really, because only after reading the code, one would know that GD is using this trick to read/write multiple fields at once) and reduce inconsistency (It is pretty weird to see the inconsistency as showed in #1576.).
This PR also removes gcc and clang's
__attribute__((packed))__
because they both of them supports#pragma pack(push, 1) -> #pragma pack(pop)
since ages ago (In fact, clang has a warning about incomplete pair of push/pop).I tested this code https://godbolt.org/z/YvWvsf9ad for compilers that we care (the one in Debian stable & Ubuntu 22.04 and some older ones). To ensure this certainly works, I added a harmless
static_assert
for everyidxHeader
.This PR corrected 2 inconsistent
int
indsl.cc
andgsl.cc
. This change is correct because based on this table theint
type is 32bit anyway (https://en.cppreference.com/w/cpp/language/types#Properties).