allow building 1.4.0 from devel (#18708)
* allow building 1.4.0 from devel * changelog
This commit is contained in:
parent
0778a38bbd
commit
7b58dc2de0
6 changed files with 29 additions and 7 deletions
|
|
@ -485,6 +485,9 @@
|
||||||
- `nim r` now supports cross compilation from unix to windows when specifying `-d:mingw` by using wine,
|
- `nim r` now supports cross compilation from unix to windows when specifying `-d:mingw` by using wine,
|
||||||
e.g.: `nim r --eval:'import os; echo "a" / "b"'` prints `a\b`
|
e.g.: `nim r --eval:'import os; echo "a" / "b"'` prints `a\b`
|
||||||
|
|
||||||
|
- `nim` can compile version 1.4.0 as follows: `nim c --lib:lib --stylecheck:off -d:nimVersion140 compiler/nim`.
|
||||||
|
`-d:nimVersion140` is not needed for bootstrapping, only for building 1.4.0 from devel.
|
||||||
|
|
||||||
- The style checking of the compiler now supports a `--styleCheck:usages` switch. This switch
|
- The style checking of the compiler now supports a `--styleCheck:usages` switch. This switch
|
||||||
enforces that every symbol is written as it was declared, not enforcing
|
enforces that every symbol is written as it was declared, not enforcing
|
||||||
the official Nim style guide. To be enabled, this has to be combined either
|
the official Nim style guide. To be enabled, this has to be combined either
|
||||||
|
|
|
||||||
|
|
@ -652,7 +652,9 @@ type
|
||||||
mUnaryMinusI, mUnaryMinusI64, mAbsI, mNot,
|
mUnaryMinusI, mUnaryMinusI64, mAbsI, mNot,
|
||||||
mUnaryPlusI, mBitnotI,
|
mUnaryPlusI, mBitnotI,
|
||||||
mUnaryPlusF64, mUnaryMinusF64,
|
mUnaryPlusF64, mUnaryMinusF64,
|
||||||
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mCStrToStr,
|
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr,
|
||||||
|
mFloatToStr, # for -d:nimVersion140
|
||||||
|
mCStrToStr,
|
||||||
mStrToStr, mEnumToStr,
|
mStrToStr, mEnumToStr,
|
||||||
mAnd, mOr,
|
mAnd, mOr,
|
||||||
mImplies, mIff, mExists, mForall, mOld,
|
mImplies, mIff, mExists, mForall, mOld,
|
||||||
|
|
@ -720,7 +722,9 @@ const
|
||||||
mEqRef, mEqProc, mLePtr, mLtPtr, mEqCString, mXor,
|
mEqRef, mEqProc, mLePtr, mLtPtr, mEqCString, mXor,
|
||||||
mUnaryMinusI, mUnaryMinusI64, mAbsI, mNot, mUnaryPlusI, mBitnotI,
|
mUnaryMinusI, mUnaryMinusI64, mAbsI, mNot, mUnaryPlusI, mBitnotI,
|
||||||
mUnaryPlusF64, mUnaryMinusF64,
|
mUnaryPlusF64, mUnaryMinusF64,
|
||||||
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mCStrToStr,
|
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr,
|
||||||
|
mFloatToStr,
|
||||||
|
mCStrToStr,
|
||||||
mStrToStr, mEnumToStr,
|
mStrToStr, mEnumToStr,
|
||||||
mAnd, mOr,
|
mAnd, mOr,
|
||||||
mEqStr, mLeStr, mLtStr,
|
mEqStr, mLeStr, mLtStr,
|
||||||
|
|
|
||||||
|
|
@ -894,15 +894,23 @@ proc genFieldCheck(p: BProc, e: PNode, obj: Rope, field: PSym) =
|
||||||
let discIndex = rdSetElemLoc(p.config, v, u.t)
|
let discIndex = rdSetElemLoc(p.config, v, u.t)
|
||||||
if optTinyRtti in p.config.globalOptions:
|
if optTinyRtti in p.config.globalOptions:
|
||||||
# not sure how to use `genEnumToStr` here
|
# not sure how to use `genEnumToStr` here
|
||||||
const code = "{ #raiseFieldError2($1, (NI)$3); $2} $n"
|
if p.config.isDefined("nimVersion140"):
|
||||||
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p), discIndex])
|
const code = "{ #raiseFieldError($1); $2} $n"
|
||||||
|
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p)])
|
||||||
|
else:
|
||||||
|
const code = "{ #raiseFieldError2($1, (NI)$3); $2} $n"
|
||||||
|
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p), discIndex])
|
||||||
else:
|
else:
|
||||||
# complication needed for signed types
|
# complication needed for signed types
|
||||||
let first = p.config.firstOrd(disc.sym.typ)
|
let first = p.config.firstOrd(disc.sym.typ)
|
||||||
let firstLit = int64Literal(cast[int](first))
|
let firstLit = int64Literal(cast[int](first))
|
||||||
let discName = genTypeInfo(p.config, p.module, disc.sym.typ, e.info)
|
let discName = genTypeInfo(p.config, p.module, disc.sym.typ, e.info)
|
||||||
const code = "{ #raiseFieldError2($1, #reprDiscriminant(((NI)$3) + (NI)$4, $5)); $2} $n"
|
if p.config.isDefined("nimVersion140"):
|
||||||
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p), discIndex, firstLit, discName])
|
const code = "{ #raiseFieldError($1); $2} $n"
|
||||||
|
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p)])
|
||||||
|
else:
|
||||||
|
const code = "{ #raiseFieldError2($1, #reprDiscriminant(((NI)$3) + (NI)$4, $5)); $2} $n"
|
||||||
|
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p), discIndex, firstLit, discName])
|
||||||
|
|
||||||
proc genCheckedRecordField(p: BProc, e: PNode, d: var TLoc) =
|
proc genCheckedRecordField(p: BProc, e: PNode, d: var TLoc) =
|
||||||
assert e[0].kind == nkDotExpr
|
assert e[0].kind == nkDotExpr
|
||||||
|
|
@ -2320,6 +2328,11 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||||
of mInt64ToStr: genDollar(p, e, d, "#nimInt64ToStr($1)")
|
of mInt64ToStr: genDollar(p, e, d, "#nimInt64ToStr($1)")
|
||||||
of mBoolToStr: genDollar(p, e, d, "#nimBoolToStr($1)")
|
of mBoolToStr: genDollar(p, e, d, "#nimBoolToStr($1)")
|
||||||
of mCharToStr: genDollar(p, e, d, "#nimCharToStr($1)")
|
of mCharToStr: genDollar(p, e, d, "#nimCharToStr($1)")
|
||||||
|
of mFloatToStr:
|
||||||
|
if e[1].typ.skipTypes(abstractInst).kind == tyFloat32:
|
||||||
|
genDollar(p, e, d, "#nimFloat32ToStr($1)")
|
||||||
|
else:
|
||||||
|
genDollar(p, e, d, "#nimFloatToStr($1)")
|
||||||
of mCStrToStr: genDollar(p, e, d, "#cstrToNimstr($1)")
|
of mCStrToStr: genDollar(p, e, d, "#cstrToNimstr($1)")
|
||||||
of mStrToStr, mUnown: expr(p, e[1], d)
|
of mStrToStr, mUnown: expr(p, e[1], d)
|
||||||
of mIsolate: genCall(p, e, d)
|
of mIsolate: genCall(p, e, d)
|
||||||
|
|
|
||||||
|
|
@ -434,6 +434,7 @@ const # magic checked op; magic unchecked op;
|
||||||
mBoolToStr: ["nimBoolToStr", "nimBoolToStr"],
|
mBoolToStr: ["nimBoolToStr", "nimBoolToStr"],
|
||||||
mIntToStr: ["cstrToNimstr", "cstrToNimstr"],
|
mIntToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||||
mInt64ToStr: ["cstrToNimstr", "cstrToNimstr"],
|
mInt64ToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||||
|
mFloatToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||||
mCStrToStr: ["cstrToNimstr", "cstrToNimstr"],
|
mCStrToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||||
mStrToStr: ["", ""]]
|
mStrToStr: ["", ""]]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; idgen: IdGenerator; g: ModuleGraph): P
|
||||||
of mBoolToStr:
|
of mBoolToStr:
|
||||||
if getOrdValue(a) == 0: result = newStrNodeT("false", n, g)
|
if getOrdValue(a) == 0: result = newStrNodeT("false", n, g)
|
||||||
else: result = newStrNodeT("true", n, g)
|
else: result = newStrNodeT("true", n, g)
|
||||||
|
of mFloatToStr: result = newStrNodeT($getFloat(a), n, g)
|
||||||
of mCStrToStr, mCharToStr:
|
of mCStrToStr, mCharToStr:
|
||||||
if a.kind == nkBracket:
|
if a.kind == nkBracket:
|
||||||
var s = ""
|
var s = ""
|
||||||
|
|
|
||||||
|
|
@ -1127,7 +1127,7 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||||
let t = skipTypes(n.typ, abstractVar-{tyTypeDesc})
|
let t = skipTypes(n.typ, abstractVar-{tyTypeDesc})
|
||||||
if t.kind in {tyUInt8..tyUInt32} or (t.kind == tyUInt and t.size < 8):
|
if t.kind in {tyUInt8..tyUInt32} or (t.kind == tyUInt and t.size < 8):
|
||||||
c.gABC(n, opcNarrowU, dest, TRegister(t.size*8))
|
c.gABC(n, opcNarrowU, dest, TRegister(t.size*8))
|
||||||
of mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mCStrToStr, mStrToStr, mEnumToStr:
|
of mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mFloatToStr, mCStrToStr, mStrToStr, mEnumToStr:
|
||||||
genConv(c, n, n[1], dest)
|
genConv(c, n, n[1], dest)
|
||||||
of mEqStr, mEqCString: genBinaryABC(c, n, dest, opcEqStr)
|
of mEqStr, mEqCString: genBinaryABC(c, n, dest, opcEqStr)
|
||||||
of mLeStr: genBinaryABC(c, n, dest, opcLeStr)
|
of mLeStr: genBinaryABC(c, n, dest, opcLeStr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue