Use C++11 [[noreturn]] attribute directly

Keep SOCI_NORETURN defined just in case somebody uses it in their own
code, but stop using it in SOCI and just use the standard C++11
attribute directly instead.
This commit is contained in:
Vadim Zeitlin
2025-06-08 00:36:27 +02:00
parent a1c52f6f9e
commit 93c5dc5717
3 changed files with 6 additions and 13 deletions

View File

@@ -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

View File

@@ -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_;

View File

@@ -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