Commit e513f0ee authored by Dominik Charousset's avatar Dominik Charousset

fixed warnings and remote tests in MinGW build

parent e45262b4
...@@ -62,7 +62,6 @@ namespace cppa { ...@@ -62,7 +62,6 @@ namespace cppa {
namespace detail { namespace detail {
int backtrace(void** buffer, int size); int backtrace(void** buffer, int size);
char** backtrace_symbols(void* const* buffer, int size);
void backtrace_symbols_fd(void* const* buffer, int size, int fd); void backtrace_symbols_fd(void* const* buffer, int size, int fd);
} // namespace detail } // namespace detail
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <io.h> #include <io.h>
#include <sstream>
#include <iostream>
#include "cppa/detail/execinfo_windows.hpp" #include "cppa/detail/execinfo_windows.hpp"
namespace cppa { namespace cppa {
...@@ -68,29 +71,17 @@ namespace detail { ...@@ -68,29 +71,17 @@ namespace detail {
int backtrace(void** buffer, int size) { int backtrace(void** buffer, int size) {
if (size <= 0) return 0; if (size <= 0) return 0;
auto hProcess = GetCurrentProcess();
auto frames = CaptureStackBackTrace (0, (DWORD) size, buffer, NULL); auto frames = CaptureStackBackTrace (0, (DWORD) size, buffer, NULL);
return static_cast<int>(frames); return static_cast<int>(frames);
} }
char** backtrace_symbols(void* const* buffer, int size) {
auto t = ((size_t) size) * ((sizeof(void*) * 2) + 6 + sizeof(char*));
auto r = (char**) malloc(t);
if (!r) return nullptr;
auto cur = (char *) &r[size];
for (int i = 0; i < size; i++) {
r[i] = cur;
sprintf (cur, "[+0x%Ix]", (size_t) buffer[i]);
cur += strlen (cur) + 1;
}
return r;
}
void backtrace_symbols_fd(void* const* buffer, int size, int fd) { void backtrace_symbols_fd(void* const* buffer, int size, int fd) {
char s[128]; std::ostringstream out;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
sprintf(s, "[+0x%Ix]\n", (size_t) buffer[i]); out << "[" << std::hex << reinterpret_cast<size_t>(buffer[i])
write(fd, s, strlen (s)); << "]" << std::endl;
auto s = out.str();
write(fd, s.c_str(), s.size());
} }
_commit(fd); _commit(fd);
} }
......
...@@ -201,7 +201,7 @@ inline void ccall(const char* errmsg, F f, Ts&&... args) { ...@@ -201,7 +201,7 @@ inline void ccall(const char* errmsg, F f, Ts&&... args) {
\******************************************************************************/ \******************************************************************************/
std::pair<native_socket_type, native_socket_type> create_pipe() { std::pair<native_socket_type, native_socket_type> create_pipe() {
socklen_t addrlen = sizeof(sockaddr_in); socklen_t addrlen = sizeof(sockaddr_in);
native_socket_type socks[2] = {-1, -1}; native_socket_type socks[2] = {invalid_socket, invalid_socket};
auto listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); auto listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listener == invalid_socket) throw_io_failure("socket() failed"); if (listener == invalid_socket) throw_io_failure("socket() failed");
union { union {
......
...@@ -11,10 +11,17 @@ ...@@ -11,10 +11,17 @@
#include "cppa/cppa.hpp" #include "cppa/cppa.hpp"
#include "cppa/actor.hpp" #include "cppa/actor.hpp"
#include "cppa/config.hpp"
#include "cppa/logging.hpp" #include "cppa/logging.hpp"
#include "cppa/to_string.hpp" #include "cppa/to_string.hpp"
#include "cppa/util/scope_guard.hpp" #include "cppa/util/scope_guard.hpp"
#ifndef CPPA_WINDOWS
constexpr char to_dev_null[] = " &>/dev/null";
#else
constexpr char to_dev_null[] = "";
#endif // CPPA_WINDOWS
void set_default_test_settings(); void set_default_test_settings();
size_t cppa_error_count(); size_t cppa_error_count();
......
...@@ -167,7 +167,7 @@ int main(int argc, char** argv) { ...@@ -167,7 +167,7 @@ int main(int argc, char** argv) {
spawn_io_server(peer_acceptor, port, p); spawn_io_server(peer_acceptor, port, p);
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
ostringstream oss; ostringstream oss;
oss << app_path << " mode=client port=" << port << " &>/dev/null"; oss << app_path << " mode=client port=" << port << to_dev_null;
thread child{[&oss] { thread child{[&oss] {
CPPA_LOGC_TRACE("NONE", "main$thread_launcher", ""); CPPA_LOGC_TRACE("NONE", "main$thread_launcher", "");
auto cmdstr = oss.str(); auto cmdstr = oss.str();
......
...@@ -387,7 +387,8 @@ int main(int argc, char** argv) { ...@@ -387,7 +387,8 @@ int main(int argc, char** argv) {
thread child; thread child;
ostringstream oss; ostringstream oss;
if (run_remote_actor) { if (run_remote_actor) {
oss << app_path << " run=remote_actor port=" << port << " &>/dev/null"; oss << app_path << " run=remote_actor port=" << port
<< to_dev_null;
// execute client_part() in a separate process, // execute client_part() in a separate process,
// connected via localhost socket // connected via localhost socket
child = thread([&oss]() { child = thread([&oss]() {
......
...@@ -109,7 +109,7 @@ int main(int argc, char** argv) { ...@@ -109,7 +109,7 @@ int main(int argc, char** argv) {
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
thread child; thread child;
ostringstream oss; ostringstream oss;
oss << argv[0] << " run=remote_actor port=" << port << " &>/dev/null"; oss << argv[0] << " run=remote_actor port=" << port << to_dev_null;
// execute client_part() in a separate process, // execute client_part() in a separate process,
// connected via localhost socket // connected via localhost socket
child = thread([&oss]() { child = thread([&oss]() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment