[cfe-dev] Question about inline Assembler - Visual Studio Style
Reid Kleckner via cfe-dev
cfe-dev at lists.llvm.org
Tue Feb 21 10:25:14 PST 2017
This looks like we're lexing multiple __asm one line statements in macros
incorrectly.
On top of that, MSVC supports using labels in inline asm in ways that LLVM
cannot. I think this is the relevant open issue:
https://bugs.llvm.org/show_bug.cgi?id=24529
Even if you overcome the lexing issue, I don't think this asm will work as
intended with clang.
On Tue, Feb 21, 2017 at 7:26 AM, via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> Hello friendly Clang-World,
>
> this is my first time using a mailing list, so I hope I do everything
> right. For my company I try to compile some old x86 code with clang, which
> compiled with Visual Studio 6. There I found the following macro:
>
> *#define POINT_TO_LABEL(variable, address) { void* dest; __asm push
> eax __asm mov eax, offset seq_lbl##address __asm mov dest,eax __asm {pop
> eax} variable = dest;}*
>
> Clang says:
> error: unexpected token in
> argument list
> POINT_TO_LABEL(pTableOfEntryPoints[seq_
> BEGINROW(1)],seq_BeginRow1);
> *^*
> Include\vSeqCodeModule.h(183,155): note: expanded from macro
> 'POINT_TO_LABEL'
> ...seq_lbl##address __asm mov dest,eax __asm {pop eax} variable = dest;}
>
> *^*
>
> When I remove the {} from the last __asm code, the error from the *'='*
> disappears, but the first message keeps coming.
>
> So... What is the problem? Is this kind of inline assembler not compatible
> with Clang?
>
> I have a second question for a private project. Do I have to send another
> mail with this question?
>
> Kind regards from Germany
> Björn
> Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816,
> USt.ID-Nr. DE 114 165 789
> Geschäftsführer: Hiroshi Kawamura, Dr Hiroshi Nakamura, Markus Bode, Heiko
> Lampert, Takashi Nagano, Takeshi Fukushima.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170221/f1aacfd9/attachment.html>
More information about the cfe-dev
mailing list