Rob Loach
2eb3279c39
Merge pull request #630 from ChaiScript/update-catch
...
Update catch.hpp to v2.13.9
2025-07-30 17:07:44 -04:00
Rob Loach
2951ce4a7a
Update catch.hpp to v2.13.9
...
Fixes #619
2025-07-28 09:33:41 -04:00
Rob Loach
f904cd5447
Merge pull request #626 from CTerasa-ep/fix-warnings
...
Fix several `noexcept` and `possibly dangling reference` warnings
2025-02-20 09:45:10 -05:00
Clemens Terasa
b44b987d4b
chaiscript_eval: Fix warning by replacing lambda with ternary operator expression
...
Using GCC 13.3.0 I get warnings like the following:
```
In file included from .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_optimizer.hpp:10,
from .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_parser.hpp:26,
from .../ChaiScript/static_libs/chaiscript_parser.cpp:1:
.../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp: In instantiation of ‘chaiscript::Boxed_Value chaiscript::eval::Global_Decl_AST_Node<T>::eval_internal(const chaiscript::detail::Dispatch_State&) const [with T = chaiscript::eval::Tracer<chaiscript::eval::Noop_Tracer_Detail>]’:
.../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp:503:19: required from here
.../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp:504:28: warning: possibly dangling reference to a temporary [-Wdangling-reference]
504 | const std::string &idname = [&]() -> const std::string & {
| ^~~~~~
.../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_eval.hpp:510:10: note: the temporary was destroyed at the end of the full expression ‘<lambda closure object>chaiscript::eval::Global_Decl_AST_Node<chaiscript::eval::Tracer<chaiscript::eval::Noop_Tracer_Detail> >::eval_internal(const chaiscript::detail::Dispatch_State&) const::<lambda()>{((const chaiscript::eval::Global_Decl_AST_Node<chaiscript::eval::Tracer<chaiscript::eval::Noop_Tracer_Detail> >*)this)}.chaiscript::eval::Global_Decl_AST_Node<chaiscript::eval::Tracer<chaiscript::eval::Noop_Tracer_Detail> >::eval_internal(const chaiscript::detail::Dispatch_State&) const::<lambda()>()’
504 | const std::string &idname = [&]() -> const std::string & {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
505 | if (this->children[0]->identifier == AST_Node_Type::Reference) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
506 | return this->children[0]->children[0]->text;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
507 | } else {
| ~~~~~~~~
508 | return this->children[0]->text;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
509 | }
| ~
510 | }();
| ~^~
```
Fix this by replacing the lambda with a simple ternary operator
expression.
2025-02-19 20:04:17 +01:00
Clemens Terasa
43dc35c3df
test_module: Fix noexcept warning
...
With gcc 13.3.0 an `-Wnoexcept` I warnings like the following:
```
In file included from .../include/c++/13.3.0/bits/char_traits.h:57,
from .../include/c++/13.3.0/string_view:40,
from .../ChaiScript/include/chaiscript/chaiscript_defines.hpp:23,
from .../ChaiScript/include/chaiscript/chaiscript_basic.hpp:10,
from .../ChaiScript/src/test_module.cpp:2:
.../include/c++/13.3.0/bits/stl_construct.h: In instantiation of ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = Type2; _Args = {Type2}; decltype (::new(void*(0)) _Tp) = Type2*]’:
.../include/c++/13.3.0/bits/stl_construct.h:115:21: required from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Type2; _Args = {Type2}]’
.../include/c++/13.3.0/bits/alloc_traits.h:661:19: required from ‘static constexpr void std::allocator_traits<std::allocator<void> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = Type2; _Args = {Type2}; allocator_type = std::allocator<void>]’
.../include/c++/13.3.0/bits/shared_ptr_base.h:604:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {Type2}; _Tp = Type2; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
.../include/c++/13.3.0/bits/shared_ptr_base.h:971:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = Type2; _Alloc = std::allocator<void>; _Args = {Type2}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
.../include/c++/13.3.0/bits/shared_ptr_base.h:1712:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {Type2}; _Tp = Type2; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
.../include/c++/13.3.0/bits/shared_ptr.h:464:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {Type2}; _Tp = Type2]’
.../include/c++/13.3.0/bits/shared_ptr.h:1009:14: required from ‘std::shared_ptr<std::_NonArray<_Tp> > std::make_shared(_Args&& ...) [with _Tp = Type2; _Args = {Type2}; _NonArray<_Tp> = Type2]’
.../ChaiScript/include/chaiscript/dispatchkit/boxed_value.hpp:121:37: required from ‘static auto chaiscript::Boxed_Value::Object_Data::get(T, bool) [with T = Type2]’
.../ChaiScript/include/chaiscript/dispatchkit/boxed_value.hpp:133:34: required from ‘chaiscript::Boxed_Value::Boxed_Value(T&&, bool) [with T = Type2; <template-parameter-1-2> = void]’
.../ChaiScript/include/chaiscript/dispatchkit/type_conversions.hpp:480:26: required from ‘chaiscript::Type_Conversion chaiscript::type_conversion(const Callable&) [with From = TestBaseType; To = Type2; Callable = create_chaiscript_module_test_module()::<lambda(const TestBaseType&)>; Type_Conversion = std::shared_ptr<detail::Type_Conversion_Base>]’
.../ChaiScript/src/test_module.cpp:194:58: required from here
.../include/c++/13.3.0/bits/stl_construct.h:95:14: warning: noexcept-expression evaluates to ‘false’ because of a call to ‘Type2::Type2(Type2&&)’ [-Wnoexcept]
95 | noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../ChaiScript/src/test_module.cpp:60:7: note: but ‘Type2::Type2(Type2&&)’ does not throw; perhaps it should be declared ‘noexcept’
60 | class Type2 {
| ^~~~~
```
Fix this by introducing `noexcept` like proposed in the warning.
2025-02-19 20:04:17 +01:00
Clemens Terasa
681104b68f
dispatchkit: boxed_value: Fix noexcept warning for Data ctor
...
Using gcc 13.3.0 I get many warnings like the following:
```
In file included from .../include/c++/13.3.0/bits/stl_iterator.h:85,
from .../include/c++/13.3.0/bits/stl_algobase.h:67,
from .../include/c++/13.3.0/bits/stl_tree.h:63,
from .../include/c++/13.3.0/map:62,
from .../ChaiScript/static_libs/../include/chaiscript/chaiscript_stdlib.hpp:10,
from .../ChaiScript/static_libs/chaiscript_stdlib.cpp:1:
.../include/c++/13.3.0/bits/stl_construct.h: In instantiation of ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; decltype (::new(void*(0)) _Tp) = chaiscript::Boxed_Value::Data*]’:
.../include/c++/13.3.0/bits/stl_construct.h:115:21: required from ‘constexpr void std::_Construct(_Tp*, _Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}]’
.../include/c++/13.3.0/bits/alloc_traits.h:661:19: required from ‘static constexpr void std::allocator_traits<std::allocator<void> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; allocator_type = std::allocator<void>]’
.../include/c++/13.3.0/bits/shared_ptr_base.h:604:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _Tp = chaiscript::Boxed_Value::Data; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
.../include/c++/13.3.0/bits/shared_ptr_base.h:971:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Alloc = std::allocator<void>; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
.../include/c++/13.3.0/bits/shared_ptr_base.h:1712:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _Tp = chaiscript::Boxed_Value::Data; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
.../include/c++/13.3.0/bits/shared_ptr.h:464:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _Tp = chaiscript::Boxed_Value::Data]’
.../include/c++/13.3.0/bits/shared_ptr.h:1009:14: required from ‘std::shared_ptr<std::_NonArray<_Tp> > std::make_shared(_Args&& ...) [with _Tp = chaiscript::Boxed_Value::Data; _Args = {chaiscript::Type_Info, chaiscript::detail::Any, bool, std::nullptr_t, bool&}; _NonArray<_Tp> = chaiscript::Boxed_Value::Data]’
.../ChaiScript/static_libs/../include/chaiscript/language/../dispatchkit/boxed_value.hpp:74:38: required from here
.../include/c++/13.3.0/bits/stl_construct.h:95:14: warning: noexcept-expression evaluates to ‘false’ because of a call to ‘chaiscript::Boxed_Value::Data::Data(const chaiscript::Type_Info&, chaiscript::detail::Any, bool, const void*, bool)’ [-Wnoexcept]
95 | noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from .../ChaiScript/static_libs/../include/chaiscript/language/chaiscript_common.hpp:21,
from .../ChaiScript/static_libs/../include/chaiscript/chaiscript_stdlib.hpp:17:
.../ChaiScript/static_libs/../include/chaiscript/language/../dispatchkit/boxed_value.hpp:34:7: note: but ‘chaiscript::Boxed_Value::Data::Data(const chaiscript::Type_Info&, chaiscript::detail::Any, bool, const void*, bool)’ does not throw; perhaps it should be declared ‘noexcept’
34 | Data(const Type_Info &ti, chaiscript::detail::Any to, bool is_ref, const void *t_void_ptr, bool t_return_value)
| ^~~~
/
```
Fix this by adding a noexcept like the warning suggests.
2025-02-19 20:04:17 +01:00
Rob Loach
406a7ba1ef
Merge pull request #575 from stephenberry/develop
...
Added virtual destructor for ChaiScript_Basic
2024-02-20 12:52:52 -05:00
Rob Loach
8d82f237bf
Merge pull request #616 from wholivesinapineappleunderthesea/develop
...
Fix spelling mistakes in cheatsheet.md
2023-11-27 23:27:35 -05:00
ar
dbd2050eb2
Fix spelling mistakes in cheatsheet.md
2023-11-27 21:18:34 -05:00
Rob Loach
866ef314a8
Add /build to .gitignore ( #614 )
2023-10-08 17:18:49 -04:00
Rob Loach
bf9f5ae2e1
Merge pull request #608 from FellowTraveler/develop
...
Add C++20 support
2023-10-08 14:58:17 -04:00
FellowTraveler
0870cb5a3a
Add C++20 support
...
ChaiScript now successfully builds on my Mac with C++20, and passes 100% of the unit tests.
2023-06-18 06:42:51 -05:00
Rob Loach
3e548184c0
Merge pull request #606 from SirNate0/patch-1
...
Fix cheatsheet.md typos
2023-02-21 12:03:56 -05:00
SirNate0
41da3db06a
Fix cheatsheet.md typos
...
Add missing parenthesis and quotes.
2023-02-21 11:33:36 -05:00
Rob Loach
2898ae679f
Merge pull request #580 from TerensTare/patch-1
...
Fix typo in `cheatsheet.md`
2021-09-02 12:19:25 -05:00
Terens
6ccab2af6a
Fix typo in cheatsheet.md
2021-09-02 14:16:15 +02:00
Stephen Berry
7cd229cf26
Added virtual destructor for ChaiScript_Basic
...
ChaiScript inherits from ChaiScript_Basic, so this is good practice.
I also need to be able to inherit from ChaiScript and dynamic cast, which is impossible without this destructor.
2021-07-28 09:04:38 -05:00
Rob Loach
6411aa7498
Merge pull request #573 from totalgee/fix_erase_at_bounds
...
Fix crash with out of bounds index (issue #572 )
2021-07-08 19:55:50 -04:00
Glen Fraser
5722a5177d
Fix crash with out of bounds index (issue #572 )
2021-07-08 18:55:36 +02:00
Rob Loach
3703a78813
Merge pull request #566 from IohannRabeson/cmake
...
Properly create a CMake a library called chaiscript
2021-06-09 01:22:51 -04:00
IohannRabeson
53fe932be4
Properly create a library called Chaiscript.
...
This allows to properly use Chaiscript as submodule with CMake.
2021-06-08 23:00:43 -04:00
Rob Loach
651abc2f5b
Merge pull request #565 from IohannRabeson/improve_cmake
...
Add include directory to chai target.
2021-06-07 15:38:30 -04:00
irabeson
b3ed4466f3
Add include directory to chai target.
...
This way, the path to the Chai's include directory is automagicaly
knowns by any CMake project using chai.
2021-06-07 11:35:52 -04:00
Rob Loach
855c3ced88
Merge pull request #562 from BerndAmend/develop
...
Update readme.txt and fix json namespace clash with nlohmann/json
Fixes #486 , #506
2021-05-24 17:56:06 -04:00
Bernd Amend
323cd7a8d4
drop link to the build dashboard
2021-05-24 23:34:54 +02:00
Bernd Amend
535d80e8d2
drop coverity scan status
2021-05-24 23:34:54 +02:00
Bernd Amend
efeb244cd9
readme.txt update requirements to C++17 #506
2021-05-24 23:34:50 +02:00
Bernd Amend
a1a78e9cf1
remove trailing spaces from readme.txt
2021-05-24 23:31:31 +02:00
Bernd Amend
0f37802aba
move namespace json into the chaiscript namespace #486
2021-05-24 23:31:31 +02:00
Rob Loach
c258670350
Merge pull request #560 from ChaiScript/master
...
Merge pull request #441 from ChaiScript/develop
2021-05-24 16:10:36 -04:00
Rob Loach
69123db3dc
license: Restore Jonathan Turner copyright
2021-05-24 16:09:20 -04:00
Rob Loach
439c1a96d3
Merge branch 'develop' into master
2021-05-24 16:05:30 -04:00
Rob Loach
3aa1fa8278
Merge pull request #557 from BerndAmend/develop
...
change .clang-format and reformat code with clang-format 11
2021-05-24 09:20:36 -04:00
Rob Loach
ef5a22b2b5
Merge pull request #558 from ChaiScript/revert-482-pair_conversion
...
Revert "Add pair_conversion registration helper with unit test"
2021-05-24 09:20:24 -04:00
Rob Loach
6030ea63bd
Revert "Add pair_conversion registration helper with unit test"
2021-05-24 09:19:47 -04:00
Rob Loach
9c118c2b1e
Merge pull request #482 from totalgee/pair_conversion
...
Add pair_conversion registration helper with unit test
2021-05-24 09:19:20 -04:00
Bernd Amend
cff6a0aced
change .clang-format and reformat code with clang-format 11
...
I initially tried to use the existing .clang-format file,
but it does not match the code style (at least with clang-format 11)
and the formatting is not consistent across files.
Therefore, I decided to rewrite the .clang-format with some personal
preferences.
Used command
find . -iname "*.hpp" -o -iname "*.cpp" | xargs clang-format -i -style=file
2021-05-24 10:44:15 +02:00
Rob Loach
6491b80496
Merge pull request #556 from BerndAmend/develop
...
Fixes for #527 , #537 , #553 , C++20, and various compiler warnings/errors reported by g++ 11.1, clang 11, and vs2019
2021-05-23 17:23:11 -04:00
Bernd Amend
a4fd5371bd
fix handling of $ in strings ChaiScript#553
2021-05-23 12:05:33 +02:00
Bernd Amend
55ec76fd39
fix testcase "Test unicode matches C++"
2021-05-22 23:54:18 +02:00
Bernd Amend
82ef037912
fix vs2019 build
2021-05-22 23:53:31 +02:00
Bernd Amend
4ec767bdc9
drop /std:c++latest and /std:c++17
...
Both are already set by cmake
2021-05-22 22:37:08 +02:00
Bernd Amend
7aea27412d
make is_nothrow_forward_constructible_v static (warning from gcc 7)
2021-05-22 18:45:12 +02:00
Bernd Amend
8ee033cf89
remove not required ()
2021-05-22 18:45:12 +02:00
Bernd Amend
59f64d8d82
set min required cmake version to 3.12
...
The already used functionallity already
requires a more recent cmake version.
Short summary why a never version is required:
CMAKE_CXX_STANDARD requires >=3.1
CMAKE_COMPILER_IS_GNUCC requires >3.7
ENABLE_LTO can be simplified with >3.11 (3.13 VS)
2021-05-22 18:45:12 +02:00
Bernd Amend
39f7aa0900
remove trailing spaces
2021-05-22 18:45:12 +02:00
Bernd Amend
32723fcbc0
fix clangs -Wshadow warning
2021-05-22 18:45:12 +02:00
Bernd Amend
14e9ec6e97
fix implicit conversion warnings by making them explicit
2021-05-22 18:45:12 +02:00
Bernd Amend
532f044bd3
remove trailing ;
2021-05-22 18:45:12 +02:00
Bernd Amend
b5d81613cf
cmake suppress some clang compiler warnings
2021-05-22 18:45:12 +02:00