Skip to content

Commit

Permalink
Locks modules should give a compile error when threads are not enable…
Browse files Browse the repository at this point in the history
…d. (#12231)

* Locks modules should give a compile error when threads are not enabled.

* fix the compile flags to make the tests pass, or ignore files where necessary.

* Fixed when statement to account for doc builds.
  • Loading branch information
rayman22201 authored and Araq committed Sep 26, 2019
1 parent 944fcc0 commit 9dd297f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/core/locks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

## This module contains Nim's support for locks and condition vars.


when not compileOption("threads") and not defined(nimdoc):
{.error: "Locks requires --threads:on option.".}

const insideRLocksModule = false
include "system/syslocks"

Expand Down
4 changes: 4 additions & 0 deletions lib/core/rlocks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

## This module contains Nim's support for reentrant locks.


when not compileOption("threads") and not defined(nimdoc):
{.error: "Rlocks requires --threads:on option.".}

const insideRLocksModule = true
include "system/syslocks"

Expand Down
4 changes: 4 additions & 0 deletions testament/testament.nim
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ const disabledFilesDefault = @[
"setimpl.nim",
"hashcommon.nim",

# Requires compiling with '--threads:on`
"sharedlist.nim",
"sharedtables.nim",

# Error: undeclared identifier: 'hasThreadSupport'
"ioselectors_epoll.nim",
"ioselectors_kqueue.nim",
Expand Down
1 change: 1 addition & 0 deletions tests/stdlib/tsharedtable.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
discard """
cmd: "nim $target --threads:on $options $file"
output: '''
'''
"""
Expand Down

0 comments on commit 9dd297f

Please sign in to comment.