Issue 23725 - ImportC fails to parse __asm __volatile on FreeBSD stdatomic.h and fenv.h
Summary: ImportC fails to parse __asm __volatile on FreeBSD stdatomic.h and fenv.h
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All FreeBSD
: P3 normal
Assignee: No Owner
URL:
Keywords: ImportC, pull
Depends on:
Blocks:
 
Reported: 2023-02-18 00:19 UTC by Walter Bright
Modified: 2023-05-31 08:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2023-02-18 00:19:06 UTC
It's the volatile following the asm that is not accepted.
Comment 1 Walter Bright 2023-02-18 03:55:36 UTC
The trouble is __GNUCLIKE_ASM is always defined because __GNUC__ is defined. Turning off __GNUC__ causes a lot of error messages like the system .h files need to be edited.

__GNUCLIKE_ASM turns on use of the inline assembler.
Comment 2 Walter Bright 2023-03-19 05:23:48 UTC
The troublesome block of code in ieeefp.h looks like:

#define	__fldcw(addr)	__asm __volatile("fldcw %0" : : "m" (*(addr)))
#define	__fldenv(addr)	__asm __volatile("fldenv %0" : : "m" (*(addr)))
#define	__fnclex()	__asm __volatile("fnclex")
#define	__fnstcw(addr)	__asm __volatile("fnstcw %0" : "=m" (*(addr)))
#define	__fnstenv(addr)	__asm __volatile("fnstenv %0" : "=m" (*(addr)))
#define	__fnstsw(addr)	__asm __volatile("fnstsw %0" : "=m" (*(addr)))
#define	__ldmxcsr(addr)	__asm __volatile("ldmxcsr %0" : : "m" (*(addr)))
#define	__stmxcsr(addr)	__asm __volatile("stmxcsr %0" : "=m" (*(addr)))
Comment 3 Dlang Bot 2023-03-19 05:37:24 UTC
@WalterBright created dlang/dmd pull request #15004 "fix Issue 23725 - ImportC fails to parse __asm __volatile on FreeBSD …" fixing this issue:

- fix Issue 23725 - ImportC fails to parse __asm __volatile on FreeBSD stdatomic.h and fenv.h

https://github.com/dlang/dmd/pull/15004
Comment 4 Walter Bright 2023-03-25 01:42:06 UTC
Fixed by https://github.com/dlang/dmd/pull/15012