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:
parent
c3459c7b14
commit
28510a9da9
7 changed files with 4 additions and 9 deletions
|
|
@ -220,4 +220,7 @@ proc mydiv(a, b): int {.raises: [].} =
|
||||||
See [docgen](docgen.html#introduction-quick-start) for details.
|
See [docgen](docgen.html#introduction-quick-start) for details.
|
||||||
- Deprecated `--oldNewlines` and its Deprecated code cleaned out.
|
- 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
|
## Tool changes
|
||||||
|
|
|
||||||
|
|
@ -930,7 +930,7 @@ proc genSeqElem(p: BProc, n, x, y: PNode, d: var TLoc) =
|
||||||
if ty.kind in {tyRef, tyPtr}:
|
if ty.kind in {tyRef, tyPtr}:
|
||||||
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
||||||
if optBoundsCheck in p.options:
|
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,
|
linefmt(p, cpsStmts,
|
||||||
"if ((NU)($1) > (NU)$2){ #raiseIndexError2($1,$2); $3}$n",
|
"if ((NU)($1) > (NU)$2){ #raiseIndexError2($1,$2); $3}$n",
|
||||||
[rdLoc(b), lenExpr(p, a), raiseInstr(p)])
|
[rdLoc(b), lenExpr(p, a), raiseInstr(p)])
|
||||||
|
|
|
||||||
|
|
@ -582,7 +582,6 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
else:
|
else:
|
||||||
undefSymbol(conf.symbols, "hotcodereloading")
|
undefSymbol(conf.symbols, "hotcodereloading")
|
||||||
undefSymbol(conf.symbols, "useNimRtl")
|
undefSymbol(conf.symbols, "useNimRtl")
|
||||||
of "laxstrings": processOnOffSwitch(conf, {optLaxStrings}, arg, pass, info)
|
|
||||||
of "nilseqs": processOnOffSwitch(conf, {optNilSeqs}, arg, pass, info)
|
of "nilseqs": processOnOffSwitch(conf, {optNilSeqs}, arg, pass, info)
|
||||||
of "oldast": processOnOffSwitch(conf, {optOldAst}, arg, pass, info)
|
of "oldast": processOnOffSwitch(conf, {optOldAst}, arg, pass, info)
|
||||||
of "checks", "x": processOnOffSwitch(conf, ChecksOptions, arg, pass, info)
|
of "checks", "x": processOnOffSwitch(conf, ChecksOptions, arg, pass, info)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ type # please make sure we have under 32 options
|
||||||
# evaluation
|
# evaluation
|
||||||
optTrMacros, # en/disable pattern matching
|
optTrMacros, # en/disable pattern matching
|
||||||
optMemTracker,
|
optMemTracker,
|
||||||
optLaxStrings,
|
|
||||||
optNilSeqs,
|
optNilSeqs,
|
||||||
optOldAst,
|
optOldAst,
|
||||||
optSinkInference # 'sink T' inference
|
optSinkInference # 'sink T' inference
|
||||||
|
|
|
||||||
|
|
@ -482,8 +482,6 @@ proc foldArrayAccess(m: PSym, n: PNode; g: ModuleGraph): PNode =
|
||||||
result = newNodeIT(nkCharLit, x.info, n.typ)
|
result = newNodeIT(nkCharLit, x.info, n.typ)
|
||||||
if idx >= 0 and idx < x.strVal.len:
|
if idx >= 0 and idx < x.strVal.len:
|
||||||
result.intVal = ord(x.strVal[int(idx)])
|
result.intVal = ord(x.strVal[int(idx)])
|
||||||
elif idx == x.strVal.len and optLaxStrings in g.config.options:
|
|
||||||
discard
|
|
||||||
else:
|
else:
|
||||||
localError(g.config, n.info, formatErrorIndexBound(idx, x.strVal.len-1) & $n)
|
localError(g.config, n.info, formatErrorIndexBound(idx, x.strVal.len-1) & $n)
|
||||||
else: discard
|
else: discard
|
||||||
|
|
|
||||||
|
|
@ -684,8 +684,6 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
let s = regs[rb].node.strVal
|
let s = regs[rb].node.strVal
|
||||||
if idx <% s.len:
|
if idx <% s.len:
|
||||||
regs[ra].intVal = s[idx].ord
|
regs[ra].intVal = s[idx].ord
|
||||||
elif idx == s.len and optLaxStrings in c.config.options:
|
|
||||||
regs[ra].intVal = 0
|
|
||||||
else:
|
else:
|
||||||
stackTrace(c, tos, pc, formatErrorIndexBound(idx, s.len-1))
|
stackTrace(c, tos, pc, formatErrorIndexBound(idx, s.len-1))
|
||||||
of opcWrArr:
|
of opcWrArr:
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,6 @@ Advanced options:
|
||||||
--excessiveStackTrace:on|off
|
--excessiveStackTrace:on|off
|
||||||
stack traces use full file paths
|
stack traces use full file paths
|
||||||
--stackTraceMsgs:on|off enable user defined stack frame msgs via `setFrameMsg`
|
--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
|
--nilseqs:on|off allow 'nil' for strings/seqs for
|
||||||
backwards compatibility
|
backwards compatibility
|
||||||
--seqsv2:on|off use the new string/seq implementation based on
|
--seqsv2:on|off use the new string/seq implementation based on
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue