From e3bd72e8e264497cf4135b8e3ae3ac2e8dc5460e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 15 Sep 2019 15:52:12 +0300 Subject: [PATCH] travis: spawn 2 separate windows instances --- .travis.yml | 37 ++++++++++++++++++++++++++----------- compiler/cheaders.v | 5 +++-- compiler/gen_c.v | 3 +++ 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 81e927b1c5..d930f8cbb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: c matrix: include: - os: linux + name: "linux" dist: xenial sudo: required addons: @@ -17,9 +18,15 @@ matrix: - libfreetype6-dev - libssl-dev - os: windows - language: sh + name: "windows_gcc" + language: bash + filter_secrets: false + - os: windows + name: "windows_msvc" + language: bash filter_secrets: false - os: osx + name: "osx" osx_image: xcode10.3 addons: homebrew: @@ -38,10 +45,21 @@ script: fi - | if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then + ### troubleshooting and diagnostics: show ALL environment variables in the instance + #set set -e git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries thirdparty/freetype/ - echo "Just running ./make.bat to produce v.exe" - ./make.bat + + if [[ "${TRAVIS_JOB_NAME}" == "windows_gcc" ]]; then + echo "Building V with GCC" + export VFLAGS="-os windows" + ./make.bat -gcc + fi + if [[ "${TRAVIS_JOB_NAME}" == "windows_msvc" ]]; then + echo "Building V with MSVC" + export VFLAGS="-os msvc" + ./make.bat -msvc + fi ./v.exe -o v2.exe compiler ./v2.exe -o v3.exe compiler ./v3.exe -o v4.exe compiler @@ -49,20 +67,17 @@ script: ls -la v2.exe ls -la v3.exe ls -la v4.exe - echo "Running v test v..." + + ### running just repl_test.v produces failing results earlier and is easier to read + echo "Running only the repl tests directly..." + ./v.exe ./compiler/tests/repl/repl_test.v + echo "Running ALL tests..." ./v.exe test v - echo "Running v -os msvc test v..." - #./v -os msvc test v - ##echo "Running only the repl tests directly" - ##./v.exe ./compiler/tests/repl/repl_test.v - echo "Testing gcc bootstrapping" - ./make.bat -gcc set +e fi - | if [[ "${TRAVIS_OS_NAME}" != "windows" ]]; then make - #./v install glfw ./v test v fi - | diff --git a/compiler/cheaders.v b/compiler/cheaders.v index e796f1e597..5da192b96f 100644 --- a/compiler/cheaders.v +++ b/compiler/cheaders.v @@ -64,8 +64,9 @@ CommonCHeaders = ' #define _Atomic volatile // MSVC cannot parse some things properly -//#undef EMPTY_STRUCT_DECLARATION -//#define EMPTY_STRUCT_DECLARATION void *____dummy_variable +#undef EMPTY_STRUCT_DECLARATION +#define EMPTY_STRUCT_DECLARATION void *____dummy_variable + #undef OPTION_CAST #define OPTION_CAST(x) #endif diff --git a/compiler/gen_c.v b/compiler/gen_c.v index 44bff72f8a..49235c0610 100644 --- a/compiler/gen_c.v +++ b/compiler/gen_c.v @@ -329,6 +329,9 @@ fn (p mut Parser) gen_struct_init(typ string, t Type) bool { } else { p.gen('($typ) {') + if t.fields.len == 1 && t.fields[0].name == '' && t.fields[0].typ.starts_with('EMPTY_STRUCT_DECLARATION') { + p.gen(' 0 /* v empty struct initialization */ ') + } } } else {