Skip to content

Commit

Permalink
remove all remaining warnings when build nim (with -d:nimHasLibFFI) (#…
Browse files Browse the repository at this point in the history
…13084)

* cleanup deprecations in evalffi + elsewhere

* remove dead code getOrdValue64
  • Loading branch information
timotheecour authored and Araq committed Jan 9, 2020
1 parent 852170c commit 3f78873
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
12 changes: 6 additions & 6 deletions compiler/evalffi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This file implements the FFI part of the evaluator for Nim code.

import ast, astalgo, ropes, types, options, tables, dynlib, msgs, os, lineinfos
import ast, types, options, tables, dynlib, msgs, lineinfos
import pkg/libffi

when defined(windows):
Expand Down Expand Up @@ -70,7 +70,7 @@ proc importcSymbol*(conf: ConfigRef, sym: PSym): PNode =
if theAddr.isNil: globalError(conf, sym.info, "cannot import: " & name)
result.intVal = cast[ByteAddress](theAddr)

proc mapType(conf: ConfigRef, t: ast.PType): ptr libffi.TType =
proc mapType(conf: ConfigRef, t: ast.PType): ptr libffi.Type =
if t == nil: return addr libffi.type_void

case t.kind
Expand Down Expand Up @@ -415,7 +415,7 @@ proc callForeignFunction*(conf: ConfigRef, call: PNode): PNode =
internalAssert conf, call[0].kind == nkPtrLit

var cif: TCif
var sig: TParamList
var sig: ParamList
# use the arguments' types for varargs support:
for i in 1..<call.len:
sig[i-1] = mapType(conf, call[i].typ)
Expand All @@ -427,7 +427,7 @@ proc callForeignFunction*(conf: ConfigRef, call: PNode): PNode =
mapType(conf, typ[0]), sig) != OK:
globalError(conf, call.info, "error in FFI call")

var args: TArgList
var args: ArgList
let fn = cast[pointer](call[0].intVal)
for i in 1..<call.len:
var t = call[i].typ
Expand Down Expand Up @@ -455,7 +455,7 @@ proc callForeignFunction*(conf: ConfigRef, fn: PNode, fntyp: PType,
internalAssert conf, fn.kind == nkPtrLit

var cif: TCif
var sig: TParamList
var sig: ParamList
for i in 0..len-1:
var aTyp = args[i+start].typ
if aTyp.isNil:
Expand All @@ -469,7 +469,7 @@ proc callForeignFunction*(conf: ConfigRef, fn: PNode, fntyp: PType,
mapType(conf, fntyp[0]), sig) != OK:
globalError(conf, info, "error in FFI call")

var cargs: TArgList
var cargs: ArgList
let fn = cast[pointer](fn.intVal)
for i in 0..len-1:
let t = args[i+start].typ
Expand Down
2 changes: 1 addition & 1 deletion compiler/sem.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ when defined(nimfix):
import nimfix/prettybase

when not defined(leanCompiler):
import spawn, semparallel
import spawn

# implementation

Expand Down
7 changes: 0 additions & 7 deletions compiler/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ proc getOrdValue*(n: PNode; onError = high(Int128)): Int128 =
# should therefore really be revisited.
onError

proc getOrdValue64*(n: PNode): BiggestInt {.deprecated: "use getOrdvalue".} =
case n.kind
of nkCharLit..nkUInt64Lit: n.intVal
of nkNilLit: 0
of nkHiddenStdConv: getOrdValue64(n[1])
else: high(BiggestInt)

proc getFloatValue*(n: PNode): BiggestFloat =
case n.kind
of nkFloatLiterals: n.floatVal
Expand Down

0 comments on commit 3f78873

Please sign in to comment.