[Issue 22722] New: ImportC: parser doesn’t understand `asm volatile` syntax
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 31 22:27:31 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22722
Issue ID: 22722
Summary: ImportC: parser doesn’t understand `asm volatile`
syntax
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
<dispatch/dispatch.h> on macOS, which is included by
<CoreFoundation/CoreFoundation.h>, has an inline function which has a macro
defined:
#define dispatch_compiler_barrier() __asm__ __volatile__("" ::: "memory”)
Where it is used, it is expanded to:
typedef void (*dispatch_function_t)(void *);
typedef intptr_t dispatch_once_t;
extern void dispatch_once_f(dispatch_once_t *predicate, void * context,
dispatch_function_t function);
static inline /* several attributes omitted */
void
_dispatch_once_f(dispatch_once_t *predicate, void * context,
dispatch_function_t function)
{
if (__builtin_expect((*predicate), (~0l)) != ~0l) {
dispatch_once_f(predicate, context, function);
} else {
asm volatile("" ::: "memory");
}
__builtin_assume(*predicate == ~0l);
}
gcc docs on the use of volatile with asm:
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile
--
More information about the Digitalmars-d-bugs
mailing list