diff --git a/changelog.md b/changelog.md index b9671147f08f..bbea91320ff6 100644 --- a/changelog.md +++ b/changelog.md @@ -17,7 +17,7 @@ rounding guarantees (via the - Unknown warnings and hints now gives warnings `warnUnknownNotes` instead of errors. -- With `-d:nimPreviewAsmSemSymbol`, backticked symbols are type checked in the `asm/emit` statements. +- backticked symbols are type checked in the `asm/emit` statements. Use `--legacy:noAsmSemSymbol` for a transitional period. ## Standard library additions and changes diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index f9db67d4bb56..8fb6ae0be849 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -173,3 +173,5 @@ proc initDefines*(symbols: StringTableRef) = defineSymbol("nimHasXorSet") defineSymbol("nimHasLegacyNoStrictDefs") + + defineSymbol("nimHasAsmSemSymbol") diff --git a/compiler/nim.cfg b/compiler/nim.cfg index c0e44915036e..0d34401dc9f7 100644 --- a/compiler/nim.cfg +++ b/compiler/nim.cfg @@ -10,7 +10,6 @@ define:nimPreviewProcConversion define:nimPreviewRangeDefault define:nimPreviewNonVarDestructor define:nimPreviewCheckedClose -define:nimPreviewAsmSemSymbol threads:off #import:"$projectpath/testability" diff --git a/compiler/options.nim b/compiler/options.nim index b456651c8221..2f903819ba89 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -250,6 +250,8 @@ type ## Old transformation for closures in JS backend noStrictDefs ## disable "strictdefs" + noAsmSemSymbol + ## disable type checking for backticked symbols in the `asm/emit` statements SymbolFilesOption* = enum disabledSf, writeOnlySf, readOnlySf, v2Sf, stressTest diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 098ce36d586b..e5faad386878 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -637,10 +637,11 @@ proc semAsmOrEmit*(con: PContext, n: PNode, marker: char): PNode = # XXX what to do here if 'amb' is true? if e != nil: incl(e.flags, sfUsed) - if isDefined(con.config, "nimPreviewAsmSemSymbol"): - result.add con.semExprWithType(con, newSymNode(e), {efTypeAllowed}) - else: + + if noAsmSemSymbol in con.config.legacyFeatures: result.add newSymNode(e) + else: + result.add con.semExprWithType(con, newSymNode(e), {efTypeAllowed}) else: result.add newStrNode(nkStrLit, sub) else: diff --git a/tests/config.nims b/tests/config.nims index 71825774c8f9..808ddbd83df2 100644 --- a/tests/config.nims +++ b/tests/config.nims @@ -38,7 +38,6 @@ switch("define", "nimPreviewHashRef") switch("define", "nimPreviewRangeDefault") switch("define", "nimPreviewNonVarDestructor") switch("define", "nimPreviewCheckedClose") -switch("define", "nimPreviewAsmSemSymbol") switch("warningAserror", "UnnamedBreak") when not defined(testsConciseTypeMismatch):