mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 14:03:23 +00:00
Deprecate gc v2 (#10151)
* Deprecate gc v2 * warnDeprecated now has custom messages
This commit is contained in:
@@ -224,7 +224,7 @@ proc testCompileOptionArg*(conf: ConfigRef; switch, arg: string, info: TLineInfo
|
||||
case arg.normalize
|
||||
of "boehm": result = conf.selectedGC == gcBoehm
|
||||
of "refc": result = conf.selectedGC == gcRefc
|
||||
of "v2": result = conf.selectedGC == gcV2
|
||||
of "v2": result = false
|
||||
of "markandsweep": result = conf.selectedGC == gcMarkAndSweep
|
||||
of "generational": result = false
|
||||
of "destructors": result = conf.selectedGC == gcDestructors
|
||||
@@ -442,7 +442,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||
of "refc":
|
||||
conf.selectedGC = gcRefc
|
||||
of "v2":
|
||||
conf.selectedGC = gcV2
|
||||
message(conf, info, warnDeprecated, "--gc:v2 is deprecated; using default gc")
|
||||
of "markandsweep":
|
||||
conf.selectedGC = 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")
|
||||
if sfDeprecated in result.flags:
|
||||
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:
|
||||
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)
|
||||
importStmtResult.add newSymNode(result, 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",
|
||||
warnXIsNeverRead: "'$1' is never read",
|
||||
warnXmightNotBeenInit: "'$1' might not have been initialized",
|
||||
warnDeprecated: "$1 is deprecated",
|
||||
warnDeprecated: "$1",
|
||||
warnConfigDeprecated: "config file '$1' is deprecated",
|
||||
warnSmallLshouldNotBeUsed: "'l' should not be used as an identifier; may look like '1' (one)",
|
||||
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)
|
||||
else:
|
||||
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 =
|
||||
result = strTableGet(c.currentScope.symbols, s)
|
||||
|
||||
@@ -147,7 +147,7 @@ proc getModuleName*(conf: ConfigRef; n: PNode): string =
|
||||
# hacky way to implement 'x / y /../ z':
|
||||
result = renderTree(n, {renderNoComments}).replace(" ")
|
||||
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(".", "/")
|
||||
of nkImportAs:
|
||||
result = getModuleName(conf, n.sons[0])
|
||||
|
||||
@@ -1916,7 +1916,7 @@ proc parseObject(p: var TParser): PNode =
|
||||
getTok(p)
|
||||
if p.tok.tokType == tkCurlyDotLe and p.validInd:
|
||||
# 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))
|
||||
else:
|
||||
addSon(result, p.emptyNode)
|
||||
@@ -2008,7 +2008,7 @@ proc parseTypeDef(p: var TParser): PNode =
|
||||
if p.tok.tokType == tkBracketLe and p.validInd:
|
||||
if not noPragmaYet:
|
||||
# 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)
|
||||
else:
|
||||
genericParam = p.emptyNode
|
||||
|
||||
@@ -242,7 +242,7 @@ proc pragmaNoForward(c: PContext, n: PNode; flag=sfNoForward) =
|
||||
# deprecated as of 0.18.1
|
||||
message(c.config, n.info, warnDeprecated,
|
||||
"use {.experimental: \"codeReordering.\".} instead; " &
|
||||
(if flag == sfNoForward: "{.noForward.}" else: "{.reorder.}"))
|
||||
(if flag == sfNoForward: "{.noForward.}" else: "{.reorder.}") & " is deprecated")
|
||||
|
||||
proc processCallConv(c: PContext, n: PNode) =
|
||||
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) =
|
||||
if (n.kind in nkPragmaCallKinds and n.len == 2) and (n[1].kind == nkIdent):
|
||||
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:
|
||||
invalidPragma(c, n)
|
||||
|
||||
proc processUndef(c: PContext, n: PNode) =
|
||||
if (n.kind in nkPragmaCallKinds and n.len == 2) and (n[1].kind == nkIdent):
|
||||
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:
|
||||
invalidPragma(c, n)
|
||||
|
||||
@@ -784,7 +784,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
||||
if sym.kind in {skTemplate, skMacro}:
|
||||
incl(sym.flags, sfImmediate)
|
||||
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)
|
||||
of wDirty:
|
||||
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:
|
||||
if it.kind in nkPragmaCallKinds and it.len == 2:
|
||||
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:
|
||||
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:
|
||||
localError(c.config, it.info, "'this' pragma is allowed to have zero or one arguments")
|
||||
of wNoRewrite:
|
||||
|
||||
@@ -2434,7 +2434,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||
result.kind = nkCall
|
||||
result = semExpr(c, result, flags)
|
||||
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)
|
||||
of nkTypeOfExpr, nkTupleTy, nkTupleClassTy, nkRefTy..nkEnumTy, nkStaticTy:
|
||||
if c.matchedConcept != nil and n.len == 1:
|
||||
|
||||
@@ -1582,7 +1582,7 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) =
|
||||
foundObj = true
|
||||
x.methods.add((col,s))
|
||||
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:
|
||||
# why check for the body? bug #2400 has none. Checking for sfForward makes
|
||||
# no sense either.
|
||||
|
||||
@@ -210,7 +210,7 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType =
|
||||
tyError, tyObject}:
|
||||
message c.config, n[i].info, errGenerated, "region needs to be an object type"
|
||||
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, t)
|
||||
if tfPartial in result.flags:
|
||||
|
||||
@@ -470,9 +470,9 @@ proc warnAboutDeprecated(conf: ConfigRef; info: TLineInfo; s: PSym) =
|
||||
for it in pragmaNode:
|
||||
if whichPragma(it) == wDeprecated and it.safeLen == 2 and
|
||||
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
|
||||
message(conf, info, warnDeprecated, name)
|
||||
message(conf, info, warnDeprecated, name & " is deprecated")
|
||||
|
||||
proc userError(conf: ConfigRef; info: TLineInfo; s: PSym) =
|
||||
let pragmaNode = extractPragma(s)
|
||||
|
||||
@@ -82,7 +82,7 @@ Advanced options:
|
||||
--skipUserCfg do not read the user's configuration file
|
||||
--skipParentCfg do not read the parent dirs' configuration files
|
||||
--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'
|
||||
--index:on|off turn index file generation on|off
|
||||
--putenv:key=value set an environment variable
|
||||
|
||||
Reference in New Issue
Block a user