Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
f2ccd2a1
Unverified
Commit
f2ccd2a1
authored
Apr 28, 2020
by
Joseph Noir
Committed by
GitHub
Apr 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1099
Fix build with exceptions disabled, close #1086
parents
4a1324ae
0dac5b9f
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
46 additions
and
12 deletions
+46
-12
Jenkinsfile
Jenkinsfile
+10
-0
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+2
-1
libcaf_core/caf/raise_error.hpp
libcaf_core/caf/raise_error.hpp
+18
-1
libcaf_core/src/detail/message_data.cpp
libcaf_core/src/detail/message_data.cpp
+2
-1
libcaf_core/src/detail/type_id_list_builder.cpp
libcaf_core/src/detail/type_id_list_builder.cpp
+3
-2
libcaf_core/src/message_builder.cpp
libcaf_core/src/message_builder.cpp
+3
-1
libcaf_core/test/byte.cpp
libcaf_core/test/byte.cpp
+4
-2
libcaf_core/test/detail/unordered_flat_map.cpp
libcaf_core/test/detail/unordered_flat_map.cpp
+2
-2
libcaf_core/test/mixin/requester.cpp
libcaf_core/test/mixin/requester.cpp
+2
-2
No files found.
Jenkinsfile
View file @
f2ccd2a1
...
...
@@ -69,6 +69,16 @@ config = [
tags:
[
'docker'
],
builds:
[
'debug'
,
'release'
],
]],
// One extra debug build with exceptions disabled.
[
'centos-7'
,
[
numCores:
4
,
tags:
[
'docker'
],
builds:
[
'debug'
],
extraDebugFlags:
[
'CAF_ENABLE_EXCEPTIONS:BOOL=OFF'
,
'CMAKE_CXX_FLAGS:STRING=-fno-exceptions'
,
],
]],
// Other UNIX systems.
[
'macOS'
,
[
numCores:
4
,
...
...
libcaf_core/caf/message.hpp
View file @
f2ccd2a1
...
...
@@ -29,6 +29,7 @@
#include "caf/detail/padded_size.hpp"
#include "caf/fwd.hpp"
#include "caf/intrusive_cow_ptr.hpp"
#include "caf/raise_error.hpp"
namespace
caf
{
...
...
@@ -188,7 +189,7 @@ message make_message(Ts&&... xs) {
auto
types
=
make_type_id_list
<
strip_and_convert_t
<
Ts
>
...
>
();
auto
vptr
=
malloc
(
data_size
);
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
auto
raw_ptr
=
new
(
vptr
)
message_data
(
types
);
intrusive_cow_ptr
<
message_data
>
ptr
{
raw_ptr
,
false
};
message_data_init
(
raw_ptr
->
storage
(),
std
::
forward
<
Ts
>
(
xs
)...);
...
...
libcaf_core/caf/raise_error.hpp
View file @
f2ccd2a1
...
...
@@ -27,10 +27,27 @@
#include "caf/detail/core_export.hpp"
#include "caf/detail/pp.hpp"
#include <type_traits>
namespace
caf
::
detail
{
CAF_CORE_EXPORT
void
log_cstring_error
(
const
char
*
cstring
);
#ifdef CAF_ENABLE_EXCEPTIONS
template
<
class
T
>
[[
noreturn
]]
std
::
enable_if_t
<
std
::
is_constructible
<
T
,
const
char
*>::
value
>
throw_impl
(
const
char
*
msg
)
{
throw
T
{
msg
};
}
template
<
class
T
>
[[
noreturn
]]
void
throw_impl
(...)
{
throw
T
{};
}
#endif // CAF_ENABLE_EXCEPTIONS
}
// namespace caf::detail
#ifdef CAF_ENABLE_EXCEPTIONS
...
...
@@ -38,7 +55,7 @@ CAF_CORE_EXPORT void log_cstring_error(const char* cstring);
# define CAF_RAISE_ERROR_IMPL_2(exception_type, msg) \
do { \
::caf::detail::log_cstring_error(msg); \
throw exception_type(msg);
\
::caf::detail::throw_impl<exception_type>(msg);
\
} while (false)
# define CAF_RAISE_ERROR_IMPL_1(msg) \
...
...
libcaf_core/src/detail/message_data.cpp
View file @
f2ccd2a1
...
...
@@ -24,6 +24,7 @@
#include "caf/detail/meta_object.hpp"
#include "caf/error.hpp"
#include "caf/error_code.hpp"
#include "caf/raise_error.hpp"
#include "caf/sec.hpp"
#include "caf/span.hpp"
...
...
@@ -55,7 +56,7 @@ message_data* message_data::copy() const {
auto
total_size
=
sizeof
(
message_data
)
+
storage_size
;
auto
vptr
=
malloc
(
total_size
);
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
auto
ptr
=
new
(
vptr
)
message_data
(
types_
);
auto
src
=
storage
();
auto
dst
=
ptr
->
storage
();
...
...
libcaf_core/src/detail/type_id_list_builder.cpp
View file @
f2ccd2a1
...
...
@@ -25,6 +25,7 @@
#include "caf/config.hpp"
#include "caf/hash/fnv.hpp"
#include "caf/raise_error.hpp"
#include "caf/type_id_list.hpp"
namespace
caf
::
detail
{
...
...
@@ -99,7 +100,7 @@ void type_id_list_builder::reserve(size_t new_capacity) {
reserved_
=
new_capacity
;
auto
ptr
=
realloc
(
storage_
,
reserved_
*
sizeof
(
type_id_t
));
if
(
ptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
storage_
=
reinterpret_cast
<
type_id_t
*>
(
ptr
);
// Add the dummy for later inserting the size on first push_back.
if
(
size_
==
0
)
{
...
...
@@ -144,7 +145,7 @@ type_id_list type_id_list_builder::copy_to_list() const {
return
make_type_id_list
();
auto
vptr
=
malloc
(
size_
*
sizeof
(
type_id_t
));
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
auto
copy
=
reinterpret_cast
<
type_id_t
*>
(
vptr
);
copy
[
0
]
=
static_cast
<
type_id_t
>
(
list_size
);
memcpy
(
copy
+
1
,
storage_
+
1
,
list_size
*
sizeof
(
type_id_t
));
...
...
libcaf_core/src/message_builder.cpp
View file @
f2ccd2a1
...
...
@@ -18,6 +18,8 @@
#include "caf/message_builder.hpp"
#include "caf/raise_error.hpp"
namespace
caf
{
namespace
{
...
...
@@ -36,7 +38,7 @@ message to_message_impl(size_t storage_size, TypeListBuilder& types,
return
message
{};
auto
vptr
=
malloc
(
sizeof
(
message_data
)
+
storage_size
);
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
message_data
*
raw_ptr
;
if
constexpr
(
Policy
==
move_msg
)
raw_ptr
=
new
(
vptr
)
message_data
(
types
.
move_to_list
());
...
...
libcaf_core/test/byte.cpp
View file @
f2ccd2a1
...
...
@@ -25,6 +25,7 @@
#include <cstdint>
#include "caf/detail/parser/add_ascii.hpp"
#include "caf/raise_error.hpp"
using
namespace
caf
;
...
...
@@ -36,13 +37,14 @@ byte operator"" _b(const char* str, size_t n) {
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
if
(
str
[
i
]
!=
'\''
)
{
if
(
!
detail
::
parser
::
add_ascii
<
2
>
(
result
,
str
[
i
]))
throw
std
::
logic_error
(
"invalid character or over-/underflow"
);
CAF_RAISE_ERROR
(
std
::
logic_error
,
"invalid character or over-/underflow"
);
else
++
consumed
;
}
}
if
(
consumed
!=
8
)
throw
std
::
logic_error
(
"too few digits, expected exactly 8"
);
CAF_RAISE_ERROR
(
std
::
logic_error
,
"too few digits, expected exactly 8"
);
return
static_cast
<
byte
>
(
result
);
}
...
...
libcaf_core/test/detail/unordered_flat_map.cpp
View file @
f2ccd2a1
...
...
@@ -163,7 +163,7 @@ CAF_TEST(lookup) {
CAF_CHECK_EQUAL
(
cxs
.
find
(
5
),
xs
.
end
());
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
CAF_TEST
(
exceptions
)
{
fill_xs
();
try
{
...
...
@@ -175,7 +175,7 @@ CAF_TEST(exceptions) {
CAF_FAIL
(
"got an expected exception"
);
}
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
// We repeat several tests with strings as value type instead of integers to
// trigger non-trivial destructors.
...
...
libcaf_core/test/mixin/requester.cpp
View file @
f2ccd2a1
...
...
@@ -180,7 +180,7 @@ CAF_TEST(requesters support fan_out_request) {
CAF_CHECK_EQUAL
(
*
sum
,
9
);
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
CAF_TEST
(
exceptions
while
processing
requests
trigger
error
messages
)
{
auto
worker
=
sys
.
spawn
([]
{
...
...
@@ -199,6 +199,6 @@ CAF_TEST(exceptions while processing requests trigger error messages) {
expect
((
error
),
from
(
worker
).
to
(
client
).
with
(
sec
::
runtime_error
));
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
CAF_TEST_FIXTURE_SCOPE_END
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment