Skip to content

Commit b5b6e5a

Browse files
committed
Drop ifdef'd code for gcc4.6 and msvc12
1 parent a0f3eaf commit b5b6e5a

20 files changed

Lines changed: 182 additions & 357 deletions

‎CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
101101
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.md")
102102
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/description.txt")
103103

104-
set(CPACK_PACKAGE_VERSION_MAJOR 5)
105-
set(CPACK_PACKAGE_VERSION_MINOR 8)
104+
set(CPACK_PACKAGE_VERSION_MAJOR 6)
105+
set(CPACK_PACKAGE_VERSION_MINOR 0)
106106
set(CPACK_PACKAGE_VERSION_PATCH 0)
107107

108108
set(CPACK_PACKAGE_EXECUTABLES "chai;ChaiScript Eval")

‎include/chaiscript/chaiscript_defines.hpp‎

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@
1212
#define CHAISCRIPT_COMPILER_VERSION CHAISCRIPT_STRINGIZE(_MSC_FULL_VER)
1313
#define CHAISCRIPT_MSVC _MSC_VER
1414
#define CHAISCRIPT_HAS_DECLSPEC
15-
#if _MSC_VER <= 1800
16-
#define CHAISCRIPT_MSVC_12
17-
#endif
1815
#else
1916
#define CHAISCRIPT_COMPILER_VERSION __VERSION__
2017
#endif
2118

22-
#ifndef CHAISCRIPT_MSVC_12
23-
#define CHAISCRIPT_HAS_MAGIC_STATICS
24-
#endif
25-
2619
#include <vector>
2720

2821
#if defined( _LIBCPP_VERSION )
@@ -51,41 +44,22 @@
5144
#endif
5245
#endif
5346

54-
#if (defined(CHAISCRIPT_MSVC) && !defined(CHAISCRIPT_MSVC_12)) || (defined(__GNUC__) && __GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || (defined(__llvm__) && !defined(CHAISCRIPT_LIBCPP))
55-
/// Currently only g++>=4.8 supports this natively
47+
#if defined(CHAISCRIPT_MSVC) || (defined(__GNUC__) && __GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || (defined(__llvm__) && !defined(CHAISCRIPT_LIBCPP))
5648
/// \todo Make this support other compilers when possible
5749
#define CHAISCRIPT_HAS_THREAD_LOCAL
5850
#endif
5951

60-
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 6)
61-
#define CHAISCRIPT_GCC_4_6
62-
#endif
63-
6452
#if defined(__llvm__)
6553
#define CHAISCRIPT_CLANG
6654
#endif
6755

68-
#if (defined(__GNUC__) && __GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || defined(CHAISCRIPT_MSVC) || defined(CHAISCRIPT_CLANG)
69-
#define CHAISCRIPT_OVERRIDE override
70-
#else
71-
#define CHAISCRIPT_OVERRIDE
72-
#endif
73-
7456

7557
#ifdef CHAISCRIPT_HAS_DECLSPEC
7658
#define CHAISCRIPT_MODULE_EXPORT extern "C" __declspec(dllexport)
7759
#else
7860
#define CHAISCRIPT_MODULE_EXPORT extern "C"
7961
#endif
8062

81-
#ifdef CHAISCRIPT_MSVC_12
82-
#define CHAISCRIPT_NOEXCEPT throw()
83-
#define CHAISCRIPT_CONSTEXPR
84-
#else
85-
#define CHAISCRIPT_NOEXCEPT noexcept
86-
#define CHAISCRIPT_CONSTEXPR constexpr
87-
#endif
88-
8963
#ifdef _DEBUG
9064
#define CHAISCRIPT_DEBUG true
9165
#else
@@ -95,8 +69,8 @@
9569
#include <memory>
9670

