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
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
Jason Turner
a880319db8
Merge branch 'develop' into best_practices
2018-05-30 08:30:29 -06:00
Jason Turner
c19705da5d
Merge remote-tracking branch 'origin/c++17' into develop
2018-05-29 13:21:09 -06:00
Jason Turner
2d762c8be3
Update copyrights to 2018
2018-05-29 11:51:15 -06:00
Jason Turner
d59350d356
Various cleanups
2017-11-18 18:42:45 -07:00
Jason Turner
7986ea08b6
More work towards all noexcept, warning cleanups
2017-08-09 14:36:45 -06:00
Jason Turner
e07cd88659
Add noexcept where appropriate
...
This modifies no logic, it simply adds the keyword `noexcept`
I believe this is 100% correct. It calls methods that are not
guaranteed to be `noexcept`, such as `operator[]` but have
no logically way of throwing.
2017-07-22 20:33:30 -06:00
Jason Turner
755f650a8d
strip noexcept
2017-07-21 05:44:20 -06:00
Jason Turner
064a385a64
Merge branch 'develop' of github.com:ChaiScript/ChaiScript into develop
2017-02-22 15:56:04 -07:00
Jason Turner
283785faaf
Add PVS Studio and address some issues it found
2017-02-22 15:18:56 -07:00
Jason Turner
87f1242ed4
Update copyrights to 2017
2017-02-15 15:55:40 -07:00
Jason Turner
077c93ab27
Fix/enhance unique_ptr support
2017-02-04 09:14:07 -08:00
Jason Turner
24352c62e8
Some clang specific fixes / warnings
2017-02-02 08:00:57 -08:00
Jason Turner
ce62706fea
Clean up warnings
...
* msvc
* pvs-studio
2016-12-06 10:31:36 -07:00
Jason Turner
fb7f8f194c
Add support for r-value parameters and unique_ptr
...
Notes
* Due to the limitations for how Boxed_Value is handled
the unique_ptrs must still be wrapped in a shared_ptr
* However, this caveat does not directly affect the user
2016-12-05 12:07:56 -07:00
Jason Turner
b1f1803759
Some cleanups found by clang's analyzer
2016-10-28 14:53:01 -06:00
Jason Turner
4e6e63ab5d
Cleanups and split up into _basic options
2016-08-27 10:33:44 -06:00
Jason Turner
e44724c780
Fix debug/clang build issues
2016-06-29 17:27:07 -06:00
Jason Turner
57aa874c6e
Revert "Prefer make_unique over make_shared"
...
This reverts commit 5a947b5035dc99d2dbef35a220340036886e189c.
2016-04-16 09:02:38 -06:00
Jason Turner
1a42614441
Remove unnecessary code
2016-04-15 23:02:42 -06:00
Jason Turner
6fa83bca85
Remove Do_Call helper class
2016-04-15 15:31:19 -06:00
Jason Turner
5a947b5035
Prefer make_unique over make_shared
2016-04-04 15:36:38 -06:00
Jason Turner
dd6b38cafb
Merge branch 'release-5.x' into develop
2016-03-30 13:01:46 -06:00
Jason Turner
91a3ae1f14
Add ability to take non-const & shared_ptr params
2016-03-27 20:02:27 -06:00
Jason Turner
5247de7d1b
use a global void value for returning unknown values
2016-03-11 10:21:39 -07:00
Jason Turner
b5b6e5a5a3
Drop ifdef'd code for gcc4.6 and msvc12
2016-03-04 11:15:39 -07:00
Jason Turner
ed65ad72d0
Update copyrights
2016-02-14 20:04:17 -07:00
Jason Turner
36765df3c0
Fix vector element assignment issues
2015-10-15 21:20:12 -06:00
Jason Turner
aabe53c934
Make var work with move-only types
2015-09-12 22:21:05 -06:00
Jason Turner
c0dd0a3041
Use static const true/false on platforms with magic statics
2015-05-02 15:27:51 -06:00
Jason Turner
45baf6f8e9
Global const values for booleans
...
- Reduces number of Boxed_Value constructions greatly
2015-05-02 13:08:23 -06:00
Jason Turner
986699a3fe
Merge branch 'develop' into smaller_make_shared
...
And also apply cleanups suggested from resharper
Conflicts:
include/chaiscript/language/chaiscript_parser.hpp
2015-04-27 11:55:12 -06:00
Jason Turner
2f531355cd
Boxed_Value changes necessary for libc++
2015-04-20 20:30:25 -06:00
Jason Turner
1f74bfd9b3
Attempt to create the concept of "return values"
...
to reduce clones of values. This doesn't quite work
2015-04-07 13:54:38 -06:00
Jason Turner
9b19aa3b6e
Get ready for 5.6.0 release
...
- Update copyrights to 2015
- Set version to 5.6.0
- Update release notes
2015-01-17 07:05:10 -07:00
Jason Turner
f95ca75aca
Clean up more warnings with stricter warning levels
2015-01-15 14:24:39 -07:00
Jason Turner
c876a89030
Fix crash during user_defined_conversions_2
...
Temporaries created during user conversion operations were being dropped
before the result of the conversion was able to be used. This fixes that
by temporarily storing the result of the conversion inside the
current Function_Push_Pop context.
2014-11-02 21:37:01 -07:00
Jason Turner
86e26966c1
More code cleanups
2014-10-28 10:53:29 -06:00
Jason Turner
78cd980067
Work around broken Apple clang implementation
...
This line of code does not cause an error on clang-3.4 or clang-3.5
on Linux. Apple's clang is somewhere between the two, no way to know
where.
For an unknown reason, specifying default move operations in 'Data'
causes the compiler to think that Boxed_Value is an incomplete type.
This is highly illogical since Data is only used via a shared_ptr, so
the size / type of Boxed_Value should be fully known (and is known on
every other compiler/platform combination).
2014-10-01 15:49:11 -06:00
Jason Turner
58d9e69479
Work around missing move operations in MSVC12
2014-10-05 21:53:44 -06:00
Jason Turner
935e9de19e
GCC 4.6 fixes to cleanups
2014-10-05 14:58:27 -06:00
Jason Turner
f547b4bb10
Enable moving of data into Boxed_Values when possible
2014-10-05 12:11:46 -06:00
Jason Turner
87e40237d3
Enable moving of Any objects
2014-10-05 11:47:50 -06:00
Jason Turner
4f5a6da280
Move constructor and noexcept correctness
2014-09-21 14:19:41 -06:00
Jason Turner
5861c45fc1
C++11 related cleanup and improvments
2014-09-15 21:16:44 -06:00
Jason Turner
4ee9ba9c96
Make up some of the performance losses #132
2014-08-30 14:49:31 -06:00
Jason Turner
a71903f185
Add strong reference to range objects #132
2014-08-30 13:36:36 -06:00
Jason Turner
4018c873dc
Spelling fixes, phase 1.
2014-05-29 20:16:47 -06:00
Jason Turner
c0bf6ee99d
Apply corrections from the "include what you use" tool
...
Generally cleanups of the includes. Making sure each file
can properly stand on its own and forward declares when possible.
2014-05-10 18:41:11 -06:00