Skip to content

Commit

Permalink
Weaken dmd-testsuite's compilable/cattributes.i wrt. unsupported __de…
Browse files Browse the repository at this point in the history
…clspec(naked) / __attribute__((naked))

These attributes are apparently treated as if the function body
started with `asm { naked; }`, where LDC only accepts DMD-style
inline asm statements for that function body. `@naked` wouldn't
be an option either, as that includes skipping our prologue, so
accessing parameters is only safe in asm via register/stack slot
directly.
  • Loading branch information
kinke committed Jul 23, 2023
1 parent 40df405 commit 1a1c2a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/dmd/compilable/cattributes.i
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ __declspec(dllexport) int ghi() { return 3; }

__declspec(dllexport) int jkl;

__declspec(naked) __declspec(dllexport)
/* LDC FIXME: __declspec(naked) restricts bodies to DMD-style inline asm
__declspec(naked)*/ __declspec(dllexport)
int test(int a, int b, int c, int d, int e, int f)
{
return a + b + c + d + e + f + abc + def() + ghi() + jkl;
Expand All @@ -24,7 +25,8 @@ __attribute__((dllexport)) int ghix() { return 3; }

__attribute__((dllexport)) int jklx;

__attribute__((naked)) __attribute__((dllexport))
/* LDC FIXME: ditto for __attribute__((naked))
__attribute__((naked))*/ __attribute__((dllexport))
int testx(int a, int b, int c, int d, int e, int f)
{
return a + b + c + d + e + f + abcx + defx() + ghix() + jklx;
Expand Down

0 comments on commit 1a1c2a2

Please sign in to comment.