2016-04-20 20:19:22 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2016-04-20 20:19:22 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef vtk_m_Assert_h
|
|
|
|
#define vtk_m_Assert_h
|
|
|
|
|
2016-06-27 19:26:39 +00:00
|
|
|
#include <vtkm/internal/Configure.h>
|
|
|
|
|
2019-12-17 14:33:12 +00:00
|
|
|
#include <cassert>
|
2016-04-20 20:19:22 +00:00
|
|
|
|
|
|
|
/// \def VTKM_ASSERT(condition)
|
|
|
|
///
|
|
|
|
/// Asserts that \a condition resolves to true. If \a condition is false,
|
|
|
|
/// then a diagnostic message is outputted and execution is terminated. The
|
|
|
|
/// behavior is essentially the same as the POSIX assert macro, but is
|
|
|
|
/// wrapped for added portability.
|
|
|
|
///
|
|
|
|
/// Like the POSIX assert macro, the check will be removed when compiling
|
|
|
|
/// in non-debug mode (specifically when NDEBUG is defined), so be prepared
|
|
|
|
/// for the possibility that the condition is never evaluated.
|
|
|
|
///
|
2017-08-28 12:53:09 +00:00
|
|
|
/// The VTKM_NO_ASSERT cmake and preprocessor option allows debugging builds
|
|
|
|
/// to remove assertions for performance reasons.
|
2018-03-29 21:25:36 +00:00
|
|
|
#if defined(VTKM_CUDA_VERSION_MAJOR) && (VTKM_CUDA_VERSION_MAJOR == 7)
|
2018-03-07 14:18:37 +00:00
|
|
|
//CUDA 7.5 doesn't support assert in device code
|
|
|
|
#define VTKM_ASSERT(condition) (void)(condition)
|
|
|
|
#elif !defined(NDEBUG) && !defined(VTKM_NO_ASSERT)
|
|
|
|
//Only assert if we are in debug mode and don't have VTKM_NO_ASSERT defined
|
2017-05-18 14:29:41 +00:00
|
|
|
#define VTKM_ASSERT(condition) assert(condition)
|
2020-01-16 22:39:10 +00:00
|
|
|
#define VTKM_ASSERTS_CHECKED
|
2016-04-20 20:19:22 +00:00
|
|
|
#else
|
2017-08-10 19:37:35 +00:00
|
|
|
#define VTKM_ASSERT(condition) (void)(condition)
|
2016-04-20 20:19:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif //vtk_m_Assert_h
|