From a3f51e2bf332701815c3884b5e6b29bca71f62b1 Mon Sep 17 00:00:00 2001 From: James Osborn Date: Thu, 14 Nov 2024 17:43:01 -0600 Subject: [PATCH] fix Nim warnings --- src/base/basicOps.nim | 1 + src/base/profile.nim | 2 +- src/examples/heatbath2dclockt.nim | 10 +++++----- src/examples/heatbath2dclocktb.nim | 12 ++++++------ src/examples/heatbath2dxy.nim | 12 ++++++------ src/examples/heatbath2dxyp.nim | 18 +++++++++--------- src/examples/heatbath2dxypt.nim | 2 +- src/examples/heatbath2dxyptb.nim | 16 ++++++++-------- src/examples/heatbath2dxyt.nim | 10 +++++----- src/examples/heatbath2dxytb.nim | 16 ++++++++-------- src/examples/modeigs1.nim | 2 +- src/examples/staghmc.nim | 8 ++++---- src/examples/staghmc_h.nim | 8 ++++---- src/examples/staghmc_s.nim | 6 +++--- src/io/modfile.nim | 10 +++++----- src/physics/wilsonD.nim | 20 ++++++++++---------- 16 files changed, 77 insertions(+), 76 deletions(-) diff --git a/src/base/basicOps.nim b/src/base/basicOps.nim index af0fc96d..5498451c 100644 --- a/src/base/basicOps.nim +++ b/src/base/basicOps.nim @@ -256,6 +256,7 @@ template setUnopT*(op,fun,t1,t2: untyped) {.dirty.} = rSetUnopT template setBinopP*(op,fun,t1,t2,t3: untyped) {.dirty.} = + getOptimPragmas() #template op*(x: typedesc[t1]; y: typedesc[t2]): typedesc = t3 proc op*(x: t1; y: t2): auto {.alwaysInline,noInit.} = var r{.noInit.}: t3 diff --git a/src/base/profile.nim b/src/base/profile.nim index 7197cbf0..f577bece 100644 --- a/src/base/profile.nim +++ b/src/base/profile.nim @@ -822,7 +822,7 @@ proc makeHotspotTable(lrti: List[RTInfoObj]): tuple[ns:int64,oh:int64] = t.children.add ri.children[i] do: # loc not found hs[loc] = ri - let tot = makeHotSpotTable(List[RTInfoObj](ri.children)) + #let tot = makeHotSpotTable(List[RTInfoObj](ri.children)) return (nstot, ohtot) proc echoHotspots* = diff --git a/src/examples/heatbath2dclockt.nim b/src/examples/heatbath2dclockt.nim index ed7d8cbc..ba7997f9 100644 --- a/src/examples/heatbath2dclockt.nim +++ b/src/examples/heatbath2dclockt.nim @@ -2,7 +2,7 @@ import qex import gauge, physics/qcdTypes import os, strutils, times -proc sumEnergy(fr,fi:any, J, h:any, g:any, p:seq[float], sf,sb:any) = +proc sumEnergy(fr,fi:auto, J, h:auto, g:auto, p:seq[float], sf,sb:auto) = fr := 0 fi := 0 for nu in 0..`(x) template TXT(x: untyped): untyped = xmltree.newText(x) diff --git a/src/examples/staghmc.nim b/src/examples/staghmc.nim index dc1746e4..d040e46a 100644 --- a/src/examples/staghmc.nim +++ b/src/examples/staghmc.nim @@ -134,9 +134,9 @@ proc mdvf(t: float) = p[mu] -= s*f[mu] toc("mdvf") -proc mdvf2(t: float) = - mdv(t) - mdvf(t) +#proc mdvf2(t: float) = +# mdv(t) +# mdvf(t) # For force gradient update #const useFG = true @@ -175,7 +175,7 @@ proc mdvAll(t: openarray[float]) = # For now, just do it separately. if t[0] != 0: mdv t[0] if t[1] != 0: mdvf t[1] -proc mdvAllfga(ts,gs:openarray[float]) = +proc mdvAllfga(ts,gs:openarray[float]) {.used.} = # TODO: actually share computation. # For now, just do it separately. let diff --git a/src/examples/staghmc_h.nim b/src/examples/staghmc_h.nim index 2643c1a5..8af38010 100644 --- a/src/examples/staghmc_h.nim +++ b/src/examples/staghmc_h.nim @@ -80,7 +80,7 @@ template pnorm2(p2:float) = threadMaster: p2 = p2t g.rephase -proc gaction(g:any, f2:seq[float], p2:float):auto = +proc gaction(g:auto, f2:seq[float], p2:float):auto = let ga = gc.actionA g fa = f2.mapit(0.5*it) @@ -100,14 +100,14 @@ template faction(fa:seq[float]) = threadMaster: fa[i] = psi2 g.rephase -proc olf(f: var any, v1: any, v2: any) = +proc olf(f: var auto, v1: auto, v2: auto) = var t {.noInit.}: type(f) for i in 0..