vtable translation unit for thread pool + warns

master
Daniel Kolesa 2018-01-10 02:57:29 +01:00
parent 1f5e7dc193
commit 375c014f7a
5 changed files with 25 additions and 5 deletions

View File

@ -28,6 +28,7 @@ namespace fs = ostd::filesystem;
#include "src/io.cc"
#include "src/process.cc"
#include "src/filesystem.cc"
#include "src/thread_pool.cc"
#include "src/channel.cc"
#include "src/string.cc"
#include "src/argparse.cc"

View File

@ -31,7 +31,7 @@ inline code_t hex_to_code(string_range hs) {
if (!std::isxdigit(c |= 32)) {
throw std::runtime_error{"malformed code point"};
}
ret = ret * 16 + (c - ((c > '9') ? ('a' - 10) : '0'));
ret = ret * 16 + code_t(c - ((c > '9') ? ('a' - 10) : '0'));
}
return ret;
}
@ -62,7 +62,7 @@ struct parse_state {
bits[n] = line;
break;
}
bits[n++] = line.slice(0, sc.data() - line.data());
bits[n++] = line.slice(0, std::size_t(sc.data() - line.data()));
sc.pop_front();
line = sc;
}
@ -145,8 +145,8 @@ struct parse_state {
](std::size_t i, std::size_t offs) {
int off = (!int(offs) * 2) - 1;
return match_pair(i, 2) && (cases.empty() || (
(cases[i + 1] == (codes[i + 1] + off)) &&
(cases[i ] == (codes[i ] + off))
(cases[i + 1] == code_t(std::int32_t(codes[i + 1]) + off)) &&
(cases[i ] == code_t(std::int32_t(codes[i ]) + off))
));
};

View File

@ -209,6 +209,9 @@
# endif
# define OSTD_LOCAL
#else
# if defined(OSTD_BUILD_LIB) || defined(OSTD_BUILD_DLL)
/* -Wunused-macros */
# endif
# if __GNUC__ >= 4
# define OSTD_EXPORT __attribute__((visibility("default")))
# define OSTD_LOCAL __attribute__((visibility("hidden")))

View File

@ -36,7 +36,7 @@ namespace ostd {
namespace detail {
struct tpool_func_base {
tpool_func_base() {}
virtual ~tpool_func_base() {}
virtual ~tpool_func_base();
virtual void clone(tpool_func_base *func) = 0;
virtual void call() = 0;
};

16
src/thread_pool.cc 100644
View File

@ -0,0 +1,16 @@
/* Thread pool implementation bits.
*
* This file is part of libostd. See COPYING.md for futher information.
*/
#include "ostd/thread_pool.hh"
#include "ostd/channel.hh"
namespace ostd {
namespace detail {
/* place the vtable here */
tpool_func_base::~tpool_func_base() {}
} /* namespace detail */
} /* namespace ostd */