From 0dfd416395cf8beb748949cf271f2b11d880809c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 6 Mar 2020 09:26:54 +0100 Subject: [PATCH] Use [[noreturn]] directly --- Installation/include/CGAL/config.h | 10 +++------- NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h | 2 +- STL_Extension/include/CGAL/assertions.h | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index a215cbbf4e5..d70989b2ffb 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -546,13 +546,9 @@ using std::max; #endif // Macro to specify a 'noreturn' attribute. -#if defined(__GNUG__) || __has_attribute(__noreturn__) -# define CGAL_NORETURN __attribute__ ((__noreturn__)) -#elif defined (_MSC_VER) -# define CGAL_NORETURN __declspec(noreturn) -#else -# define CGAL_NORETURN -#endif +// (This macro existed in CGAL before we switched to C++11. Let's keep +// the macro defined for backward-compatibility. That cannot harm.) +#define CGAL_NORETURN [[noreturn]] // Macro to specify [[no_unique_address]] if supported #if __has_cpp_attribute(no_unique_address) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h b/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h index b65f47e85d0..a096445fc4a 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/LA_eigen/LA.h @@ -102,7 +102,7 @@ template struct LA_eigen { return (int)v.cols(); } - template static CGAL_NORETURN NT determinant_aux(Mat_ const&, Tag_true) { + template static [[noreturn]] NT determinant_aux(Mat_ const&, Tag_true) { CGAL_error(); } template static NT determinant_aux(Mat_ const& m, Tag_false) { diff --git a/STL_Extension/include/CGAL/assertions.h b/STL_Extension/include/CGAL/assertions.h index 393a85b3484..812318028cc 100644 --- a/STL_Extension/include/CGAL/assertions.h +++ b/STL_Extension/include/CGAL/assertions.h @@ -54,9 +54,9 @@ namespace CGAL { // ===================== // failure functions // ----------------- -CGAL_EXPORT CGAL_NORETURN void assertion_fail ( const char*, const char*, int, const char* = "") ; -CGAL_EXPORT CGAL_NORETURN void precondition_fail ( const char*, const char*, int, const char* = "") ; -CGAL_EXPORT CGAL_NORETURN void postcondition_fail ( const char*, const char*, int, const char* = "") ; +CGAL_EXPORT [[noreturn]] void assertion_fail ( const char*, const char*, int, const char* = "") ; +CGAL_EXPORT [[noreturn]] void precondition_fail ( const char*, const char*, int, const char* = "") ; +CGAL_EXPORT [[noreturn]] void postcondition_fail ( const char*, const char*, int, const char* = "") ; // warning function // ----------------