Deprecate gc v2 (#10151)
* Deprecate gc v2 * warnDeprecated now has custom messages
This commit is contained in:
parent
e7fa8f3443
commit
9faad7591e
12 changed files with 21 additions and 21 deletions
|
|
@ -224,7 +224,7 @@ proc testCompileOptionArg*(conf: ConfigRef; switch, arg: string, info: TLineInfo
|
||||||
case arg.normalize
|
case arg.normalize
|
||||||
of "boehm": result = conf.selectedGC == gcBoehm
|
of "boehm": result = conf.selectedGC == gcBoehm
|
||||||
of "refc": result = conf.selectedGC == gcRefc
|
of "refc": result = conf.selectedGC == gcRefc
|
||||||
of "v2": result = conf.selectedGC == gcV2
|
of "v2": result = false
|
||||||
of "markandsweep": result = conf.selectedGC == gcMarkAndSweep
|
of "markandsweep": result = conf.selectedGC == gcMarkAndSweep
|
||||||
of "generational": result = false
|
of "generational": result = false
|
||||||
of "destructors": result = conf.selectedGC == gcDestructors
|
of "destructors": result = conf.selectedGC == gcDestructors
|
||||||
|
|
@ -442,7 +442,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
of "refc":
|
of "refc":
|
||||||
conf.selectedGC = gcRefc
|
conf.selectedGC = gcRefc
|
||||||
of "v2":
|
of "v2":
|
||||||
conf.selectedGC = gcV2
|
message(conf, info, warnDeprecated, "--gc:v2 is deprecated; using default gc")
|
||||||
of "markandsweep":
|
of "markandsweep":
|
||||||
conf.selectedGC = gcMarkAndSweep
|
conf.selectedGC = gcMarkAndSweep
|
||||||
defineSymbol(conf.symbols, "gcmarkandsweep")
|
defineSymbol(conf.symbols, "gcmarkandsweep")
|
||||||
|
|
|
||||||
|
|
@ -162,9 +162,9 @@ proc myImportModule(c: PContext, n: PNode; importStmtResult: PNode): PSym =
|
||||||
localError(c.config, n.info, "A module cannot import itself")
|
localError(c.config, n.info, "A module cannot import itself")
|
||||||
if sfDeprecated in result.flags:
|
if sfDeprecated in result.flags:
|
||||||
if result.constraint != nil:
|
if result.constraint != nil:
|
||||||
message(c.config, n.info, warnDeprecated, result.constraint.strVal & "; " & result.name.s)
|
message(c.config, n.info, warnDeprecated, result.constraint.strVal & "; " & result.name.s & " is deprecated")
|
||||||
else:
|
else:
|
||||||
message(c.config, n.info, warnDeprecated, result.name.s)
|
message(c.config, n.info, warnDeprecated, result.name.s & " is deprecated")
|
||||||
suggestSym(c.config, n.info, result, c.graph.usageSym, false)
|
suggestSym(c.config, n.info, result, c.graph.usageSym, false)
|
||||||
importStmtResult.add newSymNode(result, n.info)
|
importStmtResult.add newSymNode(result, n.info)
|
||||||
#newStrNode(toFullPath(c.config, f), n.info)
|
#newStrNode(toFullPath(c.config, f), n.info)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ const
|
||||||
warnOctalEscape: "octal escape sequences do not exist; leading zero is ignored",
|
warnOctalEscape: "octal escape sequences do not exist; leading zero is ignored",
|
||||||
warnXIsNeverRead: "'$1' is never read",
|
warnXIsNeverRead: "'$1' is never read",
|
||||||
warnXmightNotBeenInit: "'$1' might not have been initialized",
|
warnXmightNotBeenInit: "'$1' might not have been initialized",
|
||||||
warnDeprecated: "$1 is deprecated",
|
warnDeprecated: "$1",
|
||||||
warnConfigDeprecated: "config file '$1' is deprecated",
|
warnConfigDeprecated: "config file '$1' is deprecated",
|
||||||
warnSmallLshouldNotBeUsed: "'l' should not be used as an identifier; may look like '1' (one)",
|
warnSmallLshouldNotBeUsed: "'l' should not be used as an identifier; may look like '1' (one)",
|
||||||
warnUnknownMagic: "unknown magic '$1' might crash the compiler",
|
warnUnknownMagic: "unknown magic '$1' might crash the compiler",
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ proc skipAlias*(s: PSym; n: PNode; conf: ConfigRef): PSym =
|
||||||
prettybase.replaceDeprecated(conf, n.info, s, result)
|
prettybase.replaceDeprecated(conf, n.info, s, result)
|
||||||
else:
|
else:
|
||||||
message(conf, n.info, warnDeprecated, "use " & result.name.s & " instead; " &
|
message(conf, n.info, warnDeprecated, "use " & result.name.s & " instead; " &
|
||||||
s.name.s)
|
s.name.s & " is deprecated")
|
||||||
|
|
||||||
proc localSearchInScope*(c: PContext, s: PIdent): PSym =
|
proc localSearchInScope*(c: PContext, s: PIdent): PSym =
|
||||||
result = strTableGet(c.currentScope.symbols, s)
|
result = strTableGet(c.currentScope.symbols, s)
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ proc getModuleName*(conf: ConfigRef; n: PNode): string =
|
||||||
# hacky way to implement 'x / y /../ z':
|
# hacky way to implement 'x / y /../ z':
|
||||||
result = renderTree(n, {renderNoComments}).replace(" ")
|
result = renderTree(n, {renderNoComments}).replace(" ")
|
||||||
of nkDotExpr:
|
of nkDotExpr:
|
||||||
localError(conf, n.info, warnDeprecated, "using '.' instead of '/' in import paths")
|
localError(conf, n.info, warnDeprecated, "using '.' instead of '/' in import paths is deprecated")
|
||||||
result = renderTree(n, {renderNoComments}).replace(".", "/")
|
result = renderTree(n, {renderNoComments}).replace(".", "/")
|
||||||
of nkImportAs:
|
of nkImportAs:
|
||||||
result = getModuleName(conf, n.sons[0])
|
result = getModuleName(conf, n.sons[0])
|
||||||
|
|
|
||||||
|
|
@ -1916,7 +1916,7 @@ proc parseObject(p: var TParser): PNode =
|
||||||
getTok(p)
|
getTok(p)
|
||||||
if p.tok.tokType == tkCurlyDotLe and p.validInd:
|
if p.tok.tokType == tkCurlyDotLe and p.validInd:
|
||||||
# Deprecated since v0.20.0
|
# Deprecated since v0.20.0
|
||||||
parMessage(p, warnDeprecated, "type pragmas follow the type name; this form of writing pragmas")
|
parMessage(p, warnDeprecated, "type pragmas follow the type name; this form of writing pragmas is deprecated")
|
||||||
addSon(result, parsePragma(p))
|
addSon(result, parsePragma(p))
|
||||||
else:
|
else:
|
||||||
addSon(result, p.emptyNode)
|
addSon(result, p.emptyNode)
|
||||||
|
|
@ -2008,7 +2008,7 @@ proc parseTypeDef(p: var TParser): PNode =
|
||||||
if p.tok.tokType == tkBracketLe and p.validInd:
|
if p.tok.tokType == tkBracketLe and p.validInd:
|
||||||
if not noPragmaYet:
|
if not noPragmaYet:
|
||||||
# Deprecated since v0.20.0
|
# Deprecated since v0.20.0
|
||||||
parMessage(p, warnDeprecated, "pragma before generic parameter list")
|
parMessage(p, warnDeprecated, "pragma before generic parameter list is deprecated")
|
||||||
genericParam = parseGenericParamList(p)
|
genericParam = parseGenericParamList(p)
|
||||||
else:
|
else:
|
||||||
genericParam = p.emptyNode
|
genericParam = p.emptyNode
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ proc pragmaNoForward(c: PContext, n: PNode; flag=sfNoForward) =
|
||||||
# deprecated as of 0.18.1
|
# deprecated as of 0.18.1
|
||||||
message(c.config, n.info, warnDeprecated,
|
message(c.config, n.info, warnDeprecated,
|
||||||
"use {.experimental: \"codeReordering.\".} instead; " &
|
"use {.experimental: \"codeReordering.\".} instead; " &
|
||||||
(if flag == sfNoForward: "{.noForward.}" else: "{.reorder.}"))
|
(if flag == sfNoForward: "{.noForward.}" else: "{.reorder.}") & " is deprecated")
|
||||||
|
|
||||||
proc processCallConv(c: PContext, n: PNode) =
|
proc processCallConv(c: PContext, n: PNode) =
|
||||||
if n.kind in nkPragmaCallKinds and n.len == 2 and n.sons[1].kind == nkIdent:
|
if n.kind in nkPragmaCallKinds and n.len == 2 and n.sons[1].kind == nkIdent:
|
||||||
|
|
@ -447,14 +447,14 @@ proc processPop(c: PContext, n: PNode) =
|
||||||
proc processDefine(c: PContext, n: PNode) =
|
proc processDefine(c: PContext, n: PNode) =
|
||||||
if (n.kind in nkPragmaCallKinds and n.len == 2) and (n[1].kind == nkIdent):
|
if (n.kind in nkPragmaCallKinds and n.len == 2) and (n[1].kind == nkIdent):
|
||||||
defineSymbol(c.config.symbols, n[1].ident.s)
|
defineSymbol(c.config.symbols, n[1].ident.s)
|
||||||
message(c.config, n.info, warnDeprecated, "define")
|
message(c.config, n.info, warnDeprecated, "define is deprecated")
|
||||||
else:
|
else:
|
||||||
invalidPragma(c, n)
|
invalidPragma(c, n)
|
||||||
|
|
||||||
proc processUndef(c: PContext, n: PNode) =
|
proc processUndef(c: PContext, n: PNode) =
|
||||||
if (n.kind in nkPragmaCallKinds and n.len == 2) and (n[1].kind == nkIdent):
|
if (n.kind in nkPragmaCallKinds and n.len == 2) and (n[1].kind == nkIdent):
|
||||||
undefSymbol(c.config.symbols, n[1].ident.s)
|
undefSymbol(c.config.symbols, n[1].ident.s)
|
||||||
message(c.config, n.info, warnDeprecated, "undef")
|
message(c.config, n.info, warnDeprecated, "undef is deprecated")
|
||||||
else:
|
else:
|
||||||
invalidPragma(c, n)
|
invalidPragma(c, n)
|
||||||
|
|
||||||
|
|
@ -784,7 +784,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
||||||
if sym.kind in {skTemplate, skMacro}:
|
if sym.kind in {skTemplate, skMacro}:
|
||||||
incl(sym.flags, sfImmediate)
|
incl(sym.flags, sfImmediate)
|
||||||
incl(sym.flags, sfAllUntyped)
|
incl(sym.flags, sfAllUntyped)
|
||||||
message(c.config, n.info, warnDeprecated, "use 'untyped' parameters instead; immediate")
|
message(c.config, n.info, warnDeprecated, "use 'untyped' parameters instead; immediate is deprecated")
|
||||||
else: invalidPragma(c, it)
|
else: invalidPragma(c, it)
|
||||||
of wDirty:
|
of wDirty:
|
||||||
if sym.kind == skTemplate: incl(sym.flags, sfDirty)
|
if sym.kind == skTemplate: incl(sym.flags, sfDirty)
|
||||||
|
|
@ -1098,10 +1098,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
||||||
of wThis:
|
of wThis:
|
||||||
if it.kind in nkPragmaCallKinds and it.len == 2:
|
if it.kind in nkPragmaCallKinds and it.len == 2:
|
||||||
c.selfName = considerQuotedIdent(c, it[1])
|
c.selfName = considerQuotedIdent(c, it[1])
|
||||||
message(c.config, n.info, warnDeprecated, "the '.this' pragma")
|
message(c.config, n.info, warnDeprecated, "the '.this' pragma is deprecated")
|
||||||
elif it.kind == nkIdent or it.len == 1:
|
elif it.kind == nkIdent or it.len == 1:
|
||||||
c.selfName = getIdent(c.cache, "self")
|
c.selfName = getIdent(c.cache, "self")
|
||||||
message(c.config, n.info, warnDeprecated, "the '.this' pragma")
|
message(c.config, n.info, warnDeprecated, "the '.this' pragma is deprecated")
|
||||||
else:
|
else:
|
||||||
localError(c.config, it.info, "'this' pragma is allowed to have zero or one arguments")
|
localError(c.config, it.info, "'this' pragma is allowed to have zero or one arguments")
|
||||||
of wNoRewrite:
|
of wNoRewrite:
|
||||||
|
|
|
||||||
|
|
@ -2434,7 +2434,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||||
result.kind = nkCall
|
result.kind = nkCall
|
||||||
result = semExpr(c, result, flags)
|
result = semExpr(c, result, flags)
|
||||||
of nkBind:
|
of nkBind:
|
||||||
message(c.config, n.info, warnDeprecated, "bind")
|
message(c.config, n.info, warnDeprecated, "bind is deprecated")
|
||||||
result = semExpr(c, n.sons[0], flags)
|
result = semExpr(c, n.sons[0], flags)
|
||||||
of nkTypeOfExpr, nkTupleTy, nkTupleClassTy, nkRefTy..nkEnumTy, nkStaticTy:
|
of nkTypeOfExpr, nkTupleTy, nkTupleClassTy, nkRefTy..nkEnumTy, nkStaticTy:
|
||||||
if c.matchedConcept != nil and n.len == 1:
|
if c.matchedConcept != nil and n.len == 1:
|
||||||
|
|
|
||||||
|
|
@ -1582,7 +1582,7 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) =
|
||||||
foundObj = true
|
foundObj = true
|
||||||
x.methods.add((col,s))
|
x.methods.add((col,s))
|
||||||
if not foundObj:
|
if not foundObj:
|
||||||
message(c.config, n.info, warnDeprecated, "generic method not attachable to object type")
|
message(c.config, n.info, warnDeprecated, "generic method not attachable to object type is deprecated")
|
||||||
else:
|
else:
|
||||||
# why check for the body? bug #2400 has none. Checking for sfForward makes
|
# why check for the body? bug #2400 has none. Checking for sfForward makes
|
||||||
# no sense either.
|
# no sense either.
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType =
|
||||||
tyError, tyObject}:
|
tyError, tyObject}:
|
||||||
message c.config, n[i].info, errGenerated, "region needs to be an object type"
|
message c.config, n[i].info, errGenerated, "region needs to be an object type"
|
||||||
else:
|
else:
|
||||||
message(c.config, n.info, warnDeprecated, "region for pointer types")
|
message(c.config, n.info, warnDeprecated, "region for pointer types is deprecated")
|
||||||
addSonSkipIntLit(result, region)
|
addSonSkipIntLit(result, region)
|
||||||
addSonSkipIntLit(result, t)
|
addSonSkipIntLit(result, t)
|
||||||
if tfPartial in result.flags:
|
if tfPartial in result.flags:
|
||||||
|
|
|
||||||
|
|
@ -470,9 +470,9 @@ proc warnAboutDeprecated(conf: ConfigRef; info: TLineInfo; s: PSym) =
|
||||||
for it in pragmaNode:
|
for it in pragmaNode:
|
||||||
if whichPragma(it) == wDeprecated and it.safeLen == 2 and
|
if whichPragma(it) == wDeprecated and it.safeLen == 2 and
|
||||||
it[1].kind in {nkStrLit..nkTripleStrLit}:
|
it[1].kind in {nkStrLit..nkTripleStrLit}:
|
||||||
message(conf, info, warnDeprecated, it[1].strVal & "; " & name)
|
message(conf, info, warnDeprecated, it[1].strVal & "; " & name & " is deprecated")
|
||||||
return
|
return
|
||||||
message(conf, info, warnDeprecated, name)
|
message(conf, info, warnDeprecated, name & " is deprecated")
|
||||||
|
|
||||||
proc userError(conf: ConfigRef; info: TLineInfo; s: PSym) =
|
proc userError(conf: ConfigRef; info: TLineInfo; s: PSym) =
|
||||||
let pragmaNode = extractPragma(s)
|
let pragmaNode = extractPragma(s)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ Advanced options:
|
||||||
--skipUserCfg do not read the user's configuration file
|
--skipUserCfg do not read the user's configuration file
|
||||||
--skipParentCfg do not read the parent dirs' configuration files
|
--skipParentCfg do not read the parent dirs' configuration files
|
||||||
--skipProjCfg do not read the project's configuration file
|
--skipProjCfg do not read the project's configuration file
|
||||||
--gc:refc|v2|markAndSweep|boehm|go|none|regions
|
--gc:refc|markAndSweep|boehm|go|none|regions
|
||||||
select the GC to use; default is 'refc'
|
select the GC to use; default is 'refc'
|
||||||
--index:on|off turn index file generation on|off
|
--index:on|off turn index file generation on|off
|
||||||
--putenv:key=value set an environment variable
|
--putenv:key=value set an environment variable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue