From b34dc221a1bb8d0b933a350849cdb32494de0155 Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Fri, 27 Nov 2020 11:10:53 -0800 Subject: [PATCH] Remove `GSL_ASSUME` (unused code) This is not specified in the C++ Core Guidelines as part of GSL, so it should not be documented or supported with a GSL name. And since we don't use it in the GSL repo either, we should just remove it directly. For more about why assumptions are a dangerous blunt instrument, including that they actively eliminate contracts checks including GSL's `Expects` and `Ensures`, see [P2064](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2064r0.pdf). --- include/gsl/assert | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/gsl/assert b/include/gsl/assert index 08f7a5e..6cca337 100644 --- a/include/gsl/assert +++ b/include/gsl/assert @@ -57,20 +57,6 @@ #define GSL_STRINGIFY_DETAIL(x) #x #define GSL_STRINGIFY(x) GSL_STRINGIFY_DETAIL(x) -// -// GSL_ASSUME(cond) -// -// Tell the optimizer that the predicate cond must hold. It is unspecified -// whether or not cond is actually evaluated. -// -#ifdef _MSC_VER -#define GSL_ASSUME(cond) __assume(cond) -#elif defined(__GNUC__) -#define GSL_ASSUME(cond) ((cond) ? static_cast(0) : __builtin_unreachable()) -#else -#define GSL_ASSUME(cond) static_cast((cond) ? 0 : 0) -#endif - // // GSL.assert: assertions //