Commit b3bfa420 authored by Luca Boccassi's avatar Luca Boccassi Committed by GitHub

Merge pull request #2036 from aburgm/abort-flush

Flush stderr buffer before calling zmq_abort in assert macros
parents 95782450 07a37435
...@@ -78,6 +78,7 @@ namespace zmq ...@@ -78,6 +78,7 @@ namespace zmq
if (errstr != NULL) {\ if (errstr != NULL) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\ __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (errstr);\ zmq::zmq_abort (errstr);\
}\ }\
}\ }\
...@@ -90,6 +91,7 @@ namespace zmq ...@@ -90,6 +91,7 @@ namespace zmq
if (errstr != NULL) {\ if (errstr != NULL) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\ __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (errstr);\ zmq::zmq_abort (errstr);\
}\ }\
} while (false) } while (false)
...@@ -102,6 +104,7 @@ namespace zmq ...@@ -102,6 +104,7 @@ namespace zmq
zmq::win_error (errstr, 256);\ zmq::win_error (errstr, 256);\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\ __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (errstr);\ zmq::zmq_abort (errstr);\
}\ }\
} while (false) } while (false)
...@@ -116,6 +119,7 @@ namespace zmq ...@@ -116,6 +119,7 @@ namespace zmq
if (unlikely (!(x))) {\ if (unlikely (!(x))) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", #x, \ fprintf (stderr, "Assertion failed: %s (%s:%d)\n", #x, \
__FILE__, __LINE__);\ __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (#x);\ zmq::zmq_abort (#x);\
}\ }\
} while (false) } while (false)
...@@ -126,6 +130,7 @@ namespace zmq ...@@ -126,6 +130,7 @@ namespace zmq
if (unlikely (!(x))) {\ if (unlikely (!(x))) {\
const char *errstr = strerror (errno);\ const char *errstr = strerror (errno);\
fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\ fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (errstr);\ zmq::zmq_abort (errstr);\
}\ }\
} while (false) } while (false)
...@@ -136,6 +141,7 @@ namespace zmq ...@@ -136,6 +141,7 @@ namespace zmq
if (unlikely (x)) {\ if (unlikely (x)) {\
const char *errstr = strerror (x);\ const char *errstr = strerror (x);\
fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\ fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (errstr);\ zmq::zmq_abort (errstr);\
}\ }\
} while (false) } while (false)
...@@ -146,6 +152,7 @@ namespace zmq ...@@ -146,6 +152,7 @@ namespace zmq
if (unlikely (x)) {\ if (unlikely (x)) {\
const char *errstr = gai_strerror (x);\ const char *errstr = gai_strerror (x);\
fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\ fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort (errstr);\ zmq::zmq_abort (errstr);\
}\ }\
} while (false) } while (false)
...@@ -156,6 +163,7 @@ namespace zmq ...@@ -156,6 +163,7 @@ namespace zmq
if (unlikely (!x)) {\ if (unlikely (!x)) {\
fprintf (stderr, "FATAL ERROR: OUT OF MEMORY (%s:%d)\n",\ fprintf (stderr, "FATAL ERROR: OUT OF MEMORY (%s:%d)\n",\
__FILE__, __LINE__);\ __FILE__, __LINE__);\
fflush (stderr);\
zmq::zmq_abort ("FATAL ERROR: OUT OF MEMORY");\ zmq::zmq_abort ("FATAL ERROR: OUT OF MEMORY");\
}\ }\
} while (false) } while (false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment