This commit is contained in:
araq
2024-06-01 19:00:23 +02:00
parent cdfc886f88
commit 05b29919e1
2 changed files with 29 additions and 3 deletions

View File

@@ -1547,14 +1547,14 @@ proc genAsmStmt(p: BProc, t: PNode) =
if whichPragma(i) == wAsmSyntax:
asmSyntax = i[1].strVal
if asmSyntax != "" and
if asmSyntax != "" and
not (
asmSyntax == "gcc" and hasGnuAsm in CC[p.config.cCompiler].props or
asmSyntax == "vcc" and hasGnuAsm notin CC[p.config.cCompiler].props):
localError(
p.config, t.info,
p.config, t.info,
"Your compiler does not support the specified inline assembler")
genAsmOrEmitStmt(p, t, isAsmStmt=true, s)
# see bug #2362, "top level asm statements" seem to be a mis-feature
# but even if we don't do this, the example in #2362 cannot possibly

View File

@@ -594,4 +594,30 @@ NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "P
#define NIM_NOALIAS __restrict
/* __restrict is said to work for all the C(++) compilers out there that we support */
#if defined(__GNUC__)
# define NIM_ERR_FLAG() /* nothing to declare: uses HW flag */
# define NIM_ERR_JUMP(lab) __asm__ goto("jc %l0" \
: \
: \
: \
: lab)
# define NIM_ERR_SET() __asm__ volatile("stc" \
: \
: \
: "cc" \
)
# define NIM_ERR_CLEAR() __asm__ volatile("clc" \
: \
: \
: "cc" \
)
#else
# define NIM_ERR_FLAG() NIM_BOOL* nimErr_
# define NIM_ERR_JUMP(lab) if (NIM_UNLIKELY(*nimErr_)) goto lab
# define NIM_ERR_CLEAR() *nimErr_ = NIM_FALSE
# define NIM_ERR_SET() *nimErr_ = NIM_TRUE
#endif /* __GNUC__ */
#endif /* NIMBASE_H */