Deprecated laxStrings for mutating the internal zero terminator on strings and its Deprecated code cleaned out (#14766)

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Juan Carlos
2020-06-23 08:20:53 -03:00
committed by GitHub
parent c3459c7b14
commit 28510a9da9
7 changed files with 4 additions and 9 deletions

View File

@@ -220,4 +220,7 @@ proc mydiv(a, b): int {.raises: [].} =
See [docgen](docgen.html#introduction-quick-start) for details.
- Deprecated `--oldNewlines` and its Deprecated code cleaned out.
- Deprecated `--laxStrings` for mutating the internal zero terminator on strings and its Deprecated code cleaned out.
## Tool changes

View File

@@ -930,7 +930,7 @@ proc genSeqElem(p: BProc, n, x, y: PNode, d: var TLoc) =
if ty.kind in {tyRef, tyPtr}:
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
if optBoundsCheck in p.options:
if ty.kind == tyString and (not defined(nimNoZeroTerminator) or optLaxStrings in p.options):
if ty.kind == tyString and not defined(nimNoZeroTerminator):
linefmt(p, cpsStmts,
"if ((NU)($1) > (NU)$2){ #raiseIndexError2($1,$2); $3}$n",
[rdLoc(b), lenExpr(p, a), raiseInstr(p)])

View File

@@ -582,7 +582,6 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
else:
undefSymbol(conf.symbols, "hotcodereloading")
undefSymbol(conf.symbols, "useNimRtl")
of "laxstrings": processOnOffSwitch(conf, {optLaxStrings}, arg, pass, info)
of "nilseqs": processOnOffSwitch(conf, {optNilSeqs}, arg, pass, info)
of "oldast": processOnOffSwitch(conf, {optOldAst}, arg, pass, info)
of "checks", "x": processOnOffSwitch(conf, ChecksOptions, arg, pass, info)

View File

@@ -39,7 +39,6 @@ type # please make sure we have under 32 options
# evaluation
optTrMacros, # en/disable pattern matching
optMemTracker,
optLaxStrings,
optNilSeqs,
optOldAst,
optSinkInference # 'sink T' inference

View File

@@ -482,8 +482,6 @@ proc foldArrayAccess(m: PSym, n: PNode; g: ModuleGraph): PNode =
result = newNodeIT(nkCharLit, x.info, n.typ)
if idx >= 0 and idx < x.strVal.len:
result.intVal = ord(x.strVal[int(idx)])
elif idx == x.strVal.len and optLaxStrings in g.config.options:
discard
else:
localError(g.config, n.info, formatErrorIndexBound(idx, x.strVal.len-1) & $n)
else: discard

View File

@@ -684,8 +684,6 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
let s = regs[rb].node.strVal
if idx <% s.len:
regs[ra].intVal = s[idx].ord
elif idx == s.len and optLaxStrings in c.config.options:
regs[ra].intVal = 0
else:
stackTrace(c, tos, pc, formatErrorIndexBound(idx, s.len-1))
of opcWrArr:

View File

@@ -101,8 +101,6 @@ Advanced options:
--excessiveStackTrace:on|off
stack traces use full file paths
--stackTraceMsgs:on|off enable user defined stack frame msgs via `setFrameMsg`
--laxStrings:on|off when turned on, accessing the zero terminator in
strings is allowed; only for backwards compatibility
--nilseqs:on|off allow 'nil' for strings/seqs for
backwards compatibility
--seqsv2:on|off use the new string/seq implementation based on