summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authortheraven <theraven@FreeBSD.org>2011-12-07 15:25:48 +0000
committertheraven <theraven@FreeBSD.org>2011-12-07 15:25:48 +0000
commitded93cd9e74a8cb2766f3a3f2ecaab59747c59e4 (patch)
tree8a6278cec83d284c97957bb6df5b9f2afcd30e17 /include
parentc9b9c0a5a33422e64173fec02b4e0a586b146f11 (diff)
downloadFreeBSD-src-ded93cd9e74a8cb2766f3a3f2ecaab59747c59e4.zip
FreeBSD-src-ded93cd9e74a8cb2766f3a3f2ecaab59747c59e4.tar.gz
Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a
__noreturn macro and modify the other exiting functions to use it. The __noreturn macro, unlike __dead2, must be used BEFORE the function. This is in line with the C and C++ specifications that place _Noreturn (c1x) and [[noreturn]] (C++11) in front of the functions. As with __dead2, this macro falls back to using the GCC attribute. Unfortunately, clang currently sets the same value for the C version macro in C99 and C1x modes, so these functions are hidden by default. At some point before 10.0, I need to go through the headers and clean up the C1x / C++11 visibility. Reviewed by: brooks (mentor)
Diffstat (limited to 'include')
-rw-r--r--include/stdlib.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 3c26dfb..d7e49d0 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -76,7 +76,7 @@ extern int __mb_cur_max;
extern int ___mb_cur_max(void);
#define MB_CUR_MAX (___mb_cur_max())
-void abort(void) __dead2;
+__noreturn void abort(void);
int abs(int) __pure2;
int atexit(void (*)(void));
double atof(const char *);
@@ -86,7 +86,7 @@ void *bsearch(const void *, const void *, size_t,
size_t, int (*)(const void *, const void *));
void *calloc(size_t, size_t) __malloc_like;
div_t div(int, int) __pure2;
-void exit(int) __dead2;
+__noreturn void exit(int);
void free(void *);
char *getenv(const char *);
long labs(long) __pure2;
@@ -145,10 +145,18 @@ unsigned long long
strtoull(const char * __restrict, char ** __restrict, int);
#endif /* __LONG_LONG_SUPPORTED */
-void _Exit(int) __dead2;
+__noreturn void _Exit(int);
#endif /* __ISO_C_VISIBLE >= 1999 */
/*
+ * If we're in a mode greater than C99, expose C1x functions.
+ */
+#if __ISO_C_VISIBLE > 1999
+__noreturn void quick_exit(int)
+int
+at_quick_exit(void (*func)(void));
+#endif /* __ISO_C_VISIBLE > 1999 */
+/*
* Extensions made by POSIX relative to C. We don't know yet which edition
* of POSIX made these extensions, so assume they've always been there until
* research can be done.
OpenPOWER on IntegriCloud