aboutsummaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorNawrin Sultana <nawrin.sultana@intel.com>2023-06-06 12:35:11 -0500
committerNawrin Sultana <nawrin.sultana@intel.com>2023-07-05 12:07:51 -0500
commit50a95e3e6bab6edfd99386cc2b9950dfc211dea4 (patch)
tree1bc12e72b280676bea0f0da221acf5c902e1f169 /openmp
parent7f20407ceed8e713c5f193a2598358332b5ac0d3 (diff)
downloadllvm-50a95e3e6bab6edfd99386cc2b9950dfc211dea4.zip
llvm-50a95e3e6bab6edfd99386cc2b9950dfc211dea4.tar.gz
llvm-50a95e3e6bab6edfd99386cc2b9950dfc211dea4.tar.bz2
[OpenMP] Minor improvement in error msg and fixes few coverity reported issues
Differential Revision: https://reviews.llvm.org/D152289
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/kmp_affinity.h15
-rw-r--r--openmp/runtime/src/kmp_runtime.cpp2
-rw-r--r--openmp/runtime/src/kmp_settings.cpp2
-rw-r--r--openmp/runtime/src/z_Linux_util.cpp5
4 files changed, 17 insertions, 7 deletions
diff --git a/openmp/runtime/src/kmp_affinity.h b/openmp/runtime/src/kmp_affinity.h
index e685e2c..f27dd9a 100644
--- a/openmp/runtime/src/kmp_affinity.h
+++ b/openmp/runtime/src/kmp_affinity.h
@@ -62,7 +62,8 @@ public:
}
int error = errno;
if (abort_on_error) {
- __kmp_fatal(KMP_MSG(FatalSysError), KMP_ERR(error), __kmp_msg_null);
+ __kmp_fatal(KMP_MSG(FunctionError, "hwloc_get_cpubind()"),
+ KMP_ERR(error), __kmp_msg_null);
}
return error;
}
@@ -76,7 +77,8 @@ public:
}
int error = errno;
if (abort_on_error) {
- __kmp_fatal(KMP_MSG(FatalSysError), KMP_ERR(error), __kmp_msg_null);
+ __kmp_fatal(KMP_MSG(FunctionError, "hwloc_set_cpubind()"),
+ KMP_ERR(error), __kmp_msg_null);
}
return error;
}
@@ -95,7 +97,8 @@ public:
return 0;
error = errno;
if (abort_on_error)
- __kmp_fatal(KMP_MSG(FatalSysError), KMP_ERR(error), __kmp_msg_null);
+ __kmp_fatal(KMP_MSG(FunctionError, "hwloc_set_cpubind()"),
+ KMP_ERR(error), __kmp_msg_null);
}
return error;
}
@@ -372,7 +375,8 @@ class KMPNativeAffinity : public KMPAffinity {
}
int error = errno;
if (abort_on_error) {
- __kmp_fatal(KMP_MSG(FatalSysError), KMP_ERR(error), __kmp_msg_null);
+ __kmp_fatal(KMP_MSG(FunctionError, "pthread_getaffinity_np()"),
+ KMP_ERR(error), __kmp_msg_null);
}
return error;
}
@@ -392,7 +396,8 @@ class KMPNativeAffinity : public KMPAffinity {
}
int error = errno;
if (abort_on_error) {
- __kmp_fatal(KMP_MSG(FatalSysError), KMP_ERR(error), __kmp_msg_null);
+ __kmp_fatal(KMP_MSG(FunctionError, "pthread_setaffinity_np()"),
+ KMP_ERR(error), __kmp_msg_null);
}
return error;
}
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index 03956ac..0154ee0 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -405,6 +405,8 @@ void __kmp_print_storage_map_gtid(int gtid, void *p1, void *p2, size_t size,
}
#endif /* KMP_PRINT_DATA_PLACEMENT */
__kmp_release_bootstrap_lock(&__kmp_stdio_lock);
+
+ va_end(ap);
}
void __kmp_warn(char const *format, ...) {
diff --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp
index 181db20..eb92de1 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -1467,7 +1467,7 @@ static void __kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer,
// taskloop threshold to switch from recursive to linear tasks creation
static void __kmp_stg_parse_taskloop_min_tasks(char const *name,
char const *value, void *data) {
- int tmp;
+ int tmp = 0;
__kmp_stg_parse_int(name, value, 0, INT_MAX, &tmp);
__kmp_taskloop_min_tasks = tmp;
} // __kmp_stg_parse_taskloop_min_tasks
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index 95c9e97..260b982 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -1849,10 +1849,13 @@ int __kmp_read_from_file(char const *path, char const *format, ...) {
va_start(args, format);
FILE *f = fopen(path, "rb");
- if (f == NULL)
+ if (f == NULL) {
+ va_end(args);
return 0;
+ }
result = vfscanf(f, format, args);
fclose(f);
+ va_end(args);
return result;
}