summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2017-11-09 15:52:25 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2017-11-09 15:52:25 +0000
commitaeb40adabf18d517fa27085d3e39cb2b93eb7648 (patch)
treee4c1bb4635181b54f8b07352cccdc8678aaa70f2 /openmp/runtime/src
parent18ff303bed72782f05cfc9b87ed38d788edbdf07 (diff)
downloadbcm5719-llvm-aeb40adabf18d517fa27085d3e39cb2b93eb7648.tar.gz
bcm5719-llvm-aeb40adabf18d517fa27085d3e39cb2b93eb7648.zip
Remove const from variables with dynamic memory
Allocated memory is typically not 'const' if it needs to be freed. This patch removes around 50 wrong const attributes, modifies the corresponding functions and finally gets rid of some const_casts. These have especially been strange for __kmp_str_fname_free() that added a 'const' to call __kmp_str_free() which removed it again. Two minor cleanups that I performed in this process: * __kmp_tool_libraries now lives in kmp_settings.cpp as it is used nowhere else. * __kmp_msg_empty was removed as it was never used and Clang now complained that it was assigned a string literal that is 'const char *'. Differential Revision: https://reviews.llvm.org/D39755 llvm-svn: 317797
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp.h6
-rw-r--r--openmp/runtime/src/kmp_dispatch.cpp50
-rw-r--r--openmp/runtime/src/kmp_environment.h8
-rw-r--r--openmp/runtime/src/kmp_error.cpp14
-rw-r--r--openmp/runtime/src/kmp_global.cpp6
-rw-r--r--openmp/runtime/src/kmp_i18n.cpp4
-rw-r--r--openmp/runtime/src/kmp_i18n.h9
-rw-r--r--openmp/runtime/src/kmp_itt.inl14
-rw-r--r--openmp/runtime/src/kmp_sched.cpp18
-rw-r--r--openmp/runtime/src/kmp_settings.cpp6
-rw-r--r--openmp/runtime/src/kmp_str.cpp12
-rw-r--r--openmp/runtime/src/kmp_str.h2
-rw-r--r--openmp/runtime/src/ompt-general.cpp4
13 files changed, 70 insertions, 83 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 86bf16591fc..d30125322f4 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -744,7 +744,7 @@ extern unsigned __kmp_affinity_num_masks;
extern void __kmp_affinity_bind_thread(int which);
extern kmp_affin_mask_t *__kmp_affin_fullMask;
-extern char const *__kmp_cpuinfo_file;
+extern char *__kmp_cpuinfo_file;
#endif /* KMP_AFFINITY_SUPPORTED */
@@ -802,10 +802,6 @@ extern kmp_hws_item_t __kmp_hws_proc;
extern int __kmp_hws_requested;
extern int __kmp_hws_abs_flag; // absolute or per-item number requested
-#if OMP_50_ENABLED && LIBOMP_OMPT_SUPPORT
-extern char const *__kmp_tool_libraries;
-#endif // OMP_50_ENABLED && LIBOMP_OMPT_SUPPORT
-
/* ------------------------------------------------------------------------ */
#define KMP_PAD(type, sz) \
diff --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp
index cb2bc3f9490..9e698829b86 100644
--- a/openmp/runtime/src/kmp_dispatch.cpp
+++ b/openmp/runtime/src/kmp_dispatch.cpp
@@ -368,7 +368,7 @@ static void __kmp_dispatch_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
KMP_MB();
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_deo: T#%%d before wait: "
"ordered_iter:%%%s lower:%%%s\n",
@@ -383,7 +383,7 @@ static void __kmp_dispatch_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
KMP_MB(); /* is this necessary? */
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_deo: T#%%d after wait: "
"ordered_iter:%%%s lower:%%%s\n",
@@ -548,7 +548,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
#endif
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_init: T#%%d called: schedule:%%d "
"chunk:%%%s lb:%%%s ub:%%%s st:%%%s\n",
@@ -638,7 +638,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
#endif
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_init: T#%%d new: schedule:%%d chunk:%%%s\n",
@@ -661,7 +661,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
schedule = __kmp_auto;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_init: kmp_sch_auto: T#%%d new: "
"schedule:%%d chunk:%%%s\n",
@@ -697,7 +697,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
#endif
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_init: T#%%d new: schedule:%%d"
" chunk:%%%s\n",
@@ -1196,7 +1196,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_init: T#%%d returning: schedule:%%d ordered:%%%s "
@@ -1276,7 +1276,7 @@ static void __kmp_dispatch_finish(int gtid, ident_t *loc) {
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_finish: T#%%d before wait: "
"ordered_iteration:%%%s lower:%%%s\n",
@@ -1291,7 +1291,7 @@ static void __kmp_dispatch_finish(int gtid, ident_t *loc) {
KMP_MB(); /* is this necessary? */
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_finish: T#%%d after wait: "
"ordered_iteration:%%%s lower:%%%s\n",
@@ -1344,7 +1344,7 @@ static void __kmp_dispatch_finish_chunk(int gtid, ident_t *loc) {
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_finish_chunk: T#%%d before wait: "
@@ -1366,7 +1366,7 @@ static void __kmp_dispatch_finish_chunk(int gtid, ident_t *loc) {
//!!!!! TODO check if the inc should be unsigned, or signed???
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_finish_chunk: T#%%d after wait: "
@@ -1435,7 +1435,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
KMP_DEBUG_ASSERT(p_lb && p_ub && p_st); // AC: these cannot be NULL
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d called p_lb:%%%s "
"p_ub:%%%s p_st:%%%s p_last: %%p\n",
@@ -1517,7 +1517,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -1543,7 +1543,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
} // if
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_next: T#%%d serialized case: p_lb:%%%s "
@@ -1810,7 +1810,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -1843,7 +1843,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
if (pr->ordered) {
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -1895,7 +1895,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -1949,7 +1949,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -2022,7 +2022,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -2106,7 +2106,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -2214,7 +2214,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -2276,7 +2276,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
pr->u.p.ordered_upper = limit;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_dispatch_next: T#%%d "
"ordered_lower:%%%s ordered_upper:%%%s\n",
@@ -2306,7 +2306,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
num_done = test_then_inc<ST>((volatile ST *)&sh->u.s.num_done);
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_next: T#%%d increment num_done:%%%s\n",
@@ -2375,7 +2375,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last,
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmp_dispatch_next: T#%%d normal case: "
@@ -2408,7 +2408,7 @@ static void __kmp_dist_get_bounds(ident_t *loc, kmp_int32 gtid,
KE_TRACE(10, ("__kmpc_dist_get_bounds called (%d)\n", gtid));
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmpc_dist_get_bounds: T#%%d liter=%%d "
"iter=(%%%s, %%%s, %%%s) signed?<%s>\n",
diff --git a/openmp/runtime/src/kmp_environment.h b/openmp/runtime/src/kmp_environment.h
index e07c1bd97d9..474aa349555 100644
--- a/openmp/runtime/src/kmp_environment.h
+++ b/openmp/runtime/src/kmp_environment.h
@@ -52,14 +52,14 @@ __kmp_env_block_free( & block );
*/
struct __kmp_env_var {
- char const *name;
- char const *value;
+ char *name;
+ char *value;
};
typedef struct __kmp_env_var kmp_env_var_t;
struct __kmp_env_blk {
- char const *bulk;
- kmp_env_var_t const *vars;
+ char *bulk;
+ kmp_env_var_t *vars;
int count;
};
typedef struct __kmp_env_blk kmp_env_blk_t;
diff --git a/openmp/runtime/src/kmp_error.cpp b/openmp/runtime/src/kmp_error.cpp
index 91ea7f3a88a..1a708b58758 100644
--- a/openmp/runtime/src/kmp_error.cpp
+++ b/openmp/runtime/src/kmp_error.cpp
@@ -75,7 +75,7 @@ static void __kmp_expand_cons_stack(int gtid, struct cons_header *p) {
}
// NOTE: Function returns allocated memory, caller must free it!
-static char const *__kmp_pragma(int ct, ident_t const *ident) {
+static char *__kmp_pragma(int ct, ident_t const *ident) {
char const *cons = NULL; // Construct name.
char *file = NULL; // File name.
char *func = NULL; // Function (routine) name.
@@ -110,9 +110,9 @@ void __kmp_error_construct(kmp_i18n_id_t id, // Message identifier.
enum cons_type ct, // Construct type.
ident_t const *ident // Construct ident.
) {
- char const *construct = __kmp_pragma(ct, ident);
+ char *construct = __kmp_pragma(ct, ident);
__kmp_fatal(__kmp_msg_format(id, construct), __kmp_msg_null);
- KMP_INTERNAL_FREE(CCAST(char *, construct));
+ KMP_INTERNAL_FREE(construct);
}
void __kmp_error_construct2(kmp_i18n_id_t id, // Message identifier.
@@ -120,11 +120,11 @@ void __kmp_error_construct2(kmp_i18n_id_t id, // Message identifier.
ident_t const *ident, // First construct ident.
struct cons_data const *cons // Second construct.
) {
- char const *construct1 = __kmp_pragma(ct, ident);
- char const *construct2 = __kmp_pragma(cons->type, cons->ident);
+ char *construct1 = __kmp_pragma(ct, ident);
+ char *construct2 = __kmp_pragma(cons->type, cons->ident);
__kmp_fatal(__kmp_msg_format(id, construct1, construct2), __kmp_msg_null);
- KMP_INTERNAL_FREE(CCAST(char *, construct1));
- KMP_INTERNAL_FREE(CCAST(char *, construct2));
+ KMP_INTERNAL_FREE(construct1);
+ KMP_INTERNAL_FREE(construct2);
}
struct cons_header *__kmp_allocate_cons_stack(int gtid) {
diff --git a/openmp/runtime/src/kmp_global.cpp b/openmp/runtime/src/kmp_global.cpp
index 415cb48b018..3cd4734fd58 100644
--- a/openmp/runtime/src/kmp_global.cpp
+++ b/openmp/runtime/src/kmp_global.cpp
@@ -271,7 +271,7 @@ char *__kmp_affinity_proclist = NULL;
kmp_affin_mask_t *__kmp_affinity_masks = NULL;
unsigned __kmp_affinity_num_masks = 0;
-char const *__kmp_cpuinfo_file = NULL;
+char *__kmp_cpuinfo_file = NULL;
#endif /* KMP_AFFINITY_SUPPORTED */
@@ -298,10 +298,6 @@ kmp_int32 __kmp_max_task_priority = 0;
kmp_uint64 __kmp_taskloop_min_tasks = 0;
#endif
-#if OMP_50_ENABLED && OMPT_SUPPORT
-char const *__kmp_tool_libraries = NULL;
-#endif
-
/* This check ensures that the compiler is passing the correct data type for the
flags formal parameter of the function kmpc_omp_task_alloc(). If the type is
not a 4-byte type, then give an error message about a non-positive length
diff --git a/openmp/runtime/src/kmp_i18n.cpp b/openmp/runtime/src/kmp_i18n.cpp
index 42e1c70a382..5105a88dc6b 100644
--- a/openmp/runtime/src/kmp_i18n.cpp
+++ b/openmp/runtime/src/kmp_i18n.cpp
@@ -34,7 +34,6 @@
#define get_section(id) ((id) >> 16)
#define get_number(id) ((id)&0xFFFF)
-kmp_msg_t __kmp_msg_empty = {kmp_mt_dummy, 0, "", 0};
kmp_msg_t __kmp_msg_null = {kmp_mt_dummy, 0, NULL, 0};
static char const *no_message_available = "(No message available)";
@@ -821,9 +820,6 @@ void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, va_list args) {
if (message.type == kmp_mt_dummy && message.str == NULL) {
break;
}
- if (message.type == kmp_mt_dummy && message.str == __kmp_msg_empty.str) {
- continue;
- }
switch (message.type) {
case kmp_mt_hint: {
format = kmp_i18n_fmt_Hint;
diff --git a/openmp/runtime/src/kmp_i18n.h b/openmp/runtime/src/kmp_i18n.h
index a6aedf32781..56dae227007 100644
--- a/openmp/runtime/src/kmp_i18n.h
+++ b/openmp/runtime/src/kmp_i18n.h
@@ -103,16 +103,13 @@ typedef enum kmp_msg_type kmp_msg_type_t;
struct kmp_msg {
kmp_msg_type_t type;
int num;
- char const *str;
+ char *str;
int len;
}; // struct kmp_message
typedef struct kmp_msg kmp_msg_t;
-// Two special messages.
-extern kmp_msg_t __kmp_msg_empty; // Can be used in place where message is
-// required syntactically.
-extern kmp_msg_t
- __kmp_msg_null; // Denotes the end of variadic list of arguments.
+// Special message to denote the end of variadic list of arguments.
+extern kmp_msg_t __kmp_msg_null;
// Helper functions. Creates messages either from message catalog or from
// system. Note: these functions allocate memory. You should pass created
diff --git a/openmp/runtime/src/kmp_itt.inl b/openmp/runtime/src/kmp_itt.inl
index 65c3a81a6f3..a0789fca2ab 100644
--- a/openmp/runtime/src/kmp_itt.inl
+++ b/openmp/runtime/src/kmp_itt.inl
@@ -115,7 +115,7 @@ LINKAGE void __kmp_itt_region_forking(int gtid, int team_size, int barriers) {
// Transform compiler-generated region location into the format
// that the tools more or less standardized on:
// "<func>$omp$parallel@[file:]<line>[:<col>]"
- const char *buff = NULL;
+ char *buff = NULL;
kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
team_size, str_loc.file, str_loc.line,
@@ -135,7 +135,7 @@ LINKAGE void __kmp_itt_region_forking(int gtid, int team_size, int barriers) {
&__kmp_barrier_domain_count); // revert the count
return; // loc->reserved_2 is still 0
}
- const char *buff = NULL;
+ char *buff = NULL;
buff = __kmp_str_format("%s$omp$barrier@%s:%d", str_loc.func,
str_loc.file, str_loc.col);
__itt_suppress_push(__itt_suppress_memory_errors);
@@ -155,7 +155,7 @@ LINKAGE void __kmp_itt_region_forking(int gtid, int team_size, int barriers) {
unsigned int frm = (loc->reserved_2 & 0x0000FFFF) - 1;
if ((frm < KMP_MAX_FRAME_DOMAINS) &&
(__kmp_itt_region_team_size[frm] != team_size)) {
- const char *buff = NULL;
+ char *buff = NULL;
kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
team_size, str_loc.file, str_loc.line,
@@ -212,7 +212,7 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, __itt_timestamp begin,
// Transform compiler-generated region location into the format
// that the tools more or less standardized on:
// "<func>$omp$parallel:team_size@[file:]<line>[:<col>]"
- const char *buff = NULL;
+ char *buff = NULL;
kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
team_size, str_loc.file, str_loc.line,
@@ -233,7 +233,7 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, __itt_timestamp begin,
unsigned int frm = (loc->reserved_2 & 0x0000FFFF) - 1;
if ((frm < KMP_MAX_FRAME_DOMAINS) &&
(__kmp_itt_region_team_size[frm] != team_size)) {
- const char *buff = NULL;
+ char *buff = NULL;
kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
team_size, str_loc.file, str_loc.line,
@@ -275,7 +275,7 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, __itt_timestamp begin,
// "<func>$omp$frame@[file:]<line>[:<col>]"
kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
if (imbalance) {
- const char *buff_imb = NULL;
+ char *buff_imb = NULL;
buff_imb = __kmp_str_format("%s$omp$barrier-imbalance:%d@%s:%d",
str_loc.func, team_size, str_loc.file,
str_loc.col);
@@ -286,7 +286,7 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, __itt_timestamp begin,
end);
__kmp_str_free(&buff_imb);
} else {
- const char *buff = NULL;
+ char *buff = NULL;
buff = __kmp_str_format("%s$omp$barrier@%s:%d", str_loc.func,
str_loc.file, str_loc.col);
__itt_suppress_push(__itt_suppress_memory_errors);
diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp
index 4a878e3e944..9960859eda4 100644
--- a/openmp/runtime/src/kmp_sched.cpp
+++ b/openmp/runtime/src/kmp_sched.cpp
@@ -93,7 +93,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
KE_TRACE(10, ("__kmpc_for_static_init called (%d)\n", global_tid));
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmpc_for_static_init: T#%%d sched=%%d liter=%%d iter=(%%%s,"
@@ -125,7 +125,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
// ON A ZERO-TRIP LOOP (lower=1, upper=0,stride=1) - JPH June 23, 2009.
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmpc_for_static_init:(ZERO TRIP) liter=%%d "
"lower=%%%s upper=%%%s stride = %%%s "
@@ -179,7 +179,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmpc_for_static_init: (serial) liter=%%d "
"lower=%%%s upper=%%%s stride = %%%s\n",
@@ -208,7 +208,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
(incr > 0) ? (*pupper - *plower + 1) : (-(*plower - *pupper + 1));
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmpc_for_static_init: (serial) liter=%%d "
"lower=%%%s upper=%%%s stride = %%%s\n",
@@ -365,7 +365,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
#endif
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmpc_for_static_init: liter=%%d lower=%%%s "
"upper=%%%s stride = %%%s signed?<%s>\n",
@@ -410,7 +410,7 @@ static void __kmp_dist_for_static_init(ident_t *loc, kmp_int32 gtid,
KE_TRACE(10, ("__kmpc_dist_for_static_init called (%d)\n", gtid));
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmpc_dist_for_static_init: T#%%d schedLoop=%%d liter=%%d "
@@ -613,7 +613,7 @@ static void __kmp_dist_for_static_init(ident_t *loc, kmp_int32 gtid,
end:;
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format(
"__kmpc_dist_for_static_init: last=%%d lo=%%%s up=%%%s upDist=%%%s "
@@ -654,7 +654,7 @@ static void __kmp_team_static_init(ident_t *loc, kmp_int32 gtid,
KE_TRACE(10, ("__kmp_team_static_init called (%d)\n", gtid));
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff = __kmp_str_format("__kmp_team_static_init enter: T#%%d liter=%%d "
"iter=(%%%s, %%%s, %%%s) chunk %%%s; signed?<%s>\n",
@@ -728,7 +728,7 @@ static void __kmp_team_static_init(ident_t *loc, kmp_int32 gtid,
}
#ifdef KMP_DEBUG
{
- const char *buff;
+ char *buff;
// create format specifiers before the debug output
buff =
__kmp_str_format("__kmp_team_static_init exit: T#%%d team%%u liter=%%d "
diff --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp
index ee3076318f4..66afa09fd8e 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -335,7 +335,7 @@ static void __kmp_stg_parse_size(char const *name, char const *value,
} // __kmp_stg_parse_size
static void __kmp_stg_parse_str(char const *name, char const *value,
- char const **out) {
+ char **out) {
__kmp_str_free(out);
*out = __kmp_str_format("%s", value);
} // __kmp_stg_parse_str
@@ -2180,7 +2180,7 @@ static void __kmp_parse_affinity_env(char const *name, char const *value,
#undef set_respect
#undef set_granularity
- __kmp_str_free(CCAST(const char **, &buffer));
+ __kmp_str_free(&buffer);
if (proclist) {
if (!type) {
@@ -4354,6 +4354,8 @@ static void __kmp_stg_print_omp_cancellation(kmp_str_buf_t *buffer,
#if OMP_50_ENABLED && OMPT_SUPPORT
+static char *__kmp_tool_libraries = NULL;
+
static void __kmp_stg_parse_omp_tool_libraries(char const *name,
char const *value, void *data) {
__kmp_stg_parse_str(name, value, &__kmp_tool_libraries);
diff --git a/openmp/runtime/src/kmp_str.cpp b/openmp/runtime/src/kmp_str.cpp
index 01996b0710c..2efa1fdaa78 100644
--- a/openmp/runtime/src/kmp_str.cpp
+++ b/openmp/runtime/src/kmp_str.cpp
@@ -255,9 +255,9 @@ void __kmp_str_fname_init(kmp_str_fname_t *fname, char const *path) {
} // kmp_str_fname_init
void __kmp_str_fname_free(kmp_str_fname_t *fname) {
- __kmp_str_free(CCAST(char const **, &fname->path));
- __kmp_str_free(CCAST(char const **, &fname->dir));
- __kmp_str_free(CCAST(char const **, &fname->base));
+ __kmp_str_free(&fname->path);
+ __kmp_str_free(&fname->dir);
+ __kmp_str_free(&fname->base);
} // kmp_str_fname_free
int __kmp_str_fname_match(kmp_str_fname_t const *fname, char const *pattern) {
@@ -325,7 +325,7 @@ kmp_str_loc_t __kmp_str_loc_init(char const *psource, int init_fname) {
void __kmp_str_loc_free(kmp_str_loc_t *loc) {
__kmp_str_fname_free(&loc->fname);
- __kmp_str_free(CCAST(const char **, &(loc->_bulk)));
+ __kmp_str_free(&(loc->_bulk));
loc->file = NULL;
loc->func = NULL;
} // kmp_str_loc_free
@@ -424,9 +424,9 @@ char *__kmp_str_format( // Allocated string.
return buffer;
} // func __kmp_str_format
-void __kmp_str_free(char const **str) {
+void __kmp_str_free(char **str) {
KMP_DEBUG_ASSERT(str != NULL);
- KMP_INTERNAL_FREE(CCAST(char *, *str));
+ KMP_INTERNAL_FREE(*str);
*str = NULL;
} // func __kmp_str_free
diff --git a/openmp/runtime/src/kmp_str.h b/openmp/runtime/src/kmp_str.h
index 8bbde56972e..02a2032b580 100644
--- a/openmp/runtime/src/kmp_str.h
+++ b/openmp/runtime/src/kmp_str.h
@@ -103,7 +103,7 @@ void __kmp_str_loc_free(kmp_str_loc_t *loc);
int __kmp_str_eqf(char const *lhs, char const *rhs);
char *__kmp_str_format(char const *format, ...);
-void __kmp_str_free(char const **str);
+void __kmp_str_free(char **str);
int __kmp_str_match(char const *target, int len, char const *data);
int __kmp_str_match_false(char const *data);
int __kmp_str_match_true(char const *data);
diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index e8e94a04acf..056e53bd65a 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -214,9 +214,9 @@ ompt_try_start_tool(unsigned int omp_version, const char *runtime_version) {
// Try tool-libraries-var ICV
const char *tool_libs = getenv("OMP_TOOL_LIBRARIES");
if (tool_libs) {
- const char *libs = __kmp_str_format("%s", tool_libs);
+ char *libs = __kmp_str_format("%s", tool_libs);
char *buf;
- char *fname = __kmp_str_token(CCAST(char *, libs), sep, &buf);
+ char *fname = __kmp_str_token(libs, sep, &buf);
while (fname) {
#if KMP_OS_UNIX
void *h = dlopen(fname, RTLD_LAZY);
OpenPOWER on IntegriCloud