Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

(GH-21) Introduced compatibility of error.cxx for GCC versions 4.4 th…

…rough 4.7.

Validated by manual experiment.
  • Loading branch information...
commit 456a8ea1586056e5e51f109dc4297c40825bc580 1 parent 6a0ddd8
@ajtack authored
Showing with 26 additions and 1 deletion.
  1. +23 −0 riak/compat.hxx
  2. +3 −1 riak/error.cxx
View
23 riak/compat.hxx
@@ -0,0 +1,23 @@
+/*!
+ * \file
+ * Defines helpful utilities which contribute to compiler compatibility.
+ *
+ * \author Andres Jaan Tack <andres.jaan.tack@eesti.ee>
+ */
+#pragma once
+
+//
+// Check for support of the C++11 noexcept keyword. The macro RIAK_CPP_NOEXCEPT will safely expand
+// to this keyword if it is available, and otherwise yield a blank.
+//
+#ifdef __GNUC__
+# include <features.h>
+# if __GNUC_PREREQ(4,6)
+# define RIAK_CPP_NOEXCEPT noexcept
+# else
+# define RIAK_CPP_NOEXCEPT
+# endif
+#else
+ // TODO: Check for clang >= 3.0 and verify.
+# define RIAK_CPP_NOEXCEPT
+#endif
View
4 riak/error.cxx
@@ -1,4 +1,6 @@
+#include <boost/config.hpp>
#include <cassert>
+#include <riak/compat.hxx>
#include <riak/error.hxx>
//=============================================================================
@@ -10,7 +12,7 @@ class server_error_category
: public std::error_category
{
public:
- virtual const char* name () const {
+ virtual const char* name () const RIAK_CPP_NOEXCEPT {
return "riak::server_error";
}
Please sign in to comment.
Something went wrong with that request. Please try again.