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
9a614951
Commit
9a614951
authored
Apr 27, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build with exceptions disabled, close #1086
parent
64c40959
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
12 deletions
+34
-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
+6
-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 @
9a614951
...
@@ -59,6 +59,16 @@ config = [
...
@@ -59,6 +59,16 @@ config = [
tags:
[
'docker'
],
tags:
[
'docker'
],
builds:
[
'debug'
,
'release'
],
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.
// Other UNIX systems.
[
'macOS'
,
[
[
'macOS'
,
[
numCores:
4
,
numCores:
4
,
...
...
libcaf_core/caf/message.hpp
View file @
9a614951
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "caf/detail/padded_size.hpp"
#include "caf/detail/padded_size.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
#include "caf/intrusive_cow_ptr.hpp"
#include "caf/intrusive_cow_ptr.hpp"
#include "caf/raise_error.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -188,7 +189,7 @@ message make_message(Ts&&... xs) {
...
@@ -188,7 +189,7 @@ message make_message(Ts&&... xs) {
auto
types
=
make_type_id_list
<
strip_and_convert_t
<
Ts
>
...
>
();
auto
types
=
make_type_id_list
<
strip_and_convert_t
<
Ts
>
...
>
();
auto
vptr
=
malloc
(
data_size
);
auto
vptr
=
malloc
(
data_size
);
if
(
vptr
==
nullptr
)
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
auto
raw_ptr
=
new
(
vptr
)
message_data
(
types
);
auto
raw_ptr
=
new
(
vptr
)
message_data
(
types
);
intrusive_cow_ptr
<
message_data
>
ptr
{
raw_ptr
,
false
};
intrusive_cow_ptr
<
message_data
>
ptr
{
raw_ptr
,
false
};
message_data_init
(
raw_ptr
->
storage
(),
std
::
forward
<
Ts
>
(
xs
)...);
message_data_init
(
raw_ptr
->
storage
(),
std
::
forward
<
Ts
>
(
xs
)...);
...
...
libcaf_core/caf/raise_error.hpp
View file @
9a614951
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
#include "caf/detail/core_export.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/detail/pp.hpp"
#include "caf/detail/pp.hpp"
#include <type_traits>
namespace
caf
::
detail
{
namespace
caf
::
detail
{
CAF_CORE_EXPORT
void
log_cstring_error
(
const
char
*
cstring
);
CAF_CORE_EXPORT
void
log_cstring_error
(
const
char
*
cstring
);
...
@@ -38,7 +40,10 @@ CAF_CORE_EXPORT void log_cstring_error(const char* cstring);
...
@@ -38,7 +40,10 @@ CAF_CORE_EXPORT void log_cstring_error(const char* cstring);
# define CAF_RAISE_ERROR_IMPL_2(exception_type, msg) \
# define CAF_RAISE_ERROR_IMPL_2(exception_type, msg) \
do { \
do { \
::caf::detail::log_cstring_error(msg); \
::caf::detail::log_cstring_error(msg); \
throw exception_type(msg); \
if constexpr (std::is_constructible<exception_type, const char*>::value) \
throw exception_type(msg); \
else \
throw exception_type(); \
} while (false)
} while (false)
# define CAF_RAISE_ERROR_IMPL_1(msg) \
# define CAF_RAISE_ERROR_IMPL_1(msg) \
...
...
libcaf_core/src/detail/message_data.cpp
View file @
9a614951
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "caf/detail/meta_object.hpp"
#include "caf/detail/meta_object.hpp"
#include "caf/error.hpp"
#include "caf/error.hpp"
#include "caf/error_code.hpp"
#include "caf/error_code.hpp"
#include "caf/raise_error.hpp"
#include "caf/sec.hpp"
#include "caf/sec.hpp"
#include "caf/span.hpp"
#include "caf/span.hpp"
...
@@ -55,7 +56,7 @@ message_data* message_data::copy() const {
...
@@ -55,7 +56,7 @@ message_data* message_data::copy() const {
auto
total_size
=
sizeof
(
message_data
)
+
storage_size
;
auto
total_size
=
sizeof
(
message_data
)
+
storage_size
;
auto
vptr
=
malloc
(
total_size
);
auto
vptr
=
malloc
(
total_size
);
if
(
vptr
==
nullptr
)
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
auto
ptr
=
new
(
vptr
)
message_data
(
types_
);
auto
ptr
=
new
(
vptr
)
message_data
(
types_
);
auto
src
=
storage
();
auto
src
=
storage
();
auto
dst
=
ptr
->
storage
();
auto
dst
=
ptr
->
storage
();
...
...
libcaf_core/src/detail/type_id_list_builder.cpp
View file @
9a614951
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "caf/config.hpp"
#include "caf/config.hpp"
#include "caf/hash/fnv.hpp"
#include "caf/hash/fnv.hpp"
#include "caf/raise_error.hpp"
#include "caf/type_id_list.hpp"
#include "caf/type_id_list.hpp"
namespace
caf
::
detail
{
namespace
caf
::
detail
{
...
@@ -99,7 +100,7 @@ void type_id_list_builder::reserve(size_t new_capacity) {
...
@@ -99,7 +100,7 @@ void type_id_list_builder::reserve(size_t new_capacity) {
reserved_
=
new_capacity
;
reserved_
=
new_capacity
;
auto
ptr
=
realloc
(
storage_
,
reserved_
*
sizeof
(
type_id_t
));
auto
ptr
=
realloc
(
storage_
,
reserved_
*
sizeof
(
type_id_t
));
if
(
ptr
==
nullptr
)
if
(
ptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
storage_
=
reinterpret_cast
<
type_id_t
*>
(
ptr
);
storage_
=
reinterpret_cast
<
type_id_t
*>
(
ptr
);
// Add the dummy for later inserting the size on first push_back.
// Add the dummy for later inserting the size on first push_back.
if
(
size_
==
0
)
{
if
(
size_
==
0
)
{
...
@@ -144,7 +145,7 @@ type_id_list type_id_list_builder::copy_to_list() const {
...
@@ -144,7 +145,7 @@ type_id_list type_id_list_builder::copy_to_list() const {
return
make_type_id_list
();
return
make_type_id_list
();
auto
vptr
=
malloc
(
size_
*
sizeof
(
type_id_t
));
auto
vptr
=
malloc
(
size_
*
sizeof
(
type_id_t
));
if
(
vptr
==
nullptr
)
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
auto
copy
=
reinterpret_cast
<
type_id_t
*>
(
vptr
);
auto
copy
=
reinterpret_cast
<
type_id_t
*>
(
vptr
);
copy
[
0
]
=
static_cast
<
type_id_t
>
(
list_size
);
copy
[
0
]
=
static_cast
<
type_id_t
>
(
list_size
);
memcpy
(
copy
+
1
,
storage_
+
1
,
list_size
*
sizeof
(
type_id_t
));
memcpy
(
copy
+
1
,
storage_
+
1
,
list_size
*
sizeof
(
type_id_t
));
...
...
libcaf_core/src/message_builder.cpp
View file @
9a614951
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
#include "caf/message_builder.hpp"
#include "caf/message_builder.hpp"
#include "caf/raise_error.hpp"
namespace
caf
{
namespace
caf
{
namespace
{
namespace
{
...
@@ -36,7 +38,7 @@ message to_message_impl(size_t storage_size, TypeListBuilder& types,
...
@@ -36,7 +38,7 @@ message to_message_impl(size_t storage_size, TypeListBuilder& types,
return
message
{};
return
message
{};
auto
vptr
=
malloc
(
sizeof
(
message_data
)
+
storage_size
);
auto
vptr
=
malloc
(
sizeof
(
message_data
)
+
storage_size
);
if
(
vptr
==
nullptr
)
if
(
vptr
==
nullptr
)
throw
std
::
bad_alloc
(
);
CAF_RAISE_ERROR
(
std
::
bad_alloc
,
"bad_alloc"
);
message_data
*
raw_ptr
;
message_data
*
raw_ptr
;
if
constexpr
(
Policy
==
move_msg
)
if
constexpr
(
Policy
==
move_msg
)
raw_ptr
=
new
(
vptr
)
message_data
(
types
.
move_to_list
());
raw_ptr
=
new
(
vptr
)
message_data
(
types
.
move_to_list
());
...
...
libcaf_core/test/byte.cpp
View file @
9a614951
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <cstdint>
#include <cstdint>
#include "caf/detail/parser/add_ascii.hpp"
#include "caf/detail/parser/add_ascii.hpp"
#include "caf/raise_error.hpp"
using
namespace
caf
;
using
namespace
caf
;
...
@@ -36,13 +37,14 @@ byte operator"" _b(const char* str, size_t n) {
...
@@ -36,13 +37,14 @@ byte operator"" _b(const char* str, size_t n) {
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
if
(
str
[
i
]
!=
'\''
)
{
if
(
str
[
i
]
!=
'\''
)
{
if
(
!
detail
::
parser
::
add_ascii
<
2
>
(
result
,
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
else
++
consumed
;
++
consumed
;
}
}
}
}
if
(
consumed
!=
8
)
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
);
return
static_cast
<
byte
>
(
result
);
}
}
...
...
libcaf_core/test/detail/unordered_flat_map.cpp
View file @
9a614951
...
@@ -163,7 +163,7 @@ CAF_TEST(lookup) {
...
@@ -163,7 +163,7 @@ CAF_TEST(lookup) {
CAF_CHECK_EQUAL
(
cxs
.
find
(
5
),
xs
.
end
());
CAF_CHECK_EQUAL
(
cxs
.
find
(
5
),
xs
.
end
());
}
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
CAF_TEST
(
exceptions
)
{
CAF_TEST
(
exceptions
)
{
fill_xs
();
fill_xs
();
try
{
try
{
...
@@ -175,7 +175,7 @@ CAF_TEST(exceptions) {
...
@@ -175,7 +175,7 @@ CAF_TEST(exceptions) {
CAF_FAIL
(
"got an expected exception"
);
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
// We repeat several tests with strings as value type instead of integers to
// trigger non-trivial destructors.
// trigger non-trivial destructors.
...
...
libcaf_core/test/mixin/requester.cpp
View file @
9a614951
...
@@ -180,7 +180,7 @@ CAF_TEST(requesters support fan_out_request) {
...
@@ -180,7 +180,7 @@ CAF_TEST(requesters support fan_out_request) {
CAF_CHECK_EQUAL
(
*
sum
,
9
);
CAF_CHECK_EQUAL
(
*
sum
,
9
);
}
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
CAF_TEST
(
exceptions
while
processing
requests
trigger
error
messages
)
{
CAF_TEST
(
exceptions
while
processing
requests
trigger
error
messages
)
{
auto
worker
=
sys
.
spawn
([]
{
auto
worker
=
sys
.
spawn
([]
{
...
@@ -199,6 +199,6 @@ CAF_TEST(exceptions while processing requests trigger error messages) {
...
@@ -199,6 +199,6 @@ CAF_TEST(exceptions while processing requests trigger error messages) {
expect
((
error
),
from
(
worker
).
to
(
client
).
with
(
sec
::
runtime_error
));
expect
((
error
),
from
(
worker
).
to
(
client
).
with
(
sec
::
runtime_error
));
}
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
CAF_TEST_FIXTURE_SCOPE_END
()
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