mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-07-31 00:37:02 +08:00
Merge remote-tracking branch 'origin/develop' into fix/issue-625-macos-15-2-runtime-error-in-add-function
Requested by @lefticus in PR #654 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
ab9aabbaf3
142
.github/workflows/ci.yml
vendored
Normal file
142
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop, main]
|
||||
pull_request:
|
||||
branches: [develop, main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: Linux GCC ${{ matrix.build_type }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
|
||||
macos:
|
||||
name: macOS AppleClang ${{ matrix.build_type }}
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
|
||||
linux-sanitizers:
|
||||
name: Linux GCC ASAN+UBSAN ${{ matrix.build_type }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
|
||||
macos-sanitizers:
|
||||
name: macOS AppleClang ASAN+UBSAN ${{ matrix.build_type }}
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
|
||||
windows:
|
||||
name: Windows MSVC ${{ matrix.build_type }}
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config ${{ matrix.build_type }} -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure -C ${{ matrix.build_type }}
|
||||
|
||||
linux-tsan:
|
||||
name: Linux GCC TSAN ${{ matrix.build_type }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_THREAD_SANITIZER=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
|
||||
macos-tsan:
|
||||
name: macOS AppleClang TSAN ${{ matrix.build_type }}
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type: [Debug, Release]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_THREAD_SANITIZER=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -j
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
@ -34,7 +34,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
option(ENABLE_THREAD_SANITIZER "Enable thread sanitizer testing in gcc/clang" FALSE)
|
||||
if(ENABLE_THREAD_SANITIZER)
|
||||
add_definitions(-fsanitize=thread -g)
|
||||
@ -87,6 +87,16 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
endif()
|
||||
|
||||
|
||||
elseif(MSVC)
|
||||
option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in MSVC" FALSE)
|
||||
if(ENABLE_ADDRESS_SANITIZER)
|
||||
add_compile_options(/fsanitize=address)
|
||||
# ASAN is incompatible with /RTC (runtime error checks) and incremental linking
|
||||
string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
add_link_options(/INCREMENTAL:NO)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
23
appveyor.yml
23
appveyor.yml
@ -1,23 +0,0 @@
|
||||
version: 6.1.x.{build}
|
||||
image:
|
||||
- Visual Studio 2019
|
||||
environment:
|
||||
matrix:
|
||||
- VS_VERSION: "Visual Studio 16"
|
||||
build_script:
|
||||
- cmd: >-
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
|
||||
cmake c:\Projects\chaiscript -G "%VS_VERSION%" -DBUILD_TESTING:BOOL=ON -DBUILD_MODULES:BOOL=ON
|
||||
|
||||
cmake --build . --config Debug
|
||||
test_script:
|
||||
- cmd: ctest -C Debug
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
url: https://webhooks.gitter.im/e/9ff725a985b5679d1d5d
|
||||
on_build_success: true
|
||||
on_build_failure: true
|
||||
on_build_status_changed: false
|
||||
@ -26,10 +26,6 @@
|
||||
|
||||
namespace chaiscript {
|
||||
struct AST_Node;
|
||||
struct AST_Node_Trace;
|
||||
namespace exception {
|
||||
struct eval_error;
|
||||
}
|
||||
} // namespace chaiscript
|
||||
|
||||
namespace chaiscript {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
|
||||
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <regex>
|
||||
|
||||
@ -1455,3 +1455,23 @@ TEST_CASE("Issue 625: function_less_than strict-weak ordering with different ari
|
||||
CHECK(chai.eval<int>("overloaded(5)") == 5);
|
||||
CHECK(chai.eval<int>("overloaded(3, 2.0)") == 5);
|
||||
}
|
||||
|
||||
// Regression test for issue #607: AST_Node_Trace must be a complete type
|
||||
// when used in eval_error's std::vector<AST_Node_Trace> call_stack member.
|
||||
// This failed to compile with C++20 on clang/libc++ when AST_Node_Trace
|
||||
// was only forward-declared before eval_error's definition.
|
||||
TEST_CASE("eval_error with AST_Node_Trace call stack compiles in C++20") {
|
||||
chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(), create_chaiscript_parser());
|
||||
|
||||
// Trigger an eval_error by calling a non-existent function
|
||||
try {
|
||||
chai.eval("nonexistent_function()");
|
||||
REQUIRE(false);
|
||||
} catch (const chaiscript::exception::eval_error &e) {
|
||||
// Verify that eval_error's call_stack member (std::vector<AST_Node_Trace>)
|
||||
// is usable - this would fail to compile if AST_Node_Trace were incomplete
|
||||
const auto &stack = e.call_stack;
|
||||
CHECK(e.pretty_print().size() > 0);
|
||||
(void)stack;
|
||||
}
|
||||
}
|
||||
|
||||
3
unittests/now_function.chai
Normal file
3
unittests/now_function.chai
Normal file
@ -0,0 +1,3 @@
|
||||
// Regression test for issue #660: now() requires <chrono> include
|
||||
var t = now()
|
||||
assert_true(t > 0)
|
||||
Loading…
x
Reference in New Issue
Block a user