Bug 23613 – ImportC: asm with parentheses

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2023-01-09T17:00:48Z
Last change time
2023-01-09T22:53:00Z
Keywords
ImportC
Assigned to
No Owner
Creator
Jacob Carlborg
See also
https://issues.dlang.org/show_bug.cgi?id=23616

Comments

Comment #0 by doob — 2023-01-09T17:00:48Z
Compiling the following C code: void _hreset(int __eax) { __asm__ ("hreset $0" :: "a"(__eax)); } Results in the following errors: foo.c(3): Error: found `(` when expecting `{` foo.c(5): Error: found `End of File` when expecting `}` following compound statementng `return` statement I should not that this code is guarded with: #if __has_extension(gnu_asm) I'm using macOS 13.0.1, DMD v2.101.1 and Xcode 14.2.
Comment #1 by doob — 2023-01-09T17:50:56Z
Since the preprocessor is Clang, there's currently a mismatch in what language features the preprocessor supports and what the actual compiler supports.
Comment #2 by ibuclaw — 2023-01-09T19:21:29Z
I suspect this is a WONTFIX, use a compiler that supports GDC-style assembly, LDC also supports GDC asm.
Comment #3 by bugzilla — 2023-01-09T22:53:00Z
Supporting the gnu assembler, in all its glory, isn't realistic for ImportC. However, most .h files #ifdef out that stuff. Hence: https://github.com/dlang/dmd/pull/14799 should sidestep the problem. WONTFIX