]> git.saurik.com Git - minimal.git/commitdiff
General _assert improvements.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 16 Oct 2009 16:19:49 +0000 (16:19 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 16 Oct 2009 16:19:49 +0000 (16:19 +0000)
stdlib.h

index bc3461d8dded8e9a4aefae063360be77d23a1c8d..71850dab30bc072f0e1c4ef9c25cc31760a8b7d9 100644 (file)
--- a/stdlib.h
+++ b/stdlib.h
 #endif
 
 #ifdef __cplusplus
+#define _assert___(line) \
+    #line
+#define _assert__(line) \
+    _assert___(line)
 #define _assert_(e) \
-    throw e
+    throw __FILE__ "(" _assert__(__LINE__) "): _assert(" e ")"
 #else
 #define _assert_(e) \
     exit(1)
@@ -55,7 +59,7 @@
 
 #define _assert(expr) \
     do if (!(expr)) { \
-        fprintf(stderr, "%s(%u): _assert(%u:%s)\n", __FILE__, __LINE__, errno, #expr); \
+        fprintf(stderr, "%s(%u): _assert(%s); errno=%u\n", __FILE__, __LINE__, #expr, errno); \
         _breakpoint(); \
         _assert_(#expr); \
     } while (false)