diff options
author | Lukas Larsson <lukas@erlang.org> | 2020-07-08 17:18:53 +0200 |
---|---|---|
committer | Lukas Larsson <lukas@erlang.org> | 2020-09-21 16:40:30 +0200 |
commit | 4971092f8d0bafcd36ad8c531399d130fab43f5f (patch) | |
tree | 328490d153be747d5fe73a2adcc5ce5cb5dc67a9 | |
parent | 2c251b21dc53b2105be33b0237986880957e3ed3 (diff) | |
download | erlang-4971092f8d0bafcd36ad8c531399d130fab43f5f.tar.gz |
erts: Refactor all headers to work in C++
Co-authored-by: John Högberg <john@erlang.org>
Co-authored-by: Dan Gudmundsson <dgud@erlang.org>
32 files changed, 220 insertions, 219 deletions
diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c index 045b1b86ff..4630aa866f 100644 --- a/erts/emulator/beam/break.c +++ b/erts/emulator/beam/break.c @@ -44,7 +44,7 @@ /* Forward declarations -- should really appear somewhere else */ static void process_killer(void); void do_break(void); -void erl_crash_dump_v(char *file, int line, char* fmt, va_list args); +void erl_crash_dump_v(char *file, int line, const char* fmt, va_list args); #ifdef DEBUG static void bin_check(void); @@ -770,7 +770,7 @@ crash_dump_limited_writer(void* vfdp, char* buf, size_t len) /* XXX THIS SHOULD BE IN SYSTEM !!!! */ void -erl_crash_dump_v(char *file, int line, char* fmt, va_list args) +erl_crash_dump_v(char *file, int line, const char* fmt, va_list args) { ErtsThrPrgrData tpd_buf; /* in case we aren't a managed thread... */ int fd; diff --git a/erts/emulator/beam/erl_bif_unique.h b/erts/emulator/beam/erl_bif_unique.h index 41fce533d6..19a8b266dd 100644 --- a/erts/emulator/beam/erl_bif_unique.h +++ b/erts/emulator/beam/erl_bif_unique.h @@ -416,7 +416,7 @@ erts_proc_store_ref(Process *c_p, Uint32 ref[ERTS_MAX_REF_NUMBERS]); ERTS_GLB_INLINE Eterm erts_proc_store_ref(Process *c_p, Uint32 ref[ERTS_MAX_REF_NUMBERS]) { - Eterm *hp = HAlloc(c_p, ERTS_REF_THING_SIZE); + Eterm *hp = HAlloc(c_p, (Sint)ERTS_REF_THING_SIZE); write_ref_thing(hp, ref[0], ref[1], ref[2]); return make_internal_ref(hp); } diff --git a/erts/emulator/beam/erl_binary.h b/erts/emulator/beam/erl_binary.h index f3e3890e94..ce2f7bf2ee 100644 --- a/erts/emulator/beam/erl_binary.h +++ b/erts/emulator/beam/erl_binary.h @@ -384,7 +384,7 @@ erts_bin_drv_alloc_fnf(Uint size) BINARY_OVERFLOW_CHECK(size); bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; - res = erts_alloc_fnf(ERTS_ALC_T_DRV_BINARY, bsize); + res = (Binary *)erts_alloc_fnf(ERTS_ALC_T_DRV_BINARY, bsize); ERTS_CHK_BIN_ALIGNMENT(res); if (res) { @@ -417,7 +417,7 @@ erts_bin_nrml_alloc_fnf(Uint size) BINARY_OVERFLOW_CHECK(size); bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; - res = erts_alloc_fnf(ERTS_ALC_T_BINARY, bsize); + res = (Binary *)erts_alloc_fnf(ERTS_ALC_T_BINARY, bsize); ERTS_CHK_BIN_ALIGNMENT(res); if (res) { @@ -455,7 +455,7 @@ erts_bin_realloc_fnf(Binary *bp, Uint size) BINARY_OVERFLOW_CHECK(size); bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; - nbp = erts_realloc_fnf(type, (void *) bp, bsize); + nbp = (Binary *)erts_realloc_fnf(type, (void *) bp, bsize); ERTS_CHK_BIN_ALIGNMENT(nbp); if (nbp) { @@ -519,7 +519,7 @@ erts_create_magic_binary_x(Uint size, int (*destructor)(Binary *), { Uint bsize = unaligned ? ERTS_MAGIC_BIN_UNALIGNED_SIZE(size) : ERTS_MAGIC_BIN_SIZE(size); - Binary* bptr = erts_alloc_fnf(alloc_type, bsize); + Binary* bptr = (Binary *)erts_alloc_fnf(alloc_type, bsize); ASSERT(bsize > size); if (!bptr) erts_alloc_n_enomem(ERTS_ALC_T2N(alloc_type), bsize); @@ -557,7 +557,7 @@ erts_binary_to_magic_indirection(Binary *bp) ErtsMagicIndirectionWord *mip; ASSERT(bp->intern.flags & BIN_FLAG_MAGIC); ASSERT(ERTS_MAGIC_BIN_ATYPE(bp) == ERTS_ALC_T_MINDIRECTION); - mip = ERTS_MAGIC_BIN_UNALIGNED_DATA(bp); + mip = (ErtsMagicIndirectionWord*)ERTS_MAGIC_BIN_UNALIGNED_DATA(bp); return &mip->smp_atomic_word; } diff --git a/erts/emulator/beam/erl_gc.h b/erts/emulator/beam/erl_gc.h index b9b1ed728c..69220588a2 100644 --- a/erts/emulator/beam/erl_gc.h +++ b/erts/emulator/beam/erl_gc.h @@ -131,7 +131,7 @@ ERTS_GLB_INLINE Eterm follow_moved(Eterm term, Eterm xptr_tag) */ #define ERTS_IS_GC_DESIRED_INTERNAL(Proc, HTop, STop) \ - ((((STop) - (HTop) < (Proc)->mbuf_sz)) \ + ((((STop) - (HTop) < (Sint)(Proc)->mbuf_sz)) \ | ((Proc)->off_heap.overhead > (Proc)->bin_vheap_sz) \ | !!((Proc)->flags & F_FORCE_GC)) diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index 8c8e0c9862..5d8c710e6a 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -136,7 +136,7 @@ Eterm erts_init_process_id = ERTS_INVALID_PID; * inherit previous values. */ -extern void erl_crash_dump_v(char *, int, char *, va_list); +extern void erl_crash_dump_v(char *, int, const char *, va_list); #ifdef __WIN32__ extern void ConNormalExit(void); extern void ConWaitForExit(void); @@ -288,7 +288,7 @@ set_default_time_adj(int *time_correction_p, ErtsTimeWarpMode *time_warp_mode_p) * that don't go to the error logger go through here. */ -void erl_error(char *fmt, va_list args) +void erl_error(const char *fmt, va_list args) { erts_vfprintf(stderr, fmt, args); } @@ -2378,7 +2378,7 @@ erl_start(int argc, char **argv) -__decl_noreturn void erts_thr_fatal_error(int err, char *what) +__decl_noreturn void erts_thr_fatal_error(int err, const char *what) { char *errstr = err ? strerror(err) : NULL; erts_fprintf(stderr, @@ -2437,7 +2437,7 @@ system_cleanup(int flush_async) static int erts_exit_code; static __decl_noreturn void __noreturn -erts_exit_vv(int n, int flush_async, char *fmt, va_list args1, va_list args2) +erts_exit_vv(int n, int flush_async, const char *fmt, va_list args1, va_list args2) { system_cleanup(flush_async); @@ -2474,7 +2474,7 @@ __decl_noreturn void __noreturn erts_exit_epilogue(void) } /* Exit without flushing async threads */ -__decl_noreturn void __noreturn erts_exit(int n, char *fmt, ...) +__decl_noreturn void __noreturn erts_exit(int n, const char *fmt, ...) { va_list args1, args2; va_start(args1, fmt); diff --git a/erts/emulator/beam/erl_lock_check.c b/erts/emulator/beam/erl_lock_check.c index 39247e83e0..daf917f1b9 100644 --- a/erts/emulator/beam/erl_lock_check.c +++ b/erts/emulator/beam/erl_lock_check.c @@ -195,7 +195,7 @@ struct lc_locked_lock_t_ { lc_locked_lock_t *prev; UWord extra; Sint16 id; - char *file; + const char *file; unsigned int line; erts_lock_flags_t flags; erts_lock_options_t taken_options; @@ -407,7 +407,7 @@ make_my_locked_locks(void) static ERTS_INLINE lc_locked_lock_t * new_locked_lock(lc_thread_t* thr, erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line) + const char *file, unsigned int line) { lc_locked_lock_t *ll = lc_alloc(thr); ll->next = NULL; @@ -427,7 +427,7 @@ new_locked_lock(lc_thread_t* thr, static void raw_print_lock(char *prefix, Sint16 id, Wterm extra, erts_lock_flags_t flags, - char* file, unsigned int line, char *suffix) + const char* file, unsigned int line, char *suffix) { char *lname = (1 <= id && id < ERTS_LOCK_ORDER_SIZE ? erts_lock_order[id].name @@ -683,7 +683,7 @@ erts_lc_is_emu_thr(void) } int -erts_lc_assert_failed(char *file, int line, char *assertion) +erts_lc_assert_failed(const char *file, int line, const char *assertion) { erts_fprintf(stderr, "%s:%d: Lock check assertion \"%s\" failed!\n", file, line, assertion); @@ -706,7 +706,7 @@ void erts_lc_fail(char *fmt, ...) Sint16 -erts_lc_get_lock_order_id(char *name) +erts_lc_get_lock_order_id(const char *name) { int i; @@ -1047,7 +1047,7 @@ erts_lc_trylock_force_busy_flg(erts_lc_lock_t *lck, erts_lock_options_t options) } void erts_lc_trylock_flg_x(int locked, erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line) + const char *file, unsigned int line) { lc_thread_t *thr; lc_locked_lock_t *ll; @@ -1101,7 +1101,7 @@ void erts_lc_trylock_flg_x(int locked, erts_lc_lock_t *lck, erts_lock_options_t } void erts_lc_require_lock_flg(erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line) + const char *file, unsigned int line) { lc_thread_t *thr = make_my_locked_locks(); lc_locked_lock_t *ll = thr->locked.first; @@ -1176,7 +1176,7 @@ void erts_lc_unrequire_lock_flg(erts_lc_lock_t *lck, erts_lock_options_t options } void erts_lc_lock_flg_x(erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line) + const char *file, unsigned int line) { lc_thread_t *thr; lc_locked_lock_t *new_ll; @@ -1293,13 +1293,13 @@ erts_lc_trylock_force_busy(erts_lc_lock_t *lck) } void -erts_lc_trylock_x(int locked, erts_lc_lock_t *lck, char *file, unsigned int line) +erts_lc_trylock_x(int locked, erts_lc_lock_t *lck, const char *file, unsigned int line) { erts_lc_trylock_flg_x(locked, lck, 0, file, line); } void -erts_lc_lock_x(erts_lc_lock_t *lck, char *file, unsigned int line) +erts_lc_lock_x(erts_lc_lock_t *lck, const char *file, unsigned int line) { erts_lc_lock_flg_x(lck, 0, file, line); } @@ -1315,7 +1315,7 @@ void erts_lc_might_unlock(erts_lc_lock_t *lck) erts_lc_might_unlock_flg(lck, 0); } -void erts_lc_require_lock(erts_lc_lock_t *lck, char *file, unsigned int line) +void erts_lc_require_lock(erts_lc_lock_t *lck, const char *file, unsigned int line) { erts_lc_require_lock_flg(lck, 0, file, line); } @@ -1326,7 +1326,7 @@ void erts_lc_unrequire_lock(erts_lc_lock_t *lck) } void -erts_lc_init_lock(erts_lc_lock_t *lck, char *name, erts_lock_flags_t flags) +erts_lc_init_lock(erts_lc_lock_t *lck, const char *name, erts_lock_flags_t flags) { lck->id = erts_lc_get_lock_order_id(name); lck->extra = (UWord) &lck->extra; @@ -1337,7 +1337,7 @@ erts_lc_init_lock(erts_lc_lock_t *lck, char *name, erts_lock_flags_t flags) } void -erts_lc_init_lock_x(erts_lc_lock_t *lck, char *name, erts_lock_flags_t flags, Eterm extra) +erts_lc_init_lock_x(erts_lc_lock_t *lck, const char *name, erts_lock_flags_t flags, Eterm extra) { lck->id = erts_lc_get_lock_order_id(name); lck->extra = extra; diff --git a/erts/emulator/beam/erl_lock_check.h b/erts/emulator/beam/erl_lock_check.h index b32f27d9f9..b5b141bff6 100644 --- a/erts/emulator/beam/erl_lock_check.h +++ b/erts/emulator/beam/erl_lock_check.h @@ -57,7 +57,7 @@ typedef struct { void erts_lc_init(void); void erts_lc_late_init(void); -Sint16 erts_lc_get_lock_order_id(char *name); +Sint16 erts_lc_get_lock_order_id(const char *name); void erts_lc_check(erts_lc_lock_t *have, int have_len, erts_lc_lock_t *have_not, int have_not_len); void erts_lc_check_exact(erts_lc_lock_t *have, int have_len); @@ -66,30 +66,30 @@ void erts_lc_have_lock_ids(int *resv, int *ids, int len); void erts_lc_check_no_locked_of_type(erts_lock_flags_t flags); int erts_lc_trylock_force_busy_flg(erts_lc_lock_t *lck, erts_lock_options_t options); void erts_lc_trylock_flg_x(int locked, erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line); + const char *file, unsigned int line); void erts_lc_lock_flg_x(erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line); + const char *file, unsigned int line); void erts_lc_unlock_flg(erts_lc_lock_t *lck, erts_lock_options_t options); void erts_lc_might_unlock_flg(erts_lc_lock_t *lck, erts_lock_options_t options); int erts_lc_trylock_force_busy(erts_lc_lock_t *lck); void erts_lc_trylock_x(int locked, erts_lc_lock_t *lck, - char* file, unsigned int line); -void erts_lc_lock_x(erts_lc_lock_t *lck, char* file, unsigned int line); + const char* file, unsigned int line); +void erts_lc_lock_x(erts_lc_lock_t *lck, const char* file, unsigned int line); void erts_lc_unlock(erts_lc_lock_t *lck); void erts_lc_might_unlock(erts_lc_lock_t *lck); -void erts_lc_init_lock(erts_lc_lock_t *lck, char *name, erts_lock_flags_t flags); -void erts_lc_init_lock_x(erts_lc_lock_t *lck, char *name, erts_lock_flags_t flags, Eterm extra); +void erts_lc_init_lock(erts_lc_lock_t *lck, const char *name, erts_lock_flags_t flags); +void erts_lc_init_lock_x(erts_lc_lock_t *lck, const char *name, erts_lock_flags_t flags, Eterm extra); void erts_lc_destroy_lock(erts_lc_lock_t *lck); void erts_lc_fail(char *fmt, ...); -int erts_lc_assert_failed(char *file, int line, char *assertion); +int erts_lc_assert_failed(const char *file, int line, const char *assertion); void erts_lc_set_thread_name(char *thread_name); void erts_lc_pll(void); void erts_lc_require_lock_flg(erts_lc_lock_t *lck, erts_lock_options_t options, - char *file, unsigned int line); + const char *file, unsigned int line); void erts_lc_unrequire_lock_flg(erts_lc_lock_t *lck, erts_lock_options_t options); -void erts_lc_require_lock(erts_lc_lock_t *lck, char *file, unsigned int line); +void erts_lc_require_lock(erts_lc_lock_t *lck, const char *file, unsigned int line); void erts_lc_unrequire_lock(erts_lc_lock_t *lck); int erts_lc_is_emu_thr(void); diff --git a/erts/emulator/beam/erl_lock_count.h b/erts/emulator/beam/erl_lock_count.h index 32afef8a3e..4c50bd11f0 100644 --- a/erts/emulator/beam/erl_lock_count.h +++ b/erts/emulator/beam/erl_lock_count.h @@ -182,7 +182,7 @@ void erts_lcnt_lock_post(erts_lcnt_ref_t *ref); * @param file The name of the file where the lock was acquired. * @param line The line at which the lock was acquired. */ ERTS_GLB_FORCE_INLINE -void erts_lcnt_lock_post_x(erts_lcnt_ref_t *ref, char *file, unsigned int line); +void erts_lcnt_lock_post_x(erts_lcnt_ref_t *ref, const char *file, unsigned int line); /** @brief Records that a lock has been released. */ ERTS_GLB_FORCE_INLINE @@ -225,7 +225,7 @@ void erts_lcnt_lock_opt_idx(erts_lcnt_lock_info_carrier_t *carrier, int index, e ERTS_GLB_INLINE void erts_lcnt_lock_post_idx(erts_lcnt_lock_info_carrier_t *carrier, int index); ERTS_GLB_INLINE -void erts_lcnt_lock_post_x_idx(erts_lcnt_lock_info_carrier_t *carrier, int index, char *file, unsigned int line); +void erts_lcnt_lock_post_x_idx(erts_lcnt_lock_info_carrier_t *carrier, int index, const char *file, unsigned int line); ERTS_GLB_INLINE void erts_lcnt_lock_unacquire_idx(erts_lcnt_lock_info_carrier_t *carrier, int index); @@ -409,7 +409,7 @@ ERTS_GLB_INLINE void lcnt_update_stats__(erts_lcnt_lock_stats_t *stats, int lock_in_conflict, erts_lcnt_time_t *time_waited); ERTS_GLB_INLINE -erts_lcnt_lock_stats_t *lcnt_get_lock_stats__(erts_lcnt_lock_info_t *info, char *file, unsigned int line); +erts_lcnt_lock_stats_t *lcnt_get_lock_stats__(erts_lcnt_lock_info_t *info, const char *file, unsigned int line); ERTS_GLB_INLINE void lcnt_dec_lock_state__(ethr_atomic_t *l_state); @@ -542,7 +542,7 @@ void lcnt_dec_lock_state__(ethr_atomic_t *l_state) { } ERTS_GLB_INLINE -erts_lcnt_lock_stats_t *lcnt_get_lock_stats__(erts_lcnt_lock_info_t *info, char *file, unsigned int line) { +erts_lcnt_lock_stats_t *lcnt_get_lock_stats__(erts_lcnt_lock_info_t *info, const char *file, unsigned int line) { unsigned int i; ASSERT(info->location_count >= 1 && info->location_count <= ERTS_LCNT_MAX_LOCK_LOCATIONS); @@ -671,7 +671,7 @@ void erts_lcnt_lock_post(erts_lcnt_ref_t *ref) { } ERTS_GLB_FORCE_INLINE -void erts_lcnt_lock_post_x(erts_lcnt_ref_t *ref, char *file, unsigned int line) { +void erts_lcnt_lock_post_x(erts_lcnt_ref_t *ref, const char *file, unsigned int line) { erts_lcnt_lock_info_carrier_t *carrier; int handle; @@ -795,7 +795,7 @@ void erts_lcnt_lock_post_idx(erts_lcnt_lock_info_carrier_t *carrier, int index) } ERTS_GLB_INLINE -void erts_lcnt_lock_post_x_idx(erts_lcnt_lock_info_carrier_t *carrier, int index, char *file, unsigned int line) { +void erts_lcnt_lock_post_x_idx(erts_lcnt_lock_info_carrier_t *carrier, int index, const char *file, unsigned int line) { erts_lcnt_lock_info_t *info = &carrier->entries[index]; lcnt_thread_data_t__ *eltd = lcnt_get_thread_data__(); diff --git a/erts/emulator/beam/erl_message.h b/erts/emulator/beam/erl_message.h index 27b0c55414..0f57238490 100644 --- a/erts/emulator/beam/erl_message.h +++ b/erts/emulator/beam/erl_message.h @@ -528,15 +528,15 @@ ERTS_GLB_FORCE_INLINE ErtsMessage *erts_alloc_message(Uint sz, Eterm **hpp) ErtsMessage *mp; if (sz == 0) { - mp = erts_alloc_message_ref(); + mp = (ErtsMessage *)erts_alloc_message_ref(); ERTS_INIT_MESSAGE(mp); if (hpp) *hpp = NULL; return mp; } - mp = erts_alloc(ERTS_ALC_T_MSG, - sizeof(ErtsMessage) + (sz - 1)*sizeof(Eterm)); + mp = (ErtsMessage *)erts_alloc( + ERTS_ALC_T_MSG, sizeof(ErtsMessage) + (sz - 1)*sizeof(Eterm)); ERTS_INIT_MESSAGE(mp); mp->data.attached = ERTS_MSG_COMBINED_HFRAG; @@ -556,7 +556,7 @@ erts_shrink_message(ErtsMessage *mp, Uint sz, Eterm *brefs, Uint brefs_size) if (!mp->data.attached) return mp; ASSERT(mp->data.attached == ERTS_MSG_COMBINED_HFRAG); - nmp = erts_alloc_message_ref(); + nmp = (ErtsMessage *)erts_alloc_message_ref(); #ifdef DEBUG if (brefs && brefs_size) { int i; diff --git a/erts/emulator/beam/erl_monitor_link.h b/erts/emulator/beam/erl_monitor_link.h index 15c0676988..ef8d3024d4 100644 --- a/erts/emulator/beam/erl_monitor_link.h +++ b/erts/emulator/beam/erl_monitor_link.h @@ -781,11 +781,11 @@ void erts_monitor_tree_insert(ErtsMonitor **root, ErtsMonitor *mon); * * @param[in] old Monitor to remove from the tree * - * @param[in] new Monitor to insert into the tree + * @param[in] new_ Monitor to insert into the tree * */ void erts_monitor_tree_replace(ErtsMonitor **root, ErtsMonitor *old, - ErtsMonitor *new); + ErtsMonitor *new_); /** * @@ -1384,7 +1384,7 @@ extern size_t erts_monitor_node_key_offset; ERTS_GLB_INLINE ErtsMonitorData * erts_monitor_to_data(ErtsMonitor *mon) { - ErtsMonitorData *mdp = erts_ml_node_to_main_struct__((ErtsMonLnkNode *) mon); + ErtsMonitorData *mdp = (ErtsMonitorData *)erts_ml_node_to_main_struct__((ErtsMonLnkNode *) mon); #ifdef ERTS_ML_DEBUG ERTS_ML_ASSERT(!(mdp->origin.flags & ERTS_ML_FLG_TARGET)); @@ -1474,7 +1474,7 @@ erts_monitor_dist_delete(ErtsMonitor *mon) ErtsMonitorDataExtended *mdep; ErtsMonLnkDist *dist; Uint16 flags; - int delete; + int delete_; ERTS_ML_ASSERT(mon->flags & ERTS_ML_FLG_EXTENDED); ERTS_ML_ASSERT(mon->type == ERTS_MON_TYPE_DIST_PROC @@ -1487,8 +1487,8 @@ erts_monitor_dist_delete(ErtsMonitor *mon) erts_mtx_lock(&dist->mtx); flags = mon->flags; - delete = !!dist->alive & !!(flags & ERTS_ML_FLG_IN_TABLE); - if (delete) { + delete_ = !!dist->alive & !!(flags & ERTS_ML_FLG_IN_TABLE); + if (delete_) { if ((flags & (ERTS_ML_FLG_NAME | ERTS_ML_FLG_TARGET)) == ERTS_ML_FLG_NAME) erts_monitor_tree_delete(&dist->orig_name_monitors, mon); @@ -1498,7 +1498,7 @@ erts_monitor_dist_delete(ErtsMonitor *mon) erts_mtx_unlock(&dist->mtx); - return delete; + return delete_; } @@ -1619,7 +1619,7 @@ ErtsLink *erts_link_tree_lookup_insert(ErtsLink **root, ErtsLink *lnk); * */ ErtsLink *erts_link_tree_lookup_create(ErtsLink **root, int *created, - Uint16 type, Eterm this, Eterm other); + Uint16 type, Eterm this_, Eterm other); /** * @@ -1654,7 +1654,7 @@ void erts_link_tree_insert(ErtsLink **root, ErtsLink *lnk); * @param[in] new Link to insert into the tree * */ -void erts_link_tree_replace(ErtsLink **root, ErtsLink *old, ErtsLink *new); +void erts_link_tree_replace(ErtsLink **root, ErtsLink *old, ErtsLink *new_); /** * @@ -2237,7 +2237,7 @@ extern size_t erts_link_key_offset; ERTS_GLB_INLINE ErtsLinkData * erts_link_to_data(ErtsLink *lnk) { - ErtsLinkData *ldp = erts_ml_node_to_main_struct__((ErtsMonLnkNode *) lnk); + ErtsLinkData *ldp = (ErtsLinkData *)erts_ml_node_to_main_struct__((ErtsMonLnkNode *) lnk); #ifdef ERTS_ML_DEBUG ERTS_ML_ASSERT(erts_link_a_offset == (size_t) ldp->a.offset); @@ -2366,7 +2366,7 @@ erts_link_dist_delete(ErtsLink *lnk) { ErtsLinkDataExtended *ldep; ErtsMonLnkDist *dist; - int delete; + int delete_; ERTS_ML_ASSERT(lnk->flags & ERTS_ML_FLG_EXTENDED); ERTS_ML_ASSERT(lnk->type == ERTS_LNK_TYPE_DIST_PROC); @@ -2378,13 +2378,13 @@ erts_link_dist_delete(ErtsLink *lnk) erts_mtx_lock(&dist->mtx); - delete = !!dist->alive & !!(lnk->flags & ERTS_ML_FLG_IN_TABLE); - if (delete) + delete_ = !!dist->alive & !!(lnk->flags & ERTS_ML_FLG_IN_TABLE); + if (delete_) erts_link_list_delete(&dist->links, lnk); erts_mtx_unlock(&dist->mtx); - return delete; + return delete_; } diff --git a/erts/emulator/beam/erl_msacc.h b/erts/emulator/beam/erl_msacc.h index abea18b340..3d9ae8a5f1 100644 --- a/erts/emulator/beam/erl_msacc.h +++ b/erts/emulator/beam/erl_msacc.h @@ -167,7 +167,7 @@ extern erts_tsd_key_t ERTS_WRITE_UNLIKELY(erts_msacc_key); extern int ERTS_WRITE_UNLIKELY(erts_msacc_enabled); #endif -#define ERTS_MSACC_TSD_GET() erts_tsd_get(erts_msacc_key) +#define ERTS_MSACC_TSD_GET() ((ErtsMsAcc *)erts_tsd_get(erts_msacc_key)) #define ERTS_MSACC_TSD_SET(tsd) erts_tsd_set(erts_msacc_key,tsd) void erts_msacc_early_init(void); diff --git a/erts/emulator/beam/erl_port.h b/erts/emulator/beam/erl_port.h index 9983a22f56..4a9d7a685a 100644 --- a/erts/emulator/beam/erl_port.h +++ b/erts/emulator/beam/erl_port.h @@ -250,7 +250,7 @@ erts_port_runq(Port *prt) ERTS_GLB_INLINE void *erts_prtsd_get(Port *p, int ix); -ERTS_GLB_INLINE void *erts_prtsd_set(Port *p, int ix, void *new); +ERTS_GLB_INLINE void *erts_prtsd_set(Port *p, int ix, void *new_); #if ERTS_GLB_INLINE_INCL_FUNC_DEF @@ -290,7 +290,7 @@ erts_prtsd_set(Port *prt, int ix, void *data) if (!data) return NULL; - new_psd = erts_alloc(ERTS_ALC_T_PRTSD, sizeof(ErtsPrtSD)); + new_psd = (ErtsPrtSD*)erts_alloc(ERTS_ALC_T_PRTSD, sizeof(ErtsPrtSD)); for (i = 0; i < ERTS_PRTSD_SIZE; i++) new_psd->data[i] = NULL; psd = (ErtsPrtSD *) erts_atomic_cmpxchg_mb(&prt->psd, diff --git a/erts/emulator/beam/erl_port_task.h b/erts/emulator/beam/erl_port_task.h index 91b7b687bd..dfc9b4416c 100644 --- a/erts/emulator/beam/erl_port_task.h +++ b/erts/emulator/beam/erl_port_task.h @@ -171,7 +171,7 @@ ERTS_GLB_INLINE void erts_port_task_pre_init_sched(ErtsPortTaskSched *ptsp, ERTS_GLB_INLINE void erts_port_task_init_sched(ErtsPortTaskSched *ptsp, Eterm instr_id) { - char *lock_str = "port_sched_lock"; + const char *lock_str = "port_sched_lock"; ptsp->next = NULL; ptsp->taskq.local.busy.first = NULL; ptsp->taskq.local.busy.last = NULL; diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index 220deb7c47..183a8b44cc 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -3982,7 +3982,7 @@ check_immigration_need(ErtsRunQueue *c_rq, ErtsMigrationPath *mp, int prio) else len = RUNQ_READ_LEN(&c_rq->procs.prio_info[prio].len); - if (len < mp->prio[prio].limit.this) { + if (len < mp->prio[prio].limit.here) { if (prio == ERTS_PORT_PRIO_LEVEL) len = RUNQ_READ_LEN(&f_rq->ports.info.len); else @@ -4629,7 +4629,7 @@ init_migration_paths(void) mps->mpath[qix].flags = 0; mps->mpath[qix].misc_evac_runq = NULL; for (pix = 0; pix < ERTS_NO_PRIO_LEVELS; pix++) { - mps->mpath[qix].prio[pix].limit.this = -1; + mps->mpath[qix].prio[pix].limit.here = -1; mps->mpath[qix].prio[pix].limit.other = -1; mps->mpath[qix].prio[pix].runq = NULL; mps->mpath[qix].prio[pix].flags = 0; @@ -5184,7 +5184,7 @@ erts_fprintf(stderr, "--------------------------------\n"); | ERTS_CHK_RUNQ_FLG_IMMIGRATE(flags, pix))) { ASSERT(run_queue_info[qix].prio[pix].immigrate_from < 0); ASSERT(run_queue_info[qix].prio[pix].emigrate_to < 0); - mp->prio[pix].limit.this = -1; + mp->prio[pix].limit.here = -1; mp->prio[pix].limit.other = -1; mp->prio[pix].runq = NULL; mp->prio[pix].flags = 0; @@ -5195,7 +5195,7 @@ erts_fprintf(stderr, "--------------------------------\n"); ASSERT(run_queue_info[qix].prio[pix].emigrate_to >= 0); mqix = run_queue_info[qix].prio[pix].emigrate_to; - mp->prio[pix].limit.this + mp->prio[pix].limit.here = run_queue_info[qix].prio[pix].migration_limit; mp->prio[pix].limit.other = run_queue_info[mqix].prio[pix].migration_limit; @@ -5208,7 +5208,7 @@ erts_fprintf(stderr, "--------------------------------\n"); ASSERT(run_queue_info[qix].prio[pix].immigrate_from >= 0); mqix = run_queue_info[qix].prio[pix].immigrate_from; - mp->prio[pix].limit.this + mp->prio[pix].limit.here = run_queue_info[qix].prio[pix].migration_limit; mp->prio[pix].limit.other = run_queue_info[mqix].prio[pix].migration_limit; @@ -5229,7 +5229,7 @@ erts_fprintf(stderr, "--------------------------------\n"); nmp->misc_evac_runq = omp->misc_evac_runq; for (pix = 0; pix < ERTS_NO_PRIO_LEVELS; pix++) { - nmp->prio[pix].limit.this = omp->prio[pix].limit.this; + nmp->prio[pix].limit.here = omp->prio[pix].limit.here; nmp->prio[pix].limit.other = omp->prio[pix].limit.other; nmp->prio[pix].runq = omp->prio[pix].runq; nmp->prio[pix].flags = omp->prio[pix].flags; @@ -5304,7 +5304,7 @@ change_no_used_runqs(int used) nmp->misc_evac_runq = NULL; for (pix = 0; pix < ERTS_NO_PRIO_LEVELS; pix++) { - nmp->prio[pix].limit.this = -1; + nmp->prio[pix].limit.here = -1; nmp->prio[pix].limit.other = -1; nmp->prio[pix].runq = NULL; nmp->prio[pix].flags = 0; @@ -5319,7 +5319,7 @@ change_no_used_runqs(int used) | ERTS_RUNQ_FLGS_EVACUATE_QMASK); nmp->misc_evac_runq = to_rq; for (pix = 0; pix < ERTS_NO_PRIO_LEVELS; pix++) { - nmp->prio[pix].limit.this = -1; + nmp->prio[pix].limit.here = -1; nmp->prio[pix].limit.other = -1; nmp->prio[pix].runq = to_rq; nmp->prio[pix].flags = 0; diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h index 8dfa5b1bbb..8649d1ad2f 100644 --- a/erts/emulator/beam/erl_process.h +++ b/erts/emulator/beam/erl_process.h @@ -452,7 +452,7 @@ typedef struct { ErtsRunQueue *misc_evac_runq; struct { struct { - int this; + int here; int other; } limit; ErtsRunQueue *runq; @@ -2067,7 +2067,7 @@ void *erts_psd_set_init(Process *p, int ix, void *data); ERTS_GLB_INLINE void * erts_psd_get(Process *p, int ix); ERTS_GLB_INLINE void * -erts_psd_set(Process *p, int ix, void *new); +erts_psd_set(Process *p, int ix, void *data); #if ERTS_GLB_INLINE_INCL_FUNC_DEF @@ -2278,7 +2278,7 @@ erts_check_emigration_need(ErtsRunQueue *c_rq, int prio) /* No migration if other is non-empty */ if (!(ERTS_RUNQ_FLGS_GET(rq) & ERTS_RUNQ_FLG_NONEMPTY) && erts_get_sched_util(rq, 0, 1) < mp->prio[prio].limit.other - && erts_get_sched_util(c_rq, 0, 1) > mp->prio[prio].limit.this) { + && erts_get_sched_util(c_rq, 0, 1) > mp->prio[prio].limit.here) { return rq; } } @@ -2291,7 +2291,7 @@ erts_check_emigration_need(ErtsRunQueue *c_rq, int prio) else len = RUNQ_READ_LEN(&c_rq->procs.prio_info[prio].len); - if (len > mp->prio[prio].limit.this) { + if (len > mp->prio[prio].limit.here) { ErtsRunQueue *n_rq = mp->prio[prio].runq; if (n_rq) { if (prio == ERTS_PORT_PRIO_LEVEL) diff --git a/erts/emulator/beam/erl_process_lock.c b/erts/emulator/beam/erl_process_lock.c index 44c7892040..323ebcb120 100644 --- a/erts/emulator/beam/erl_process_lock.c +++ b/erts/emulator/beam/erl_process_lock.c @@ -1180,7 +1180,7 @@ void erts_lcnt_update_process_locks(int enable) { #if ERTS_PROC_LOCK_OWN_IMPL void -erts_proc_lc_lock(Process *p, ErtsProcLocks locks, char *file, unsigned int line) +erts_proc_lc_lock(Process *p, ErtsProcLocks locks, const char *file, unsigned int line) { erts_lc_lock_t lck = ERTS_LC_LOCK_INIT(-1, p->common.id, @@ -1209,7 +1209,7 @@ erts_proc_lc_lock(Process *p, ErtsProcLocks locks, char *file, unsigned int line void erts_proc_lc_trylock(Process *p, ErtsProcLocks locks, int locked, - char* file, unsigned int line) + const char *file, unsigned int line) { erts_lc_lock_t lck = ERTS_LC_LOCK_INIT(-1, p->common.id, @@ -1308,7 +1308,7 @@ erts_proc_lc_might_unlock(Process *p, ErtsProcLocks locks) } void -erts_proc_lc_require_lock(Process *p, ErtsProcLocks locks, char *file, +erts_proc_lc_require_lock(Process *p, ErtsProcLocks locks, const char *file, unsigned int line) { #if ERTS_PROC_LOCK_OWN_IMPL @@ -1655,7 +1655,7 @@ erts_proc_lc_my_proc_locks(Process *p) } void -erts_proc_lc_chk_no_proc_locks(char *file, int line) +erts_proc_lc_chk_no_proc_locks(const char *file, int line) { int resv[5]; int ids[5] = {lc_id.proc_lock_main, diff --git a/erts/emulator/beam/erl_process_lock.h b/erts/emulator/beam/erl_process_lock.h index bd38eca4dc..af21dd5426 100644 --- a/erts/emulator/beam/erl_process_lock.h +++ b/erts/emulator/beam/erl_process_lock.h @@ -244,7 +244,8 @@ void erts_lcnt_proc_lock_destroy(Process *p); ERTS_GLB_INLINE void erts_lcnt_proc_lock(erts_proc_lock_t *lock, ErtsProcLocks locks); ERTS_GLB_INLINE -void erts_lcnt_proc_lock_post_x(erts_proc_lock_t *lock, ErtsProcLocks locks, char *file, unsigned int line); +void erts_lcnt_proc_lock_post_x(erts_proc_lock_t *lock, ErtsProcLocks locks, + const char *file, unsigned int line); ERTS_GLB_INLINE void erts_lcnt_proc_lock_unacquire(erts_proc_lock_t *lock, ErtsProcLocks locks); ERTS_GLB_INLINE @@ -285,7 +286,7 @@ void erts_lcnt_proc_lock(erts_proc_lock_t *lock, ErtsProcLocks locks) { ERTS_GLB_INLINE void erts_lcnt_proc_lock_post_x(erts_proc_lock_t *lock, ErtsProcLocks locks, - char *file, unsigned int line) { + const char *file, unsigned int line) { erts_lcnt_lock_info_carrier_t *carrier; int handle; @@ -401,20 +402,20 @@ void erts_lcnt_proc_trylock(erts_proc_lock_t *lock, ErtsProcLocks locks, int res #define ERTS_CHK_HAVE_ONLY_MAIN_PROC_LOCK(P) \ erts_proc_lc_chk_only_proc_main((P)) void erts_proc_lc_lock(Process *p, ErtsProcLocks locks, - char *file, unsigned int line); + const char *file, unsigned int line); void erts_proc_lc_trylock(Process *p, ErtsProcLocks locks, int locked, - char *file, unsigned int line); + const char *file, unsigned int line); void erts_proc_lc_unlock(Process *p, ErtsProcLocks locks); void erts_proc_lc_might_unlock(Process *p, ErtsProcLocks locks); void erts_proc_lc_chk_have_proc_locks(Process *p, ErtsProcLocks locks); void erts_proc_lc_chk_proc_locks(Process *p, ErtsProcLocks locks); void erts_proc_lc_chk_only_proc_main(Process *p); void erts_proc_lc_chk_only_proc(Process *p, ErtsProcLocks locks); -void erts_proc_lc_chk_no_proc_locks(char *file, int line); +void erts_proc_lc_chk_no_proc_locks(const char *file, int line); ErtsProcLocks erts_proc_lc_my_proc_locks(Process *p); int erts_proc_lc_trylock_force_busy(Process *p, ErtsProcLocks locks); void erts_proc_lc_require_lock(Process *p, ErtsProcLocks locks, - char* file, unsigned int line); + const char* file, unsigned int line); void erts_proc_lc_unrequire_lock(Process *p, ErtsProcLocks locks); #else #define ERTS_CHK_NO_PROC_LOCKS @@ -536,7 +537,7 @@ ERTS_GLB_INLINE ErtsProcLocks erts_proc_raw_trylock__(Process *p, ERTS_GLB_INLINE void erts_proc_lock_x__(Process *, erts_pix_lock_t *, ErtsProcLocks, - char *file, unsigned int line); + const char *file, unsigned int line); #else ERTS_GLB_INLINE void erts_proc_lock__(Process *, erts_pix_lock_t *, @@ -652,7 +653,7 @@ ERTS_GLB_INLINE void erts_proc_lock_x__(Process *p, erts_pix_lock_t *pix_lck, ErtsProcLocks locks, - char *file, unsigned int line) + const char *file, unsigned int line) #else erts_proc_lock__(Process *p, erts_pix_lock_t *pix_lck, @@ -912,7 +913,7 @@ erts_proc_lock_op_debug(Process *p, ErtsProcLocks locks, int locked) #ifdef ERTS_ENABLE_LOCK_POSITION -ERTS_GLB_INLINE void erts_proc_lock_x(Process *, ErtsProcLocks, char *file, unsigned int line); +ERTS_GLB_INLINE void erts_proc_lock_x(Process *, ErtsProcLocks, const char *file, unsigned int line); #else ERTS_GLB_INLINE void erts_proc_lock(Process *, ErtsProcLocks); #endif @@ -931,7 +932,7 @@ ERTS_GLB_INLINE Sint erts_proc_read_refc(Process *); ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_proc_lock_x(Process *p, ErtsProcLocks locks, char *file, unsigned int line) +erts_proc_lock_x(Process *p, ErtsProcLocks locks, const char *file, unsigned int line) #else erts_proc_lock(Process *p, ErtsProcLocks locks) #endif diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h index 95523d3924..16463dea69 100644 --- a/erts/emulator/beam/erl_term.h +++ b/erts/emulator/beam/erl_term.h @@ -1382,7 +1382,6 @@ ERTS_GLB_INLINE unsigned tag_val_def(Wterm x) #define line __LINE__ #endif { - static char *msg = "tag_val_def error"; switch (x & _TAG_PRIMARY_MASK) { case TAG_PRIMARY_LIST: @@ -1427,7 +1426,7 @@ ERTS_GLB_INLINE unsigned tag_val_def(Wterm x) break; } } - erl_assert_error(msg, __FUNCTION__, file, line); + erl_assert_error("tag_val_def error", __FUNCTION__, file, line); #undef file #undef line } diff --git a/erts/emulator/beam/erl_thr_progress.h b/erts/emulator/beam/erl_thr_progress.h index 00a9e61407..ea6178ede3 100644 --- a/erts/emulator/beam/erl_thr_progress.h +++ b/erts/emulator/beam/erl_thr_progress.h @@ -155,7 +155,7 @@ ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_progress_current_to_later__(ErtsThrPrgrV ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_progress_later(ErtsSchedulerData *); ERTS_GLB_INLINE ErtsThrPrgrVal erts_thr_progress_current(void); ERTS_GLB_INLINE int erts_thr_progress_has_passed__(ErtsThrPrgrVal val1, ErtsThrPrgrVal val2); -ERTS_GLB_INLINE int erts_thr_progress_has_reached_this(ErtsThrPrgrVal this, ErtsThrPrgrVal val); +ERTS_GLB_INLINE int erts_thr_progress_has_reached_this(ErtsThrPrgrVal this_, ErtsThrPrgrVal val); ERTS_GLB_INLINE int erts_thr_progress_equal(ErtsThrPrgrVal val1, ErtsThrPrgrVal val2); ERTS_GLB_INLINE int erts_thr_progress_cmp(ErtsThrPrgrVal val1, ErtsThrPrgrVal val2); @@ -193,7 +193,7 @@ erts_thr_prgr_read_mb__(ERTS_THR_PRGR_ATOMIC *atmc) ERTS_GLB_INLINE int erts_thr_progress_is_managed_thread(void) { - ErtsThrPrgrData *tpd = erts_tsd_get(erts_thr_prgr_data_key__); + ErtsThrPrgrData *tpd = (ErtsThrPrgrData*)erts_tsd_get(erts_thr_prgr_data_key__); return tpd && tpd->is_managed; } @@ -220,7 +220,7 @@ erts_thr_progress_unmanaged_continue(ErtsThrPrgrDelayHandle handle) ERTS_GLB_INLINE int erts_thr_progress_lc_is_delaying(void) { - ErtsThrPrgrData *tpd = erts_tsd_get(erts_thr_prgr_data_key__); + ErtsThrPrgrData *tpd = (ErtsThrPrgrData *)erts_tsd_get(erts_thr_prgr_data_key__); return tpd && tpd->is_delaying; } @@ -249,7 +249,7 @@ erts_thr_progress_later(ErtsSchedulerData *esdp) ERTS_THR_MEMORY_BARRIER; } else { - tpd = erts_tsd_get(erts_thr_prgr_data_key__); + tpd = (ErtsThrPrgrData *)erts_tsd_get(erts_thr_prgr_data_key__); if (tpd && tpd->is_managed) goto managed_thread; val = erts_thr_prgr_read_mb__(&erts_thr_prgr__.current); @@ -286,11 +286,11 @@ erts_thr_progress_has_passed__(ErtsThrPrgrVal val1, ErtsThrPrgrVal val0) } ERTS_GLB_INLINE int -erts_thr_progress_has_reached_this(ErtsThrPrgrVal this, ErtsThrPrgrVal val) +erts_thr_progress_has_reached_this(ErtsThrPrgrVal this_, ErtsThrPrgrVal val) { - if (this == val) + if (this_ == val) return 1; - return erts_thr_progress_has_passed__(this, val); + return erts_thr_progress_has_passed__(this_, val); } ERTS_GLB_INLINE int diff --git a/erts/emulator/beam/erl_threads.h b/erts/emulator/beam/erl_threads.h index efaabf5f23..e6f0300e7c 100644 --- a/erts/emulator/beam/erl_threads.h +++ b/erts/emulator/beam/erl_threads.h @@ -381,7 +381,7 @@ typedef struct { #endif } erts_rwlock_t; -__decl_noreturn void __noreturn erts_thr_fatal_error(int, char *); +__decl_noreturn void __noreturn erts_thr_fatal_error(int, const char *); /* implemented in erl_init.c */ #define ERTS_THR_INIT_DATA_DEF_INITER ETHR_INIT_DATA_DEFAULT_INITER @@ -411,7 +411,7 @@ ERTS_GLB_INLINE erts_tid_t erts_thr_self(void); ERTS_GLB_INLINE int erts_thr_getname(erts_tid_t tid, char *buf, size_t len); ERTS_GLB_INLINE int erts_equal_tids(erts_tid_t x, erts_tid_t y); ERTS_GLB_INLINE void erts_mtx_init(erts_mtx_t *mtx, - char *name, + const char *name, Eterm extra, erts_lock_flags_t flags); ERTS_GLB_INLINE void erts_mtx_init_locked(erts_mtx_t *mtx, @@ -420,9 +420,9 @@ ERTS_GLB_INLINE void erts_mtx_init_locked(erts_mtx_t *mtx, erts_lock_flags_t flags); ERTS_GLB_INLINE void erts_mtx_destroy(erts_mtx_t *mtx); #ifdef ERTS_ENABLE_LOCK_POSITION -ERTS_GLB_INLINE int erts_mtx_trylock_x(erts_mtx_t *mtx, char *file, +ERTS_GLB_INLINE int erts_mtx_trylock_x(erts_mtx_t *mtx, const char *file, unsigned int line); -ERTS_GLB_INLINE void erts_mtx_lock_x(erts_mtx_t *mtx, char *file, +ERTS_GLB_INLINE void erts_mtx_lock_x(erts_mtx_t *mtx, const char *file, unsigned int line); #else ERTS_GLB_INLINE int erts_mtx_trylock(erts_mtx_t *mtx); @@ -447,10 +447,10 @@ ERTS_GLB_INLINE void erts_rwmtx_init(erts_rwmtx_t *rwmtx, erts_lock_flags_t flags); ERTS_GLB_INLINE void erts_rwmtx_destroy(erts_rwmtx_t *rwmtx); #ifdef ERTS_ENABLE_LOCK_POSITION -ERTS_GLB_INLINE int erts_rwmtx_tryrlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line); -ERTS_GLB_INLINE void erts_rwmtx_rlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line); -ERTS_GLB_INLINE void erts_rwmtx_rwlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line); -ERTS_GLB_INLINE int erts_rwmtx_tryrwlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line); +ERTS_GLB_INLINE int erts_rwmtx_tryrlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line); +ERTS_GLB_INLINE void erts_rwmtx_rlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line); +ERTS_GLB_INLINE void erts_rwmtx_rwlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line); +ERTS_GLB_INLINE int erts_rwmtx_tryrwlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line); #else ERTS_GLB_INLINE int erts_rwmtx_tryrlock(erts_rwmtx_t *rwmtx); ERTS_GLB_INLINE void erts_rwmtx_rlock(erts_rwmtx_t *rwmtx); @@ -468,7 +468,7 @@ ERTS_GLB_INLINE void erts_spinlock_init(erts_spinlock_t *lock, ERTS_GLB_INLINE void erts_spinlock_destroy(erts_spinlock_t *lock); ERTS_GLB_INLINE void erts_spin_unlock(erts_spinlock_t *lock); #ifdef ERTS_ENABLE_LOCK_POSITION -ERTS_GLB_INLINE void erts_spin_lock_x(erts_spinlock_t *lock, char *file, unsigned int line); +ERTS_GLB_INLINE void erts_spin_lock_x(erts_spinlock_t *lock, const char *file, unsigned int line); #else ERTS_GLB_INLINE void erts_spin_lock(erts_spinlock_t *lock); #endif @@ -480,8 +480,8 @@ ERTS_GLB_INLINE void erts_rwlock_init(erts_rwlock_t *lock, ERTS_GLB_INLINE void erts_rwlock_destroy(erts_rwlock_t *lock); ERTS_GLB_INLINE void erts_read_unlock(erts_rwlock_t *lock); #ifdef ERTS_ENABLE_LOCK_POSITION -ERTS_GLB_INLINE void erts_read_lock_x(erts_rwlock_t *lock, char *file, unsigned int line); -ERTS_GLB_INLINE void erts_write_lock_x(erts_rwlock_t *lock, char *file, unsigned int line); +ERTS_GLB_INLINE void erts_read_lock_x(erts_rwlock_t *lock, const char *file, unsigned int line); +ERTS_GLB_INLINE void erts_write_lock_x(erts_rwlock_t *lock, const char *file, unsigned int line); #else ERTS_GLB_INLINE void erts_read_lock(erts_rwlock_t *lock); ERTS_GLB_INLINE void erts_write_lock(erts_rwlock_t *lock); @@ -583,9 +583,9 @@ do { \ Type act = ReadOp((VarP)); \ while (1) { \ Type exp = act; \ - Type new = exp & ~(Mask); \ - new |= ((Mask) & (Set)); \ - act = CmpxchgOp((VarP), new, exp); \ + Type new_value = exp & ~(Mask); \ + new_value |= ((Mask) & (Set)); \ + act = CmpxchgOp((VarP), new_value, exp); \ if (act == exp) \ return act; \ } \ @@ -1241,7 +1241,7 @@ erts_atomic64_xchg_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t val); \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_cmpxchg_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t new, \ + erts_aint64_t new_value, \ erts_aint64_t exp); \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_read_bset_ ## BARRIER(erts_atomic64_t *var, \ @@ -1294,10 +1294,10 @@ ethr_dw_atomic_read_nob(ethr_dw_atomic_t *var, static ERTS_INLINE int ethr_dw_atomic_cmpxchg_nob(ethr_dw_atomic_t *var, - ethr_dw_sint_t *new, + ethr_dw_sint_t *new_value, ethr_dw_sint_t *xchg) { - return ethr_dw_atomic_cmpxchg(var, new, xchg); + return ethr_dw_atomic_cmpxchg(var, new_value, xchg); } #undef ERTS_ATOMIC64_OPS_IMPL__ @@ -1370,70 +1370,70 @@ erts_atomic64_read_ ## BARRIER(erts_atomic64_t *var) \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_inc_read_ ## BARRIER(erts_atomic64_t *var) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + 1); \ - return new; \ + var, xchg, new_value, \ + new_value = xchg + 1); \ + return new_value; \ } \ \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_dec_read_ ## BARRIER(erts_atomic64_t *var) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg - 1); \ - return new; \ + var, xchg, new_value, \ + new_value = xchg - 1); \ + return new_value; \ } \ \ ERTS_GLB_INLINE void \ erts_atomic64_inc_ ## BARRIER(erts_atomic64_t *var) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + 1); \ + var, xchg, new_value, \ + new_value = xchg + 1); \ } \ \ ERTS_GLB_INLINE void \ erts_atomic64_dec_ ## BARRIER(erts_atomic64_t *var) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg - 1); \ + var, xchg, new_value, \ + new_value = xchg - 1); \ } \ \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_add_read_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t val) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + val); \ - return new; \ + var, xchg, new_value, \ + new_value = xchg + val); \ + return new_value; \ } \ \ ERTS_GLB_INLINE void \ erts_atomic64_add_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t val) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg + val); \ + var, xchg, new_value, \ + new_value = xchg + val); \ } \ \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_read_bor_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t val) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg | val); \ + var, xchg, new_value, \ + new_value = xchg | val); \ return xchg; \ } \ \ @@ -1441,10 +1441,10 @@ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_read_band_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t val) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = xchg & val); \ + var, xchg, new_value, \ + new_value = xchg & val); \ return xchg; \ } \ \ @@ -1452,21 +1452,21 @@ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_xchg_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t val) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ - new = val); \ + var, xchg, new_value, \ + new_value = val); \ return xchg; \ } \ \ ERTS_GLB_INLINE erts_aint64_t \ erts_atomic64_cmpxchg_ ## BARRIER(erts_atomic64_t *var, \ - erts_aint64_t new, \ + erts_aint64_t new_value, \ erts_aint64_t exp) \ { \ ethr_dw_sint_t dw_xchg, dw_new; \ ERTS_AINT64_TO_DW_SINT__(dw_xchg, exp); \ - ERTS_AINT64_TO_DW_SINT__(dw_new, new); \ + ERTS_AINT64_TO_DW_SINT__(dw_new, new_value); \ if (ethr_dw_atomic_cmpxchg_ ## BARRIER(var, &dw_new, &dw_xchg)) \ return exp; \ return ERTS_DW_SINT_TO_AINT64__(dw_xchg); \ @@ -1477,12 +1477,12 @@ erts_atomic64_read_bset_ ## BARRIER(erts_atomic64_t *var, \ erts_aint64_t mask, \ erts_aint64_t set) \ { \ - erts_aint64_t xchg, new; \ + erts_aint64_t xchg, new_value; \ ERTS_ATOMIC64_DW_CMPXCHG_IMPL__(ethr_dw_atomic_cmpxchg_ ## BARRIER, \ - var, xchg, new, \ + var, xchg, new_value, \ { \ - new = xchg & ~mask; \ - new |= mask & set; \ + new_value = xchg & ~mask; \ + new_value |= mask & set; \ }); \ return xchg; \ } @@ -1609,7 +1609,7 @@ erts_equal_tids(erts_tid_t x, erts_tid_t y) } ERTS_GLB_INLINE void -erts_mtx_init(erts_mtx_t *mtx, char *name, Eterm extra, erts_lock_flags_t flags) +erts_mtx_init(erts_mtx_t *mtx, const char *name, Eterm extra, erts_lock_flags_t flags) { int res = ethr_mutex_init(&mtx->mtx); if (res) { @@ -1678,7 +1678,7 @@ erts_mtx_destroy(erts_mtx_t *mtx) ERTS_GLB_INLINE int #ifdef ERTS_ENABLE_LOCK_POSITION -erts_mtx_trylock_x(erts_mtx_t *mtx, char *file, unsigned int line) +erts_mtx_trylock_x(erts_mtx_t *mtx, const char *file, unsigned int line) #else erts_mtx_trylock(erts_mtx_t *mtx) #endif @@ -1711,7 +1711,7 @@ erts_mtx_trylock(erts_mtx_t *mtx) ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_mtx_lock_x(erts_mtx_t *mtx, char *file, unsigned int line) +erts_mtx_lock_x(erts_mtx_t *mtx, const char *file, unsigned int line) #else erts_mtx_lock(erts_mtx_t *mtx) #endif @@ -1912,7 +1912,7 @@ erts_rwmtx_destroy(erts_rwmtx_t *rwmtx) ERTS_GLB_INLINE int #ifdef ERTS_ENABLE_LOCK_POSITION -erts_rwmtx_tryrlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line) +erts_rwmtx_tryrlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line) #else erts_rwmtx_tryrlock(erts_rwmtx_t *rwmtx) #endif @@ -1946,7 +1946,7 @@ erts_rwmtx_tryrlock(erts_rwmtx_t *rwmtx) ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_rwmtx_rlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line) +erts_rwmtx_rlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line) #else erts_rwmtx_rlock(erts_rwmtx_t *rwmtx) #endif @@ -1988,7 +1988,7 @@ erts_rwmtx_runlock(erts_rwmtx_t *rwmtx) ERTS_GLB_INLINE int #ifdef ERTS_ENABLE_LOCK_POSITION -erts_rwmtx_tryrwlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line) +erts_rwmtx_tryrwlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line) #else erts_rwmtx_tryrwlock(erts_rwmtx_t *rwmtx) #endif @@ -2022,7 +2022,7 @@ erts_rwmtx_tryrwlock(erts_rwmtx_t *rwmtx) ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_rwmtx_rwlock_x(erts_rwmtx_t *rwmtx, char *file, unsigned int line) +erts_rwmtx_rwlock_x(erts_rwmtx_t *rwmtx, const char *file, unsigned int line) #else erts_rwmtx_rwlock(erts_rwmtx_t *rwmtx) #endif @@ -2181,7 +2181,7 @@ erts_spin_unlock(erts_spinlock_t *lock) ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_spin_lock_x(erts_spinlock_t *lock, char *file, unsigned int line) +erts_spin_lock_x(erts_spinlock_t *lock, const char *file, unsigned int line) #else erts_spin_lock(erts_spinlock_t *lock) #endif @@ -2281,7 +2281,7 @@ erts_read_unlock(erts_rwlock_t *lock) ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_read_lock_x(erts_rwlock_t *lock, char *file, unsigned int line) +erts_read_lock_x(erts_rwlock_t *lock, const char *file, unsigned int line) #else erts_read_lock(erts_rwlock_t *lock) #endif @@ -2316,7 +2316,7 @@ erts_write_unlock(erts_rwlock_t *lock) ERTS_GLB_INLINE void #ifdef ERTS_ENABLE_LOCK_POSITION -erts_write_lock_x(erts_rwlock_t *lock, char *file, unsigned int line) +erts_write_lock_x(erts_rwlock_t *lock, const char *file, unsigned int line) #else erts_write_lock(erts_rwlock_t *lock) #endif diff --git a/erts/emulator/beam/erl_trace.h b/erts/emulator/beam/erl_trace.h index 91633ca7f7..28a5b1ecac 100644 --- a/erts/emulator/beam/erl_trace.h +++ b/erts/emulator/beam/erl_trace.h @@ -75,7 +75,7 @@ void erts_init_trace(void); void erts_trace_check_exiting(Eterm exiting); ErtsTracer erts_set_system_seq_tracer(Process *c_p, ErtsProcLocks c_p_locks, - ErtsTracer new); + ErtsTracer new_); ErtsTracer erts_get_system_seq_tracer(void); void erts_change_default_proc_tracing(int setflags, Uint flagsp, const ErtsTracer tracerp); @@ -105,7 +105,7 @@ Uint32 erts_call_trace(Process *p, ErtsCodeInfo *info, struct binary *match_spec Eterm* args, int local, ErtsTracer *tracer); void erts_trace_return(Process* p, ErtsCodeMFA *mfa, Eterm retval, ErtsTracer *tracer); -void erts_trace_exception(Process* p, ErtsCodeMFA *mfa, Eterm class, Eterm value, +void erts_trace_exception(Process* p, ErtsCodeMFA *mfa, Eterm class_, Eterm value, ErtsTracer *tracer); void erts_trace_return_to(Process *p, BeamInstr *pc); void trace_sched(Process*, ErtsProcLocks, Eterm); diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 91c4844d20..cd133275fb 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -29,7 +29,7 @@ ** Export entry */ -typedef struct export +typedef struct export_ { /* Pointer to code for function. */ void* addressv[ERTS_NUM_CODE_IX]; diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h index 26c1bc6c3d..665a961410 100644 --- a/erts/emulator/beam/global.h +++ b/erts/emulator/beam/global.h @@ -889,7 +889,7 @@ void erts_bif_info_init(void); /* bif.c */ -void erts_write_bif_wrapper(Export *export, BeamInstr *address); +void erts_write_bif_wrapper(Export *export_, BeamInstr *address); void erts_queue_monitor_message(Process *, ErtsProcLocks*, @@ -998,9 +998,9 @@ double erts_get_positive_zero_float(void); /* config.c */ __decl_noreturn void __noreturn erts_exit_epilogue(void); -__decl_noreturn void __noreturn erts_exit(int n, char*, ...); +__decl_noreturn void __noreturn erts_exit(int n, const char*, ...); __decl_noreturn void __noreturn erts_flush_async_exit(int n, char*, ...); -void erl_error(char*, va_list); +void erl_error(const char*, va_list); /* This controls whether sharing-preserving copy is used by Erlang */ diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h index 3b9b87dd33..697dfa0d3d 100644 --- a/erts/emulator/beam/sys.h +++ b/erts/emulator/beam/sys.h @@ -86,7 +86,7 @@ #define ERTS_GLB_INLINE #endif -#if ERTS_CAN_INLINE || defined(ERTS_DO_INCL_GLB_INLINE_FUNC_DEF) +#if (ERTS_CAN_INLINE || defined(ERTS_DO_INCL_GLB_INLINE_FUNC_DEF)) # define ERTS_GLB_INLINE_INCL_FUNC_DEF 1 #else # define ERTS_GLB_INLINE_INCL_FUNC_DEF 0 @@ -297,7 +297,7 @@ __decl_noreturn void __noreturn erl_assert_error(const char* expr, const char *f * Compile time assert * (the actual compiler error msg can be a bit confusing) */ -#if ERTS_AT_LEAST_GCC_VSN__(3,1,1) +#if ERTS_AT_LEAST_GCC_VSN__(3,1,1) && !defined __cplusplus # define ERTS_CT_ASSERT(e) \ do { \ enum { compile_time_assert__ = __builtin_choose_expr((e),0,(void)0) }; \ @@ -305,7 +305,7 @@ __decl_noreturn void __noreturn erl_assert_error(const char* expr, const char *f #else # define ERTS_CT_ASSERT(e) \ do { \ - enum { compile_time_assert__ = 1/(e) }; \ + enum { compile_time_assert__ = 1/((int)(e)) }; \ } while (0) #endif @@ -347,8 +347,8 @@ __decl_noreturn void __noreturn erl_assert_error(const char* expr, const char *f ** ** Eterm: A tagged erlang term (possibly 64 bits) ** BeamInstr: A beam code instruction unit, possibly larger than Eterm, not smaller. -** UInt: An unsigned integer exactly as large as an Eterm. -** SInt: A signed integer exactly as large as an eterm and therefor large +** Uint: An unsigned integer exactly as large as an Eterm. +** Sint: A signed integer exactly as large as an eterm and therefor large ** enough to hold the return value of the signed_val() macro. ** UWord: An unsigned integer at least as large as a void * and also as large ** or larger than an Eterm @@ -633,7 +633,7 @@ static unsigned long zero_value = 0, one_value = 1; # endif /* !__WIN32__ */ #endif /* WANT_NONBLOCKING */ -__decl_noreturn void __noreturn erts_exit(int n, char*, ...); +__decl_noreturn void __noreturn erts_exit(int n, const char*, ...); /* Some special erts_exit() codes: */ #define ERTS_INTR_EXIT -1 /* called from signal handler */ @@ -969,7 +969,7 @@ erts_refc_inc_unless(erts_refc_t *refcp, { erts_aint_t val = erts_atomic_read_nob((erts_atomic_t *) refcp); while (1) { - erts_aint_t exp, new; + erts_aint_t exp, new_value; #ifdef ERTS_REFC_DEBUG if (val < min_val) erts_exit(ERTS_ABORT_EXIT, @@ -978,11 +978,11 @@ erts_refc_inc_unless(erts_refc_t *refcp, #endif if (val == unless_val) return val; - new = val + 1; + new_value = val + 1; exp = val; - val = erts_atomic_cmpxchg_nob((erts_atomic_t *) refcp, new, exp); + val = erts_atomic_cmpxchg_nob((erts_atomic_t *) refcp, new_value, exp); if (val == exp) - return new; + return new_value; } } diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index edfe3d5161..bd81439814 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -1501,7 +1501,7 @@ static const struct in6_addr in6addr_loopback = #endif /* HAVE_IN6 */ /* XXX: is this a driver interface function ??? */ -void erts_exit(int n, char*, ...); +void erts_exit(int n, const char*, ...); /* * Malloc wrapper, diff --git a/erts/emulator/sys/win32/sys.c b/erts/emulator/sys/win32/sys.c index 244fed720d..2e4d3b4d9d 100644 --- a/erts/emulator/sys/win32/sys.c +++ b/erts/emulator/sys/win32/sys.c @@ -39,8 +39,8 @@ void erts_sys_init_float(void); void erl_start(int, char**); -void erts_exit(int n, char*, ...); -void erl_error(char*, va_list); +void erts_exit(int n, const char*, ...); +void erl_error(const char*, va_list); /* * Microsoft-specific function to map a WIN32 error code to a Posix errno. diff --git a/erts/include/internal/ethr_internal.h b/erts/include/internal/ethr_internal.h index 89ee47efe3..986e2b84de 100644 --- a/erts/include/internal/ethr_internal.h +++ b/erts/include/internal/ethr_internal.h @@ -54,9 +54,6 @@ extern void (*ethr_thr_child_func__)(void *); int ethr_set_tse__(ethr_ts_event *tsep); ethr_ts_event *ethr_get_tse__(void); ETHR_PROTO_NORETURN__ ethr_abort__(void); -#ifdef ETHR_WIN32_THREADS -int ethr_win_get_errno__(void); -#endif #ifdef ETHR_INCLUDE_MONOTONIC_CLOCK__ #undef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index d6644185f9..e5a692090a 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -267,7 +267,7 @@ ETHR_PROTO_NORETURN__ ethr_fatal_error__(const char *file, #define __builtin_expect(X, Y) (X) #endif -#if ETHR_AT_LEAST_GCC_VSN__(3, 1, 1) +#if ETHR_AT_LEAST_GCC_VSN__(3, 1, 1) && !defined __cplusplus # define ETHR_CHOOSE_EXPR __builtin_choose_expr #else # define ETHR_CHOOSE_EXPR(B, E1, E2) ((B) ? (E1) : (E2)) @@ -498,6 +498,10 @@ typedef struct { # define ETHR_NEED_RWSPINLOCK_PROTOTYPES__ #endif +#if defined(__WIN32__) +int ethr_win_get_errno__(void); +#endif + int ethr_init(ethr_init_data *); int ethr_late_init(ethr_late_init_data *); int ethr_install_exit_handler(void (*funcp)(void)); @@ -654,7 +658,7 @@ extern pthread_key_t ethr_ts_event_key__; static ETHR_INLINE ethr_ts_event * ETHR_INLINE_FUNC_NAME_(ethr_lookup_ts_event__)(int busy_dup) { - ethr_ts_event *tsep = pthread_getspecific(ethr_ts_event_key__); + ethr_ts_event *tsep = (ethr_ts_event*)pthread_getspecific(ethr_ts_event_key__); if (!tsep || (busy_dup && (tsep->iflgs & ETHR_TS_EV_BUSY))) { int res = ethr_make_ts_event__(&tsep, 0); if (res != 0) @@ -675,7 +679,7 @@ extern DWORD ethr_ts_event_key__; static ETHR_INLINE ethr_ts_event * ETHR_INLINE_FUNC_NAME_(ethr_lookup_ts_event__)(int busy_dup) { - ethr_ts_event *tsep = TlsGetValue(ethr_ts_event_key__); + ethr_ts_event *tsep = (ethr_ts_event *) TlsGetValue(ethr_ts_event_key__); if (!tsep || (busy_dup && (tsep->iflgs & ETHR_TS_EV_BUSY))) { int res = ethr_make_ts_event__(&tsep, !0); if (res != 0) diff --git a/erts/include/internal/i386/atomic.h b/erts/include/internal/i386/atomic.h index 52ef1762d5..1e9a8f4a2a 100644 --- a/erts/include/internal/i386/atomic.h +++ b/erts/include/internal/i386/atomic.h @@ -91,15 +91,15 @@ ETHR_NATMC_FUNC__(addr)(ETHR_ATMC_T__ *var) static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(cmpxchg_mb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ old) + ETHR_AINT_T__ new_value, + ETHR_AINT_T__ old_value) { __asm__ __volatile__( "lock; cmpxchg" ETHR_AINT_SUFFIX__ " %2, %3" - : "=a"(old), "=m"(var->counter) - : "r"(new), "m"(var->counter), "0"(old) + : "=a"(old_value), "=m"(var->counter) + : "r"(new_value), "m"(var->counter), "0"(old_value) : "cc", "memory"); /* full memory clobber to make this a compiler barrier */ - return old; + return old_value; } #if ETHR_INCLUDE_ATOMIC_IMPL__ == 4 diff --git a/erts/include/internal/i386/ethr_dw_atomic.h b/erts/include/internal/i386/ethr_dw_atomic.h index d0c18eb3a3..8e037be578 100644 --- a/erts/include/internal/i386/ethr_dw_atomic.h +++ b/erts/include/internal/i386/ethr_dw_atomic.h @@ -149,7 +149,7 @@ ethr_native_dw_atomic_addr(ethr_native_dw_atomic_t *var) static ETHR_INLINE int ethr_native_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, - ethr_sint_t *new, + ethr_sint_t *new_value, ethr_sint_t *xchg) { ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); @@ -171,7 +171,7 @@ ethr_native_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, "setz %3\n\t" "popl %%ebx\n\t" : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=c"(xchgd) - : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "r"(new) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "r"(new_value) : "cc", "memory"); #elif ETHR_NO_CLOBBER_EBX__ @@ -186,7 +186,7 @@ ethr_native_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, "setz %3\n\t" "popl %%ebx\n\t" : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=q"(xchgd) - : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "c"(new[1]), "r"(new[0]) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "c"(new_value[1]), "r"(new_value[0]) : "cc", "memory"); #else @@ -199,7 +199,7 @@ ethr_native_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, "lock; cmpxchg" ETHR_DW_CMPXCHG_SFX__ " %0\n\t" "setz %3\n\t" : "=m"(*p), "=d"(xchg[1]), "=a"(xchg[0]), "=q"(xchgd) - : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "c"(new[1]), "b"(new[0]) + : "m"(*p), "1"(xchg[1]), "2"(xchg[0]), "c"(new_value[1]), "b"(new_value[0]) : "cc", "memory"); #endif @@ -224,10 +224,10 @@ ethr_native_su_dw_atomic_read(ethr_native_dw_atomic_t *var) if (ETHR_X86_RUNTIME_CONF_HAVE_SSE2__) return ethr_sse2_native_su_dw_atomic_read(var); else { - ethr_sint_t new[2]; + ethr_sint_t new_value[2]; ethr_dw_atomic_no_sse2_convert_t xchg; - new[0] = new[1] = xchg.sint[0] = xchg.sint[1] = 0x83838383; - (void) ethr_native_dw_atomic_cmpxchg_mb(var, new, xchg.sint); + new_value[0] = new_value[1] = xchg.sint[0] = xchg.sint[1] = 0x83838383; + (void) ethr_native_dw_atomic_cmpxchg_mb(var, new_value, xchg.sint); return xchg.sint64; } } @@ -242,9 +242,9 @@ ethr_native_su_dw_atomic_set(ethr_native_dw_atomic_t *var, ethr_sse2_native_su_dw_atomic_set(var, val); else { ethr_sint_t xchg[2] = {0, 0}; - ethr_dw_atomic_no_sse2_convert_t new; - new.sint64 = val; - while (!ethr_native_dw_atomic_cmpxchg_mb(var, new.sint, xchg)); + ethr_dw_atomic_no_sse2_convert_t new_value; + new_value.sint64 = val; + while (!ethr_native_dw_atomic_cmpxchg_mb(var, new_value.sint, xchg)); } } diff --git a/erts/include/internal/win/ethr_atomic.h b/erts/include/internal/win/ethr_atomic.h index 32c28f692d..58cd17c4fb 100644 --- a/erts/include/internal/win/ethr_atomic.h +++ b/erts/include/internal/win/ethr_atomic.h @@ -395,9 +395,9 @@ ETHR_NATMC_FUNC__(or_retold_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ mask) #endif static ETHR_INLINE ETHR_AINT_T__ -ETHR_NATMC_FUNC__(xchg_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ new) +ETHR_NATMC_FUNC__(xchg_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ new_value) { - return ETHR_ILCKD__(Exchange)(&var->value, new); + return ETHR_ILCKD__(Exchange)(&var->value, new_value); } #endif @@ -412,10 +412,10 @@ ETHR_NATMC_FUNC__(xchg_mb)(ETHR_ATMC_T__ *var, ETHR_AINT_T__ new) static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(cmpxchg_mb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ old) + ETHR_AINT_T__ new_value, + ETHR_AINT_T__ old_value) { - return ETHR_ILCKD__(CompareExchange)(&var->value, new, old); + return ETHR_ILCKD__(CompareExchange)(&var->value, new_value, old_value); } #endif @@ -430,10 +430,10 @@ ETHR_NATMC_FUNC__(cmpxchg_mb)(ETHR_ATMC_T__ *var, static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(cmpxchg_acqb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ old) + ETHR_AINT_T__ new_value, + ETHR_AINT_T__ old_value) { - return ETHR_ILCKD_ACQ__(CompareExchange)(&var->value, new, old); + return ETHR_ILCKD_ACQ__(CompareExchange)(&var->value, new_value, old_value); } #endif @@ -448,10 +448,10 @@ ETHR_NATMC_FUNC__(cmpxchg_acqb)(ETHR_ATMC_T__ *var, static ETHR_INLINE ETHR_AINT_T__ ETHR_NATMC_FUNC__(cmpxchg_relb)(ETHR_ATMC_T__ *var, - ETHR_AINT_T__ new, - ETHR_AINT_T__ old) + ETHR_AINT_T__ new_value, + ETHR_AINT_T__ old_value) { - return ETHR_ILCKD_REL__(CompareExchange)(&var->value, new, old); + return ETHR_ILCKD_REL__(CompareExchange)(&var->value, new_value, old_value); } #endif diff --git a/erts/include/internal/win/ethr_dw_atomic.h b/erts/include/internal/win/ethr_dw_atomic.h index 0a596c9122..03311f6025 100644 --- a/erts/include/internal/win/ethr_dw_atomic.h +++ b/erts/include/internal/win/ethr_dw_atomic.h @@ -115,12 +115,12 @@ ethr_native_dw_atomic_addr(ethr_native_dw_atomic_t *var) static ETHR_INLINE ethr_sint64_t ethr_native_su_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, - ethr_sint64_t new, + ethr_sint64_t new_value, ethr_sint64_t exp) { ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); ETHR_DW_DBG_ALIGNED__(p); - return (ethr_sint64_t) _InterlockedCompareExchange64(p, new, exp); + return (ethr_sint64_t) _InterlockedCompareExchange64(p, new_value, exp); } #elif ETHR_SIZEOF_PTR == 8 @@ -137,14 +137,14 @@ ethr_native_su_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, static ETHR_INLINE int ethr_native_dw_atomic_cmpxchg_mb(ethr_native_dw_atomic_t *var, - ethr_sint_t *new, + ethr_sint_t *new_value, ethr_sint_t *xchg) { ethr_native_dw_ptr_t p = (ethr_native_dw_ptr_t) ETHR_DW_NATMC_MEM__(var); ETHR_DW_DBG_ALIGNED__(p); return (int) _InterlockedCompareExchange128(p, - new[ETHR_WIN_HIGH_WORD__], - new[ETHR_WIN_LOW_WORD__], + new_value[ETHR_WIN_HIGH_WORD__], + new_value[ETHR_WIN_LOW_WORD__], xchg); } |