Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows MSVC build to CI #156

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ jobs:
cmake -S compiler -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_CODEGEN='ast_to_llvmir;optree_to_llvmir'
cmake --build build --parallel

build-msvc:
name: Build on Windows MSVC
runs-on: windows-latest
needs: code-style-check
steps:
- name: Initialize repository
uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: |
cmake -S compiler -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel

unit-test:
name: Unit test
runs-on: ubuntu-latest
Expand Down
16 changes: 11 additions & 5 deletions compiler/include/compiler/utils/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
#include <tuple>
#include <type_traits>

#if __has_builtin(__builtin_unreachable)
#if defined(_MSC_VER) && !defined(__clang__) // MSVC
#define COMPILER_UNREACHABLE(MESSAGE) \
assert(false && (MESSAGE)); \
__builtin_unreachable()
#else
#define COMPILER_UNREACHABLE(MESSAGE) assert(false && (MESSAGE))
do { \
assert(false && (MESSAGE)); \
__assume(false); \
} while (0)
#else // GCC, Clang
#define COMPILER_UNREACHABLE(MESSAGE) \
do { \
assert(false && (MESSAGE)); \
__builtin_unreachable(); \
} while (0)
#endif

namespace utils {
Expand Down