First steps towards enablement of MSVC2017 for pymod. A lot of things to TODO yet ...

This commit is contained in:
Matthias Köfferlein 2018-08-04 18:02:39 +02:00
parent d81dcb6b22
commit 23d715001b
40 changed files with 245 additions and 176 deletions

View File

@ -30,6 +30,7 @@
namespace std_ext = __gnu_cxx;
# define DB_HASH_NAMESPACE __gnu_cxx
#else
# define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
# include <hash_map>
# include <hash_set>
namespace std_ext = std;

View File

@ -31,12 +31,6 @@
#include <memory>
namespace tl
{
template<> DB_PUBLIC tl::Registrar<db::Library> *tl::Registrar<db::Library>::instance = 0;
template class DB_PUBLIC tl::RegisteredClass<db::Library>;
}
namespace db
{

View File

@ -97,7 +97,7 @@ path<C>::area () const
}
template <class C>
DB_PUBLIC std::string
std::string
path<C>::to_string () const
{
std::string s = "(";

View File

@ -27,12 +27,6 @@
#include <string.h>
namespace tl
{
template<> DB_PUBLIC tl::Registrar<db::StreamFormatDeclaration> *tl::Registrar<db::StreamFormatDeclaration>::instance = 0;
template class DB_PUBLIC tl::RegisteredClass<db::StreamFormatDeclaration>;
}
namespace db
{

View File

@ -27,12 +27,6 @@
#include <stdio.h>
namespace tl
{
template<> DB_PUBLIC tl::Registrar<db::TechnologyComponentProvider> *tl::Registrar<db::TechnologyComponentProvider>::instance = 0;
template class DB_PUBLIC tl::RegisteredClass<db::TechnologyComponentProvider>;
}
namespace db
{

View File

@ -25,6 +25,7 @@
#define HDR_dbTypes
#include <stdint.h>
#define _USE_MATH_DEFINES // for MSVC
#include <math.h>
#include <stdio.h>
#include <algorithm>

View File

@ -24,14 +24,6 @@
#include "dbUserObject.h"
#include "tlClassRegistry.h"
namespace tl
{
template<> DB_PUBLIC tl::Registrar<db::user_object_factory_base<db::Coord> > *tl::Registrar<db::user_object_factory_base<db::Coord> >::instance = 0;
template class DB_PUBLIC tl::RegisteredClass<db::user_object_factory_base<db::Coord> >;
template<> DB_PUBLIC tl::Registrar<db::user_object_factory_base<db::DCoord> > *tl::Registrar<db::user_object_factory_base<db::DCoord> >::instance = 0;
template class DB_PUBLIC tl::RegisteredClass<db::user_object_factory_base<db::DCoord> >;
}
namespace db
{
static unsigned int s_class_id = 1;

View File

@ -195,14 +195,14 @@ public:
return std::string ("(not a valid enum value)");
}
static std::string enum_to_string (const E *e)
static std::string enum_to_string_ext (const E *e)
{
const Enum<E> *ecls = dynamic_cast<const Enum<E> *> (cls_decl<E> ());
tl_assert (ecls != 0);
return ecls->enum_to_string (*e);
}
static std::string enum_to_string_inspect (const E *e)
static std::string enum_to_string_inspect_ext (const E *e)
{
const Enum<E> *ecls = dynamic_cast<const Enum<E> *> (cls_decl<E> ());
tl_assert (ecls != 0);
@ -246,8 +246,8 @@ public:
gsi::Methods m =
gsi::constructor ("new", &new_enum_from_int, gsi::arg("i"), "@brief Creates an enum from an integer value") +
gsi::constructor ("new", &new_enum_from_string, gsi::arg("s"), "@brief Creates an enum from a string value") +
gsi::method_ext ("to_s", &enum_to_string, "@brief Gets the symbolic string from an enum") +
gsi::method_ext ("inspect", &enum_to_string_inspect, "@brief Converts an enum to a visual string") +
gsi::method_ext ("to_s", &enum_to_string_ext, "@brief Gets the symbolic string from an enum") +
gsi::method_ext ("inspect", &enum_to_string_inspect_ext, "@brief Converts an enum to a visual string") +
gsi::method_ext ("to_i", &enum_to_i, "@brief Gets the integer value from the enum") +
gsi::method_ext ("==", &enum_eq, gsi::arg("other"), "@brief Compares two enums") +
gsi::method_ext ("!=", &enum_ne, gsi::arg("other"), "@brief Compares two enums for inequality") +

View File

@ -22,11 +22,6 @@
#include "gsiInterpreter.h"
namespace tl
{
template<> GSI_PUBLIC tl::Registrar<gsi::Interpreter> *tl::Registrar<gsi::Interpreter>::instance = 0;
}
namespace gsi
{

View File

@ -572,6 +572,13 @@ struct pair_decl
// warning:
#define __SUPPRESS_UNUSED_WARNING(x) (void)(x)
// HACK: the Qt binding code takes __null instead of NULL, but
// MS defines it as empty in sal.h ... better __null was NULL again.
#if defined(__null)
# undef __null
# define __null 0
#endif
}
#endif

View File

@ -21,7 +21,9 @@
*/
#if QT_VERSION >= 0x050000
# include "../qt5/QtGui/gsiDeclQtGuiTypeTraits.h"
# include "../qt5/QtGui/gsiQtExternals.h"
#else
# include "../qt4/QtGui/gsiDeclQtGuiTypeTraits.h"
# include "../qt4/QtGui/gsiQtExternals.h"
#endif

View File

@ -21,6 +21,7 @@
*/
#if QT_VERSION >= 0x050000
# include "../qt5/QtWidgets/gsiDeclQtWidgetsTypeTraits.h"
# include "../qt5/QtWidgets/gsiQtExternals.h"
#else
// no present in Qt4

View File

@ -61,16 +61,31 @@ equals(HAVE_RUBY, "1") {
QMAKE_RPATHDIR += $$RPATH
}
QMAKE_CXXFLAGS_WARN_ON += \
-pedantic \
-Woverloaded-virtual \
-Wsign-promo \
-Wsynth \
-Wno-deprecated \
-Wno-long-long \
-Wno-strict-aliasing \
-Wno-deprecated-declarations \
-Wno-reserved-user-defined-literal \
msvc {
INCLUDEPATH += \
$$THIRD_PARTY/zlib/1.2.11/include \
QMAKE_CXXFLAGS += -bigobj
QMAKE_CXXFLAGS_WARN_ON += \
}
!msvc {
QMAKE_CXXFLAGS_WARN_ON += \
-pedantic \
-Woverloaded-virtual \
-Wsign-promo \
-Wsynth \
-Wno-deprecated \
-Wno-long-long \
-Wno-strict-aliasing \
-Wno-deprecated-declarations \
-Wno-reserved-user-defined-literal \
}
equals(HAVE_QT, "0") {
@ -79,7 +94,7 @@ equals(HAVE_QT, "0") {
} else {
DEFINES += HAVE_QT
QT += network xml sql
QT += core network xml sql
equals(HAVE_QT5, "1") {
QT += designer printsupport
@ -94,10 +109,14 @@ equals(HAVE_QT, "0") {
}
# only support the required symbols for shared object load performance
win32 {
QMAKE_LFLAGS += -Wl,--exclude-all-symbols
msvc {
# ...
} else {
QMAKE_CXXFLAGS += -fvisibility=hidden
win32 {
QMAKE_LFLAGS += -Wl,--exclude-all-symbols
} else {
QMAKE_CXXFLAGS += -fvisibility=hidden
}
}
VERSION_STRING = $$KLAYOUT_VERSION

View File

@ -36,7 +36,6 @@
#if defined(HAVE_QTBINDINGS)
# include "gsiQtGuiExternals.h"
# include "gsiQtWidgetsExternals.h"
FORCE_LINK_GSI_QTGUI
FORCE_LINK_GSI_QTWIDGETS // for Qt5

View File

@ -43,8 +43,6 @@ namespace tl
template <> struct type_traits<gsi::PluginBase> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
template <> Registrar<gsi::PluginFactoryBase> *Registrar<gsi::PluginFactoryBase>::instance = 0;
}
namespace gsi

View File

@ -112,7 +112,7 @@ LayoutHandle::layout_changed ()
}
void
LayoutHandle::rename (const std::string &name, bool force) throw (tl::Exception)
LayoutHandle::rename (const std::string &name, bool force)
{
std::string n (name);

View File

@ -83,7 +83,7 @@ public:
* If "force" is set to true, the layout will be given that name, irregardless if
* the name already is being used. If "force" is false, a new unique name is created.
*/
void rename (const std::string &name, bool force = false) throw (tl::Exception);
void rename (const std::string &name, bool force = false);
/**
* @brief Gets the name of the handle

View File

@ -589,9 +589,3 @@ PluginRoot::instance ()
}
}
namespace tl
{
template<> LAYBASIC_PUBLIC Registrar<lay::PluginDeclaration> *tl::Registrar<lay::PluginDeclaration>::instance = 0;
template class LAYBASIC_PUBLIC tl::RegisteredClass<lay::PluginDeclaration>;
}

View File

@ -22,17 +22,5 @@
#include "layTechnology.h"
#include "layPlugin.h"
#include "layStream.h"
#include <stdio.h>
#include <QFileInfo>
#include <QDir>
namespace tl
{
template<> LAYBASIC_PUBLIC tl::Registrar<lay::TechnologyEditorProvider> *tl::Registrar<lay::TechnologyEditorProvider>::instance = 0;
template class LAYBASIC_PUBLIC tl::RegisteredClass<lay::TechnologyEditorProvider>;
}
// .. nothing yet ..

View File

@ -7,7 +7,7 @@ TEMPLATE = lib
# $(DESTDIR) and $(TARGET)
win32 {
QMAKE_POST_LINK += $(COPY) $(DESTDIR_TARGET) $$DESTDIR_UT/$${TARGET}.ut
QMAKE_POST_LINK += $(COPY) $(DESTDIR_TARGET) $$shell_path($$DESTDIR_UT/$${TARGET}.ut)
# to avoid the major version being appended to the dll name - in this case -lxyz won't link it again
# because the library is called xyx0.dll.

View File

@ -122,9 +122,3 @@ MacroInterpreter::suffix (const std::string &dsl_name)
}
}
namespace tl
{
template<> LYM_PUBLIC tl::Registrar<lym::MacroInterpreter> *Registrar<lym::MacroInterpreter>::instance = 0;
template class LYM_PUBLIC tl::RegisteredClass<lym::MacroInterpreter>;
}

View File

@ -192,11 +192,3 @@ class StandardFormatDeclaration
static tl::RegisteredClass<rdb::FormatDeclaration> format_decl (new StandardFormatDeclaration (), 0, "KLayout-RDB");
}
// -------------------------------------------------------------
namespace tl
{
template<> RDB_PUBLIC tl::Registrar<rdb::FormatDeclaration> *tl::Registrar<rdb::FormatDeclaration>::instance = 0;
template class RDB_PUBLIC tl::RegisteredClass<rdb::FormatDeclaration>;
}

View File

@ -6,7 +6,16 @@ include($$PWD/../../lib.pri)
DEFINES += MAKE_TL_LIBRARY
LIBS += -lz
!msvc {
LIBS += -lz
}
msvc {
LIBS += \
-L$$THIRD_PARTY/zlib/1.2.11/lib -lzlib
}
equals(HAVE_QT, "0") {
LIBS += -lpthread
@ -152,6 +161,3 @@ equals(HAVE_CURL, "1") {
}
INCLUDEPATH =
DEPENDPATH =

View File

@ -23,3 +23,39 @@
#include "tlClassRegistry.h"
#include <map>
namespace tl
{
struct ti_compare_f
{
bool operator() (const std::type_info *a, const std::type_info *b) const
{
return a->before (*b);
}
};
typedef std::map<const std::type_info *, RegistrarBase *, ti_compare_f> inst_map_type;
static inst_map_type s_inst_map;
TL_PUBLIC void set_registrar_instance_by_type (const std::type_info &ti, RegistrarBase *rb)
{
if (rb) {
s_inst_map[&ti] = rb;
} else {
s_inst_map.erase (&ti);
}
}
TL_PUBLIC RegistrarBase *registrar_instance_by_type (const std::type_info &ti)
{
inst_map_type::const_iterator im = s_inst_map.find (&ti);
if (im != s_inst_map.end ()) {
return im->second;
} else {
return 0;
}
}
}

View File

@ -27,6 +27,7 @@
#include "tlCommon.h"
#include "tlLog.h"
#include <typeinfo>
namespace tl
{
@ -93,10 +94,12 @@ public:
RegisteredClass (X *inst, int position = 0, const char *name = "", bool owned = true)
: m_owned (owned)
{
if (! Registrar<X>::instance) {
Registrar<X>::instance = new Registrar<X> ();
Registrar<X> *instance = Registrar<X>::get_instance ();
if (! instance) {
instance = new Registrar<X> ();
Registrar<X>::set_instance (instance);
}
mp_node = Registrar<X>::instance->insert (inst, owned, position, name);
mp_node = instance->insert (inst, owned, position, name);
if (tl::verbosity () >= 40) {
tl::info << "Registered object '" << name << "' with priority " << position;
@ -105,13 +108,18 @@ public:
~RegisteredClass ()
{
// remove the associated object
Registrar<X>::instance->remove (mp_node);
Registrar<X> *instance = Registrar<X>::get_instance ();
if (instance) {
// remove the associated object
instance->remove (mp_node);
if (instance->begin () == instance->end ()) {
// no more registered objects left - remove registrar
delete instance;
Registrar<X>::set_instance (0);
}
if (Registrar<X>::instance->begin () == Registrar<X>::instance->end ()) {
// no more registered objects left - remove registrar
delete Registrar<X>::instance;
Registrar<X>::instance = 0;
}
}
@ -120,6 +128,22 @@ private:
bool m_owned;
};
/**
* @brief A base class for the registrar types
*/
class RegistrarBase { };
/**
* @brief Sets the registrar instance by type
*/
TL_PUBLIC void set_registrar_instance_by_type (const std::type_info &ti, RegistrarBase *rb);
/**
* @brief Gets the registrar instance by type
* Returns 0 if no registrar instance is set by this type;
*/
TL_PUBLIC RegistrarBase *registrar_instance_by_type (const std::type_info &ti);
/**
* @brief The registrar capable of registering objects of type Y derived from X
*
@ -131,6 +155,7 @@ private:
*/
template <class X>
class Registrar
: public RegistrarBase
{
public:
class iterator
@ -220,15 +245,18 @@ public:
static Registrar<X> *get_instance ()
{
return instance;
return static_cast<Registrar<X> *> (registrar_instance_by_type (typeid (X)));
}
static void set_instance (Registrar<X> *instance)
{
set_registrar_instance_by_type (typeid (X), instance);
}
private:
friend class iterator;
template <class Y> friend class RegisteredClass;
static Registrar<X> *instance;
RegistrarNode<X> *insert (X *cls, bool owned, int position, const std::string &name)
{
RegistrarNode<X> **link = &mp_first;

View File

@ -23,6 +23,7 @@
#include "tlLog.h"
#include "tlCommandLineParser.h"
#include "tlFileUtils.h"
#include "tlString.h"
namespace tl
{

View File

@ -28,14 +28,14 @@
namespace tl
{
TL_PUBLIC void handle_event_exception (tl::Exception &ex)
void handle_event_exception (tl::Exception &ex)
{
// Exceptions have unpredicable side effects for events so we just log
// them here.
tl::warn << ex.msg ();
}
TL_PUBLIC void handle_event_exception (std::exception &ex)
void handle_event_exception (std::exception &ex)
{
// Exceptions have unpredicable side effects for events so we just log
// them here.

View File

@ -36,12 +36,12 @@ namespace tl
/**
* @brief A helper function to handle event exceptions of tl::Exception type
*/
void handle_event_exception (tl::Exception &ex);
TL_PUBLIC void handle_event_exception (tl::Exception &ex);
/**
* @brief A helper function to handle event exceptions of std::exception type
*/
void handle_event_exception (std::exception &ex);
TL_PUBLIC void handle_event_exception (std::exception &ex);
/**
* @brief A framework of observer and observables

View File

@ -31,6 +31,7 @@
#include <vector>
#include <sstream>
#include <iostream>
#define _USE_MATH_DEFINES // for MSVC
#include <math.h>
#include <string.h>
#include <stdlib.h>

View File

@ -27,19 +27,36 @@
#include <cctype>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#if defined(_MSC_VER)
#if defined(_WIN32)
# include <sys/types.h>
# include <sys/stat.h>
# include <io.h>
# include <Windows.h>
#elif defined(_WIN32)
# include <sys/stat.h>
# include <unistd.h>
# include <dirent.h>
# include <dir.h>
# include <windows.h>
#elif defined(__APPLE__)
# include <libproc.h>
#endif
# include <Windows.h>
#if !defined(_WIN32)
#elif defined(__APPLE__)
# include <sys/stat.h>
# include <unistd.h>
# include <dirent.h>
# include <libproc.h>
# include <dlfcn.h>
#else
# include <sys/stat.h>
# include <unistd.h>
# include <dirent.h>
# include <dlfcn.h>
#endif
namespace tl
@ -664,13 +681,21 @@ bool file_exists (const std::string &p)
bool is_writable (const std::string &p)
{
stat_struct st;
#if defined(_MSC_VER)
return stat_func (p, st) == 0 && (st.st_mode & _S_IWRITE) != 0;
#else
return stat_func (p, st) == 0 && (st.st_mode & S_IWUSR) != 0;
#endif
}
bool is_readable (const std::string &p)
{
stat_struct st;
#if defined(_MSC_VER)
return stat_func (p, st) == 0 && (st.st_mode & _S_IREAD) != 0;
#else
return stat_func (p, st) == 0 && (st.st_mode & S_IRUSR) != 0;
#endif
}
bool is_dir (const std::string &p)
@ -679,7 +704,11 @@ bool is_dir (const std::string &p)
if (stat_func (p, st) != 0) {
return false;
} else {
#if defined(_MSC_VER)
return !(st.st_mode & _S_IFREG);
#else
return !S_ISREG (st.st_mode);
#endif
}
}

View File

@ -25,7 +25,9 @@
#include "tlString.h"
#include <stdio.h>
#include <unistd.h>
#if !defined(_MSC_VER)
# include <unistd.h>
#endif
#include <stdlib.h>
#if defined(_WIN32)
@ -250,7 +252,11 @@ ChannelProxy::ChannelProxy (const ChannelProxy &d)
static bool
can_colorize (FILE *stream)
{
#if defined(_MSC_VER)
return false;
#else
return isatty (fileno (stream));
#endif
}
#define ANSI_RED "\033[31;1m"

View File

@ -721,7 +721,7 @@ from_string (const std::string &s, const unsigned char * &result)
}
void
from_string (const std::string &s, double &v) throw (tl::Exception)
from_string (const std::string &s, double &v)
{
const char *cp = s.c_str ();
while (*cp && isspace (*cp)) {
@ -743,7 +743,7 @@ from_string (const std::string &s, double &v) throw (tl::Exception)
template <class T>
void
convert_string_to_int (const std::string &s, T &v) throw (tl::Exception)
convert_string_to_int (const std::string &s, T &v)
{
double x;
// HACK: this should be some real string-to-int conversion
@ -761,43 +761,43 @@ convert_string_to_int (const std::string &s, T &v) throw (tl::Exception)
}
void
from_string (const std::string &s, int &v) throw (tl::Exception)
from_string (const std::string &s, int &v)
{
convert_string_to_int (s, v);
}
void
from_string (const std::string &s, long &v) throw (tl::Exception)
from_string (const std::string &s, long &v)
{
convert_string_to_int (s, v);
}
void
from_string (const std::string &s, long long &v) throw (tl::Exception)
from_string (const std::string &s, long long &v)
{
convert_string_to_int (s, v);
}
void
from_string (const std::string &s, unsigned int &v) throw (tl::Exception)
from_string (const std::string &s, unsigned int &v)
{
convert_string_to_int (s, v);
}
void
from_string (const std::string &s, unsigned long &v) throw (tl::Exception)
from_string (const std::string &s, unsigned long &v)
{
convert_string_to_int (s, v);
}
void
from_string (const std::string &s, unsigned long long &v) throw (tl::Exception)
from_string (const std::string &s, unsigned long long &v)
{
convert_string_to_int (s, v);
}
void
from_string (const std::string &s, bool &b) throw (tl::Exception)
from_string (const std::string &s, bool &b)
{
std::string t (tl::trim (s));
if (t == "true") {

View File

@ -757,14 +757,14 @@ private:
TL_PUBLIC void from_string (const std::string &s, const char * &result);
TL_PUBLIC void from_string (const std::string &s, const unsigned char * &result);
TL_PUBLIC void from_string (const std::string &s, double &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, int &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, long &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, long long &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, unsigned int &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, unsigned long &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, unsigned long long &v) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, bool &b) throw (tl::Exception);
TL_PUBLIC void from_string (const std::string &s, double &v);
TL_PUBLIC void from_string (const std::string &s, int &v);
TL_PUBLIC void from_string (const std::string &s, long &v);
TL_PUBLIC void from_string (const std::string &s, long long &v);
TL_PUBLIC void from_string (const std::string &s, unsigned int &v);
TL_PUBLIC void from_string (const std::string &s, unsigned long &v);
TL_PUBLIC void from_string (const std::string &s, unsigned long long &v);
TL_PUBLIC void from_string (const std::string &s, bool &b);
inline void from_string (const std::string &s, std::string &v) { v = s; }

View File

@ -180,7 +180,7 @@ private:
#if defined(HAVE_QT)
template <class T>
class TL_PUBLIC ThreadStorage
class ThreadStorage
: public QThreadStorage<T>
{
public:

View File

@ -32,46 +32,52 @@
#include <stdio.h>
#ifndef _MSC_VER // not available on MS VC++
#if !defined(_MSC_VER) // not available on MS VC++
# include <unistd.h>
#endif
#if defined(_MSC_VER)
# include <Windows.h>
#endif
#if defined(__MACH__)
#include <mach/clock.h>
#include <mach/mach.h>
# include <mach/clock.h>
# include <mach/mach.h>
#endif
namespace tl
{
// -------------------------------------------------------------
// Gets the current time in ms from epoch
void current_utc_time (struct timespec *ts)
static int64_t ms_time ()
{
#if defined(__MACH__)
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec;
return int64_t (mts.tv_sec) * 1000 + int64_t (0.5 + mts.tv_nsec / 1.0e6);
#elif defined(_MSC_VER)
FILETIME ft;
GetSystemTimeAsFileTime (&ft);
// device by 8192 -> should fit into a 64bit type
uint64_t t = (uint64_t (ft.dwHighDateTime) << (64 - 13)) | (uint64_t (ft.dwLowDateTime) >> 13);
return int64_t (0.5 + t / 0.8192);
#else
timespec ts;
clock_gettime(CLOCK_REALTIME, ts);
return int64_t (ts.tv_sec) * 1000 + int64_t (0.5 + ts.tv_nsec / 1.0e6);
#endif
}
// -------------------------------------------------------------
// Gets the current time in ms from epoch
static int64_t ms_time ()
{
struct timespec spec;
current_utc_time (&spec);
return int64_t (spec.tv_sec) * 1000 + int64_t (0.5 + spec.tv_nsec / 1.0e6);
}
// -------------------------------------------------------------
@ -100,9 +106,6 @@ Timer::start ()
m_sys_ms += (timer_t) ((clks.tms_stime + clks.tms_cstime) * clk2msec + 0.5);
#endif
struct timespec spec;
current_utc_time (&spec);
m_wall_ms += ms_time ();
}

View File

@ -456,7 +456,7 @@ protected:
}
private:
virtual void execute (tl::TestBase *_this) throw (tl::Exception) = 0;
virtual void execute (tl::TestBase *_this) = 0;
void write_detailed_diff (std::ostream &os, const std::string &subject, const std::string &ref);
@ -496,11 +496,11 @@ struct TestImpl##NAME \
: public tl::TestBase \
{ \
TestImpl##NAME () : TestBase (__FILE__, #NAME) { } \
virtual void execute (tl::TestBase *_this) throw (tl::Exception); \
virtual void execute (tl::TestBase *_this); \
}; \
static TestImpl##NAME TestImpl_Inst##NAME; \
} \
void TestImpl##NAME::execute (tl::TestBase *_this) throw (tl::Exception)
void TestImpl##NAME::execute (tl::TestBase *_this)
#define EXPECT_EQ(WHAT,EQUALS) \
_this->checkpoint (__FILE__, __LINE__); \

View File

@ -20,7 +20,6 @@
*/
#include "tlClassRegistry.h"
#include "tlUnitTest.h"
@ -39,13 +38,13 @@ public:
class Y : public X
{
public:
virtual const char *name () const { return "Y"; };
virtual const char *name () const { return "Y"; }
};
class Z : public X
{
public:
virtual const char *name () const { return "Z"; };
virtual const char *name () const { return "Z"; }
};
@ -59,12 +58,12 @@ public:
class B : public A
{
virtual const char *name () const { return "B"; };
virtual const char *name () const { return "B"; }
};
class C : public A
{
virtual const char *name () const { return "C"; };
virtual const char *name () const { return "C"; }
};
@ -112,10 +111,3 @@ TEST(3)
}
}
namespace tl
{
template <> tl::Registrar<class_registry_test::X> *Registrar<class_registry_test::X>::instance = 0;
template <> tl::Registrar<class_registry_test::A> *Registrar<class_registry_test::A>::instance = 0;
}

View File

@ -26,6 +26,7 @@
#include "tlUnitTest.h"
#include <stdlib.h>
#define _USE_MATH_DEFINES // for MSVC
#include <math.h>
// basics

View File

@ -25,7 +25,8 @@
#include "tlTimer.h"
#include "tlUnitTest.h"
#include <cmath>
#define _USE_MATH_DEFINES // for MSVC
#include <math.h>
#include <clocale>
using namespace tl;

View File

@ -26,7 +26,7 @@
#include <stdio.h>
#if defined(WIN32)
#include <windows.h>
#include <Windows.h>
inline void usleep(long us)
{
Sleep(us / 1000);