Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/jemalloc/dist/src Add noreturn where needed. In...



details:   https://anonhg.NetBSD.org/src/rev/a809e17d57b0
branches:  trunk
changeset: 449558:a809e17d57b0
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 10 19:34:30 2019 +0000

description:
Add noreturn where needed. In the prof case because of cassert() and return
in some functions we disable the cassert() for clang. We should really have
a JEMALLOC_PROF_NORETURN and a way to mark the remaining of the function
unreachable.

diffstat:

 external/bsd/jemalloc/dist/src/extent.c   |   4 +-
 external/bsd/jemalloc/dist/src/jemalloc.c |   2 +-
 external/bsd/jemalloc/dist/src/prof.c     |  35 ++++++++++++++++--------------
 external/bsd/jemalloc/dist/src/rtree.c    |   4 +-
 external/bsd/jemalloc/dist/src/witness.c  |   8 +++---
 5 files changed, 28 insertions(+), 25 deletions(-)

diffs (246 lines):

diff -r 08b872a90041 -r a809e17d57b0 external/bsd/jemalloc/dist/src/extent.c
--- a/external/bsd/jemalloc/dist/src/extent.c   Sun Mar 10 19:32:56 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/extent.c   Sun Mar 10 19:34:30 2019 +0000
@@ -697,7 +697,7 @@
        }
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_add(tsdn_t *tsdn, const extent_t *extent) {
        cassert(config_prof);
        /* prof_gdump() requirement. */
@@ -723,7 +723,7 @@
        }
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_sub(tsdn_t *tsdn, const extent_t *extent) {
        cassert(config_prof);
 
diff -r 08b872a90041 -r a809e17d57b0 external/bsd/jemalloc/dist/src/jemalloc.c
--- a/external/bsd/jemalloc/dist/src/jemalloc.c Sun Mar 10 19:32:56 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/jemalloc.c Sun Mar 10 19:34:30 2019 +0000
@@ -862,7 +862,7 @@
        return false;
 }
 
-static void
+static JEMALLOC_NORETURN void
 malloc_abort_invalid_conf(void) {
        assert(opt_abort_conf);
        malloc_printf("<jemalloc>: Abort (abort_conf:true) on invalid conf "
diff -r 08b872a90041 -r a809e17d57b0 external/bsd/jemalloc/dist/src/prof.c
--- a/external/bsd/jemalloc/dist/src/prof.c     Sun Mar 10 19:32:56 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/prof.c     Sun Mar 10 19:34:30 2019 +0000
@@ -207,7 +207,7 @@
 
 /******************************************************************************/
 
-void
+JEMALLOC_NORETURN void
 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
        prof_tdata_t *tdata;
 
@@ -237,7 +237,7 @@
        }
 }
 
-void
+JEMALLOC_NORETURN void
 prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
     prof_tctx_t *tctx) {
        prof_tctx_set(tsdn, ptr, usize, NULL, tctx);
@@ -268,7 +268,7 @@
        }
 }
 
