Use [[noreturn]] directly

This commit is contained in:
Laurent Rineau 2020-03-06 09:26:54 +01:00
parent 49244a6359
commit 0dfd416395
3 changed files with 7 additions and 11 deletions

View File

@ -546,13 +546,9 @@ using std::max;
#endif #endif
// Macro to specify a 'noreturn' attribute. // Macro to specify a 'noreturn' attribute.
#if defined(__GNUG__) || __has_attribute(__noreturn__) // (This macro existed in CGAL before we switched to C++11. Let's keep
# define CGAL_NORETURN __attribute__ ((__noreturn__)) // the macro defined for backward-compatibility. That cannot harm.)
#elif defined (_MSC_VER) #define CGAL_NORETURN [[noreturn]]
# define CGAL_NORETURN __declspec(noreturn)
#else
# define CGAL_NORETURN
#endif
// Macro to specify [[no_unique_address]] if supported // Macro to specify [[no_unique_address]] if supported
#if __has_cpp_attribute(no_unique_address) #if __has_cpp_attribute(no_unique_address)

View File

@ -102,7 +102,7 @@ template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
return (int)v.cols(); return (int)v.cols();
} }
template<class Mat_> static CGAL_NORETURN NT determinant_aux(Mat_ const&, Tag_true) { template<class Mat_> static [[noreturn]] NT determinant_aux(Mat_ const&, Tag_true) {
CGAL_error(); CGAL_error();
} }
template<class Mat_> static NT determinant_aux(Mat_ const& m, Tag_false) { template<class Mat_> static NT determinant_aux(Mat_ const& m, Tag_false) {

View File

@ -54,9 +54,9 @@ namespace CGAL {
// ===================== // =====================
// failure functions // failure functions
// ----------------- // -----------------
CGAL_EXPORT CGAL_NORETURN void assertion_fail ( const char*, const char*, int, const char* = "") ; CGAL_EXPORT [[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 [[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 postcondition_fail ( const char*, const char*, int, const char* = "") ;
// warning function // warning function
// ---------------- // ----------------