Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / utility / gmxassert.h
index d48997917bf12ac62be483a15db09471cf2a2942..c278f2c2fc3c702d473c718a47a60793c0a1345b 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011-2018, The GROMACS development team.
+ * Copyright (c) 2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
  * keep the option open.
  */
 #ifdef GMX_DISABLE_ASSERTS
-#define GMX_RELEASE_ASSERT(condition, msg)
-#else
-#ifdef _MSC_VER
-#define GMX_RELEASE_ASSERT(condition, msg) \
-    ((void) ((condition) ? (void)0 :                               \
-             ::gmx::internal::assertHandler(#condition, msg, \
-                                            GMX_CURRENT_FUNCTION, __FILE__, __LINE__)))
+#    define GMX_RELEASE_ASSERT(condition, msg)
 #else
+#    ifdef _MSC_VER
+#        define GMX_RELEASE_ASSERT(condition, msg)                                                      \
+            ((void)((condition) ? (void)0                                                               \
+                                : ::gmx::internal::assertHandler(#condition, msg, GMX_CURRENT_FUNCTION, \
+                                                                 __FILE__, __LINE__)))
+#    else
 // Use an "immediately invoked function expression" to allow being
 // used in constexpr context with older GCC versions
 // https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/
-#define GMX_RELEASE_ASSERT(condition, msg) \
-    ((void) ((condition) ? (void)0 :                               \
-             [&](){::gmx::internal::assertHandler(#condition, msg, \
-                                                  GMX_CURRENT_FUNCTION, __FILE__, __LINE__); } ()))
-#endif
+#        define GMX_RELEASE_ASSERT(condition, msg)                                                         \
+            ((void)((condition) ? (void)0 : [&]() {                                                        \
+                ::gmx::internal::assertHandler(#condition, msg, GMX_CURRENT_FUNCTION, __FILE__, __LINE__); \
+            }()))
+#    endif
 #endif
 /*! \def GMX_ASSERT
  * \brief
@@ -89,9 +90,9 @@
  * \see ::GMX_RELEASE_ASSERT
  */
 #ifdef NDEBUG
-#define GMX_ASSERT(condition, msg) ((void)0)
+#    define GMX_ASSERT(condition, msg) ((void)0)
 #else
-#define GMX_ASSERT(condition, msg) GMX_RELEASE_ASSERT(condition, msg)
+#    define GMX_ASSERT(condition, msg) GMX_RELEASE_ASSERT(condition, msg)
 #endif
 
 //! \}
@@ -111,11 +112,10 @@ namespace internal
  *
  * \ingroup module_utility
  */
-[[noreturn]]
-void assertHandler(const char *condition, const char *msg,
-                   const char *func, const char *file, int line);
+[[noreturn]] void
+assertHandler(const char* condition, const char* msg, const char* func, const char* file, int line);
 
-}   // namespace internal
+} // namespace internal
 //! \endcond
 
 } // namespace gmx