Fix windows compilation error for alloca.

Added MacOS testing.
This commit is contained in:
cheatfate 2018-04-19 23:47:12 +03:00
parent 93f72e024a
commit efcc9e1910
2 changed files with 37 additions and 10 deletions

View File

@ -1,3 +1,6 @@
matrix:
include:
- os: linux
sudo: required
services:
- docker
@ -6,3 +9,25 @@ before_install:
script:
- docker run statusteam/nim-base nim --version
- docker run -v "$(pwd):/project" -w /project statusteam/nim-base sh -c "nimble install -dy && nimble test"
- os: osx
before_install:
- git clone https://github.com/nim-lang/nim.git
- cd nim
- git remote add statusim https://github.com/status-im/nim.git
- git fetch statusim
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
- for b in $(git branch -a --list 'statusim/status-autopatch-*'); do git merge $b; done
- git clone --depth 1 https://github.com/nim-lang/csources.git
- cd csources
- sh build.sh
- cd ..
- export PATH=$PWD/bin:$PATH
- nim c koch
- ./koch boot -d:release
- ./koch nimble
- cd ..
script:
- nimble install -dy && nimble test

View File

@ -42,6 +42,9 @@ type
bufferLen: int32
buffer: UncheckedArray[T]
when defined(windows):
proc alloca(n: int): pointer {.importc, header: "<malloc.h>".}
else:
proc alloca(n: int): pointer {.importc, header: "<alloca.h>".}
proc raiseRangeError(s: string) =
@ -116,4 +119,3 @@ template toOpenArray*(a: StackArray, first: int): auto =
template toOpenArray*(a: StackArray, first, last: int): auto =
if first < 0 or first >= last or last <= a.len: raiseOutOfRange()
toOpenArray(a.buffer, first, last)