mirror of
https://github.com/status-im/nim-confutils.git
synced 2025-01-21 01:18:59 +00:00
require secondarySources
to be gcsafe
(#86)
Avoid Nim 2.0 warning in callers of `confutils.load`. ``` Warning: 'loadImpl' is not GC-safe as it performs an indirect call via 'secondarySources' [GcUnsafe2] ```
This commit is contained in:
parent
c67257660b
commit
dbe8d61f7f
@ -893,7 +893,7 @@ proc loadImpl[C, SecondarySources](
|
||||
quitOnFailure = true,
|
||||
secondarySourcesRef: ref SecondarySources,
|
||||
secondarySources: proc (config: Configuration,
|
||||
sources: ref SecondarySources) = nil,
|
||||
sources: ref SecondarySources) {.gcsafe.} = nil,
|
||||
envVarsPrefix = getAppFilename()): Configuration =
|
||||
## Loads a program configuration by parsing command-line arguments
|
||||
## and a standard set of config files that can specify:
|
||||
|
@ -182,7 +182,11 @@ proc testConfigFile() =
|
||||
putEnv("PREFIX_DATA_DIR", "ENV VAR DATADIR")
|
||||
|
||||
test "basic config file":
|
||||
let conf = TestConf.load(envVarsPrefix="prefix", secondarySources = proc (config: TestConf, sources: auto) =
|
||||
let conf = TestConf.load(
|
||||
envVarsPrefix="prefix",
|
||||
secondarySources = proc (
|
||||
config: TestConf, sources: ref SecondarySources
|
||||
) {.raises: [ConfigurationError].} =
|
||||
if config.configFile.isSome:
|
||||
sources.addConfigFile(Toml, config.configFile.get)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user