diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index b9d6e18f0215e..28c0851aa6b0e 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -1538,16 +1538,16 @@ proc genAsmStmt(p: BProc, t: PNode) = genLineDir(p, t) var s = newRopeAppender() - var inlineAsmSyntax = "" + var asmSyntax = "" if (let p = t[0]; p.kind == nkPragma): for i in p: - if whichPragma(i) == wInlineAsmSyntax: - inlineAsmSyntax = i[1].strVal + if whichPragma(i) == wAsmSyntax: + asmSyntax = i[1].strVal - if inlineAsmSyntax != "" and + if asmSyntax != "" and not ( - inlineAsmSyntax == "gcc" and hasGnuAsm in CC[p.config.cCompiler].props or - inlineAsmSyntax == "vcc" and hasGnuAsm notin CC[p.config.cCompiler].props): + 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, "Your compiler does not support the specified inline assembler") diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 596d36d02dc50..a4c5397992794 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -304,7 +304,7 @@ proc pragmaAsm*(c: PContext, n: PNode): char = of wSubsChar: if it[1].kind == nkCharLit: result = chr(int(it[1].intVal)) else: invalidPragma(c, it) - of wInlineAsmSyntax: + of wAsmSyntax: let s = expectStrLit(c, it) if s notin ["gcc", "vcc"]: invalidPragma(c, it) else: invalidPragma(c, it) diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index 2804df0dd59e8..39e0b2e25a44a 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -84,7 +84,7 @@ type wComputedGoto = "computedGoto", wExperimental = "experimental", wDoctype = "doctype", wWrite = "write", wGensym = "gensym", wInject = "inject", wDirty = "dirty", wInheritable = "inheritable", wThreadVar = "threadvar", wEmit = "emit", - wAsmNoStackFrame = "asmNoStackFrame", wInlineAsmSyntax = "inlineAsmSyntax", wImplicitStatic = "implicitStatic", + wAsmNoStackFrame = "asmNoStackFrame", wAsmSyntax = "asmSyntax", wImplicitStatic = "implicitStatic", wGlobal = "global", wCodegenDecl = "codegenDecl", wUnchecked = "unchecked", wGuard = "guard", wLocks = "locks", wPartial = "partial", wExplain = "explain", wLiftLocals = "liftlocals", wEnforceNoRaises = "enforceNoRaises", wSystemRaisesDefect = "systemRaisesDefect", diff --git a/doc/manual_experimental.md b/doc/manual_experimental.md index dbe432a38cf45..fe36a78d15356 100644 --- a/doc/manual_experimental.md +++ b/doc/manual_experimental.md @@ -2597,18 +2597,18 @@ method foo(x: Base) {.base.} = discard It gives an error: method `foo` can be defined only in the same module with its type (Base). -inlineAsmSyntax pragma +asmSyntax pragma ====================== -`inlineAsmSyntax` pragma allowing specify target inline assembler syntax in `asm` stmt. +`asmSyntax` pragma allowing specify target inline assembler syntax in `asm` stmt. It prevents compiling code with different of the target CC inline asm syntax, i.e. it will not allow gcc inline asm code to be compiled with vcc. ```nim proc nothing() = - asm {.inlineAsmSyntax: "gcc".}""" + asm {.asmSyntax: "gcc".}""" nop """ ``` -The current C(C++) backend implementation cannot generate code for gcc and for vcc at the same time. For example, `{.inlineAsmSyntax: "vcc".}` with the ICC compiler will not generate code with intel asm syntax, even though ICC can use both gcc-like asm and vcc-like. +The current C(C++) backend implementation cannot generate code for gcc and for vcc at the same time. For example, `{.asmSyntax: "vcc".}` with the ICC compiler will not generate code with intel asm syntax, even though ICC can use both gcc-like asm and vcc-like.