mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
fix Issue 23347 - ImportC: pragma pack causes asm label to set symbol name to be ignored (#14481)
This commit is contained in:
parent
f382f39582
commit
27a952e316
2 changed files with 28 additions and 9 deletions
|
@ -1886,15 +1886,6 @@ final class CParser(AST) : Parser!AST
|
|||
}
|
||||
if (s !is null)
|
||||
{
|
||||
s = applySpecifier(s, specifier);
|
||||
if (level == LVL.local)
|
||||
{
|
||||
// Wrap the declaration in `extern (C) { declaration }`
|
||||
// Necessary for function pointers, but harmless to apply to all.
|
||||
auto decls = new AST.Dsymbols(1);
|
||||
(*decls)[0] = s;
|
||||
s = new AST.LinkDeclaration(s.loc, linkage, decls);
|
||||
}
|
||||
// Saw `asm("name")` in the function, type, or variable definition.
|
||||
// This is equivalent to `pragma(mangle, "name")` in D
|
||||
if (asmName)
|
||||
|
@ -1917,6 +1908,15 @@ final class CParser(AST) : Parser!AST
|
|||
p.mangleOverride = str;
|
||||
}
|
||||
}
|
||||
s = applySpecifier(s, specifier);
|
||||
if (level == LVL.local)
|
||||
{
|
||||
// Wrap the declaration in `extern (C) { declaration }`
|
||||
// Necessary for function pointers, but harmless to apply to all.
|
||||
auto decls = new AST.Dsymbols(1);
|
||||
(*decls)[0] = s;
|
||||
s = new AST.LinkDeclaration(s.loc, linkage, decls);
|
||||
}
|
||||
symbols.push(s);
|
||||
}
|
||||
first = false;
|
||||
|
|
19
compiler/test/runnable/test23347.c
Normal file
19
compiler/test/runnable/test23347.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* DISABLED: osx32 osx64 win32 win64
|
||||
* TEST_OUTPUT:
|
||||
---
|
||||
---
|
||||
*/
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23347
|
||||
|
||||
void fork() { }
|
||||
|
||||
#pragma pack(push, 4)
|
||||
void spoon() asm("fork");
|
||||
#pragma pack(pop);
|
||||
|
||||
int main()
|
||||
{
|
||||
spoon();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue