From 09991cf21d77b105d32a488823076d685ccec1cb Mon Sep 17 00:00:00 2001 From: Shin-ichi MORITA Date: Sat, 10 Jun 2023 11:44:42 +0900 Subject: [PATCH] Fixing build errors on Windows. --- include/xemmai/global.h | 4 +++- include/xemmai/object.h | 3 +++ include/xemmai/type.h | 4 ++-- include/xemmai/value.h | 8 +++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/xemmai/global.h b/include/xemmai/global.h index 93d83d1e..eedce3c7 100644 --- a/include/xemmai/global.h +++ b/include/xemmai/global.h @@ -235,7 +235,9 @@ XEMMAI__LIBRARY__TYPE(t_global, bytes) XEMMAI__LIBRARY__TYPE_AS(t_global, t_lexer::t_error, lexer__error) XEMMAI__LIBRARY__TYPE_AS(t_global, t_parser::t_error, parser__error) -#ifndef _WIN32 +#ifdef _WIN32 +XEMMAI__PORTABLE__EXPORT t_global* f_global(); +#else inline t_global* f_global() { return t_global::v_instance; diff --git a/include/xemmai/object.h b/include/xemmai/object.h index a6ba5adc..d7487848 100644 --- a/include/xemmai/object.h +++ b/include/xemmai/object.h @@ -32,6 +32,9 @@ class t_object friend class t_with_lock_for_write; static inline XEMMAI__PORTABLE__THREAD struct +#ifdef _WIN32 + t_roots +#endif { t_object* v_next; t_object* v_previous; diff --git a/include/xemmai/type.h b/include/xemmai/type.h index 39182671..ab68e593 100644 --- a/include/xemmai/type.h +++ b/include/xemmai/type.h @@ -324,8 +324,8 @@ void f_throw_type_error [[noreturn]] (const wchar_t* a_name) f_throw_type_error(typeid(typename t_fundamental::t_type), a_name); } -template -inline void f_check(const t_value& a_object, const wchar_t* a_name) +template +inline void f_check(const t_value& a_object, const wchar_t* a_name) { if (!f_is(a_object)) [[unlikely]] f_throw_type_error(a_name); } diff --git a/include/xemmai/value.h b/include/xemmai/value.h index 160df7be..0fa0e765 100644 --- a/include/xemmai/value.h +++ b/include/xemmai/value.h @@ -249,7 +249,7 @@ class t_value : public T_tag double v_float; }; - void f_copy(const t_value& a_value) + void f_copy(const auto& a_value) { if (sizeof(double) > sizeof(intptr_t)) v_float = a_value.v_float; @@ -273,7 +273,8 @@ class t_value : public T_tag { f_copy(a_value); } - t_value(const t_value& a_value) : T_tag(a_value) + template + t_value(const t_value& a_value) : T_tag(a_value) { f_copy(a_value); } @@ -284,7 +285,8 @@ class t_value : public T_tag f_copy(a_value); return *this; } - t_value& operator=(const t_value& a_value) + template + t_value& operator=(const t_value& a_value) { static_cast(*this) = a_value; f_copy(a_value);