Assert.h 2.05 KB
Newer Older
 Kenneth Moreland committed Apr 20, 2016 1 2 3 4 5 6 7 8 //============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // 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. //  Kenneth Moreland committed Sep 20, 2017 9 // Copyright 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).  Kenneth Moreland committed Apr 20, 2016 10 11 12 // Copyright 2016 UT-Battelle, LLC. // Copyright 2016 Los Alamos National Security. //  Kenneth Moreland committed Sep 20, 2017 13 // Under the terms of Contract DE-NA0003525 with NTESS,  Kenneth Moreland committed Apr 20, 2016 14 15 16 17 18 19 20 21 22 23 // the U.S. Government retains certain rights in this software. // // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ #ifndef vtk_m_Assert_h #define vtk_m_Assert_h  Kenneth Moreland committed Jun 27, 2016 24 25 #include  Kenneth Moreland committed Apr 20, 2016 26 27 28 29 30 31 32 33 34 35 36 37 38 #include /// \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. ///  Allison Vacanti committed Aug 28, 2017 39 40 /// The VTKM_NO_ASSERT cmake and preprocessor option allows debugging builds /// to remove assertions for performance reasons.  Robert Maynard committed Mar 29, 2018 41 #if defined(VTKM_CUDA_VERSION_MAJOR) && (VTKM_CUDA_VERSION_MAJOR == 7)  Robert Maynard committed Mar 07, 2018 42 43 44 45 //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  Kitware Robot committed May 25, 2017 46 #define VTKM_ASSERT(condition) assert(condition)  Kenneth Moreland committed Apr 20, 2016 47 #else  Robert Maynard committed Aug 10, 2017 48 #define VTKM_ASSERT(condition) (void)(condition)  Kenneth Moreland committed Apr 20, 2016 49 50 51 #endif #endif //vtk_m_Assert_h