9771
namespace chaiscript {
98-
static const int version_major = 5;
99-
static const int version_minor = 8;
72+
static const int version_major = 6;
73+
static const int version_minor = 0;
10074
static const int version_patch = 0;
10175

10276
static const char *compiler_version = CHAISCRIPT_COMPILER_VERSION;

‎include/chaiscript/dispatchkit/any.hpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ namespace chaiscript {
2121
class bad_any_cast : public std::bad_cast
2222
{
2323
public:
24-
bad_any_cast() CHAISCRIPT_NOEXCEPT
24+
bad_any_cast() noexcept
2525
: m_what("bad any cast")
2626
{
2727
}
2828

2929
bad_any_cast(const bad_any_cast &) = default;
3030

31-
virtual ~bad_any_cast() CHAISCRIPT_NOEXCEPT {}
31+
virtual ~bad_any_cast() noexcept {}
3232

3333
/// \brief Description of what error occurred
34-
virtual const char * what() const CHAISCRIPT_NOEXCEPT CHAISCRIPT_OVERRIDE
34+
virtual const char * what() const noexcept override
3535
{
3636
return m_what.c_str();
3737
}
@@ -76,12 +76,12 @@ namespace chaiscript {
7676

7777
virtual ~Data_Impl() {}
7878

79-
virtual void *data() CHAISCRIPT_OVERRIDE
79+
virtual void *data() override
8080
{
8181
return &m_data;
8282
}
8383

84-
std::unique_ptr<Data> clone() const CHAISCRIPT_OVERRIDE
84+
std::unique_ptr<Data> clone() const override
8585
{
8686
return std::unique_ptr<Data>(new Data_Impl<T>(m_data));
8787
}
@@ -107,10 +107,8 @@ namespace chaiscript {
107107
}
108108
}
109109

110-
#if !defined(_MSC_VER) || _MSC_VER != 1800
111110
Any(Any &&) = default;
112111
Any &operator=(Any &&t_any) = default;
113-
#endif
114112

115113
template<typename ValueType,
116114
typename = typename std::enable_if<!std::is_same<Any, typename std::decay<ValueType>::type>::value>::type>

‎include/chaiscript/dispatchkit/bad_boxed_cast.hpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace chaiscript
3030
{
3131
public:
3232
bad_boxed_cast(Type_Info t_from, const std::type_info &t_to,
33-
std::string t_what) CHAISCRIPT_NOEXCEPT
33+
std::string t_what) noexcept
3434
: from(std::move(t_from)), to(&t_to), m_what(std::move(t_what))
3535
{
3636
}
@@ -40,16 +40,16 @@ namespace chaiscript
4040
{
4141
}
4242

43-
explicit bad_boxed_cast(std::string t_what) CHAISCRIPT_NOEXCEPT
43+
explicit bad_boxed_cast(std::string t_what) noexcept
4444
: to(nullptr), m_what(std::move(t_what))
4545
{
4646
}
4747

4848
bad_boxed_cast(const bad_boxed_cast &) = default;
49-
virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT {}
49+
virtual ~bad_boxed_cast() noexcept {}
5050

5151
/// \brief Description of what error occurred
52-
virtual const char * what() const CHAISCRIPT_NOEXCEPT CHAISCRIPT_OVERRIDE
52+
virtual const char * what() const noexcept override
5353
{
5454
return m_what.c_str();
5555
}

‎include/chaiscript/dispatchkit/boxed_number.hpp‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace chaiscript
3030
{
3131
arithmetic_error(const std::string& reason) : std::runtime_error("Arithmetic error: " + reason) {}
3232
arithmetic_error(const arithmetic_error &) = default;
33-
virtual ~arithmetic_error() CHAISCRIPT_NOEXCEPT {}
33+
virtual ~arithmetic_error() noexcept {}
3434
};
3535
}
3636
}
@@ -90,7 +90,7 @@ namespace chaiscript
9090
{
9191
}
9292

93-
static CHAISCRIPT_CONSTEXPR Common_Types get_common_type(size_t t_size, bool t_signed)
93+
static constexpr Common_Types get_common_type(size_t t_size, bool t_signed)
9494
{
9595
return (t_size == 1 && t_signed)?(Common_Types::t_int8)
9696
:(t_size == 1)?(Common_Types::t_uint8)
@@ -508,11 +508,8 @@ namespace chaiscript
508508
}
509509

510510
Boxed_Number(const Boxed_Number &) = default;
511-
512-
#if !defined(_MSC_VER) || _MSC_VER != 1800
513511
Boxed_Number(Boxed_Number &&) = default;
514512
Boxed_Number& operator=(Boxed_Number &&) = default;
515-
#endif
516513

517514
template<typename T> explicit Boxed_Number(T t)
518515
: bv(Boxed_Value(t))

‎include/chaiscript/dispatchkit/boxed_value.hpp‎

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ namespace chaiscript
6262

6363
Data(const Data &) = delete;
6464

65-
#if !defined(__APPLE__) && (!defined(_MSC_VER) || _MSC_VER != 1800)
6665
Data(Data &&) = default;
6766
Data &operator=(Data &&rhs) = default;
68-
#endif
6967

7068

7169
Type_Info m_type_info;
@@ -189,11 +187,8 @@ namespace chaiscript
189187
{
190188
}
191189

192-
#if !defined(_MSC_VER) || _MSC_VER != 1800
193190
Boxed_Value(Boxed_Value&&) = default;
194191
Boxed_Value& operator=(Boxed_Value&&) = default;
195-
#endif
196-
197192
Boxed_Value(const Boxed_Value&) = default;
198193
Boxed_Value& operator=(const Boxed_Value&) = default;
199194

@@ -210,63 +205,63 @@ namespace chaiscript
210205
return *this;
211206
}
212207

