Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add {.migrated(ident, msg):... .} to issue callsite migration warnings for changed APIs #18513

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PRTEMP1
  • Loading branch information
timotheecour committed Jul 17, 2021
commit 0b6cdf1326d6dbc62660c6562f00757037aca037
1 change: 1 addition & 0 deletions compiler/condsyms.nim
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,4 @@ proc initDefines*(symbols: StringTableRef) =
defineSymbol("nimHasDragonBox")
defineSymbol("nimHasHintAll")
defineSymbol("nimHasTrace")
defineSymbol("nimHasCustomWarning")
4 changes: 3 additions & 1 deletion compiler/pragmas.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const

const
declPragmas = {wImportc, wImportObjC, wImportCpp, wImportJs, wExportc, wExportCpp,
wExportNims, wExtern, wDeprecated, wNodecl, wError, wUsed}
wExportNims, wExtern, wDeprecated, wNodecl, wError, wUsed, wCustom}
## common pragmas for declarations, to a good approximation
procPragmas* = declPragmas + {FirstCallConv..LastCallConv,
wMagic, wNoSideEffect, wSideEffect, wNoreturn, wNosinks, wDynlib, wHeader,
Expand Down Expand Up @@ -977,6 +977,8 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
# whole module
elif it.kind in nkPragmaCallKinds: deprecatedStmt(c, it)
else: incl(c.module.flags, sfDeprecated)
of wCustom:

of wVarargs:
noVal(c, it)
if sym.typ == nil: invalidPragma(c, it)
Expand Down
1 change: 1 addition & 0 deletions compiler/wordrecg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type

wInOut = "inout", wByCopy = "bycopy", wByRef = "byref", wOneWay = "oneway",
wBitsize = "bitsize", wImportHidden = "all",
wCustom = "custom",

TSpecialWords* = set[TSpecialWord]

Expand Down
2 changes: 1 addition & 1 deletion lib/pure/os.nim
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ when not defined(nimscript):
include "includes/osenv"

proc getHomeDir*(): string {.rtl, extern: "nos$1",
tags: [ReadEnvEffect, ReadIOEffect].} =
tags: [ReadEnvEffect, ReadIOEffect], migration(bar, "baz").} =
## Returns the home directory of the current user.
##
## This proc is wrapped by the `expandTilde proc <#expandTilde,string>`_
Expand Down
5 changes: 4 additions & 1 deletion lib/system.nim
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ proc compileOption*(option, arg: string): bool {.
when compileOption("opt", "size") and compileOption("gc", "boehm"):
discard "compiled with optimization for size and uses Boehm's GC"

when not defined(nimHasCustomWarning):
{.pragma: custom.}

{.push warning[GcMem]: off, warning[Uninit]: off.}
# {.push hints: off.}

Expand Down Expand Up @@ -2134,7 +2137,7 @@ const
import system/dollars
export dollars

proc delete*[T](x: var seq[T], i: Natural) {.noSideEffect, deprecated: "foobar".} =
proc delete*[T](x: var seq[T], i: Natural) {.noSideEffect.} =
## Deletes the item at index `i` by moving all `x[i+1..^1]` items by one position.
##
## This is an `O(n)` operation.
Expand Down
5 changes: 5 additions & 0 deletions lib/system/inclrtl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ else:

when defined(nimHasSinkInference):
{.push sinkInference: on.}

# when defined(nimMigrationLints):
# {.pragma: migration, deprecated: "see nimLegacyHomeDir".}
# else:
# {.pragma: migration.}