diff options
| author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-09 15:52:25 +0000 |
|---|---|---|
| committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-11-09 15:52:25 +0000 |
| commit | aeb40adabf18d517fa27085d3e39cb2b93eb7648 (patch) | |
| tree | e4c1bb4635181b54f8b07352cccdc8678aaa70f2 /openmp/runtime/src/kmp_dispatch.cpp | |
| parent | 18ff303bed72782f05cfc9b87ed38d788edbdf07 (diff) | |
| download | bcm5719-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/kmp_dispatch.cpp')
| -rw-r--r-- | openmp/runtime/src/kmp_dispatch.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
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", |

