diff --git a/include/soci/noreturn.h b/include/soci/noreturn.h index 3462449c..73723e64 100644 --- a/include/soci/noreturn.h +++ b/include/soci/noreturn.h @@ -8,15 +8,7 @@ #ifndef SOCI_NORETURN_H_INCLUDED #define SOCI_NORETURN_H_INCLUDED -// Define a portable SOCI_NORETURN macro. -// -// TODO-C++11: Use [[noreturn]] attribute. -#if defined(__GNUC__) -# define SOCI_NORETURN __attribute__((noreturn)) void -#elif defined(_MSC_VER) -# define SOCI_NORETURN __declspec(noreturn) void -#else -# define SOCI_NORETURN void -#endif +// This is defined only for compatibility, don't use it any longer. +#define SOCI_NORETURN [[noreturn]] void #endif // SOCI_NORETURN_H_INCLUDED diff --git a/include/soci/statement.h b/include/soci/statement.h index 6fa64d2e..0f5388de 100644 --- a/include/soci/statement.h +++ b/include/soci/statement.h @@ -11,7 +11,6 @@ #include "soci/bind-values.h" #include "soci/into-type.h" #include "soci/into.h" -#include "soci/noreturn.h" #include "soci/use-type.h" #include "soci/use.h" #include "soci/soci-backend.h" @@ -99,7 +98,8 @@ private: // after adding the context in which it happened, including the provided // description of the operation that failed, the SQL query and, if // applicable, its parameters. - SOCI_NORETURN rethrow_current_exception_with_context(char const* operation); + [[noreturn]] + void rethrow_current_exception_with_context(char const* operation); int refCount_; diff --git a/src/core/statement.cpp b/src/core/statement.cpp index d54234c1..b9dc4616 100644 --- a/src/core/statement.cpp +++ b/src/core/statement.cpp @@ -897,7 +897,8 @@ statement_impl::make_vector_use_type_backend() return backEnd_->make_vector_use_type_backend(); } -SOCI_NORETURN +[[noreturn]] +void statement_impl::rethrow_current_exception_with_context(char const* operation) { try