__assert_fail(): remove _Noreturn, to get proper stacktraces
authorrofl0r <retnyg@gmx.net>
Tue, 1 Jan 2013 06:59:11 +0000 (07:59 +0100)
committerrofl0r <retnyg@gmx.net>
Fri, 4 Jan 2013 19:36:34 +0000 (20:36 +0100)
for _Noreturn functions, gcc generates code that trashes the
stack frame, and so it makes it impossible to inspect the causes
of an assert error in gdb.

abort() is not affected (i have not yet investigated why).

include/assert.h
src/exit/assert.c

index c64d3e5..ab745db 100644 (file)
@@ -12,7 +12,7 @@
 extern "C" {
 #endif
 
-_Noreturn void __assert_fail (const char *, const char *, int, const char *);
+void __assert_fail (const char *, const char *, int, const char *);
 
 #ifdef __cplusplus
 }
index 49b0dc3..e87442a 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-_Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func)
+void __assert_fail(const char *expr, const char *file, int line, const char *func)
 {
        fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line);
        fflush(NULL);