Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jll63 committed Sep 25, 2024
1 parent 7d86ecb commit 0319b00
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 44 deletions.
20 changes: 1 addition & 19 deletions include/yorel/yomm2/detail/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@

#include <yorel/yomm2/detail/static_list.hpp>

#if defined(YOMM2_SHARED)
#if defined(_MSC_VER)
#if !defined(yOMM2_API_msc)
#define yOMM2_API_msc __declspec(dllimport)
#endif
#endif
#endif

#if !defined(yOMM2_API_gcc)
#define yOMM2_API_gcc
#endif

#if !defined(yOMM2_API_msc)
#define yOMM2_API_msc
#endif

#define yOMM2_API yOMM2_API_gcc yOMM2_API_msc

namespace yorel {
namespace yomm2 {

Expand Down Expand Up @@ -89,7 +71,7 @@ struct class_info : static_list<class_info>::static_link {

struct overrider_info;

struct yOMM2_API method_info : static_list<method_info>::static_link {
struct method_info : static_list<method_info>::static_link {
type_id *vp_begin, *vp_end;
static_list<overrider_info> specs;
void* ambiguous;
Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/basic_error_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace yomm2 {
namespace policies {

template<class Policy, typename Stream = detail::ostderr>
struct yOMM2_API_gcc basic_error_output : virtual error_output {
struct basic_error_output : virtual error_output {
static Stream error_stream;
};

Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/basic_indirect_vptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace yomm2 {
namespace policies {

template<class Policy>
struct yOMM2_API_gcc basic_indirect_vptr : virtual indirect_vptr {
struct basic_indirect_vptr : virtual indirect_vptr {
static std::vector<std::uintptr_t const* const*> indirect_vptrs;
};

Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/basic_trace_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace yomm2 {
namespace policies {

template<class Policy, typename Stream = detail::ostderr>
struct yOMM2_API_gcc basic_trace_output : virtual trace_output {
struct basic_trace_output : virtual trace_output {
static Stream trace_stream;
static bool trace_enabled;
};
Expand Down
21 changes: 7 additions & 14 deletions include/yorel/yomm2/policies/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,9 @@ namespace yorel {
namespace yomm2 {
namespace detail {

template<class Name>
struct yOMM2_API_gcc yOMM2_API_msc method_tables {
template<class Class>
static std::uintptr_t* static_vptr;
};

template<class Name>
template<class Class>
std::uintptr_t* method_tables<Name>::static_vptr;

using class_catalog = detail::static_list<detail::class_info>;
using method_catalog = detail::static_list<detail::method_info>;

struct domain {};

} // namespace detail

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -90,10 +78,11 @@ struct debug_shared;
struct release_shared;

template<class Name>
struct yOMM2_API_gcc basic_domain : detail::domain,
detail::method_tables<Name> {
struct basic_domain {
static detail::class_catalog classes;
static detail::method_catalog methods;
template<class Class>
static std::uintptr_t* static_vptr;
static std::vector<std::uintptr_t> dispatch_data;
};

Expand All @@ -103,6 +92,10 @@ detail::class_catalog basic_domain<Name>::classes;
template<class Name>
detail::method_catalog basic_domain<Name>::methods;

template<class Name>
template<class Class>
std::uintptr_t* basic_domain<Name>::static_vptr;

template<class Name>
std::vector<std::uintptr_t> basic_domain<Name>::dispatch_data;

Expand Down
4 changes: 2 additions & 2 deletions include/yorel/yomm2/policies/fast_perfect_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace yomm2 {
namespace policies {

template<class Policy>
struct yOMM2_API_gcc fast_perfect_hash : virtual type_hash {
struct fast_perfect_hash : virtual type_hash {
struct report {
std::size_t method_table_size, dispatch_table_size;
std::size_t hash_search_attempts;
Expand Down Expand Up @@ -161,7 +161,7 @@ template<class Policy>
std::size_t fast_perfect_hash<Policy>::hash_max;

template<class Policy>
struct yOMM2_API_gcc checked_perfect_hash : virtual fast_perfect_hash<Policy>,
struct checked_perfect_hash : virtual fast_perfect_hash<Policy>,
virtual runtime_checks {
static std::vector<type_id> control;

Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/throw_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace yorel {
namespace yomm2 {
namespace policies {

struct yOMM2_API_gcc throw_error : virtual error_handler {
struct throw_error : virtual error_handler {
template<class Error>
static auto error(const Error& error) {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/vectored_error_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace yomm2 {
namespace policies {

template<class Policy>
struct yOMM2_API_gcc vectored_error_handler : virtual error_handler {
struct vectored_error_handler : virtual error_handler {

using error_variant = std::variant<
error, resolution_error, unknown_class_error, hash_search_error,
Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/vptr_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace policies {
template<
class Policy,
class Map = std::unordered_map<type_id, const std::uintptr_t*>>
struct yOMM2_API_gcc vptr_map : virtual external_vptr {
struct vptr_map : virtual external_vptr {
static Map vptrs;

template<typename ForwardIterator>
Expand Down
2 changes: 1 addition & 1 deletion include/yorel/yomm2/policies/vptr_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace yomm2 {
namespace policies {

template<class Policy>
struct yOMM2_API_gcc vptr_vector : virtual external_vptr {
struct vptr_vector : virtual external_vptr {
static std::vector<const std::uintptr_t*> vptrs;

template<typename ForwardIterator>
Expand Down
4 changes: 2 additions & 2 deletions include/yorel/yomm2/policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ namespace yorel {
namespace yomm2 {
namespace policies {

struct yOMM2_API_gcc release
struct release
: basic_policy<
release, std_rtti, fast_perfect_hash<release>, vptr_vector<release>,
vectored_error_handler<release>> {};

struct yOMM2_API_gcc debug
struct debug
: basic_policy<
debug, std_rtti, checked_perfect_hash<debug>, vptr_vector<debug>,
basic_error_output<debug>, basic_trace_output<debug>,
Expand Down

0 comments on commit 0319b00

Please sign in to comment.