mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 12:40:11 +03:00
Fix #21271 - ImportC: incorrect compatibility macro for __pragma
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()`.
This commit is contained in:
parent
dfe501dde6
commit
856d4921a0
2 changed files with 17 additions and 1 deletions
16
compiler/test/compilable/test21271.c
Normal file
16
compiler/test/compilable/test21271.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
// 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");
|
|
@ -59,7 +59,7 @@
|
|||
#define __forceinline __attribute__((always_inline))
|
||||
#undef _Check_return_
|
||||
//#define _Check_return_
|
||||
#define __pragma(x)
|
||||
#define __pragma(x) _Pragma(#x)
|
||||
|
||||
#undef _GLIBCXX_USE_FLOAT128
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue