option(GMX_SKIP_DEFAULT_CFLAGS "Don't automatically add suggested/required Compiler flags." OFF)
mark_as_advanced(GMX_SKIP_DEFAULT_CFLAGS)
+option(GMX_BUILD_FOR_COVERAGE
+ "Tune build for better code coverage metrics (e.g., disable asserts)"
+ OFF)
+mark_as_advanced(GMX_BUILD_FOR_COVERAGE)
+
######################################################################
# Compiler tests
# These need to be done early (before further tests).
COMPONENT development)
endif()
+if (GMX_BUILD_FOR_COVERAGE)
+ # Code heavy with asserts makes conditional coverage close to useless metric,
+ # as by design most of the false branches are impossible to trigger in
+ # correctly functioning code. And the benefit of testing those that could
+ # be triggered by using an API against its specification isn't usually
+ # worth the effort.
+ add_definitions(-DNDEBUG -DBOOST_DISABLE_ASSERTS -DGMX_DISABLE_ASSERTS)
+endif ()
+
add_subdirectory(doxygen)
add_subdirectory(share)
add_subdirectory(src)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013, by the GROMACS development team, led by
* David van der Spoel, Berk Hess, Erik Lindahl, and including many
* others, as listed in the AUTHORS file in the top-level source
* directory and at http://www.gromacs.org.
* \{
*/
-/*! \brief
+/*! \def GMX_RELEASE_ASSERT
+ * \brief
* Macro for asserts that should also be present in the release version.
*
* Regardless of NDEBUG, this macro checks \p condition, and if it is not true,
* should only be used in a context where it is safe to throw an exception to
* keep the option open.
*/
+#ifdef GMX_DISABLE_ASSERTS
+#define GMX_RELEASE_ASSERT(condition, msg)
+#else
#define GMX_RELEASE_ASSERT(condition, msg) \
((void) ((condition) ? (void)0 : \
::gmx::internal::assertHandler(#condition, msg, \
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)))
+#endif
/*! \def GMX_ASSERT
* \brief
* Macro for debug asserts.