diff --git a/include/xgboost/span.h b/include/xgboost/span.h index e2dff409d..4d61471bf 100644 --- a/include/xgboost/span.h +++ b/include/xgboost/span.h @@ -102,13 +102,27 @@ namespace common { #define SPAN_CHECK KERNEL_CHECK -#else // not CUDA +#else // ------------------------------ not CUDA ---------------------------- -#define KERNEL_CHECK(cond) \ - (XGBOOST_EXPECT((cond), true) ? static_cast(0) : std::terminate()) +#if defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1 + +#define KERNEL_CHECK(cond) \ + do { \ + if (XGBOOST_EXPECT(!(cond), false)) { \ + printf("[xgboost] fatal error.\n"); \ + } \ + } while (0) #define SPAN_CHECK(cond) KERNEL_CHECK(cond) +#else + +#define KERNEL_CHECK(cond) (XGBOOST_EXPECT((cond), true) ? static_cast(0) : std::terminate()) + +#define SPAN_CHECK(cond) KERNEL_CHECK(cond) + +#endif // defined(XGBOOST_STRICT_R_MODE) + #endif // __CUDA_ARCH__ #if defined(__CUDA_ARCH__) diff --git a/src/tree/hist/evaluate_splits.h b/src/tree/hist/evaluate_splits.h index 9fd3ce5ca..ed3f14e60 100644 --- a/src/tree/hist/evaluate_splits.h +++ b/src/tree/hist/evaluate_splits.h @@ -114,9 +114,6 @@ template class HistEvaluator { left_sum.SetSubstract(parent.stats, right_sum); break; } - default: { - std::terminate(); - } } };