Merge pull request #268 from galik/master

Fix: Issue: #267 gsl::fail_fast only defined for one configuration
This commit is contained in:
Neil MacIntosh 2016-03-24 17:34:16 -07:00
commit 5ae7e71f09

View File

@ -20,6 +20,7 @@
#define GSL_CONTRACTS_H #define GSL_CONTRACTS_H
#include <exception> #include <exception>
#include <stdexcept>
// //
// There are three configuration options for this GSL implementation's behavior // There are three configuration options for this GSL implementation's behavior
@ -42,10 +43,6 @@
// GSL.assert: assertions // GSL.assert: assertions
// //
#if defined(GSL_THROW_ON_CONTRACT_VIOLATION)
#include <stdexcept>
namespace gsl namespace gsl
{ {
struct fail_fast : public std::runtime_error struct fail_fast : public std::runtime_error
@ -54,6 +51,8 @@ struct fail_fast : public std::runtime_error
}; };
} }
#if defined(GSL_THROW_ON_CONTRACT_VIOLATION)
#define Expects(cond) if (!(cond)) \ #define Expects(cond) if (!(cond)) \
throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__)); throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__));
#define Ensures(cond) if (!(cond)) \ #define Ensures(cond) if (!(cond)) \