diff --git a/openmp/runtime/src/kmp_io.cpp b/openmp/runtime/src/kmp_io.cpp index 0c52662bc2357..3c0a9a64b3309 100644 --- a/openmp/runtime/src/kmp_io.cpp +++ b/openmp/runtime/src/kmp_io.cpp @@ -133,8 +133,8 @@ void __kmp_vprintf(enum kmp_io out_stream, char const *format, va_list ap) { int chars = 0; #ifdef KMP_DEBUG_PIDS - chars = KMP_SNPRINTF(db, __kmp_debug_buf_chars, - "pid=%d: ", (kmp_int32)getpid()); + chars = KMP_SNPRINTF(db, __kmp_debug_buf_chars, "pid=%" KMP_INT32_SPEC ": ", + (kmp_int32)getpid()); #endif chars += KMP_VSNPRINTF(db, __kmp_debug_buf_chars, format, ap); @@ -167,7 +167,8 @@ void __kmp_vprintf(enum kmp_io out_stream, char const *format, va_list ap) { #if KMP_OS_WINDOWS DWORD count; #ifdef KMP_DEBUG_PIDS - __kmp_str_buf_print(&__kmp_console_buf, "pid=%d: ", (kmp_int32)getpid()); + __kmp_str_buf_print(&__kmp_console_buf, "pid=%" KMP_INT32_SPEC ": ", + (kmp_int32)getpid()); #endif __kmp_str_buf_vprint(&__kmp_console_buf, format, ap); WriteFile(stream, __kmp_console_buf.str, __kmp_console_buf.used, &count, @@ -175,7 +176,7 @@ void __kmp_vprintf(enum kmp_io out_stream, char const *format, va_list ap) { __kmp_str_buf_clear(&__kmp_console_buf); #else #ifdef KMP_DEBUG_PIDS - fprintf(stream, "pid=%d: ", (kmp_int32)getpid()); + fprintf(stream, "pid=%" KMP_INT32_SPEC ": ", (kmp_int32)getpid()); #endif vfprintf(stream, format, ap); fflush(stream); diff --git a/openmp/runtime/src/kmp_lock.cpp b/openmp/runtime/src/kmp_lock.cpp index 0ad14f862bcb9..cd89519d61d90 100644 --- a/openmp/runtime/src/kmp_lock.cpp +++ b/openmp/runtime/src/kmp_lock.cpp @@ -3952,7 +3952,7 @@ void __kmp_cleanup_user_locks(void) { #define IS_CRITICAL(lck) \ ((__kmp_get_user_lock_flags_ != NULL) && \ - ((*__kmp_get_user_lock_flags_)(lck)&kmp_lf_critical_section)) + ((*__kmp_get_user_lock_flags_)(lck) & kmp_lf_critical_section)) // Loop through lock table, free all locks. // Do not free item [0], it is reserved for lock tables list. diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp index 64548b1397c34..e9d7bd35ec14e 100644 --- a/openmp/runtime/src/kmp_runtime.cpp +++ b/openmp/runtime/src/kmp_runtime.cpp @@ -584,9 +584,7 @@ static void __kmp_fini_allocator() { __kmp_fini_memkind(); } /* ------------------------------------------------------------------------ */ #if ENABLE_LIBOMPTARGET -static void __kmp_init_omptarget() { - __kmp_init_target_task(); -} +static void __kmp_init_omptarget() { __kmp_init_target_task(); } #endif /* ------------------------------------------------------------------------ */ @@ -1539,7 +1537,7 @@ __kmp_fork_in_teams(ident_t *loc, int gtid, kmp_team_t *parent_team, , exit_frame_p #endif - ); + ); } #if OMPT_SUPPORT @@ -1735,7 +1733,7 @@ __kmp_serial_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, if (!ap) { // revert change made in __kmpc_serialized_parallel() master_th->th.th_serial_team->t.t_level--; -// Get args from parent team for teams construct + // Get args from parent team for teams construct #if OMPT_SUPPORT void *dummy; @@ -1774,7 +1772,7 @@ __kmp_serial_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, , exit_frame_p #endif - ); + ); } #if OMPT_SUPPORT @@ -1873,7 +1871,7 @@ __kmp_serial_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, , exit_frame_p #endif - ); + ); } #if OMPT_SUPPORT @@ -3302,29 +3300,29 @@ static kmp_internal_control_t __kmp_get_global_icvs(void) { KMP_DEBUG_ASSERT(__kmp_nested_proc_bind.used > 0); kmp_internal_control_t g_icvs = { - 0, // int serial_nesting_level; //corresponds to value of th_team_serialized - (kmp_int8)__kmp_global.g.g_dynamic, // internal control for dynamic - // adjustment of threads (per thread) - (kmp_int8)__kmp_env_blocktime, // int bt_set; //internal control for - // whether blocktime is explicitly set - __kmp_dflt_blocktime, // int blocktime; //internal control for blocktime + 0, // int serial_nesting_level; //corresponds to value of + // th_team_serialized + (kmp_int8)__kmp_global.g.g_dynamic, // internal control for dynamic + // adjustment of threads (per thread) + (kmp_int8)__kmp_env_blocktime, // int bt_set; //internal control for + // whether blocktime is explicitly set + __kmp_dflt_blocktime, // int blocktime; //internal control for blocktime #if KMP_USE_MONITOR - __kmp_bt_intervals, // int bt_intervals; //internal control for blocktime + __kmp_bt_intervals, // int bt_intervals; //internal control for blocktime // intervals #endif - __kmp_dflt_team_nth, // int nproc; //internal control for # of threads for - // next parallel region (per thread) - // (use a max ub on value if __kmp_parallel_initialize not called yet) - __kmp_cg_max_nth, // int thread_limit; - __kmp_task_max_nth, // int task_thread_limit; // to set the thread_limit - // on task. This is used in the case of target thread_limit - __kmp_dflt_max_active_levels, // int max_active_levels; //internal control - // for max_active_levels - r_sched, // kmp_r_sched_t sched; //internal control for runtime schedule - // {sched,chunk} pair - __kmp_nested_proc_bind.bind_types[0], - __kmp_default_device, - NULL // struct kmp_internal_control *next; + __kmp_dflt_team_nth, // int nproc; //internal control for # of threads for + // next parallel region (per thread) + // (use a max ub on value if __kmp_parallel_initialize not called yet) + __kmp_cg_max_nth, // int thread_limit; + __kmp_task_max_nth, // int task_thread_limit; // to set the thread_limit + // on task. This is used in the case of target thread_limit + __kmp_dflt_max_active_levels, // int max_active_levels; //internal control + // for max_active_levels + r_sched, // kmp_r_sched_t sched; //internal control for runtime schedule + // {sched,chunk} pair + __kmp_nested_proc_bind.bind_types[0], __kmp_default_device, + NULL // struct kmp_internal_control *next; }; return g_icvs; @@ -6726,10 +6724,12 @@ static inline char *__kmp_reg_status_name() { env var can not be found, because the name will contain different pid. */ // macOS* complains about name being too long with additional getuid() #if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB - return __kmp_str_format("__KMP_REGISTERED_LIB_%d_%d", (int)getpid(), - (int)getuid()); + return __kmp_str_format("__KMP_REGISTERED_LIB_%" KMP_UINT32_SPEC + "_%" KMP_UINT32_SPEC, + (kmp_uint32)getpid(), (kmp_uint32)getuid()); #else - return __kmp_str_format("__KMP_REGISTERED_LIB_%d", (int)getpid()); + return __kmp_str_format("__KMP_REGISTERED_LIB_%" KMP_UINT32_SPEC, + (kmp_uint32)getpid()); #endif } // __kmp_reg_status_get diff --git a/openmp/runtime/src/kmp_utility.cpp b/openmp/runtime/src/kmp_utility.cpp index bfa450c9ced26..e512f03b23c9f 100644 --- a/openmp/runtime/src/kmp_utility.cpp +++ b/openmp/runtime/src/kmp_utility.cpp @@ -307,9 +307,11 @@ void __kmp_expand_file_name(char *result, size_t rlen, char *pattern) { case 'i': { pid_t id = getpid(); #if (KMP_ARCH_X86_64 || KMP_ARCH_AARCH64) && defined(__MINGW32__) - snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*lld", width, id); + snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*" KMP_UINT64_SPEC, + width, (kmp_uint64)id); #else - snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*d", width, id); + snp_result = KMP_SNPRINTF(pos, end - pos + 1, "%0*" KMP_UINT32_SPEC, + width, (kmp_uint32)id); #endif if (snp_result >= 0 && snp_result <= end - pos) { while (*pos) diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp index 0c89f2346750f..492e30b16f157 100644 --- a/openmp/runtime/src/z_Linux_util.cpp +++ b/openmp/runtime/src/z_Linux_util.cpp @@ -2247,7 +2247,8 @@ int __kmp_is_address_mapped(void *addr) { return 0; } - char *name = __kmp_str_format("/proc/%d/map", pid); + char *name = + __kmp_str_format("/proc/%" KMP_INT32_SPEC "/map", (kmp_int32)pid); size_t sz = (1 << 20); file = open(name, O_RDONLY); if (file == -1) {