213-
const Type_Info &get_type_info() const CHAISCRIPT_NOEXCEPT
208+
const Type_Info &get_type_info() const noexcept
214209
{
215210
return m_data->m_type_info;
216211
}
217212

218213
/// return true if the object is uninitialized
219-
bool is_undef() const CHAISCRIPT_NOEXCEPT
214+
bool is_undef() const noexcept
220215
{
221216
return m_data->m_type_info.is_undef();
222217
}
223218

224-
bool is_const() const CHAISCRIPT_NOEXCEPT
219+
bool is_const() const noexcept
225220
{
226221
return m_data->m_type_info.is_const();
227222
}
228223

229-
bool is_type(const Type_Info &ti) const CHAISCRIPT_NOEXCEPT
224+
bool is_type(const Type_Info &ti) const noexcept
230225
{
231226
return m_data->m_type_info.bare_equal(ti);
232227
}
233228

234-
bool is_null() const CHAISCRIPT_NOEXCEPT
229+
bool is_null() const noexcept
235230
{
236231
return (m_data->m_data_ptr == nullptr && m_data->m_const_data_ptr == nullptr);
237232
}
238233

239-
const chaiscript::detail::Any & get() const CHAISCRIPT_NOEXCEPT
234+
const chaiscript::detail::Any & get() const noexcept
240235
{
241236
return m_data->m_obj;
242237
}
243238

244-
bool is_ref() const CHAISCRIPT_NOEXCEPT
239+
bool is_ref() const noexcept
245240
{
246241
return m_data->m_is_ref;
247242
}
248243

249-
bool is_return_value() const CHAISCRIPT_NOEXCEPT
244+
bool is_return_value() const noexcept
250245
{
251246
return m_data->m_return_value;
252247
}
253248

254-
void reset_return_value() const CHAISCRIPT_NOEXCEPT
249+
void reset_return_value() const noexcept
255250
{
256251
m_data->m_return_value = false;
257252
}
258253

259-
bool is_pointer() const CHAISCRIPT_NOEXCEPT
254+
bool is_pointer() const noexcept
260255
{
261256
return !is_ref();
262257
}
263258

264-
void *get_ptr() const CHAISCRIPT_NOEXCEPT
259+
void *get_ptr() const noexcept
265260
{
266261
return m_data->m_data_ptr;
267262
}
268263

269-
const void *get_const_ptr() const CHAISCRIPT_NOEXCEPT
264+
const void *get_const_ptr() const noexcept
270265
{
271266
return m_data->m_const_data_ptr;
272267
}
@@ -306,7 +301,7 @@ namespace chaiscript
306301

307302

308303
/// \returns true if the two Boxed_Values share the same internal type
309-
static bool type_match(const Boxed_Value &l, const Boxed_Value &r) CHAISCRIPT_NOEXCEPT
304+
static bool type_match(const Boxed_Value &l, const Boxed_Value &r) noexcept
310305
{
311306
return l.get_type_info() == r.get_type_info();
312307
}
@@ -416,18 +411,16 @@ namespace chaiscript
416411
return detail::const_var_impl(t);
417412
}
418413

419-
#ifdef CHAISCRIPT_HAS_MAGIC_STATICS
420414
inline Boxed_Value const_var(bool b) {
421-
static auto t = detail::const_var_impl(true);
422-
static auto f = detail::const_var_impl(false);
415+
static const auto t = detail::const_var_impl(true);
416+
static const auto f = detail::const_var_impl(false);
423417

424418
if (b) {
425419
return t;
426420
} else {
427421
return f;
428422
}
429423
}
430-
#endif
431424

432425
}
433426

0 commit comments

Comments
 (0)