blob: 6a95f1ca001864412bf18a4e5b548d70fbeb72d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
discard """
targets: "c js"
"""
# test the new pragmas
{.push warnings: off, hints: off.}
proc noWarning() =
var
x: int
echo(x)
{.pop.}
proc WarnMe() =
var
x: int
echo(x)
# bug #11852
proc foo(x: string, y: int, res: int) =
{.push checks: off}
var a: ptr char = unsafeAddr(x[y])
{.pop.}
if x.len > y:
doAssert ord(a[]) == 51
else:
doAssert x.len + 48 == res
foo("", 0, 48)
foo("abc", 40, 51)
# bug #22362
{.push staticBoundChecks: on.}
proc main(): void =
{.pop.}
discard
{.push staticBoundChecks: on.}
main()
proc timnFoo[T](obj: T) {.noSideEffect.} = discard # BUG
{.push exportc.}
proc foo1() =
var s1 = "bar"
timnFoo(s1)
var s2 = @[1]
timnFoo(s2)
{.pop.}
block: # bug #22913
block:
type r = object
template std[T](x: T) =
let ttt {.used.} = x
result = $ttt
proc bar[T](x: T): string =
std(x)
{.push exportc: "$1".}
proc foo(): r =
let s = bar(123)
{.pop.}
discard foo()
block:
type r = object
{.push exportc: "$1".}
proc foo2(): r =
let s = $result
{.pop.}
discard foo2()
|