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,8 +1,33 @@
sudo: required
services:
- docker
before_install:
- docker pull statusteam/nim-base
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"
matrix:
include:
- os: linux
sudo: required
services:
- docker
before_install:
- docker pull statusteam/nim-base
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,7 +42,10 @@ type
bufferLen: int32
buffer: UncheckedArray[T]
proc alloca(n: int): pointer {.importc, header: "<alloca.h>".}
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) =
raise newException(RangeError, s)
@ -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)