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
4ef8096e
Commit
4ef8096e
authored
Dec 21, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CAF_REQUIRE on FreeBSD, rm execinfo_windows
parent
4e6e3189
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
171 deletions
+21
-171
libcaf_core/caf/config.hpp
libcaf_core/caf/config.hpp
+21
-33
libcaf_core/caf/detail/execinfo_windows.hpp
libcaf_core/caf/detail/execinfo_windows.hpp
+0
-59
libcaf_core/src/execinfo_windows.cpp
libcaf_core/src/execinfo_windows.cpp
+0
-79
No files found.
libcaf_core/caf/config.hpp
View file @
4ef8096e
...
@@ -104,44 +104,32 @@
...
@@ -104,44 +104,32 @@
# error Platform and/or compiler not supportet
# error Platform and/or compiler not supportet
#endif
#endif
#include <memory>
#include <cstdio>
#include <cstdio>
#include <cstdlib>
#include <cstdlib>
// import backtrace and backtrace_symbols_fd into caf::detail
// import backtrace and backtrace_symbols_fd into caf::detail
#ifdef CAF_WINDOWS
#ifndef CAF_ENABLE_RUNTIME_CHECKS
#include "caf/detail/execinfo_windows.hpp"
# define CAF_REQUIRE(unused) static_cast<void>(0)
#else
#elif defined(CAF_WINDOWS) || defined(CAF_BSD)
#include <execinfo.h>
# define CAF_REQUIRE(stmt) \
namespace
caf
{
if (static_cast<bool>(stmt) == false) { \
namespace
detail
{
printf("%s:%u: requirement failed '%s'\n", __FILE__, __LINE__, #stmt); \
using
::
backtrace
;
abort(); \
using
::
backtrace_symbols_fd
;
}
// namespace detail
}
// namespace caf
#endif
#ifdef CAF_ENABLE_RUNTIME_CHECKS
# define CAF_REQUIRE__(stmt, file, line) \
printf("%s:%u: requirement failed '%s'\n", file, line, stmt); { \
void* array[10]; \
auto caf_bt_size = ::caf::detail::backtrace(array, 10); \
::caf::detail::backtrace_symbols_fd(array, caf_bt_size, 2); \
} abort()
# define CAF_REQUIRE(stmt) \
if (static_cast<bool>(stmt) == false) { \
CAF_REQUIRE__(#stmt, __FILE__, __LINE__); \
} static_cast<void>(0)
#else
# define CAF_REQUIRE(unused) static_cast<void>(0)
#endif
#define CAF_CRITICAL__(error, file, line) { \
printf("%s:%u: critical error: '%s'\n", file, line, error); \
exit(7); \
} static_cast<void>(0)
} static_cast<void>(0)
#else // defined(CAF_LINUX) || defined(CAF_MACOS)
# include <execinfo.h>
# define CAF_REQUIRE(stmt) \
if (static_cast<bool>(stmt) == false) { \
printf("%s:%u: requirement failed '%s'\n", __FILE__, __LINE__, #stmt); \
void* array[10]; \
auto caf_bt_size = ::backtrace(array, 10); \
::backtrace_symbols_fd(array, caf_bt_size, 2); \
abort(); \
} static_cast<void>(0)
#endif
#define CAF_CRITICAL(error) CAF_CRITICAL__(error, __FILE__, __LINE__)
#define CAF_CRITICAL(error) \
printf("%s:%u: critical error: '%s'\n", __FILE__, __LINE__, error); \
abort()
#endif // CAF_CONFIG_HPP
#endif // CAF_CONFIG_HPP
libcaf_core/caf/detail/execinfo_windows.hpp
deleted
100644 → 0
View file @
4e6e3189
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2014 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
/******************************************************************************\
* Based on work by the mingw-w64 project; *
* original header: *
* *
* Copyright (c) 2012 mingw-w64 project *
* *
* Contributing author: Kai Tietz *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
* DEALINGS IN THE SOFTWARE. *
\ ******************************************************************************/
#ifndef CAF_DETAIL_EXECINFO_WINDOWS_HPP
#define CAF_DETAIL_EXECINFO_WINDOWS_HPP
namespace
caf
{
namespace
detail
{
int
backtrace
(
void
**
buffer
,
int
size
);
void
backtrace_symbols_fd
(
void
*
const
*
buffer
,
int
size
,
int
fd
);
}
// namespace detail
}
// namespace caf
#endif // CAF_DETAIL_EXECINFO_WINDOWS_HPP
libcaf_core/src/execinfo_windows.cpp
deleted
100644 → 0
View file @
4e6e3189
/******************************************************************************
* _________________________ *
* __ ____/__ |__ ____/ C++ *
* _ / __ /| |_ /_ Actor *
* / /___ _ ___ | __/ Framework *
* ____/ /_/ |_/_/ *
* *
* Copyright (C) 2011 - 2014 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENCE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
/******************************************************************************\
* Based on work by the mingw-w64 project; *
* original header: *
* *
* Copyright (c) 2012 mingw-w64 project *
* *
* Contributing author: Kai Tietz *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
* DEALINGS IN THE SOFTWARE. *
\ ******************************************************************************/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <sstream>
#include <iostream>
#include "cppa/detail/execinfo_windows.hpp"
namespace
cppa
{
namespace
detail
{
int
backtrace
(
void
**
buffer
,
int
size
)
{
if
(
size
<=
0
)
return
0
;
auto
frames
=
CaptureStackBackTrace
(
0
,
(
DWORD
)
size
,
buffer
,
NULL
);
return
static_cast
<
int
>
(
frames
);
}
void
backtrace_symbols_fd
(
void
*
const
*
buffer
,
int
size
,
int
fd
)
{
std
::
ostringstream
out
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
out
<<
"["
<<
std
::
hex
<<
reinterpret_cast
<
size_t
>
(
buffer
[
i
])
<<
"]"
<<
std
::
endl
;
auto
s
=
out
.
str
();
write
(
fd
,
s
.
c_str
(),
s
.
size
());
}
_commit
(
fd
);
}
}
// namespace detail
}
// namespace cppa
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