Module Name:    src
Committed By:   christos
Date:           Sun Mar 10 19:34:30 UTC 2019

Modified Files:
        src/external/bsd/jemalloc/dist/src: extent.c jemalloc.c prof.c rtree.c
            witness.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/extent.c \
    src/external/bsd/jemalloc/dist/src/prof.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/jemalloc/dist/src/jemalloc.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/rtree.c \
    src/external/bsd/jemalloc/dist/src/witness.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/jemalloc/dist/src/extent.c
diff -u src/external/bsd/jemalloc/dist/src/extent.c:1.2 src/external/bsd/jemalloc/dist/src/extent.c:1.3
--- src/external/bsd/jemalloc/dist/src/extent.c:1.2	Mon Mar  4 12:20:07 2019
+++ src/external/bsd/jemalloc/dist/src/extent.c	Sun Mar 10 15:34:30 2019
@@ -697,7 +697,7 @@ extent_interior_register(tsdn_t *tsdn, r
 	}
 }
 
-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 @@ extent_gdump_add(tsdn_t *tsdn, const ext
 	}
 }
 
-static void
+static JEMALLOC_NORETURN void
 extent_gdump_sub(tsdn_t *tsdn, const extent_t *extent) {
 	cassert(config_prof);
 
Index: src/external/bsd/jemalloc/dist/src/prof.c
diff -u src/external/bsd/jemalloc/dist/src/prof.c:1.2 src/external/bsd/jemalloc/dist/src/prof.c:1.3
--- src/external/bsd/jemalloc/dist/src/prof.c:1.2	Mon Mar  4 12:18:53 2019
+++ src/external/bsd/jemalloc/dist/src/prof.c	Sun Mar 10 15:34:30 2019
@@ -207,7 +207,7 @@ rb_gen(static UNUSED, tdata_tree_, prof_
 
 /******************************************************************************/
 
-void
+JEMALLOC_NORETURN void
 prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated) {
 	prof_tdata_t *tdata;
 
@@ -237,7 +237,7 @@ prof_alloc_rollback(tsd_t *tsd, prof_tct
 	}
 }
 
-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 @@ prof_free_sampled_object(tsd_t *tsd, siz
 	}
 }
 
-void
+JEMALLOC_NORETURN void
 bt_init(prof_bt_t *bt, void **vec) {
 	cassert(config_prof);
 
@@ -276,7 +276,7 @@ bt_init(prof_bt_t *bt, void **vec) {
 	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 @@ prof_enter(tsd_t *tsd, prof_tdata_t *tda
 	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 @@ prof_backtrace(prof_bt_t *bt) {
 #undef BT_FRAME
 }
 #else
-void
+JEMALLOC_NORETURN void
 prof_backtrace(prof_bt_t *bt) {
 	cassert(config_prof);
 	not_reached();
@@ -575,7 +575,7 @@ prof_gctx_create(tsdn_t *tsdn, prof_bt_t
 	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 @@ label_return:
 	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 @@ label_return:
 	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 @@ prof_cnt_all(uint64_t *curobjs, uint64_t
 
 #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 @@ static void
 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 @@ void
 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 @@ void
 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 @@ prof_gdump(tsdn_t *tsdn) {
 	}
 }
 
-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 @@ prof_gdump_set(tsdn_t *tsdn, bool gdump)
 	return prof_gdump_old;
 }
 
-void
+JEMALLOC_NORETURN void
 prof_boot0(void) {
 	cassert(config_prof);
 
@@ -2264,7 +2267,7 @@ prof_boot0(void) {
 	    sizeof(PROF_PREFIX_DEFAULT));
 }
 
-void
+JEMALLOC_NORETURN void
 prof_boot1(void) {
 	cassert(config_prof);
 

Index: src/external/bsd/jemalloc/dist/src/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.4 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.5
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.4	Sun Mar 10 06:00:29 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Sun Mar 10 15:34:30 2019
@@ -862,7 +862,7 @@ malloc_conf_next(char const **opts_p, ch
 	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 "

Index: src/external/bsd/jemalloc/dist/src/rtree.c
diff -u src/external/bsd/jemalloc/dist/src/rtree.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/rtree.c:1.2
--- src/external/bsd/jemalloc/dist/src/rtree.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/rtree.c	Sun Mar 10 15:34:30 2019
@@ -34,7 +34,7 @@ rtree_node_alloc_impl(tsdn_t *tsdn, rtre
 }
 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_impl(tsdn_t *tsdn, rtre
 }
 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();
Index: src/external/bsd/jemalloc/dist/src/witness.c
diff -u src/external/bsd/jemalloc/dist/src/witness.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/witness.c:1.2
--- src/external/bsd/jemalloc/dist/src/witness.c:1.1.1.1	Mon Mar  4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/witness.c	Sun Mar 10 15:34:30 2019
@@ -14,7 +14,7 @@ witness_init(witness_t *witness, const c
 	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_impl(const witness_li
 }
 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_impl(const witness_t
 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_impl(const witne
 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;

Reply via email to