__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 c64d3e52db15ea94a35bad06444885fe215ac8b9..ab745db18022aeda15f1d04ba6d4ef93c82b4f9d 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 49b0dc3ec434c68a92ad3c38f087aec74c45e4e3..e87442a7c50d9ca8fdf267d7c6038780941c56d3 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);