-
-
Notifications
You must be signed in to change notification settings - Fork 652
fix Issue 24130 - ImportC: Windows headers use inline asm with differ… #15595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for your pull request, @WalterBright! Bugzilla references
|
Now I get:
Of course, I don't have that particular vadefs.h so I don't know what is on line 70. Sigh. But evidently, _M_CEE_PURE is going down some nutburger path. Not sure what to do here. |
3c872d0
to
cf9dc1c
Compare
Decided to try parsing Microsoft asm syntax. |
a189282
to
a8057c9
Compare
Hmm, how do I disable the omf platform from running? |
a8057c9
to
72dc196
Compare
The test runner apparently cannot do this. But I found another way... |
72dc196
to
05403c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments, I see regressions and breaking downstream compilers.
@@ -626,7 +626,7 @@ final class CParser(AST) : Parser!AST | |||
|
|||
default: | |||
// ImportC extensions: parse as a D asm block. | |||
s = parseAsm(); | |||
s = parseAsm(compileEnv.masm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say just pass true
instead of relying on...
@@ -780,7 +780,9 @@ extern (C++) final class Module : Package | |||
{ | |||
filetype = FileType.c; | |||
|
|||
global.compileEnv.masm = target.os == Target.OS.Windows && !target.omfobj; // Microsoft inline assembler format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... platform-specific global variables that gdc (and ldc?) don't define or set.
case TOK.endOfLine: | ||
nextDefineLine(); | ||
goto case; | ||
|
||
case TOK.semicolon: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it unintentionally bleeds into D code parser. Did you forget an if (endOfLine) { ... }
?
case TOK.semicolon: | ||
if (nestlevel != 0) | ||
error("mismatched number of curly brackets"); | ||
|
||
if (toklist || label) | ||
{ | ||
// Create AsmStatement from list of tokens we've saved | ||
AST.Statement s = new AST.AsmStatement(token.loc, toklist); | ||
AST.AsmStatement as = new AST.AsmStatement(token.loc, toklist); | ||
as.caseSensitive = !endOfLine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two variables mean different things, why is one setting the other?
…ent syntax
Microsoft inline asm looks like this:
Look ma, no semicolons. ImportC's inline asm wants semicolons. Microsoft uses generic C code instead when
_M_CEE_PURE
is set, so we set it, too. The other macros Microsoft uses for generic C code look rather more dangerous to use: