mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
allow building 1.4.0 from devel (#18708)
* allow building 1.4.0 from devel * changelog
This commit is contained in:
@@ -485,6 +485,9 @@
|
||||
- `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`
|
||||
|
||||
- `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
|
||||
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
|
||||
|
||||
@@ -652,7 +652,9 @@ type
|
||||
mUnaryMinusI, mUnaryMinusI64, mAbsI, mNot,
|
||||
mUnaryPlusI, mBitnotI,
|
||||
mUnaryPlusF64, mUnaryMinusF64,
|
||||
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mCStrToStr,
|
||||
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr,
|
||||
mFloatToStr, # for -d:nimVersion140
|
||||
mCStrToStr,
|
||||
mStrToStr, mEnumToStr,
|
||||
mAnd, mOr,
|
||||
mImplies, mIff, mExists, mForall, mOld,
|
||||
@@ -720,7 +722,9 @@ const
|
||||
mEqRef, mEqProc, mLePtr, mLtPtr, mEqCString, mXor,
|
||||
mUnaryMinusI, mUnaryMinusI64, mAbsI, mNot, mUnaryPlusI, mBitnotI,
|
||||
mUnaryPlusF64, mUnaryMinusF64,
|
||||
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mCStrToStr,
|
||||
mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr,
|
||||
mFloatToStr,
|
||||
mCStrToStr,
|
||||
mStrToStr, mEnumToStr,
|
||||
mAnd, mOr,
|
||||
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)
|
||||
if optTinyRtti in p.config.globalOptions:
|
||||
# not sure how to use `genEnumToStr` here
|
||||
const code = "{ #raiseFieldError2($1, (NI)$3); $2} $n"
|
||||
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p), discIndex])
|
||||
if p.config.isDefined("nimVersion140"):
|
||||
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:
|
||||
# complication needed for signed types
|
||||
let first = p.config.firstOrd(disc.sym.typ)
|
||||
let firstLit = int64Literal(cast[int](first))
|
||||
let discName = genTypeInfo(p.config, p.module, disc.sym.typ, e.info)
|
||||
const code = "{ #raiseFieldError2($1, #reprDiscriminant(((NI)$3) + (NI)$4, $5)); $2} $n"
|
||||
linefmt(p, cpsStmts, code, [strLit, raiseInstr(p), discIndex, firstLit, discName])
|
||||
if p.config.isDefined("nimVersion140"):
|
||||
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) =
|
||||
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 mBoolToStr: genDollar(p, e, d, "#nimBoolToStr($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 mStrToStr, mUnown: expr(p, e[1], d)
|
||||
of mIsolate: genCall(p, e, d)
|
||||
|
||||
@@ -434,6 +434,7 @@ const # magic checked op; magic unchecked op;
|
||||
mBoolToStr: ["nimBoolToStr", "nimBoolToStr"],
|
||||
mIntToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||
mInt64ToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||
mFloatToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||
mCStrToStr: ["cstrToNimstr", "cstrToNimstr"],
|
||||
mStrToStr: ["", ""]]
|
||||
|
||||
|
||||
@@ -290,6 +290,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; idgen: IdGenerator; g: ModuleGraph): P
|
||||
of mBoolToStr:
|
||||
if getOrdValue(a) == 0: result = newStrNodeT("false", n, g)
|
||||
else: result = newStrNodeT("true", n, g)
|
||||
of mFloatToStr: result = newStrNodeT($getFloat(a), n, g)
|
||||
of mCStrToStr, mCharToStr:
|
||||
if a.kind == nkBracket:
|
||||
var s = ""
|
||||
|
||||
@@ -1127,7 +1127,7 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||
let t = skipTypes(n.typ, abstractVar-{tyTypeDesc})
|
||||
if t.kind in {tyUInt8..tyUInt32} or (t.kind == tyUInt and 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)
|
||||
of mEqStr, mEqCString: genBinaryABC(c, n, dest, opcEqStr)
|
||||
of mLeStr: genBinaryABC(c, n, dest, opcLeStr)
|
||||
|
||||
Reference in New Issue
Block a user