[Openmp-commits] [openmp] r317798 - Add const to some variables to avoid const_casts
Jonas Hahnfeld via Openmp-commits
openmp-commits at lists.llvm.org
Thu Nov 9 07:52:29 PST 2017
Author: hahnfeld
Date: Thu Nov 9 07:52:29 2017
New Revision: 317798
URL: http://llvm.org/viewvc/llvm-project?rev=317798&view=rev
Log:
Add const to some variables to avoid const_casts
In these places the const attribute seems correct and doesn't
need any other change, so let's do it.
Differential Revision: https://reviews.llvm.org/D39756
Modified:
openmp/trunk/runtime/src/kmp_settings.cpp
openmp/trunk/runtime/src/kmp_utility.cpp
Modified: openmp/trunk/runtime/src/kmp_settings.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.cpp?rev=317798&r1=317797&r2=317798&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.cpp (original)
+++ openmp/trunk/runtime/src/kmp_settings.cpp Thu Nov 9 07:52:29 2017
@@ -3298,15 +3298,15 @@ static void __kmp_stg_parse_schedule(cha
if (length > INT_MAX) {
KMP_WARNING(LongValue, name);
} else {
- char *semicolon;
+ const char *semicolon;
if (value[length - 1] == '"' || value[length - 1] == '\'')
KMP_WARNING(UnbalancedQuotes, name);
do {
char sentinel;
- semicolon = CCAST(char *, strchr(value, ';'));
+ semicolon = strchr(value, ';');
if (*value && semicolon != value) {
- char *comma = CCAST(char *, strchr(value, ','));
+ const char *comma = strchr(value, ',');
if (comma) {
++comma;
@@ -3371,7 +3371,7 @@ static void __kmp_stg_parse_omp_schedule
if (value) {
length = KMP_STRLEN(value);
if (length) {
- char *comma = CCAST(char *, strchr(value, ','));
+ const char *comma = strchr(value, ',');
if (value[length - 1] == '"' || value[length - 1] == '\'')
KMP_WARNING(UnbalancedQuotes, name);
/* get the specified scheduling style */
Modified: openmp/trunk/runtime/src/kmp_utility.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_utility.cpp?rev=317798&r1=317797&r2=317798&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_utility.cpp (original)
+++ openmp/trunk/runtime/src/kmp_utility.cpp Thu Nov 9 07:52:29 2017
@@ -96,14 +96,13 @@ static kmp_uint64 __kmp_parse_frequency(
) {
double value = 0.0;
- char const *unit = NULL;
+ char *unit = NULL;
kmp_uint64 result = 0; /* Zero is a better unknown value than all ones. */
if (frequency == NULL) {
return result;
}
- value = strtod(frequency,
- CCAST(char **, &unit)); // strtod() does not like "const"
+ value = strtod(frequency, &unit);
if (0 < value &&
value <= DBL_MAX) { // Good value (not overflow, underflow, etc).
if (strcmp(unit, "MHz") == 0) {
More information about the Openmp-commits
mailing list