This reverts commit 98c29c01eb.
This commit is contained in:
parent
2ce592a209
commit
4857c462d5
3 changed files with 14 additions and 17 deletions
|
|
@ -28,6 +28,11 @@ type
|
||||||
|
|
||||||
{.push stackTrace: off.}
|
{.push stackTrace: off.}
|
||||||
|
|
||||||
|
|
||||||
|
proc `$`*(lock: Lock): string =
|
||||||
|
# workaround bug #14873
|
||||||
|
result = "()"
|
||||||
|
|
||||||
proc initLock*(lock: var Lock) {.inline.} =
|
proc initLock*(lock: var Lock) {.inline.} =
|
||||||
## Initializes the given lock.
|
## Initializes the given lock.
|
||||||
when not defined(js):
|
when not defined(js):
|
||||||
|
|
|
||||||
|
|
@ -102,18 +102,26 @@ else:
|
||||||
SysLockObj {.importc: "pthread_mutex_t", pure, final,
|
SysLockObj {.importc: "pthread_mutex_t", pure, final,
|
||||||
header: """#include <sys/types.h>
|
header: """#include <sys/types.h>
|
||||||
#include <pthread.h>""".} = object
|
#include <pthread.h>""".} = object
|
||||||
|
when defined(linux) and defined(amd64):
|
||||||
|
abi: array[40 div sizeof(clong), clong]
|
||||||
|
|
||||||
SysLockAttr {.importc: "pthread_mutexattr_t", pure, final
|
SysLockAttr {.importc: "pthread_mutexattr_t", pure, final
|
||||||
header: """#include <sys/types.h>
|
header: """#include <sys/types.h>
|
||||||
#include <pthread.h>""".} = object
|
#include <pthread.h>""".} = object
|
||||||
|
when defined(linux) and defined(amd64):
|
||||||
|
abi: array[4 div sizeof(cint), cint] # actually a cint
|
||||||
|
|
||||||
SysCondObj {.importc: "pthread_cond_t", pure, final,
|
SysCondObj {.importc: "pthread_cond_t", pure, final,
|
||||||
header: """#include <sys/types.h>
|
header: """#include <sys/types.h>
|
||||||
#include <pthread.h>""".} = object
|
#include <pthread.h>""".} = object
|
||||||
|
when defined(linux) and defined(amd64):
|
||||||
|
abi: array[48 div sizeof(clonglong), clonglong]
|
||||||
|
|
||||||
SysCondAttr {.importc: "pthread_condattr_t", pure, final
|
SysCondAttr {.importc: "pthread_condattr_t", pure, final
|
||||||
header: """#include <sys/types.h>
|
header: """#include <sys/types.h>
|
||||||
#include <pthread.h>""".} = object
|
#include <pthread.h>""".} = object
|
||||||
|
when defined(linux) and defined(amd64):
|
||||||
|
abi: array[4 div sizeof(cint), cint] # actually a cint
|
||||||
|
|
||||||
SysLockType = distinct cint
|
SysLockType = distinct cint
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,21 +11,5 @@ proc use* (m: var MyType): int =
|
||||||
result = 3
|
result = 3
|
||||||
|
|
||||||
block:
|
block:
|
||||||
# bug #14873
|
|
||||||
var l: Lock
|
var l: Lock
|
||||||
doAssert ($l).len > 0
|
doAssert $l == "()"
|
||||||
# on posix, "()", on windows, something else, but that shouldn't be part of the spec
|
|
||||||
# what matters is that `$` doesn't cause the codegen bug mentioned
|
|
||||||
|
|
||||||
when true: # intentional
|
|
||||||
# bug https://github.com/nim-lang/Nim/issues/14873#issuecomment-784241605
|
|
||||||
type
|
|
||||||
Test = object
|
|
||||||
path: string # Removing this makes both cases work.
|
|
||||||
lock: Lock
|
|
||||||
# A: This is not fine.
|
|
||||||
var a = Test()
|
|
||||||
proc main(): void =
|
|
||||||
# B: This is fine.
|
|
||||||
var b = Test()
|
|
||||||
main()
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue