aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorrcdailey <[email protected]>2015-03-08 16:48:23 +0000
committerlloyd <[email protected]>2015-03-08 16:48:23 +0000
commitc84b150c50093c680f18f0792bf7d52f157b01fe (patch)
tree40158cb3da0f1064d0ab6b42ae2ab998f604b168 /src
parentf0ccd62149e466d4fbf1fb2c57227c4d3cee190c (diff)
Add BOTAN_NOEXCEPT macro to work around missing noexcept in VS 2013.
Based on github pull req 23 by Robert Daily.
Diffstat (limited to 'src')
-rw-r--r--src/build-data/buildh.in8
-rw-r--r--src/lib/alloc/secmem.h10
-rw-r--r--src/lib/utils/exceptn.h2
3 files changed, 14 insertions, 6 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index 02f2731d6..e9115132f 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -135,6 +135,14 @@ otherwise does a byte at a time write via a volatile pointer.
#define BOTAN_DEPRECATED(msg)
#endif
+#if defined(_MSC_VER)
+ // noexcept is not supported in VS 2013
+ #include <yvals.h>
+ #define BOTAN_NOEXCEPT _NOEXCEPT
+#else
+ #define BOTAN_NOEXCEPT noexcept
+#endif
+
/*
* Module availability definitions
*/
diff --git a/src/lib/alloc/secmem.h b/src/lib/alloc/secmem.h
index 82b4083ea..6b3f8a487 100644
--- a/src/lib/alloc/secmem.h
+++ b/src/lib/alloc/secmem.h
@@ -34,14 +34,14 @@ class secure_allocator
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
- secure_allocator() noexcept {}
+ secure_allocator() BOTAN_NOEXCEPT {}
- ~secure_allocator() noexcept {}
+ ~secure_allocator() BOTAN_NOEXCEPT {}
- pointer address(reference x) const noexcept
+ pointer address(reference x) const BOTAN_NOEXCEPT
{ return std::addressof(x); }
- const_pointer address(const_reference x) const noexcept
+ const_pointer address(const_reference x) const BOTAN_NOEXCEPT
{ return std::addressof(x); }
pointer allocate(size_type n, const void* = 0)
@@ -68,7 +68,7 @@ class secure_allocator
delete [] p;
}
- size_type max_size() const noexcept
+ size_type max_size() const BOTAN_NOEXCEPT
{
return static_cast<size_type>(-1) / sizeof(T);
}
diff --git a/src/lib/utils/exceptn.h b/src/lib/utils/exceptn.h
index e7231f84d..7a10319c5 100644
--- a/src/lib/utils/exceptn.h
+++ b/src/lib/utils/exceptn.h
@@ -172,7 +172,7 @@ struct BOTAN_DLL Self_Test_Failure : public Internal_Error
*/
struct BOTAN_DLL Memory_Exhaustion : public std::bad_alloc
{
- const char* what() const noexcept
+ const char* what() const BOTAN_NOEXCEPT
{ return "Ran out of memory, allocation failed"; }
};