diff options
| -rw-r--r-- | compat/linkage-macros.hpp | 10 | ||||
| -rw-r--r-- | compat/macros.hpp | 12 | ||||
| -rw-r--r-- | options/value.cpp | 2 | ||||
| -rw-r--r-- | options/value.hpp | 44 | 
4 files changed, 35 insertions, 33 deletions
| diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp index 9e71ac8c..967dfba9 100644 --- a/compat/linkage-macros.hpp +++ b/compat/linkage-macros.hpp @@ -11,5 +11,11 @@  #   define OTR_GENERIC_IMPORT  #endif -#define OTR_TEMPLATE_EXPORT template class OTR_GENERIC_EXPORT -#define OTR_TEMPLATE_IMPORT extern template class OTR_GENERIC_IMPORT +#define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x +#define OTR_TEMPLATE_EXPORT_(x) template class OTR_GENERIC_EXPORT x + +#if defined _MSC_VER +#   define OTR_TEMPLATE_EXPORT OTR_TEMPLATE_EXPORT_ +#else +#   define OTR_TEMPLATE_EXPORT OTR_TEMPLATE_EXPORT_ +#endif diff --git a/compat/macros.hpp b/compat/macros.hpp index c0bc66f4..01d9cd83 100644 --- a/compat/macros.hpp +++ b/compat/macros.hpp @@ -46,23 +46,21 @@  #   define OTR_FUNNAME (__PRETTY_FUNCTION__)  #endif +#if !defined PP_CAT +#   define PP_CAT(x,y) PP_CAT1(x,y) +#   define PP_CAT1(x,y) x##y +#endif +  #if defined __cplusplus  // from now only C++ macros -#   define thunk(...) ([&]() { __VA_ARGS__; }) -  #if defined _MSC_VER  #   define OTR_DEPRECATE(msg, decl, body) __declspec(deprecated(msg)) decl body  #else  #   define OTR_DEPRECATE(msg, decl, body) decl body __attribute__((deprecated(msg)))  #endif -#if !defined PP_CAT -#   define PP_CAT(x,y) PP_CAT1(x,y) -#   define PP_CAT1(x,y) x##y -#endif -  namespace static_warning_detail {      template<bool> struct test___132; diff --git a/options/value.cpp b/options/value.cpp index 5796dcd6..0e0725f8 100644 --- a/options/value.cpp +++ b/options/value.cpp @@ -1,5 +1,5 @@  // instantiate the "template class" value<t> symbols -#define OTR_OPT_VALUE OTR_TEMPLATE_EXPORT +#define OTR_INST_VALUE OTR_TEMPLATE_EXPORT  #include "value.hpp" diff --git a/options/value.hpp b/options/value.hpp index a95626f7..47a4d631 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -15,6 +15,7 @@  #include "base-value.hpp"  #include "value-traits.hpp"  #include "compat/macros.hpp" +#include "compat/linkage-macros.hpp"  #include <cstdio>  #include <type_traits> @@ -142,30 +143,27 @@ private:      const t def;  }; -#if defined _MSC_VER - -#   if !defined OTR_OPT_VALUE -#      define OTR_OPT_VALUE OTR_TEMPLATE_IMPORT -#   endif - -    OTR_OPT_VALUE value<double>; -    OTR_OPT_VALUE value<float>; -    OTR_OPT_VALUE value<int>; -    OTR_OPT_VALUE value<bool>; -    OTR_OPT_VALUE value<QString>; -    OTR_OPT_VALUE value<slider_value>; -    OTR_OPT_VALUE value<QPointF>; -    OTR_OPT_VALUE value<QVariant>; - -    OTR_OPT_VALUE value<QList<double>>; -    OTR_OPT_VALUE value<QList<float>>; -    OTR_OPT_VALUE value<QList<int>>; -    OTR_OPT_VALUE value<QList<bool>>; -    OTR_OPT_VALUE value<QList<QString>>; -    OTR_OPT_VALUE value<QList<slider_value>>; -    OTR_OPT_VALUE value<QList<QPointF>>; -    OTR_OPT_VALUE value<QList<QVariant>>; +#if !defined OTR_INST_VALUE +#   define OTR_INST_VALUE OTR_TEMPLATE_IMPORT +#endif +#if !defined __APPLE__ +    OTR_INST_VALUE(value<double>); +    OTR_INST_VALUE(value<float>); +    OTR_INST_VALUE(value<int>); +    OTR_INST_VALUE(value<bool>); +    OTR_INST_VALUE(value<QString>); +    OTR_INST_VALUE(value<slider_value>); +    OTR_INST_VALUE(value<QPointF>); +    OTR_INST_VALUE(value<QVariant>); +    OTR_INST_VALUE(value<QList<double>>); +    OTR_INST_VALUE(value<QList<float>>); +    OTR_INST_VALUE(value<QList<int>>); +    OTR_INST_VALUE(value<QList<bool>>); +    OTR_INST_VALUE(value<QList<QString>>); +    OTR_INST_VALUE(value<QList<slider_value>>); +    OTR_INST_VALUE(value<QList<QPointF>>); +    OTR_INST_VALUE(value<QList<QVariant>>);  #endif  } // ns options | 
