mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00

Fixes https://github.com/dlang/dmd/issues/21271 Redefine the compatibility macro in terms of C99's `_Pragma()` instead of ignoring it. Clang and GCC will replace `_Pragma()` with `#pragma` directives in the preprocessed output, while cl.exe will actually convert it back to `__pragma()`. This is still a better situation than before as ImportC partially supports `__pragma()`.
16 lines
336 B
C
16 lines
336 B
C
// https://github.com/dlang/dmd/issues/21271
|
|
#define PUSH __pragma(pack(push))
|
|
#define PACK __pragma(pack(1))
|
|
#define POP __pragma(pack(pop))
|
|
|
|
PUSH
|
|
PACK
|
|
struct S21271_1 {
|
|
int x;
|
|
};
|
|
_Static_assert(_Alignof(struct S21271_1)==1, "1");
|
|
POP
|
|
struct S21271_2 {
|
|
int x;
|
|
};
|
|
_Static_assert(_Alignof(struct S21271_2)==_Alignof(int), "2");
|