summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Eischer <r.eischer@certec.at>2015-01-26 09:23:36 +0100
committerRoland Eischer <r.eischer@certec.at>2015-01-26 09:25:58 +0100
commit47855f1c68a282903a8db470697915bd419ec17c (patch)
tree29c8eee83ee64edfdf904a55399cf67f0d407078
parent30eff69a10898dd9b2fb10ed07ae8c68458a5ad2 (diff)
Added macro wrapper for noexcept
- Added macro wrapper for noexcept to support MSVC compiler.
-rw-r--r--include/array.h4
-rw-r--r--include/byref.h2
-rw-r--r--include/byval.h2
-rw-r--r--include/class.h2
-rw-r--r--include/classbase.h2
-rw-r--r--include/exception.h4
-rw-r--r--include/global.h4
-rw-r--r--include/hashmember.h2
-rw-r--r--include/hiddenpointer.h2
-rw-r--r--include/object.h2
-rw-r--r--include/script.h10
-rw-r--r--include/value.h4
-rw-r--r--zend/includes.h11
-rw-r--r--zend/script.cpp2
-rw-r--r--zend/value.cpp4
15 files changed, 32 insertions, 25 deletions
diff --git a/include/array.h b/include/array.h
index d238862..882670a 100644
--- a/include/array.h
+++ b/include/array.h
@@ -38,7 +38,7 @@ public:
* Move constructor from a value object
* @param value
*/
- Array(Value &&value) noexcept : Value(std::move(value))
+ Array(Value &&value) _NOEXCEPT : Value(std::move(value))
{
// type must be valid
if (value.type() != Type::Array) throw FatalError("Moving a non-array to an array variable");
@@ -107,7 +107,7 @@ public:
* @param value
* @return Array
*/
- Array &operator=(Value &&value) noexcept
+ Array &operator=(Value &&value) _NOEXCEPT
{
// skip self assignment
if (this == &value) return *this;
diff --git a/include/byref.h b/include/byref.h
index ff60981..07e2e21 100644
--- a/include/byref.h
+++ b/include/byref.h
@@ -45,7 +45,7 @@ public:
* Move constructor
* @param argument
*/
- ByRef(ByRef &&argument) noexcept : Argument(argument) {}
+ ByRef(ByRef &&argument) _NOEXCEPT : Argument(argument) {}
/**
* Destructor
diff --git a/include/byval.h b/include/byval.h
index 3606df7..38c5280 100644
--- a/include/byval.h
+++ b/include/byval.h
@@ -45,7 +45,7 @@ public:
* Move constructor
* @param argument
*/
- ByVal(ByVal &&argument) noexcept : Argument(argument) {}
+ ByVal(ByVal &&argument) _NOEXCEPT : Argument(argument) {}
/**
* Destructor
diff --git a/include/class.h b/include/class.h
index 76ac114..45bc236 100644
--- a/include/class.h
+++ b/include/class.h
@@ -48,7 +48,7 @@ public:
* Move constructor
* @param that
*/
- Class(Class<T> &&that) noexcept : ClassBase(std::move(that)) {}
+ Class(Class<T> &&that) _NOEXCEPT : ClassBase(std::move(that)) {}
/**
* Destructor
diff --git a/include/classbase.h b/include/classbase.h
index a70157f..f594f75 100644
--- a/include/classbase.h
+++ b/include/classbase.h
@@ -85,7 +85,7 @@ public:
* Move constructor
* @param that
*/
- ClassBase(ClassBase &&that) noexcept : _impl(std::move(that._impl)) {}
+ ClassBase(ClassBase &&that) _NOEXCEPT : _impl(std::move(that._impl)) {}
/**
* Destructor
diff --git a/include/exception.h b/include/exception.h
index 94aaa85..15e92bc 100644
--- a/include/exception.h
+++ b/include/exception.h
@@ -52,11 +52,7 @@ public:
* Overridden what method
* @return const char *
*/
-#ifdef _NOEXCEPT
virtual const char *what() const _NOEXCEPT override
-#else
- virtual const char *what() const noexcept override
-#endif
{
return _message.c_str();
}
diff --git a/include/global.h b/include/global.h
index 4593e5d..2757979 100644
--- a/include/global.h
+++ b/include/global.h
@@ -34,7 +34,7 @@ public:
* Move constructor
* @param global
*/
- Global(Global &&global) noexcept : Value(std::move(global)), _name(std::move(global._name)), _exists(global._exists) {}
+ Global(Global &&global) _NOEXCEPT : Value(std::move(global)), _name(std::move(global._name)), _exists(global._exists) {}
/**
* Destructor
@@ -70,7 +70,7 @@ public:
* @return Global
*/
/*
- Global &operator=(Global &&global) noexcept
+ Global &operator=(Global &&global) _NOEXCEPT
{
// skip self assignment
if (&global == this) return *this;
diff --git a/include/hashmember.h b/include/hashmember.h
index b5b6c17..ce27192 100644
--- a/include/hashmember.h
+++ b/include/hashmember.h
@@ -579,7 +579,7 @@ protected:
* Move constructor
* @param value Other element
*/
-// HashMember(HashMember<Type> &&member) noexcept :
+// HashMember(HashMember<Type> &&member) _NOEXCEPT :
// _parent(std::move(member._parent)), _index(std::move(member._index)) {}
private:
diff --git a/include/hiddenpointer.h b/include/hiddenpointer.h
index 5465ebb..955e7d7 100644
--- a/include/hiddenpointer.h
+++ b/include/hiddenpointer.h
@@ -84,7 +84,7 @@ public:
* Move constructor
* @param that
*/
- HiddenPointer(HiddenPointer<Type> &&that) noexcept : _allocated(that._allocated), _buffer(that._buffer)
+ HiddenPointer(HiddenPointer<Type> &&that) _NOEXCEPT : _allocated(that._allocated), _buffer(that._buffer)
{
// the other object is no longer allocated
that._allocated = false;
diff --git a/include/object.h b/include/object.h
index 301fa57..2eea05b 100644
--- a/include/object.h
+++ b/include/object.h
@@ -140,7 +140,7 @@ public:
* @param value
* @return ForcedValue
*/
- Object &operator=(Value &&value) noexcept
+ Object &operator=(Value &&value) _NOEXCEPT
{
// skip self assignment
if (this == &value) return *this;
diff --git a/include/script.h b/include/script.h
index fb546ea..6aee034 100644
--- a/include/script.h
+++ b/include/script.h
@@ -42,33 +42,33 @@ public:
* @param source PHP source code to be evaluated
* @param size Length of the source code
*/
- Script(const char *name, const char *source, size_t size) noexcept;
+ Script(const char *name, const char *source, size_t size) _NOEXCEPT;
/**
* Alternative constructor without a size
* @param name Name of the PHP script
* @param source PHP source code to be evaluated
*/
- Script(const char *name, const char *source) noexcept : Script(name, source, ::strlen(source)) {}
+ Script(const char *name, const char *source) _NOEXCEPT : Script(name, source, ::strlen(source)) {}
/**
* Alternative constructor without a name
* @param source PHP source code to be evaluated
* @param size Length of the source code
*/
- Script(const char *source, size_t size) noexcept : Script("Unknown", source, size) {}
+ Script(const char *source, size_t size) _NOEXCEPT : Script("Unknown", source, size) {}
/**
* Alternative constructor without a name and without a size
* @param source PHP source code to be evaluated
*/
- Script(const char *source) noexcept : Script("Unknown", source, ::strlen(source)) {}
+ Script(const char *source) _NOEXCEPT : Script("Unknown", source, ::strlen(source)) {}
/**
* Constructor based on a std::string
* @param source PHP source code to be evaluated
*/
- Script(const std::string &source) noexcept : Script("Unknown", source.c_str(), source.size()) {}
+ Script(const std::string &source) _NOEXCEPT : Script("Unknown", source.c_str(), source.size()) {}
/**
* Destructor
diff --git a/include/value.h b/include/value.h
index b962415..b87574b 100644
--- a/include/value.h
+++ b/include/value.h
@@ -129,7 +129,7 @@ public:
* Move constructor
* @param value
*/
- Value(Value &&that) noexcept;
+ Value(Value &&that) _NOEXCEPT;
/**
* Destructor
@@ -141,7 +141,7 @@ public:
* @param value
* @return Value
*/
- Value &operator=(Value &&value) noexcept;
+ Value &operator=(Value &&value) _NOEXCEPT;
/**
* Assignment operator for various types
diff --git a/zend/includes.h b/zend/includes.h
index 874b0b1..93c74ec 100644
--- a/zend/includes.h
+++ b/zend/includes.h
@@ -44,6 +44,17 @@
#define BOOL2SUCCESS(b) ((b) ? SUCCESS : FAILURE)
/**
+ * Macro to be able to support MSVC compiler
+ */
+#ifndef _NOEXCEPT
+# ifndef _MSC_VER
+# define _NOEXCEPT noexecpt
+# else
+# define _NOEXCEPT __declspec(nothrow)
+# endif
+#endif
+
+/**
* Include other files from this library
*/
#include "../include/version.h"
diff --git a/zend/script.cpp b/zend/script.cpp
index 988ab1c..9e1d8f6 100644
--- a/zend/script.cpp
+++ b/zend/script.cpp
@@ -50,7 +50,7 @@ zend_op_array *Script::compile(const char *name, const char *phpcode, size_t siz
* @param script actual PHP code
* @param size length of the string
*/
-Script::Script(const char *name, const char *phpcode, size_t size) noexcept
+Script::Script(const char *name, const char *phpcode, size_t size) _NOEXCEPT
{
// we need the tsrm_ls variable
TSRMLS_FETCH();
diff --git a/zend/value.cpp b/zend/value.cpp
index 8c8cc9a..e021cc1 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -285,7 +285,7 @@ Value::Value(const Value &that)
* Move constructor
* @param value
*/
-Value::Value(Value &&that) noexcept: _val(that._val)
+Value::Value(Value &&that) _NOEXCEPT: _val(that._val)
{
// clear the other object
that._val = nullptr;
@@ -396,7 +396,7 @@ int Value::refcount() const
* @param value
* @return Value
*/
-Value &Value::operator=(Value &&value) noexcept
+Value &Value::operator=(Value &&value) _NOEXCEPT
{
// skip self assignment
if (this == &value) return *this;