-void
+JEMALLOC_NORETURN void
 bt_init(prof_bt_t *bt, void **vec) {
        cassert(config_prof);
 
@@ -276,7 +276,7 @@
        bt->len = 0;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_enter(tsd_t *tsd, prof_tdata_t *tdata) {
        cassert(config_prof);
        assert(tdata == prof_tdata_get(tsd, false));
@@ -289,7 +289,7 @@
        malloc_mutex_lock(tsd_tsdn(tsd), &bt2gctx_mtx);
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_leave(tsd_t *tsd, prof_tdata_t *tdata) {
        cassert(config_prof);
        assert(tdata == prof_tdata_get(tsd, false));
@@ -530,7 +530,7 @@
 #undef BT_FRAME
 }
 #else
-void
+JEMALLOC_NORETURN void
 prof_backtrace(prof_bt_t *bt) {
        cassert(config_prof);
        not_reached();
@@ -575,7 +575,7 @@
        return gctx;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx,
     prof_tdata_t *tdata) {
        cassert(config_prof);
@@ -1175,7 +1175,7 @@
        return ret;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_dump_gctx_prep(tsdn_t *tsdn, prof_gctx_t *gctx, prof_gctx_tree_t *gctxs) {
        cassert(config_prof);
 
@@ -1548,7 +1548,7 @@
        return ret;
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_dump_prep(tsd_t *tsd, prof_tdata_t *tdata,
     struct prof_tdata_merge_iter_arg_s *prof_tdata_merge_iter_arg,
     struct prof_gctx_merge_iter_arg_s *prof_gctx_merge_iter_arg,
@@ -1719,7 +1719,7 @@
 
 #define DUMP_FILENAME_BUFSIZE  (PATH_MAX + 1)
 #define VSEQ_INVALID           UINT64_C(0xffffffffffffffff)
-static void
+static JEMALLOC_NORETURN void
 prof_dump_filename(char *filename, char v, uint64_t vseq) {
        cassert(config_prof);
 
@@ -1741,8 +1741,9 @@
 prof_fdump(void) {
        tsd_t *tsd;
        char filename[DUMP_FILENAME_BUFSIZE];
-
+#ifndef __clang__
        cassert(config_prof);
+#endif
        assert(opt_prof_final);
        assert(opt_prof_prefix[0] != '\0');
 
@@ -1778,8 +1779,9 @@
 prof_idump(tsdn_t *tsdn) {
        tsd_t *tsd;
        prof_tdata_t *tdata;
-
+#ifndef __clang__
        cassert(config_prof);
+#endif
 
        if (!prof_booted || tsdn_null(tsdn) || !prof_active_get_unlocked()) {
                return;
@@ -1835,8 +1837,9 @@
 prof_gdump(tsdn_t *tsdn) {
        tsd_t *tsd;
        prof_tdata_t *tdata;
-
+#ifndef __clang__
        cassert(config_prof);
+#endif
 
        if (!prof_booted || tsdn_null(tsdn) || !prof_active_get_unlocked()) {
                return;
@@ -1865,7 +1868,7 @@
        }
 }
 
-static void
+static JEMALLOC_NORETURN void
 prof_bt_hash(const void *key, size_t r_hash[2]) {
        const prof_bt_t *bt = (const prof_bt_t *)key;
 
@@ -2256,7 +2259,7 @@
        return prof_gdump_old;
 }
 
-void
+JEMALLOC_NORETURN void
 prof_boot0(void) {
        cassert(config_prof);
 
@@ -2264,7 +2267,7 @@
            sizeof(PROF_PREFIX_DEFAULT));
 }
 
-void
+JEMALLOC_NORETURN void
 prof_boot1(void) {
        cassert(config_prof);
 
diff -r 08b872a90041 -r a809e17d57b0 external/bsd/jemalloc/dist/src/rtree.c
--- a/external/bsd/jemalloc/dist/src/rtree.c    Sun Mar 10 19:32:56 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/rtree.c    Sun Mar 10 19:34:30 2019 +0000
@@ -34,7 +34,7 @@
 }
 rtree_node_alloc_t *JET_MUTABLE rtree_node_alloc = rtree_node_alloc_impl;
 
-static void
+static JEMALLOC_NORETURN void
 rtree_node_dalloc_impl(tsdn_t *tsdn, rtree_t *rtree, rtree_node_elm_t *node) {
        /* Nodes are never deleted during normal operation. */
        not_reached();
@@ -49,7 +49,7 @@
 }
 rtree_leaf_alloc_t *JET_MUTABLE rtree_leaf_alloc = rtree_leaf_alloc_impl;
 
-static void
+static JEMALLOC_NORETURN void
 rtree_leaf_dalloc_impl(tsdn_t *tsdn, rtree_t *rtree, rtree_leaf_elm_t *leaf) {
        /* Leaves are never deleted during normal operation. */
        not_reached();
diff -r 08b872a90041 -r a809e17d57b0 external/bsd/jemalloc/dist/src/witness.c
--- a/external/bsd/jemalloc/dist/src/witness.c  Sun Mar 10 19:32:56 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/witness.c  Sun Mar 10 19:34:30 2019 +0000
@@ -14,7 +14,7 @@
        witness->opaque = opaque;
 }
 
-static void
+static JEMALLOC_NORETURN void
 witness_lock_error_impl(const witness_list_t *witnesses,
     const witness_t *witness) {
        witness_t *w;
@@ -28,7 +28,7 @@
 }
 witness_lock_error_t *JET_MUTABLE witness_lock_error = witness_lock_error_impl;
 
-static void
+static JEMALLOC_NORETURN void
 witness_owner_error_impl(const witness_t *witness) {
        malloc_printf("<jemalloc>: Should own %s(%u)\n", witness->name,
            witness->rank);
@@ -37,7 +37,7 @@
 witness_owner_error_t *JET_MUTABLE witness_owner_error =
     witness_owner_error_impl;
 
-static void
+static JEMALLOC_NORETURN void
 witness_not_owner_error_impl(const witness_t *witness) {
        malloc_printf("<jemalloc>: Should not own %s(%u)\n", witness->name,
            witness->rank);
@@ -46,7 +46,7 @@
 witness_not_owner_error_t *JET_MUTABLE witness_not_owner_error =
     witness_not_owner_error_impl;
 
-static void
+static JEMALLOC_NORETURN void
 witness_depth_error_impl(const witness_list_t *witnesses,
     witness_rank_t rank_inclusive, unsigned depth) {
        witness_t *w;



Home | Main Index | Thread Index | Old Index