aboutsummaryrefslogtreecommitdiff
path: root/Source/ablastr/utils/TextMsg.H
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-05-01 18:25:01 +0200
committerGravatar GitHub <noreply@github.com> 2023-05-01 09:25:01 -0700
commit1c6f1bf24513b4e56f640eea402fa8223ea1c667 (patch)
tree29967ef551e4632b757f41ac98e10b258692be71 /Source/ablastr/utils/TextMsg.H
parenta602c6e60ec8d6b728dfe7fe5e79ec191c906f57 (diff)
downloadWarpX-1c6f1bf24513b4e56f640eea402fa8223ea1c667.tar.gz
WarpX-1c6f1bf24513b4e56f640eea402fa8223ea1c667.tar.zst
WarpX-1c6f1bf24513b4e56f640eea402fa8223ea1c667.zip
Use WARPX_ABORT_WITH_MESSAGE("msg") instead of amrex::Abort(Utils::TextMsg::Err("msg")) (#3879)
* use WARPX_ABORT_WITH_MSG instead of amrex::Abort(Utils::TextMsg::Err(msg)) [WIP] * use WARPX_ABORT_WITH_MESSAGE * fix typo * fix missing parenthesis * remove spaces to prevent automatic text wrapping * remove wrong parenthesis
Diffstat (limited to 'Source/ablastr/utils/TextMsg.H')
-rw-r--r--Source/ablastr/utils/TextMsg.H21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/ablastr/utils/TextMsg.H b/Source/ablastr/utils/TextMsg.H
index 9dc55cac6..6fa7b28a9 100644
--- a/Source/ablastr/utils/TextMsg.H
+++ b/Source/ablastr/utils/TextMsg.H
@@ -49,12 +49,33 @@ namespace ablastr::utils::TextMsg
std::string
Warn (const std::string &msg, const bool do_text_wrapping = true);
+ /** \brief This function is a wrapper around amrex::Assert, designed to ensure the uniform
+ * formatting of the error messages. The function is designed to be used via the
+ * ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE(EX,MSG) macro.
+ *
+ * @param[in] ex the text of the failed assertion
+ * @param[in] file the file where the assertion failed
+ * @param[in] line the line where the assertion failed
+ * @param[in] msg the error message
+ */
void
Assert (const char *ex, const char *file, const int line, const std::string &msg);
+ /** \brief This function is a wrapper around amrex::Abort, designed to ensure the uniform
+ * formatting of the error messages. The function is designed to be used via the
+ * ABLASTR_ABORT_WITH_MESSAGE(MSG) macro.
+ *
+ * @param[in] file the file where abort was called
+ * @param[in] line the line here abort was called
+ * @param[in] msg the error message
+ */
+ void
+ Abort (const char *file, const int line, const std::string &msg);
+
} // namespace ablastr::utils::TextMsg
#define ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE(EX,MSG) (EX)?((void)0) : ablastr::utils::TextMsg::Assert( # EX , __FILE__, __LINE__ , MSG)
+#define ABLASTR_ABORT_WITH_MESSAGE(MSG) ablastr::utils::TextMsg::Abort( __FILE__, __LINE__ , MSG)
#endif // ABLASTR_TEXT_MSG_H_