[Openmp-commits] [openmp] r317797 - Remove const from variables with dynamic memory
Jonas Hahnfeld via Openmp-commits
openmp-commits at lists.llvm.org
Thu Nov 9 07:52:25 PST 2017
Author: hahnfeld
Date: Thu Nov 9 07:52:25 2017
New Revision: 317797
URL: http://llvm.org/viewvc/llvm-project?rev=317797&view=rev
Log:
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
Modified:
openmp/trunk/runtime/src/kmp.h
openmp/trunk/runtime/src/kmp_dispatch.cpp
openmp/trunk/runtime/src/kmp_environment.h
openmp/trunk/runtime/src/kmp_error.cpp
openmp/trunk/runtime/src/kmp_global.cpp
openmp/trunk/runtime/src/kmp_i18n.cpp
openmp/trunk/runtime/src/kmp_i18n.h
openmp/trunk/runtime/src/kmp_itt.inl
openmp/trunk/runtime/src/kmp_sched.cpp
openmp/trunk/runtime/src/kmp_settings.cpp
openmp/trunk/runtime/src/kmp_str.cpp
openmp/trunk/runtime/src/kmp_str.h
openmp/trunk/runtime/src/ompt-general.cpp
Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Thu Nov 9 07:52:25 2017
@@ -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) \
Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Thu Nov 9 07:52:25 2017
@@ -368,7 +368,7 @@ static void __kmp_dispatch_deo(int *gtid
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
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 gt
#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 gt
#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 gt
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 gt
#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 gt
#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 gt
#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 gt
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(
#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(
//!!!!! 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 *
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 *
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 *
} // 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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
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 *
#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_
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",
Modified: openmp/trunk/runtime/src/kmp_environment.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_environment.h?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_environment.h (original)
+++ openmp/trunk/runtime/src/kmp_environment.h Thu Nov 9 07:52:25 2017
@@ -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;
Modified: openmp/trunk/runtime/src/kmp_error.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_error.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_error.cpp (original)
+++ openmp/trunk/runtime/src/kmp_error.cpp Thu Nov 9 07:52:25 2017
@@ -75,7 +75,7 @@ static void __kmp_expand_cons_stack(int
}
// 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
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_
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) {
Modified: openmp/trunk/runtime/src/kmp_global.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_global.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_global.cpp (original)
+++ openmp/trunk/runtime/src/kmp_global.cpp Thu Nov 9 07:52:25 2017
@@ -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
Modified: openmp/trunk/runtime/src/kmp_i18n.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_i18n.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_i18n.cpp (original)
+++ openmp/trunk/runtime/src/kmp_i18n.cpp Thu Nov 9 07:52:25 2017
@@ -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 severi
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;
Modified: openmp/trunk/runtime/src/kmp_i18n.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_i18n.h?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_i18n.h (original)
+++ openmp/trunk/runtime/src/kmp_i18n.h Thu Nov 9 07:52:25 2017
@@ -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
Modified: openmp/trunk/runtime/src/kmp_itt.inl
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_itt.inl?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_itt.inl (original)
+++ openmp/trunk/runtime/src/kmp_itt.inl Thu Nov 9 07:52:25 2017
@@ -115,7 +115,7 @@ LINKAGE void __kmp_itt_region_forking(in
// 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(in
&__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(in
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
// 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
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
// "<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
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);
Modified: openmp/trunk/runtime/src/kmp_sched.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_sched.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_sched.cpp (original)
+++ openmp/trunk/runtime/src/kmp_sched.cpp Thu Nov 9 07:52:25 2017
@@ -93,7 +93,7 @@ static void __kmp_for_static_init(ident_
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_
// 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_
#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_
(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_
#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(i
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(i
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
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
}
#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 "
Modified: openmp/trunk/runtime/src/kmp_settings.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.cpp (original)
+++ openmp/trunk/runtime/src/kmp_settings.cpp Thu Nov 9 07:52:25 2017
@@ -335,7 +335,7 @@ static void __kmp_stg_parse_size(char co
} // __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(cha
#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_cancella
#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);
Modified: openmp/trunk/runtime/src/kmp_str.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_str.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_str.cpp (original)
+++ openmp/trunk/runtime/src/kmp_str.cpp Thu Nov 9 07:52:25 2017
@@ -255,9 +255,9 @@ void __kmp_str_fname_init(kmp_str_fname_
} // 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 co
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 str
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
Modified: openmp/trunk/runtime/src/kmp_str.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_str.h?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_str.h (original)
+++ openmp/trunk/runtime/src/kmp_str.h Thu Nov 9 07:52:25 2017
@@ -103,7 +103,7 @@ void __kmp_str_loc_free(kmp_str_loc_t *l
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);
Modified: openmp/trunk/runtime/src/ompt-general.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-general.cpp?rev=317797&r1=317796&r2=317797&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-general.cpp (original)
+++ openmp/trunk/runtime/src/ompt-general.cpp Thu Nov 9 07:52:25 2017
@@ -214,9 +214,9 @@ ompt_try_start_tool(unsigned int omp_ver
// 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);
More information about the Openmp-commits
mailing list