Bug 22315 – ImportC: #pragma pack is not implemented

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-18T08:10:41Z
Last change time
2021-10-21T21:39:27Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2021-09-18T08:10:41Z
I believe Walter has said that he doesn’t intend to support #pragma pack, but I have discovered some macOS system headers that use the feature. At least, fcntl.h and sys/event.h use the feature in defining some structures. An example from event.h: #pragma pack(4) struct kevent { uintptr_t ident; /* identifier for this event */ int16_t filter; /* filter for event */ uint16_t flags; /* general flags */ uint32_t fflags; /* filter-specific flags */ intptr_t data; /* filter-specific data */ void *udata; /* opaque user data identifier */ }; #pragma pack() (I have no idea why pragma pack is even used here, the structure has no padding). I haven’t studied the headers closely enough to see if ignoring it matters or not.
Comment #1 by bugzilla — 2021-09-26T09:41:35Z
It would have padding if uintptr_t is 64 bits.
Comment #2 by bugzilla — 2021-09-28T05:56:21Z
Comment #3 by bugzilla — 2021-09-28T06:10:59Z
https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Type-Attributes.html for: __attribute__ ((aligned)) __attribute__ ((packed))
Comment #4 by bugzilla — 2021-10-02T02:47:41Z
Comment #5 by dlang-bot — 2021-10-14T08:06:23Z
@WalterBright created dlang/dmd pull request #13166 "fix Issue 22315 - ImportC: #pragma pack is not implemented" fixing this issue: - fix Issue 22315 - ImportC: #pragma pack is not implemented https://github.com/dlang/dmd/pull/13166
Comment #6 by dlang-bot — 2021-10-14T19:00:18Z
dlang/dmd pull request #13166 "fix Issue 22315 - ImportC: #pragma pack is not implemented" was merged into stable: - fc97a3c00146f8ee1a6ae6d89f64b9bbcd80ad34 by Walter Bright: fix Issue 22315 - ImportC: #pragma pack is not implemented https://github.com/dlang/dmd/pull/13166
Comment #7 by dlang-bot — 2021-10-21T21:39:27Z
dlang/dmd pull request #13209 "Merge stable into master" was merged into master: - 3131d4789f3af6fab2040cfcc5897c0113e41335 by Walter Bright: fix Issue 22315 - ImportC: #pragma pack is not implemented (#13166) https://github.com/dlang/dmd/pull/13209