[Openmp-commits] [PATCH] D83963: [OpenMP] Use `abort` not `error` for fatal runtime exceptions

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 16 12:51:22 PDT 2020


jdoerfert updated this revision to Diff 278581.
jdoerfert added a comment.

Add flush


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83963/new/

https://reviews.llvm.org/D83963

Files:
  openmp/libomptarget/src/private.h


Index: openmp/libomptarget/src/private.h
===================================================================
--- openmp/libomptarget/src/private.h
+++ openmp/libomptarget/src/private.h
@@ -66,17 +66,19 @@
 // implementation for fatal messages
 ////////////////////////////////////////////////////////////////////////////////
 
-#define FATAL_MESSAGE0(_num, _str)                                    \
-  do {                                                                \
-    fprintf(stderr, "Libomptarget fatal error %d: %s\n", _num, _str); \
-    exit(1);                                                          \
+#define FATAL_MESSAGE0(_num, _str)                                             \
+  do {                                                                         \
+    fprintf(stderr, "Libomptarget fatal error %d: %s\n", _num, _str);          \
+    fflush(stderr);                                                            \
+    abort();                                                                   \
   } while (0)
 
-#define FATAL_MESSAGE(_num, _str, ...)                              \
-  do {                                                              \
-    fprintf(stderr, "Libomptarget fatal error %d:" _str "\n", _num, \
-            __VA_ARGS__);                                           \
-    exit(1);                                                        \
+#define FATAL_MESSAGE(_num, _str, ...)                                         \
+  do {                                                                         \
+    fprintf(stderr, "Libomptarget fatal error %d:" _str "\n", _num,            \
+            __VA_ARGS__);                                                      \
+    fflush(stderr);                                                            \
+    abort();                                                                   \
   } while (0)
 
 // Implemented in libomp, they are called from within __tgt_* functions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83963.278581.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200716/23b93d10/attachment.bin>


More information about the Openmp-commits mailing list