diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2017-09-27 20:36:27 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2017-09-27 20:36:27 +0000 |
commit | 5b33aeb20780d7027f9204c74651de35eaefe3de (patch) | |
tree | 1bd50aee310cc17f1084d5388acac0dff421d359 | |
parent | 1957e1bc23518b058a87e3a1c5ca5b437c344351 (diff) |
Remove unnecessary semicolons
Removes semicolons after if {} blocks, function definitions, etc.
I was able to apply the large OMPT patch cleanly on top of this one
with no conflicts.
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@314340 91177308-0d34-0410-b5e6-96231b3b80d8
27 files changed, 498 insertions, 509 deletions
diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h index c0cb8de..c4f6d91 100644 --- a/runtime/src/kmp.h +++ b/runtime/src/kmp.h @@ -668,7 +668,7 @@ public: virtual api_type get_api_type() const { KMP_ASSERT(0); return NATIVE_OS; - }; + } private: static bool picked_api; diff --git a/runtime/src/kmp_affinity.cpp b/runtime/src/kmp_affinity.cpp index f8428d9..f010a25 100644 --- a/runtime/src/kmp_affinity.cpp +++ b/runtime/src/kmp_affinity.cpp @@ -1686,7 +1686,7 @@ static int __kmp_affinity_cmp_ProcCpuInfo_os_id(const void *a, const void *b) { if (aa[osIdIndex] > bb[osIdIndex]) return 1; return 0; -}; +} static int __kmp_affinity_cmp_ProcCpuInfo_phys_id(const void *a, const void *b) { diff --git a/runtime/src/kmp_alloc.cpp b/runtime/src/kmp_alloc.cpp index b7d4732..9874255 100644 --- a/runtime/src/kmp_alloc.cpp +++ b/runtime/src/kmp_alloc.cpp @@ -464,7 +464,7 @@ static void *bget(kmp_info_t *th, bufsize requested_size) { if (size < 0 || size + sizeof(bhead_t) > MaxSize) { return NULL; - }; // if + } __kmp_bget_dequeue(th); /* Release any queued buffers */ @@ -716,7 +716,7 @@ static void *bgetr(kmp_info_t *th, void *buf, bufsize size) { osize = bd->tsize - (bufsize)sizeof(bdhead_t); } else { osize -= sizeof(bhead_t); - }; + } KMP_DEBUG_ASSERT(osize > 0); @@ -1258,7 +1258,7 @@ void __kmp_finalize_bget(kmp_info_t *th) { if (th->th.th_local.bget_data != NULL) { __kmp_free(th->th.th_local.bget_data); th->th.th_local.bget_data = NULL; - }; // if + } } void kmpc_set_poolsize(size_t size) { @@ -1385,7 +1385,7 @@ void *kmpc_realloc(void *ptr, size_t size) { *(void **)result = result; result = (void **)result + 1; } - }; // if + } return result; } @@ -1393,14 +1393,14 @@ void *kmpc_realloc(void *ptr, size_t size) { void kmpc_free(void *ptr) { if (!__kmp_init_serial) { return; - }; // if + } if (ptr != NULL) { kmp_info_t *th = __kmp_get_thread(); __kmp_bget_dequeue(th); /* Release any queued buffers */ // extract allocated pointer and free it KMP_ASSERT(*((void **)ptr - 1)); brel(th, *((void **)ptr - 1)); - }; + } } void *___kmp_thread_malloc(kmp_info_t *th, size_t size KMP_SRC_LOC_DECL) { @@ -1499,7 +1499,7 @@ static void *___kmp_allocate_align(size_t size, descr.ptr_allocated)); if (descr.ptr_allocated == NULL) { KMP_FATAL(OutOfHeapMemory); - }; + } addr_allocated = (kmp_uintptr_t)descr.ptr_allocated; addr_aligned = @@ -1689,7 +1689,7 @@ void *___kmp_fast_allocate(kmp_info_t *this_thr, size_t size KMP_SRC_LOC_DECL) { ((kmp_mem_descr_t *)((kmp_uintptr_t)ptr - sizeof(kmp_mem_descr_t))) ->ptr_aligned); goto end; - }; + } ptr = TCR_SYNC_PTR(this_thr->th.th_free_lists[index].th_free_list_sync); if (ptr != NULL) { // no-sync free list is empty, use sync free list (filled in by other diff --git a/runtime/src/kmp_atomic.cpp b/runtime/src/kmp_atomic.cpp index af0ce21..f870e30 100644 --- a/runtime/src/kmp_atomic.cpp +++ b/runtime/src/kmp_atomic.cpp @@ -611,16 +611,16 @@ kmp_atomic_lock_t __kmp_atomic_lock_32c; static inline void operator+=(Quad_a4_t &lhs, Quad_a4_t &rhs) { lhs.q += rhs.q; -}; +} static inline void operator-=(Quad_a4_t &lhs, Quad_a4_t &rhs) { lhs.q -= rhs.q; -}; +} static inline void operator*=(Quad_a4_t &lhs, Quad_a4_t &rhs) { lhs.q *= rhs.q; -}; +} static inline void operator/=(Quad_a4_t &lhs, Quad_a4_t &rhs) { lhs.q /= rhs.q; -}; +} static inline bool operator<(Quad_a4_t &lhs, Quad_a4_t &rhs) { return lhs.q < rhs.q; } @@ -630,16 +630,16 @@ static inline bool operator>(Quad_a4_t &lhs, Quad_a4_t &rhs) { static inline void operator+=(Quad_a16_t &lhs, Quad_a16_t &rhs) { lhs.q += rhs.q; -}; +} static inline void operator-=(Quad_a16_t &lhs, Quad_a16_t &rhs) { lhs.q -= rhs.q; -}; +} static inline void operator*=(Quad_a16_t &lhs, Quad_a16_t &rhs) { lhs.q *= rhs.q; -}; +} static inline void operator/=(Quad_a16_t &lhs, Quad_a16_t &rhs) { lhs.q /= rhs.q; -}; +} static inline bool operator<(Quad_a16_t &lhs, Quad_a16_t &rhs) { return lhs.q < rhs.q; } @@ -649,33 +649,33 @@ static inline bool operator>(Quad_a16_t &lhs, Quad_a16_t &rhs) { static inline void operator+=(kmp_cmplx128_a4_t &lhs, kmp_cmplx128_a4_t &rhs) { lhs.q += rhs.q; -}; +} static inline void operator-=(kmp_cmplx128_a4_t &lhs, kmp_cmplx128_a4_t &rhs) { lhs.q -= rhs.q; -}; +} static inline void operator*=(kmp_cmplx128_a4_t &lhs, kmp_cmplx128_a4_t &rhs) { lhs.q *= rhs.q; -}; +} static inline void operator/=(kmp_cmplx128_a4_t &lhs, kmp_cmplx128_a4_t &rhs) { lhs.q /= rhs.q; -}; +} static inline void operator+=(kmp_cmplx128_a16_t &lhs, kmp_cmplx128_a16_t &rhs) { lhs.q += rhs.q; -}; +} static inline void operator-=(kmp_cmplx128_a16_t &lhs, kmp_cmplx128_a16_t &rhs) { lhs.q -= rhs.q; -}; +} static inline void operator*=(kmp_cmplx128_a16_t &lhs, kmp_cmplx128_a16_t &rhs) { lhs.q *= rhs.q; -}; +} static inline void operator/=(kmp_cmplx128_a16_t &lhs, kmp_cmplx128_a16_t &rhs) { lhs.q /= rhs.q; -}; +} #endif diff --git a/runtime/src/kmp_csupport.cpp b/runtime/src/kmp_csupport.cpp index 8b7067d..ba721ef 100644 --- a/runtime/src/kmp_csupport.cpp +++ b/runtime/src/kmp_csupport.cpp @@ -588,7 +588,7 @@ void __kmpc_flush(ident_t *loc) { // mfence is a SSE2 instruction. Do not execute it if CPU is not SSE2. if (!__kmp_cpuinfo.initialized) { __kmp_query_cpuid(&__kmp_cpuinfo); - }; // if + } if (!__kmp_cpuinfo.sse2) { // CPU cannot execute SSE2 instructions. } else { @@ -599,7 +599,7 @@ void __kmpc_flush(ident_t *loc) { #else __sync_synchronize(); #endif // KMP_COMPILER_ICC - }; // if + } #endif // KMP_MIC #elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64) // Nothing to see here move along @@ -639,7 +639,7 @@ void __kmpc_barrier(ident_t *loc, kmp_int32 global_tid) { if (__kmp_env_consistency_check) { if (loc == 0) { KMP_WARNING(ConstructIdentInvalid); // ??? What does it mean for the user? - }; // if + } __kmp_check_barrier(global_tid, ct_barrier, loc); } @@ -2976,7 +2976,7 @@ kmp_uint64 __kmpc_get_taskid() { gtid = __kmp_get_gtid(); if (gtid < 0) { return 0; - }; // if + } thread = __kmp_thread_from_gtid(gtid); return thread->th.th_current_task->td_task_id; @@ -2991,7 +2991,7 @@ kmp_uint64 __kmpc_get_parent_taskid() { gtid = __kmp_get_gtid(); if (gtid < 0) { return 0; - }; // if + } thread = __kmp_thread_from_gtid(gtid); parent_task = thread->th.th_current_task->td_parent; return (parent_task == NULL ? 0 : parent_task->td_task_id); diff --git a/runtime/src/kmp_debug.cpp b/runtime/src/kmp_debug.cpp index fc0cab8..b0da90a 100644 --- a/runtime/src/kmp_debug.cpp +++ b/runtime/src/kmp_debug.cpp @@ -49,8 +49,8 @@ int __kmp_debug_assert(char const *msg, char const *file, int line) { char const *slash = strrchr(file, '/'); if (slash != NULL) { file = slash + 1; - }; // if - }; // if + } + } #ifdef KMP_DEBUG __kmp_acquire_bootstrap_lock(&__kmp_stdio_lock); diff --git a/runtime/src/kmp_debugger.cpp b/runtime/src/kmp_debugger.cpp index 4394a19..c4f373e 100644 --- a/runtime/src/kmp_debugger.cpp +++ b/runtime/src/kmp_debugger.cpp @@ -279,10 +279,10 @@ int __kmp_omp_num_threads(ident_t const *ident) { for (i = 0; i < info->num; ++i) { if (kmp_location_match(&loc, &items[i])) { num_threads = items[i].num_threads; - }; // if - }; // for + } + } __kmp_str_loc_free(&loc); - }; // if + } return num_threads; ; diff --git a/runtime/src/kmp_dispatch.cpp b/runtime/src/kmp_dispatch.cpp index 92fe1b2..359b370 100644 --- a/runtime/src/kmp_dispatch.cpp +++ b/runtime/src/kmp_dispatch.cpp @@ -1166,7 +1166,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb, #if USE_ITT_BUILD if (pr->ordered) { __kmp_itt_ordered_init(gtid); - }; // if + } // Report loop metadata if (itt_need_metadata_reporting) { // Only report metadata by master of active team at level 1 @@ -1195,7 +1195,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb, __kmp_itt_metadata_loop(loc, schedtype, tc, cur_chunk); } #endif /* USE_ITT_BUILD */ - }; // if + } #ifdef KMP_DEBUG { @@ -1620,7 +1620,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last, victim = reinterpret_cast<dispatch_private_info_template<T> *>( other_threads[victimIdx] ->th.th_dispatch->th_dispatch_pr_current); - }; + } if (!victim || (*(volatile T *)&victim->u.p.static_steal_counter != *(volatile T *)&pr->u.p.static_steal_counter)) { @@ -1721,7 +1721,7 @@ static int __kmp_dispatch_next(ident_t *loc, int gtid, kmp_int32 *p_last, victim = reinterpret_cast<dispatch_private_info_template<T> *>( other_threads[victimIdx] ->th.th_dispatch->th_dispatch_pr_current); - }; + } if (!victim || (*(volatile T *)&victim->u.p.static_steal_counter != *(volatile T *)&pr->u.p.static_steal_counter)) { diff --git a/runtime/src/kmp_environment.cpp b/runtime/src/kmp_environment.cpp index 5cf9c81..efbe84e 100644 --- a/runtime/src/kmp_environment.cpp +++ b/runtime/src/kmp_environment.cpp @@ -80,7 +80,7 @@ static inline void *allocate(size_t size) { void *ptr = KMP_INTERNAL_MALLOC(size); if (ptr == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if + } return ptr; } // allocate @@ -95,9 +95,9 @@ char *__kmp_env_get(char const *name) { result = (char *)KMP_INTERNAL_MALLOC(len); if (result == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if + } KMP_STRNCPY_S(result, len, value, len); - }; // if + } #elif KMP_OS_WINDOWS /* We use GetEnvironmentVariable for Windows* OS instead of getenv because the act of loading a DLL on Windows* OS makes any user-set environment @@ -110,14 +110,14 @@ char *__kmp_env_get(char const *name) { DWORD error = GetLastError(); if (error != ERROR_ENVVAR_NOT_FOUND) { __kmp_fatal(KMP_MSG(CantGetEnvVar, name), KMP_ERR(error), __kmp_msg_null); - }; // if + } // Variable is not found, it's ok, just continue. } else { DWORD len = rc; result = (char *)KMP_INTERNAL_MALLOC(len); if (result == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if + } rc = GetEnvironmentVariable(name, result, len); if (!rc) { // GetEnvironmentVariable() may return 0 if variable is empty. @@ -130,9 +130,9 @@ char *__kmp_env_get(char const *name) { __kmp_msg_null); KMP_INTERNAL_FREE((void *)result); result = NULL; - }; // if - }; // if - }; // if + } + } + } #else #error Unknown or unsupported OS. #endif @@ -163,9 +163,9 @@ int __kmp_env_exists(char const *name) { DWORD error = GetLastError(); if (error != ERROR_ENVVAR_NOT_FOUND) { __kmp_fatal(KMP_MSG(CantGetEnvVar, name), KMP_ERR(error), __kmp_msg_null); - }; // if + } return 0; - }; // if + } return 1; #else #error Unknown or unsupported OS. @@ -185,7 +185,7 @@ void __kmp_env_set(char const *name, char const *value, int overwrite) { // responding... But this error message never appears. --ln __kmp_fatal(KMP_MSG(CantSetEnvVar, name), KMP_HNT(NotEnoughMemory), __kmp_msg_null); - }; // if + } #elif KMP_OS_WINDOWS BOOL rc; if (!overwrite) { @@ -193,17 +193,17 @@ void __kmp_env_set(char const *name, char const *value, int overwrite) { if (rc) { // Variable exists, do not overwrite. return; - }; // if + } DWORD error = GetLastError(); if (error != ERROR_ENVVAR_NOT_FOUND) { __kmp_fatal(KMP_MSG(CantGetEnvVar, name), KMP_ERR(error), __kmp_msg_null); - }; // if - }; // if + } + } rc = SetEnvironmentVariable(name, value); if (!rc) { DWORD error = GetLastError(); __kmp_fatal(KMP_MSG(CantSetEnvVar, name), KMP_ERR(error), __kmp_msg_null); - }; // if + } #else #error Unknown or unsupported OS. #endif @@ -219,7 +219,7 @@ void __kmp_env_unset(char const *name) { if (!rc) { DWORD error = GetLastError(); __kmp_fatal(KMP_MSG(CantSetEnvVar, name), KMP_ERR(error), __kmp_msg_null); - }; // if + } #else #error Unknown or unsupported OS. #endif @@ -260,10 +260,10 @@ ___kmp_env_blk_parse_string(kmp_env_blk_t *block, // M: Env block to fill. ptr = strchr(ptr, chr_delimiter); if (ptr == NULL) { break; - }; // if + } ++delimiters; ptr += 1; - }; // forever + } } // Allocate vars array. @@ -285,15 +285,14 @@ ___kmp_env_blk_parse_string(kmp_env_blk_t *block, // M: Env block to fill. ++count; // Get the next var. var = __kmp_str_token(NULL, str_delimiter, &buf); - }; // while + } } // Fill out result. block->bulk = bulk; block->vars = vars; block->count = count; - -}; // ___kmp_env_blk_parse_string +} /* Windows* OS (actually, DOS) environment block is a piece of memory with environment variables. Each variable is terminated with zero byte, entire @@ -336,7 +335,7 @@ static void ___kmp_env_blk_parse_windows( var = var + len + 1; // Move pointer to the beginning of the next variable. len = KMP_STRLEN(var); - }; // while + } size = size + 1; // Total size of env block, including terminating zero byte. } @@ -363,17 +362,15 @@ static void ___kmp_env_blk_parse_windows( // Get the next var. var = var + len + 1; len = KMP_STRLEN(var); - }; // while + } } - - }; // if + } // Fill out result. block->bulk = bulk; block->vars = vars; block->count = count; - -}; // ___kmp_env_blk_parse_windows +} #endif /* Unix environment block is a array of pointers to variables, last pointer in @@ -399,7 +396,7 @@ ___kmp_env_blk_parse_unix(kmp_env_blk_t *block, // M: Env block to fill. while (env[count] != NULL) { size += KMP_STRLEN(env[count]) + 1; ++count; - }; // while + } } // Allocate memory. @@ -424,15 +421,14 @@ ___kmp_env_blk_parse_unix(kmp_env_blk_t *block, // M: Env block to fill. vars[i].value = value; // Move pointer. var += len + 1; - }; // for + } } // Fill out result. block->bulk = bulk; block->vars = vars; block->count = count; - -}; // ___kmp_env_blk_parse_unix +} void __kmp_env_blk_init(kmp_env_blk_t *block, // M: Block to initialize. char const *bulk // I: Initialization string, or NULL. @@ -450,14 +446,14 @@ void __kmp_env_blk_init(kmp_env_blk_t *block, // M: Block to initialize. DWORD error = GetLastError(); __kmp_fatal(KMP_MSG(CantGetEnvironment), KMP_ERR(error), __kmp_msg_null); - }; // if + } ___kmp_env_blk_parse_windows(block, mem); FreeEnvironmentStrings(mem); } #else #error Unknown or unsupported OS. #endif - }; // if + } } // __kmp_env_blk_init @@ -498,8 +494,8 @@ char const * // R: Value of variable or NULL if variable does not exist. for (i = 0; i < block->count; ++i) { if (strcmp(block->vars[i].name, name) == 0) { return block->vars[i].value; - }; // if - }; // for + } + } return NULL; } // __kmp_env_block_var diff --git a/runtime/src/kmp_environment.h b/runtime/src/kmp_environment.h index f59f3e5..9b17079 100644 --- a/runtime/src/kmp_environment.h +++ b/runtime/src/kmp_environment.h @@ -49,7 +49,7 @@ __kmp_env_blk_init( & block, "KMP_WARNING=1|KMP_AFFINITY=none" ); // from string __kmp_env_blk_sort( & block ); // Optionally, sort list. for ( i = 0; i < block.count; ++ i ) { // Process block.vars[ i ].name and block.vars[ i ].value... -}; // for i +} __kmp_env_block_free( & block ); */ diff --git a/runtime/src/kmp_error.cpp b/runtime/src/kmp_error.cpp index 292afb5..caacf3d 100644 --- a/runtime/src/kmp_error.cpp +++ b/runtime/src/kmp_error.cpp @@ -89,7 +89,7 @@ static char const *__kmp_pragma(int ct, ident_t const *ident) { cons = cons_text_c[ct]; } else { KMP_DEBUG_ASSERT(0); - }; + } if (ident != NULL && ident->psource != NULL) { char *tail = NULL; __kmp_str_buf_print(&buffer, "%s", @@ -100,7 +100,7 @@ static char const *__kmp_pragma(int ct, ident_t const *ident) { __kmp_str_split(tail, ';', &file, &tail); __kmp_str_split(tail, ';', &func, &tail); __kmp_str_split(tail, ';', &line, &tail); - }; // if + } prgm = __kmp_msg_format(kmp_i18n_fmt_Pragma, cons, file, func, line); __kmp_str_buf_free(&buffer); return prgm.str; @@ -135,7 +135,7 @@ struct cons_header *__kmp_allocate_cons_stack(int gtid) { /* TODO for monitor perhaps? */ if (gtid < 0) { __kmp_check_null_func(); - }; // if + } KE_TRACE(10, ("allocate cons_stack (%d)\n", gtid)); p = (struct cons_header *)__kmp_allocate(sizeof(struct cons_header)); p->p_top = p->w_top = p->s_top = 0; @@ -155,9 +155,9 @@ void __kmp_free_cons_stack(void *ptr) { if (p->stack_data != NULL) { __kmp_free(p->stack_data); p->stack_data = NULL; - }; // if + } __kmp_free(p); - }; // if + } } #if KMP_DEBUG @@ -179,7 +179,7 @@ static void dump_cons_stack(int gtid, struct cons_header *p) { __kmp_str_buf_print( &buffer, " stack_data[%2d] = { %s (%s) %d %p }\n", i, cons_text_c[c->type], get_src(c->ident), c->prev, c->name); - }; // for i + } __kmp_str_buf_print(&buffer, "End construct stack for thread %d\n", gtid); __kmp_str_buf_print( &buffer, @@ -198,7 +198,7 @@ void __kmp_push_parallel(int gtid, ident_t const *ident) { KE_TRACE(100, (PUSH_MSG(ct_parallel, ident))); if (p->stack_top >= p->stack_size) { __kmp_expand_cons_stack(gtid, p); - }; // if + } tos = ++p->stack_top; p->stack_data[tos].type = ct_parallel; p->stack_data[tos].prev = p->p_top; @@ -216,19 +216,19 @@ void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident) { if (p->stack_top >= p->stack_size) { __kmp_expand_cons_stack(gtid, p); - }; // if + } if (p->w_top > p->p_top && !(IS_CONS_TYPE_TASKQ(p->stack_data[p->w_top].type) && IS_CONS_TYPE_TASKQ(ct))) { // We are already in a WORKSHARE construct for this PARALLEL region. __kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident, &p->stack_data[p->w_top]); - }; // if + } if (p->s_top > p->p_top) { // We are already in a SYNC construct for this PARALLEL region. __kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident, &p->stack_data[p->s_top]); - }; // if + } } void __kmp_push_workshare(int gtid, enum cons_type ct, ident_t const *ident) { @@ -336,8 +336,8 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l /* inside a another SYNC construct for this PARALLEL region */ __kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident, &p->stack_data[p->s_top]); - }; // if - }; // if + } + } } void @@ -425,15 +425,15 @@ void __kmp_pop_sync(int gtid, enum cons_type ct, ident_t const *ident) { KE_TRACE(10, ("__kmp_pop_sync (%d %d)\n", gtid, __kmp_get_gtid())); if (tos == 0 || p->s_top == 0) { __kmp_error_construct(kmp_i18n_msg_CnsDetectedEnd, ct, ident); - }; + } if (tos != p->s_top || p->stack_data[tos].type != ct) { __kmp_check_null_func(); __kmp_error_construct2(kmp_i18n_msg_CnsExpectedEnd, ct, ident, &p->stack_data[tos]); - }; + } if (gtid < 0) { __kmp_check_null_func(); - }; + } KE_TRACE(100, (POP_MSG(p))); p->s_top = p->stack_data[tos].prev; p->stack_data[tos].type = ct_none; diff --git a/runtime/src/kmp_ftn_entry.h b/runtime/src/kmp_ftn_entry.h index ccb673f..819a14b 100644 --- a/runtime/src/kmp_ftn_entry.h +++ b/runtime/src/kmp_ftn_entry.h @@ -77,7 +77,7 @@ int FTN_STDCALL FTN_GET_STACKSIZE(void) { #else if (!__kmp_init_serial) { __kmp_serial_initialize(); - }; + } return (int)__kmp_stksize; #endif } @@ -88,7 +88,7 @@ size_t FTN_STDCALL FTN_GET_STACKSIZE_S(void) { #else if (!__kmp_init_serial) { __kmp_serial_initialize(); - }; + } return __kmp_stksize; #endif } @@ -138,7 +138,7 @@ int FTN_STDCALL FTN_GET_BLOCKTIME(void) { KF_TRACE(10, ("kmp_get_blocktime: T#%d(%d:%d), blocktime=%d\n", gtid, team->t.t_id, tid, get__blocktime(team, tid))); return get__blocktime(team, tid); - }; + } #endif } @@ -548,7 +548,7 @@ int FTN_STDCALL xexpand(FTN_GET_THREAD_LIMIT)(void) { #else if (!__kmp_init_serial) { __kmp_serial_initialize(); - }; + } /* global ICV */ return __kmp_cg_max_nth; #endif @@ -930,10 +930,10 @@ void FTN_STDCALL xexpand(FTN_SET_LOCK)(void **user_lock) { #ifdef KMP_STUB if (*((kmp_stub_lock_t *)user_lock) == UNINIT) { // TODO: Issue an error. - }; // if + } if (*((kmp_stub_lock_t *)user_lock) != UNLOCKED) { // TODO: Issue an error. - }; // if + } *((kmp_stub_lock_t *)user_lock) = LOCKED; #else __kmpc_set_lock(NULL, __kmp_entry_gtid(), user_lock); @@ -944,7 +944,7 @@ void FTN_STDCALL xexpand(FTN_SET_NEST_LOCK)(void **user_lock) { #ifdef KMP_STUB if (*((kmp_stub_lock_t *)user_lock) == UNINIT) { // TODO: Issue an error. - }; // if + } (*((int *)user_lock))++; #else __kmpc_set_nest_lock(NULL, __kmp_entry_gtid(), user_lock); @@ -955,10 +955,10 @@ void FTN_STDCALL xexpand(FTN_UNSET_LOCK)(void **user_lock) { #ifdef KMP_STUB if (*((kmp_stub_lock_t *)user_lock) == UNINIT) { // TODO: Issue an error. - }; // if + } if (*((kmp_stub_lock_t *)user_lock) == UNLOCKED) { // TODO: Issue an error. - }; // if + } *((kmp_stub_lock_t *)user_lock) = UNLOCKED; #else __kmpc_unset_lock(NULL, __kmp_entry_gtid(), user_lock); @@ -969,10 +969,10 @@ void FTN_STDCALL xexpand(FTN_UNSET_NEST_LOCK)(void **user_lock) { #ifdef KMP_STUB if (*((kmp_stub_lock_t *)user_lock) == UNINIT) { // TODO: Issue an error. - }; // if + } if (*((kmp_stub_lock_t *)user_lock) == UNLOCKED) { // TODO: Issue an error. - }; // if + } (*((int *)user_lock))--; #else __kmpc_unset_nest_lock(NULL, __kmp_entry_gtid(), user_lock); @@ -983,10 +983,10 @@ int FTN_STDCALL xexpand(FTN_TEST_LOCK)(void **user_lock) { #ifdef KMP_STUB if (*((kmp_stub_lock_t *)user_lock) == UNINIT) { // TODO: Issue an error. - }; // if + } if (*((kmp_stub_lock_t *)user_lock) == LOCKED) { return 0; - }; // if + } *((kmp_stub_lock_t *)user_lock) = LOCKED; return 1; #else @@ -998,7 +998,7 @@ int FTN_STDCALL xexpand(FTN_TEST_NEST_LOCK)(void **user_lock) { #ifdef KMP_STUB if (*((kmp_stub_lock_t *)user_lock) == UNINIT) { // TODO: Issue an error. - }; // if + } return ++(*((int *)user_lock)); #else return __kmpc_test_nest_lock(NULL, __kmp_entry_gtid(), user_lock); @@ -1015,7 +1015,7 @@ double FTN_STDCALL xexpand(FTN_GET_WTIME)(void) { // routine can be used to measure library initialization time on Linux* OS now if (!__kmp_init_serial) { __kmp_serial_initialize(); - }; + } #endif __kmp_elapsed(&data); return data; @@ -1029,7 +1029,7 @@ double FTN_STDCALL xexpand(FTN_GET_WTICK)(void) { double data; if (!__kmp_init_serial) { __kmp_serial_initialize(); - }; + } __kmp_elapsed_tick(&data); return data; #endif diff --git a/runtime/src/kmp_i18n.cpp b/runtime/src/kmp_i18n.cpp index 7537b6f..3035e09 100644 --- a/runtime/src/kmp_i18n.cpp +++ b/runtime/src/kmp_i18n.cpp @@ -65,9 +65,9 @@ void __kmp_i18n_catopen() { __kmp_acquire_bootstrap_lock(&lock); if (status == KMP_I18N_CLOSED) { __kmp_i18n_do_catopen(); - }; // if + } __kmp_release_bootstrap_lock(&lock); - }; // if + } } // func __kmp_i18n_catopen /* Linux* OS and OS X* part */ @@ -109,7 +109,7 @@ void __kmp_i18n_do_catopen() { __kmp_str_split(lang, '.', &lang, &tail); __kmp_str_split(lang, '_', &lang, &tail); english = (strcmp(lang, "en") == 0); - }; // if + } KMP_INTERNAL_FREE(lang); @@ -171,9 +171,9 @@ void __kmp_i18n_do_catopen() { KMP_INFORM(WillUseDefaultMessages); KMP_INTERNAL_FREE(CCAST(char *, nlspath)); } // __kmp_generate_warnings - }; // if + } __kmp_str_buf_free(&version); - }; // if + } } // func __kmp_i18n_do_catopen void __kmp_i18n_catclose() { @@ -181,7 +181,7 @@ void __kmp_i18n_catclose() { KMP_DEBUG_ASSERT(cat != KMP_I18N_NULLCAT); catclose(cat); cat = KMP_I18N_NULLCAT; - }; // if + } status = KMP_I18N_CLOSED; } // func __kmp_i18n_catclose @@ -195,19 +195,19 @@ char const *__kmp_i18n_catgets(kmp_i18n_id_t id) { if (1 <= number && number <= __kmp_i18n_default_table.sect[section].size) { if (status == KMP_I18N_CLOSED) { __kmp_i18n_catopen(); - }; // if + } if (status == KMP_I18N_OPENED) { message = catgets(cat, section, number, __kmp_i18n_default_table.sect[section].str[number]); - }; // if + } if (message == NULL) { message = __kmp_i18n_default_table.sect[section].str[number]; - }; // if - }; // if - }; // if + } + } + } if (message == NULL) { message = no_message_available; - }; // if + } return message; } // func __kmp_i18n_catgets @@ -253,8 +253,8 @@ static UINT get_code_page() { cp = CP_UTF7; } else { // !!! TODO: Issue a warning? - }; // if - }; // if + } + } KMP_INTERNAL_FREE((void *)value); return cp; @@ -268,12 +268,12 @@ static void kmp_i18n_table_free(kmp_i18n_table_t *table) { // Free message. KMP_INTERNAL_FREE((void *)table->sect[s].str[m]); table->sect[s].str[m] = NULL; - }; // for m + } table->sect[s].size = 0; // Free section itself. KMP_INTERNAL_FREE((void *)table->sect[s].str); table->sect[s].str = NULL; - }; // for s + } table->size = 0; KMP_INTERNAL_FREE((void *)table->sect); table->sect = NULL; @@ -297,7 +297,7 @@ void __kmp_i18n_do_catopen() { status = KMP_I18N_ABSENT; // mark catalog as absent so it will not // be re-opened. goto end; - }; // if + } // Construct resource DLL name. /* Simple LoadLibrary( name ) is not suitable due to security issue (see @@ -316,7 +316,7 @@ void __kmp_i18n_do_catopen() { goto end; // TODO: Enable multiple messages (KMP_MSG) to be passed to __kmp_msg; and // print a proper warning. - }; // if + } // Now get path to the our DLL. for (;;) { @@ -324,13 +324,13 @@ void __kmp_i18n_do_catopen() { if (drc == 0) { // Error occurred. status = KMP_I18N_ABSENT; goto end; - }; // if + } if (drc < path.size) { path.used = drc; break; - }; // if + } __kmp_str_buf_reserve(&path, path.size * 2); - }; // forever + } // Now construct the name of message catalog. kmp_str_fname fname; @@ -394,10 +394,9 @@ void __kmp_i18n_do_catopen() { __kmp_msg_null); KMP_INFORM(WillUseDefaultMessages); } // __kmp_generate_warnings - }; // if + } __kmp_str_buf_free(&version); - - }; // if + } code_page = get_code_page(); end: @@ -411,7 +410,7 @@ void __kmp_i18n_catclose() { kmp_i18n_table_free(&table); FreeLibrary(cat); cat = KMP_I18N_NULLCAT; - }; // if + } code_page = default_code_page; status = KMP_I18N_CLOSED; } // func __kmp_i18n_catclose @@ -449,12 +448,12 @@ static int ___strip_crs(char *str) { if (str[in] != '\r') { str[out] = str[in]; ++out; - }; // if + } if (str[in] == 0) { break; - }; // if + } ++in; - }; // forever + } return out - 1; } // func __strip_crs @@ -480,7 +479,7 @@ static char const *___catgets(kmp_i18n_id_t id) { NULL); if (wlen <= 0) { goto end; - }; // if + } wmsg = (wchar_t *)addr; // Warning: wmsg may be not nul-terminated! // Calculate length of multibyte message. @@ -493,7 +492,7 @@ static char const *___catgets(kmp_i18n_id_t id) { ); if (len <= 0) { goto end; - }; // if + } // Allocate memory. msg = (char *)KMP_INTERNAL_MALLOC(len + 1); @@ -507,7 +506,7 @@ static char const *___catgets(kmp_i18n_id_t id) { ); if (rc <= 0 || rc > len) { goto end; - }; // if + } KMP_DEBUG_ASSERT(rc == len); len = rc; msg[len] = 0; // Put terminating null to the end. @@ -519,7 +518,7 @@ static char const *___catgets(kmp_i18n_id_t id) { if (len >= 1 && msg[len - 1] == '\n') { --len; msg[len] = 0; - }; // if + } // Everything looks ok. result = msg; @@ -529,10 +528,10 @@ end: if (msg != NULL) { KMP_INTERNAL_FREE(msg); - }; // if + } if (wmsg != NULL) { LocalFree(wmsg); - }; // if + } return result; @@ -548,35 +547,35 @@ char const *__kmp_i18n_catgets(kmp_i18n_id_t id) { if (1 <= number && number <= __kmp_i18n_default_table.sect[section].size) { if (status == KMP_I18N_CLOSED) { __kmp_i18n_catopen(); - }; // if + } if (cat != KMP_I18N_NULLCAT) { if (table.size == 0) { table.sect = (kmp_i18n_section_t *)KMP_INTERNAL_CALLOC( (__kmp_i18n_default_table.size + 2), sizeof(kmp_i18n_section_t)); table.size = __kmp_i18n_default_table.size; - }; // if + } if (table.sect[section].size == 0) { table.sect[section].str = (const char **)KMP_INTERNAL_CALLOC( __kmp_i18n_default_table.sect[section].size + 2, sizeof(char const *)); table.sect[section].size = __kmp_i18n_default_table.sect[section].size; - }; // if + } if (table.sect[section].str[number] == NULL) { table.sect[section].str[number] = ___catgets(id); - }; // if + } message = table.sect[section].str[number]; - }; // if + } if (message == NULL) { // Catalog is not opened or message is not found, return default // message. message = __kmp_i18n_default_table.sect[section].str[number]; - }; // if - }; // if - }; // if + } + } + } if (message == NULL) { message = no_message_available; - }; // if + } return message; } // func __kmp_i18n_catgets @@ -614,8 +613,8 @@ void __kmp_i18n_dump_catalog(kmp_str_buf_t *buffer) { for (id = (kmp_i18n_id_t)(ranges[range].first + 1); id < ranges[range].last; id = (kmp_i18n_id_t)(id + 1)) { __kmp_str_buf_print(buffer, "%d: <<%s>>\n", id, __kmp_i18n_catgets(id)); - }; // for id - }; // for range + } + } __kmp_printf("%s", buffer->str); @@ -689,17 +688,17 @@ static char *sys_error(int err) { // Strip trailing newlines. while (len > 0 && message[len - 1] == '\n') { --len; - }; // while + } message[len] = 0; } else { // FormatMessage() failed to format system error message. GetLastError() // would give us error code, which we would convert to message... this it // dangerous recursion, which cannot clarify original error, so we will not // even start it. - }; // if + } if (buffer != NULL) { LocalFree(buffer); - }; // if + } #else // Non-Windows* OS: Linux* OS or OS X* @@ -732,7 +731,7 @@ static char *sys_error(int err) { rc = strerror_r(err, buffer, size); if (rc == -1) { rc = errno; // XSI version sets errno. - }; // if + } while (rc == ERANGE) { // ERANGE means the buffer is too small. KMP_INTERNAL_FREE(buffer); size *= 2; @@ -743,13 +742,13 @@ static char *sys_error(int err) { rc = strerror_r(err, buffer, size); if (rc == -1) { rc = errno; // XSI version sets errno. - }; // if - }; // while + } + } if (rc == 0) { message = buffer; } else { // Buffer is unused. Free it. KMP_INTERNAL_FREE(buffer); - }; // if + } #endif @@ -758,7 +757,7 @@ static char *sys_error(int err) { if (message == NULL) { // TODO: I18n this message. message = __kmp_str_format("%s", "(No system error message available)"); - }; // if + } return message; } // sys_error @@ -810,8 +809,8 @@ void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, ...) { case kmp_ms_fatal: { format = kmp_i18n_fmt_Fatal; } break; - default: { KMP_DEBUG_ASSERT(0); }; - }; // switch + default: { KMP_DEBUG_ASSERT(0); } + } fmsg = __kmp_msg_format(format, message.num, message.str); __kmp_str_free(&message.str); __kmp_str_buf_cat(&buffer, fmsg.str, fmsg.len); @@ -823,10 +822,10 @@ void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, ...) { message = va_arg(args, kmp_msg_t); if (message.type == kmp_mt_dummy && message.str == NULL) { break; - }; // if + } if (message.type == kmp_mt_dummy && message.str == __kmp_msg_empty.str) { continue; - }; // if + } switch (message.type) { case kmp_mt_hint: { format = kmp_i18n_fmt_Hint; @@ -834,13 +833,13 @@ void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, ...) { case kmp_mt_syserr: { format = kmp_i18n_fmt_SysErr; } break; - default: { KMP_DEBUG_ASSERT(0); }; - }; // switch + default: { KMP_DEBUG_ASSERT(0); } + } fmsg = __kmp_msg_format(format, message.num, message.str); __kmp_str_free(&message.str); __kmp_str_buf_cat(&buffer, fmsg.str, fmsg.len); __kmp_str_free(&fmsg.str); - }; // forever + } va_end(args); // Print formatted messages. diff --git a/runtime/src/kmp_i18n.h b/runtime/src/kmp_i18n.h index 08db951..d895ca2 100644 --- a/runtime/src/kmp_i18n.h +++ b/runtime/src/kmp_i18n.h @@ -159,7 +159,7 @@ KMP_NORETURN void __kmp_fatal(kmp_msg_t message, ...); { \ if (error) { \ KMP_SYSFAIL(func, error); \ - }; \ + } \ } // Check status, if not zero, generate fatal error message using errno. @@ -168,7 +168,7 @@ KMP_NORETURN void __kmp_fatal(kmp_msg_t message, ...); if (status != 0) { \ int error = errno; \ KMP_SYSFAIL(func, error); \ - }; \ + } \ } #ifdef KMP_DEBUG diff --git a/runtime/src/kmp_io.cpp b/runtime/src/kmp_io.cpp index 61ac1ca..609dd18 100644 --- a/runtime/src/kmp_io.cpp +++ b/runtime/src/kmp_io.cpp @@ -66,7 +66,7 @@ static int is_console(void) { err = GetLastError(); // err == 0 means buffer too short (we suppose console exists). // In Window applications we usually have err == 6 (invalid handle). - }; // if + } return rc > 0 || err == 0; } diff --git a/runtime/src/kmp_itt.cpp b/runtime/src/kmp_itt.cpp index dec5990..313f44e 100644 --- a/runtime/src/kmp_itt.cpp +++ b/runtime/src/kmp_itt.cpp @@ -70,7 +70,7 @@ void __kmp_itt_initialize() { __kmp_version_minor, __kmp_version_build); if (__itt_api_version_ptr != NULL) { __kmp_str_buf_print(&buf, ":%s", __itt_api_version()); - }; // if + } version = __itt_mark_create(buf.str); __itt_mark(version, NULL); __kmp_str_buf_free(&buf); @@ -144,8 +144,8 @@ extern "C" void __itt_error_handler(__itt_error_code err, va_list args) { __kmp_str_free(&err_code.str); } } break; - default: { KMP_WARNING(IttUnknownError, err); }; - }; // switch + default: { KMP_WARNING(IttUnknownError, err); } + } } // __itt_error_handler #endif /* USE_ITT_BUILD */ diff --git a/runtime/src/kmp_itt.inl b/runtime/src/kmp_itt.inl index 3e19e33..01b1ea0 100644 --- a/runtime/src/kmp_itt.inl +++ b/runtime/src/kmp_itt.inl @@ -533,7 +533,7 @@ void *__kmp_itt_barrier_object(int gtid, int bt, int set_name, src = loc->psource; expl = (loc->flags & KMP_IDENT_BARRIER_EXPL) != 0; impl = (loc->flags & KMP_IDENT_BARRIER_IMPL) != 0; - }; // if + } if (impl) { switch (loc->flags & KMP_IDENT_BARRIER_IMPL_MASK) { case KMP_IDENT_BARRIER_IMPL_FOR: { @@ -551,11 +551,11 @@ void *__kmp_itt_barrier_object(int gtid, int bt, int set_name, default: { type = "OMP Implicit Barrier"; KMP_DEBUG_ASSERT(0); - }; - }; /* switch */ + } + } } else if (expl) { type = "OMP Explicit Barrier"; - }; /* if */ + } } break; case bs_forkjoin_barrier: { // In case of fork/join barrier we can read thr->th.th_ident, because it @@ -569,18 +569,17 @@ void *__kmp_itt_barrier_object(int gtid, int bt, int set_name, loc = team->t.t_ident; if (loc != NULL) { src = loc->psource; - }; // if + } type = "OMP Join Barrier"; } break; - }; // switch + } KMP_ITT_DEBUG_LOCK(); __itt_sync_create(object, type, src, __itt_attr_barrier); KMP_ITT_DEBUG_PRINT( "[bar sta] scre( %p, \"%s\", \"%s\", __itt_attr_barrier )\n", object, type, src); - }; // if - - }; // if + } + } #endif return object; } // __kmp_itt_barrier_object @@ -592,7 +591,7 @@ void __kmp_itt_barrier_starting(int gtid, void *object) { KMP_ITT_DEBUG_LOCK(); __itt_sync_releasing(object); KMP_ITT_DEBUG_PRINT("[bar sta] srel( %p )\n", object); - }; // if + } KMP_ITT_DEBUG_LOCK(); __itt_sync_prepare(object); KMP_ITT_DEBUG_PRINT("[bar sta] spre( %p )\n", object); @@ -610,7 +609,7 @@ void __kmp_itt_barrier_middle(int gtid, void *object) { __itt_sync_releasing(object); KMP_ITT_DEBUG_PRINT("[bar mid] srel( %p )\n", object); } else { - }; // if + } #endif } // __kmp_itt_barrier_middle @@ -622,7 +621,7 @@ void __kmp_itt_barrier_finished(int gtid, void *object) { KMP_ITT_DEBUG_LOCK(); __itt_sync_acquired(object); KMP_ITT_DEBUG_PRINT("[bar end] sacq( %p )\n", object); - }; // if + } #endif } // __kmp_itt_barrier_finished @@ -639,7 +638,7 @@ void *__kmp_itt_taskwait_object(int gtid) { object = reinterpret_cast<void *>(kmp_uintptr_t(taskdata) + taskdata->td_taskwait_counter % sizeof(kmp_taskdata_t)); - }; // if + } #endif return object; } // __kmp_itt_taskwait_object @@ -684,7 +683,7 @@ void __kmp_itt_task_starting( KMP_ITT_DEBUG_LOCK(); __itt_sync_cancel(object); KMP_ITT_DEBUG_PRINT("[tsk sta] scan( %p )\n", object); - }; // if + } #endif } // __kmp_itt_task_starting @@ -742,7 +741,7 @@ __kmp_inline void ___kmp_itt_lock_init(kmp_user_lock_p lock, char const *type) { __itt_sync_create(lock, type, src, 0); KMP_ITT_DEBUG_PRINT("[lck ini] scre( %p, \"%s\", \"%s\", 0 )\n", lock, type, src); - }; // if + } #endif } // ___kmp_itt_lock_init #endif // KMP_USE_DYNAMIC_LOCK @@ -883,7 +882,7 @@ void __kmp_itt_single_start(int gtid) { __itt_mark(thr->th.th_itt_mark_single, NULL); KMP_ITT_DEBUG_PRINT("[sin sta] mark( %d, NULL )\n", thr->th.th_itt_mark_single); - }; // if + } #endif } // __kmp_itt_single_start @@ -917,7 +916,7 @@ void __kmp_itt_ordered_init(int gtid) { char const *src = (loc == NULL ? NULL : loc->psource); __itt_sync_create(thr->th.th_dispatch->th_dispatch_sh_current, "OMP Ordered", src, 0); - }; // if + } #endif } // __kmp_itt_ordered_init @@ -928,8 +927,8 @@ void __kmp_itt_ordered_prep(int gtid) { if (!t->t.t_serialized) { kmp_info_t *th = __kmp_thread_from_gtid(gtid); __itt_sync_prepare(th->th.th_dispatch->th_dispatch_sh_current); - }; // if - }; // if + } + } #endif } // __kmp_itt_ordered_prep @@ -940,8 +939,8 @@ void __kmp_itt_ordered_start(int gtid) { if (!t->t.t_serialized) { kmp_info_t *th = __kmp_thread_from_gtid(gtid); __itt_sync_acquired(th->th.th_dispatch->th_dispatch_sh_current); - }; // if - }; // if + } + } #endif } // __kmp_itt_ordered_start @@ -952,8 +951,8 @@ void __kmp_itt_ordered_end(int gtid) { if (!t->t.t_serialized) { kmp_info_t *th = __kmp_thread_from_gtid(gtid); __itt_sync_releasing(th->th.th_dispatch->th_dispatch_sh_current); - }; // if - }; // if + } + } #endif } // __kmp_itt_ordered_end @@ -977,7 +976,7 @@ void __kmp_itt_thread_name(int gtid) { __itt_thr_name_set(name.str, name.used); KMP_ITT_DEBUG_PRINT("[thr nam] name( \"%s\")\n", name.str); __kmp_str_buf_free(&name); - }; // if + } #endif } // __kmp_itt_thread_name diff --git a/runtime/src/kmp_runtime.cpp b/runtime/src/kmp_runtime.cpp index 60325ae..ae639ba 100644 --- a/runtime/src/kmp_runtime.cpp +++ b/runtime/src/kmp_runtime.cpp @@ -418,7 +418,7 @@ void __kmp_abort_process() { if (__kmp_debug_buf) { __kmp_dump_debug_buffer(); - }; // if + } if (KMP_OS_WINDOWS) { // Let other threads know of abnormal termination and prevent deadlock @@ -438,7 +438,7 @@ void __kmp_abort_process() { _exit(3); // Just in case, if signal ignored, exit anyway. } else { abort(); - }; // if + } __kmp_infinite_loop(); __kmp_release_bootstrap_lock(&__kmp_exit_lock); @@ -1081,7 +1081,7 @@ static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team, #if USE_DEBUGGER balign[b].bb.b_worker_arrived = team->t.t_bar[b].b_team_arrived; #endif - }; // for b + } } } @@ -1601,8 +1601,8 @@ int __kmp_fork_call(ident_t *loc, int gtid, int nth = __kmp_omp_num_threads(loc); if (nth > 0) { // 0 means debugger doesn't want to change num threads master_set_numthreads = nth; - }; // if - }; // if + } + } #endif KF_TRACE(10, ("__kmp_fork_call: before internal fork: root=%p, team=%p, " @@ -3051,8 +3051,8 @@ static void __kmp_free_team_arrays(kmp_team_t *team) { if (team->t.t_dispatch[i].th_disp_buffer != NULL) { __kmp_free(team->t.t_dispatch[i].th_disp_buffer); team->t.t_dispatch[i].th_disp_buffer = NULL; - }; // if - }; // for + } + } __kmp_free(team->t.t_threads); __kmp_free(team->t.t_disp_buffer); __kmp_free(team->t.t_dispatch); @@ -3218,7 +3218,7 @@ static void __kmp_initialize_root(kmp_root_t *root) { hot_team_max_nth = hot_team->t.t_max_nproc; for (f = 0; f < hot_team_max_nth; ++f) { hot_team->t.t_threads[f] = NULL; - }; // for + } hot_team->t.t_nproc = 1; // TODO???: hot_team->t.t_max_active_levels = __kmp_dflt_max_active_levels; hot_team->t.t_sched.r_sched_type = r_sched.r_sched_type; @@ -3249,7 +3249,7 @@ static void __kmp_print_structure_team_accum( // Add team to list of teams. KMP_DEBUG_ASSERT(list != NULL); if (team == NULL) { return; - }; // if + } __kmp_print_structure_team_accum(list, team->t.t_parent); __kmp_print_structure_team_accum(list, team->t.t_next_pool); @@ -3258,16 +3258,16 @@ static void __kmp_print_structure_team_accum( // Add team to list of teams. l = list; while (l->next != NULL && l->entry != team) { l = l->next; - }; // while + } if (l->next != NULL) { return; // Team has been added before, exit. - }; // if + } // Team is not found. Search list again for insertion point. l = list; while (l->next != NULL && l->entry->t.t_id <= team->t.t_id) { l = l->next; - }; // while + } // Insert team. { @@ -3287,7 +3287,7 @@ static void __kmp_print_structure_team(char const *title, kmp_team_p const *team __kmp_printf("%2x %p\n", team->t.t_id, team); } else { __kmp_printf(" - (nil)\n"); - }; // if + } } static void __kmp_print_structure_thread(char const *title, @@ -3297,7 +3297,7 @@ static void __kmp_print_structure_thread(char const *title, __kmp_printf("%2d %p\n", thread->th.th_info.ds.ds_gtid, thread); } else { __kmp_printf(" - (nil)\n"); - }; // if + } } void __kmp_print_structure(void) { @@ -3318,12 +3318,12 @@ void __kmp_print_structure(void) { __kmp_printf("%2d", gtid); if (__kmp_threads != NULL) { __kmp_printf(" %p", __kmp_threads[gtid]); - }; // if + } if (__kmp_root != NULL) { __kmp_printf(" %p", __kmp_root[gtid]); - }; // if + } __kmp_printf("\n"); - }; // for gtid + } } // Print out __kmp_threads array. @@ -3352,11 +3352,11 @@ void __kmp_print_structure(void) { __kmp_printf("\n"); __kmp_print_structure_team_accum(list, thread->th.th_team); __kmp_print_structure_team_accum(list, thread->th.th_serial_team); - }; // if - }; // for gtid + } + } } else { __kmp_printf("Threads array is not allocated.\n"); - }; // if + } // Print out __kmp_root array. __kmp_printf("\n------------------------------\nUbers\n----------------------" @@ -3377,11 +3377,11 @@ void __kmp_print_structure(void) { __kmp_printf("\n"); __kmp_print_structure_team_accum(list, root->r.r_root_team); __kmp_print_structure_team_accum(list, root->r.r_hot_team); - }; // if - }; // for gtid + } + } } else { __kmp_printf("Ubers array is not allocated.\n"); - }; // if + } __kmp_printf("\n------------------------------\nTeams\n----------------------" "--------\n"); @@ -3397,11 +3397,11 @@ void __kmp_print_structure(void) { for (i = 0; i < team->t.t_nproc; ++i) { __kmp_printf(" Thread %2d: ", i); __kmp_print_structure_thread("", team->t.t_threads[i]); - }; // for i + } __kmp_print_structure_team(" Next in pool: ", team->t.t_next_pool); __kmp_printf("\n"); list = list->next; - }; // while + } // Print out __kmp_thread_pool and __kmp_team_pool. __kmp_printf("\n------------------------------\nPools\n----------------------" @@ -3417,7 +3417,7 @@ void __kmp_print_structure(void) { kmp_team_list_item_t *item = list; list = list->next; KMP_INTERNAL_FREE(item); - }; // while + } } #endif @@ -3660,7 +3660,7 @@ int __kmp_register_root(int initial_thread) { capacity = __kmp_threads_capacity; if (!initial_thread && TCR_PTR(__kmp_threads[0]) == NULL) { --capacity; - }; // if + } /* see if there are too many threads */ if (__kmp_all_nth >= capacity && !__kmp_expand_threads(1, 1)) { @@ -3672,7 +3672,7 @@ int __kmp_register_root(int initial_thread) { __kmp_fatal(KMP_MSG(CantRegisterNewThread), KMP_HNT(SystemLimitOnThreads), __kmp_msg_null); } - }; // if + } /* find an available thread slot */ /* Don't reassign the zero slot since we need that to only be used by initial @@ -3808,7 +3808,7 @@ int __kmp_register_root(int initial_thread) { #if USE_DEBUGGER root_thread->th.th_bar[b].bb.b_worker_arrived = 0; #endif - }; // for + } } KMP_DEBUG_ASSERT(root->r.r_hot_team->t.t_bar[bs_forkjoin_barrier].b_arrived == KMP_INIT_BARRIER_STATE); @@ -4089,9 +4089,9 @@ static void __kmp_initialize_info(kmp_info_t *this_thr, kmp_team_t *team, __kmp_print_storage_map_gtid( gtid, this_thr->th.th_pri_common, this_thr->th.th_pri_common + 1, sizeof(struct common_table), "th_%d.th_pri_common\n", gtid); - }; // if + } this_thr->th.th_pri_head = NULL; - }; // if + } /* Initialize dynamic dispatch */ { @@ -5784,7 +5784,7 @@ static void __kmp_reap_thread(kmp_info_t *thread, int is_root) { ANNOTATE_HAPPENS_BEFORE(thread); kmp_flag_64 flag(&thread->th.th_bar[bs_forkjoin_barrier].bb.b_go, thread); __kmp_release_64(&flag); - }; // if + } // Terminate OS thread. __kmp_reap_worker(thread); @@ -5808,7 +5808,7 @@ static void __kmp_reap_thread(kmp_info_t *thread, int is_root) { // Decrement # of [worker] threads in the pool. KMP_DEBUG_ASSERT(__kmp_thread_pool_nth > 0); --__kmp_thread_pool_nth; - }; // if + } __kmp_free_implicit_task(thread); @@ -5841,13 +5841,13 @@ static void __kmp_reap_thread(kmp_info_t *thread, int is_root) { if (thread->th.th_cons) { __kmp_free_cons_stack(thread->th.th_cons); thread->th.th_cons = NULL; - }; // if + } } if (thread->th.th_pri_common != NULL) { __kmp_free(thread->th.th_pri_common); thread->th.th_pri_common = NULL; - }; // if + } if (thread->th.th_task_state_memo_stack != NULL) { __kmp_free(thread->th.th_task_state_memo_stack); @@ -5857,14 +5857,14 @@ static void __kmp_reap_thread(kmp_info_t *thread, int is_root) { #if KMP_USE_BGET if (thread->th.th_local.bget_data != NULL) { __kmp_finalize_bget(thread); - }; // if + } #endif #if KMP_AFFINITY_SUPPORTED if (thread->th.th_affin_mask != NULL) { KMP_CPU_FREE(thread->th.th_affin_mask); thread->th.th_affin_mask = NULL; - }; // if + } #endif /* KMP_AFFINITY_SUPPORTED */ __kmp_reap_team(thread->th.th_serial_team); @@ -5943,7 +5943,7 @@ static void __kmp_internal_end(void) { thread->th.th_next_pool = NULL; thread->th.th_in_pool = FALSE; __kmp_reap_thread(thread, 0); - }; // while + } __kmp_thread_pool_insert_pt = NULL; // Reap teams. @@ -5954,7 +5954,7 @@ static void __kmp_internal_end(void) { // Reap it. team->t.t_next_pool = NULL; __kmp_reap_team(team); - }; // while + } __kmp_reap_task_teams(); @@ -6210,7 +6210,7 @@ void __kmp_internal_end_thread(int gtid_req) { __kmp_release_bootstrap_lock(&__kmp_forkjoin_lock); __kmp_release_bootstrap_lock(&__kmp_initz_lock); return; - }; + } } /* now we can safely conduct the actual termination */ @@ -6303,9 +6303,9 @@ void __kmp_register_library_startup(void) { // If not, then we know the other copy of the library is no longer // running. neighbor = 2; - }; // if - }; // if - }; // if + } + } + } switch (neighbor) { case 0: // Cannot parse environment variable -- neighbor status unknown. // Assume it is the incompatible format of future version of the @@ -6320,7 +6320,7 @@ void __kmp_register_library_startup(void) { // That's not allowed. Issue fatal error. __kmp_fatal(KMP_MSG(DuplicateLibrary, KMP_LIBRARY_FILE, file_name), KMP_HNT(DuplicateLibrary), __kmp_msg_null); - }; // if + } KMP_INTERNAL_FREE(duplicate_ok); __kmp_duplicate_library_ok = 1; done = 1; // Exit the loop. @@ -6330,12 +6330,10 @@ void __kmp_register_library_startup(void) { __kmp_env_unset(name); } break; default: { KMP_DEBUG_ASSERT(0); } break; - }; // switch - - }; // if + } + } KMP_INTERNAL_FREE((void *)value); - - }; // while + } KMP_INTERNAL_FREE((void *)name); } // func __kmp_register_library_startup @@ -6350,7 +6348,7 @@ void __kmp_unregister_library(void) { if (value != NULL && strcmp(value, __kmp_registration_str) == 0) { // Ok, this is our variable. Delete it. __kmp_env_unset(name); - }; // if + } KMP_INTERNAL_FREE(__kmp_registration_str); KMP_INTERNAL_FREE(value); @@ -6565,7 +6563,7 @@ static void __kmp_do_serial_initialize(void) { __kmp_i18n_dump_catalog(&buffer); __kmp_printf("%s", buffer.str); __kmp_str_buf_free(&buffer); - }; // if + } __kmp_env_free(&val); #endif @@ -6626,7 +6624,7 @@ static void __kmp_do_serial_initialize(void) { if (rc != 0) { __kmp_fatal(KMP_MSG(FunctionError, "atexit()"), KMP_ERR(rc), __kmp_msg_null); - }; // if + } } #endif @@ -7553,7 +7551,7 @@ void __kmp_aux_set_blocktime(int arg, kmp_info_t *thread, int tid) { void __kmp_aux_set_defaults(char const *str, int len) { if (!__kmp_init_serial) { __kmp_serial_initialize(); - }; + } __kmp_env_initialize(str); if (__kmp_settings diff --git a/runtime/src/kmp_settings.cpp b/runtime/src/kmp_settings.cpp index 4733e28..c4fb9f2 100644 --- a/runtime/src/kmp_settings.cpp +++ b/runtime/src/kmp_settings.cpp @@ -137,8 +137,8 @@ static size_t __kmp_round4k(size_t size) { size &= ~(_4k - 1); if (size <= KMP_SIZE_T_MAX - _4k) { size += _4k; // Round up if there is no overflow. - }; // if - }; // if + } + } return size; } // __kmp_round4k @@ -282,7 +282,7 @@ static void __kmp_stg_parse_bool(char const *name, char const *value, } else { __kmp_msg(kmp_ms_warning, KMP_MSG(BadBoolValue, name, value), KMP_HNT(ValidBoolValues), __kmp_msg_null); - }; // if + } } // __kmp_stg_parse_bool static void __kmp_stg_parse_size(char const *name, char const *value, @@ -297,7 +297,7 @@ static void __kmp_stg_parse_size(char const *name, char const *value, if (value) { if (is_specified != NULL) { *is_specified = 1; - }; // if + } __kmp_str_to_size(value, out, factor, &msg); if (msg == NULL) { if (*out > size_max) { @@ -312,9 +312,9 @@ static void __kmp_stg_parse_size(char const *name, char const *value, if (*out != round4k) { *out = round4k; msg = KMP_I18N_STR(NotMultiple4K); - }; // if + } #endif - }; // if + } } else { // If integer overflow occurred, * out == KMP_SIZE_T_MAX. Cut it to // size_max silently. @@ -322,8 +322,8 @@ static void __kmp_stg_parse_size(char const *name, char const *value, *out = size_max; } else if (*out > size_max) { *out = size_max; - }; // if - }; // if + } + } if (msg != NULL) { // Message is not empty. Print warning. kmp_str_buf_t buf; @@ -332,8 +332,8 @@ static void __kmp_stg_parse_size(char const *name, char const *value, KMP_WARNING(ParseSizeIntWarn, name, value, msg); KMP_INFORM(Using_str_Value, name, buf.str); __kmp_str_buf_free(&buf); - }; // if - }; // if + } + } } // __kmp_stg_parse_size #if KMP_AFFINITY_SUPPORTED @@ -362,7 +362,7 @@ static void __kmp_stg_parse_int( } else if (uint > (unsigned int)max) { msg = KMP_I18N_STR(ValueTooLarge); uint = max; - }; // if + } } else { // If overflow occurred msg contains error message and uint is very big. Cut // tmp it to INT_MAX. @@ -370,8 +370,8 @@ static void __kmp_stg_parse_int( uint = min; } else if (uint > (unsigned int)max) { uint = max; - }; // if - }; // if + } + } if (msg != NULL) { // Message is not empty. Print warning. kmp_str_buf_t buf; @@ -380,7 +380,7 @@ static void __kmp_stg_parse_int( __kmp_str_buf_print(&buf, "%" KMP_UINT64_SPEC "", uint); KMP_INFORM(Using_uint64_Value, name, buf.str); __kmp_str_buf_free(&buf); - }; // if + } *out = uint; } // __kmp_stg_parse_int @@ -581,7 +581,7 @@ static void __kmp_stg_parse_device_thread_limit(char const *name, rc = __kmp_stg_check_rivals(name, value, rivals); if (rc) { return; - }; // if + } if (!__kmp_strcasecmp_with_sentinel("all", value, 0)) { __kmp_max_nth = __kmp_xproc; __kmp_allThreadsSpecified = 1; @@ -647,9 +647,9 @@ static void __kmp_stg_parse_blocktime(char const *name, char const *value, __kmp_msg(kmp_ms_warning, KMP_MSG(LargeValue, name, value), __kmp_msg_null); KMP_INFORM(MaxValueUsing, name, __kmp_dflt_blocktime); - }; // if + } __kmp_env_blocktime = TRUE; // KMP_BLOCKTIME was specified. - }; // if + } #if KMP_USE_MONITOR // calculate number of monitor thread wakeup intervals corresponding to // blocktime. @@ -718,7 +718,7 @@ static void __kmp_stg_parse_wait_policy(char const *name, char const *value, rc = __kmp_stg_check_rivals(name, value, wait->rivals); if (rc) { return; - }; // if + } if (wait->omp) { if (__kmp_str_match("ACTIVE", 1, value)) { @@ -735,7 +735,7 @@ static void __kmp_stg_parse_wait_policy(char const *name, char const *value, } } else { KMP_WARNING(StgInvalidValue, name, value); - }; // if + } } else { if (__kmp_str_match("serial", 1, value)) { /* S */ __kmp_library = library_serial; @@ -749,8 +749,8 @@ static void __kmp_stg_parse_wait_policy(char const *name, char const *value, __kmp_library = library_throughput; } else { KMP_WARNING(StgInvalidValue, name, value); - }; // if - }; // if + } + } __kmp_aux_set_library(__kmp_library); } // __kmp_stg_parse_wait_policy @@ -769,7 +769,7 @@ static void __kmp_stg_print_wait_policy(kmp_str_buf_t *buffer, char const *name, case library_throughput: { value = "PASSIVE"; } break; - }; // switch + } } else { switch (__kmp_library) { case library_serial: { @@ -781,11 +781,11 @@ static void __kmp_stg_print_wait_policy(kmp_str_buf_t *buffer, char const *name, case library_throughput: { value = "throughput"; } break; - }; // switch - }; // if + } + } if (value != NULL) { __kmp_stg_print_str(buffer, name, value); - }; // if + } } // __kmp_stg_print_wait_policy @@ -882,7 +882,7 @@ static void __kmp_stg_parse_stacksize(char const *name, char const *value, rc = __kmp_stg_check_rivals(name, value, stacksize->rivals); if (rc) { return; - }; // if + } __kmp_stg_parse_size(name, // Env var name value, // Env var value __kmp_sys_min_stksize, // Min value @@ -1105,7 +1105,7 @@ static void __kmp_stg_parse_num_threads(char const *name, char const *value, __kmp_dflt_team_nth_ub = __kmp_dflt_team_nth; } } - }; // if + } K_DIAG(1, ("__kmp_dflt_team_nth == %d\n", __kmp_dflt_team_nth)); } // __kmp_stg_parse_num_threads @@ -1311,22 +1311,22 @@ static void __kmp_stg_parse_debug(char const *name, char const *value, __kmp_stg_parse_int(name, value, 0, INT_MAX, &debug); if (kmp_a_debug < debug) { kmp_a_debug = debug; - }; // if + } if (kmp_b_debug < debug) { kmp_b_debug = debug; - }; // if + } if (kmp_c_debug < debug) { kmp_c_debug = debug; - }; // if + } if (kmp_d_debug < debug) { kmp_d_debug = debug; - }; // if + } if (kmp_e_debug < debug) { kmp_e_debug = debug; - }; // if + } if (kmp_f_debug < debug) { kmp_f_debug = debug; - }; // if + } } // __kmp_stg_parse_debug static void __kmp_stg_parse_debug_buf(char const *name, char const *value, @@ -1604,7 +1604,7 @@ static void __kmp_stg_parse_force_reduction(char const *name, char const *value, rc = __kmp_stg_check_rivals(name, value, reduction->rivals); if (rc) { return; - }; // if + } if (reduction->force) { if (value != 0) { if (__kmp_str_match("critical", 0, value)) @@ -1667,7 +1667,7 @@ static void __kmp_stg_parse_storage_map(char const *name, char const *value, } else { __kmp_storage_map_verbose = FALSE; __kmp_stg_parse_bool(name, value, &__kmp_storage_map); // !!! - }; // if + } } // __kmp_stg_parse_storage_map static void __kmp_stg_print_storage_map(kmp_str_buf_t *buffer, char const *name, @@ -1960,7 +1960,7 @@ static void __kmp_parse_affinity_env(char const *name, char const *value, _var = _val; \ } else { \ EMIT_WARN(FALSE, (AffParamDefined, name, start)); \ - }; \ + } \ ++_guard; \ } @@ -1978,7 +1978,7 @@ static void __kmp_parse_affinity_env(char const *name, char const *value, *out_gran_levels = levels; \ } else { \ EMIT_WARN(FALSE, (AffParamDefined, name, start)); \ - }; \ + } \ ++gran; \ } @@ -2157,7 +2157,7 @@ static void __kmp_parse_affinity_env(char const *name, char const *value, number[count] = n; } else { KMP_WARNING(AffManyParams, name, start); - }; // if + } ++count; } else { EMIT_WARN(TRUE, (AffInvalidParam, name, start)); @@ -2205,18 +2205,18 @@ static void __kmp_parse_affinity_env(char const *name, char const *value, case affinity_physical: { if (count > 0) { *out_offset = number[0]; - }; // if + } if (count > 1) { KMP_WARNING(AffManyParamsForLogic, name, number[1]); - }; // if + } } break; case affinity_balanced: { if (count > 0) { *out_compact = number[0]; - }; // if + } if (count > 1) { *out_offset = number[1]; - }; // if + } if (__kmp_affinity_gran == affinity_gran_default) { #if KMP_MIC_SUPPORTED @@ -2239,10 +2239,10 @@ static void __kmp_parse_affinity_env(char const *name, char const *value, case affinity_compact: { if (count > 0) { *out_compact = number[0]; - }; // if + } if (count > 1) { *out_offset = number[1]; - }; // if + } } break; case affinity_explicit: { if (*out_proclist == NULL) { @@ -2256,20 +2256,20 @@ static void __kmp_parse_affinity_env(char const *name, char const *value, case affinity_none: { if (count > 0) { KMP_WARNING(AffNoParam, name, "none"); - }; // if + } } break; case affinity_disabled: { if (count > 0) { KMP_WARNING(AffNoParam, name, "disabled"); - }; // if + } } break; case affinity_default: { if (count > 0) { KMP_WARNING(AffNoParam, name, "default"); - }; // if + } } break; - default: { KMP_ASSERT(0); }; - }; // switch + default: { KMP_ASSERT(0); } + } } // __kmp_parse_affinity_env static void __kmp_stg_parse_affinity(char const *name, char const *value, @@ -3262,7 +3262,7 @@ static void __kmp_stg_parse_ld_balance_interval(char const *name, __kmp_load_balance_interval = interval; } else { KMP_WARNING(StgInvalidValue, name, value); - }; // if + } } // __kmp_stg_parse_load_balance_interval static void __kmp_stg_print_ld_balance_interval(kmp_str_buf_t *buffer, @@ -3283,7 +3283,7 @@ static void __kmp_stg_parse_init_at_fork(char const *name, char const *value, __kmp_stg_parse_bool(name, value, &__kmp_need_register_atfork); if (__kmp_need_register_atfork) { __kmp_need_register_atfork_specified = TRUE; - }; + } } // __kmp_stg_parse_init_at_fork static void __kmp_stg_print_init_at_fork(kmp_str_buf_t *buffer, @@ -3343,7 +3343,7 @@ static void __kmp_stg_parse_schedule(char const *name, char const *value, KMP_WARNING(EmptyClause, name); } while ((value = semicolon ? semicolon + 1 : NULL)); } - }; // if + } } // __kmp_stg_parse__schedule @@ -3519,7 +3519,7 @@ static void __kmp_stg_parse_atomic_mode(char const *name, char const *value, // 0 rather that max value. if (mode > 0) { __kmp_atomic_mode = mode; - }; // if + } } // __kmp_stg_parse_atomic_mode static void __kmp_stg_print_atomic_mode(kmp_str_buf_t *buffer, char const *name, @@ -3543,7 +3543,7 @@ static void __kmp_stg_parse_consistency_check(char const *name, __kmp_env_consistency_check = FALSE; } else { KMP_WARNING(StgInvalidValue, name, value); - }; // if + } } // __kmp_stg_parse_consistency_check static void __kmp_stg_print_consistency_check(kmp_str_buf_t *buffer, @@ -3718,7 +3718,7 @@ static void __kmp_stg_parse_gtid_mode(char const *name, char const *value, } else { __kmp_gtid_mode = mode; __kmp_adjust_gtid_mode = FALSE; - }; // if + } } // __kmp_str_parse_gtid_mode static void __kmp_stg_print_gtid_mode(kmp_str_buf_t *buffer, char const *name, @@ -4613,9 +4613,9 @@ static inline kmp_setting_t *__kmp_stg_find(char const *name) { for (i = 0; i < __kmp_stg_count; ++i) { if (strcmp(__kmp_stg_table[i].name, name) == 0) { return &__kmp_stg_table[i]; - }; // if - }; // for - }; // if + } + } + } return NULL; } // __kmp_stg_find @@ -4675,7 +4675,7 @@ static void __kmp_stg_init(void) { #ifdef KMP_GOMP_COMPAT if (gomp_stacksize != NULL) { rivals[i++] = gomp_stacksize; - }; // if + } #endif rivals[i++] = omp_stacksize; rivals[i++] = NULL; @@ -4684,7 +4684,7 @@ static void __kmp_stg_init(void) { #ifdef KMP_GOMP_COMPAT if (gomp_stacksize != NULL) { gomp_stacksize->data = &gomp_data; - }; // if + } #endif omp_stacksize->data = &omp_data; } @@ -4704,13 +4704,13 @@ static void __kmp_stg_init(void) { rivals[i++] = kmp_library; if (omp_wait_policy != NULL) { rivals[i++] = omp_wait_policy; - }; // if + } rivals[i++] = NULL; kmp_library->data = &kmp_data; if (omp_wait_policy != NULL) { omp_wait_policy->data = &omp_data; - }; // if + } } { // Initialize KMP_DEVICE_THREAD_LIMIT and KMP_ALL_THREADS @@ -4800,23 +4800,23 @@ static void __kmp_stg_init(void) { rivals[i++] = kmp_force_red; if (kmp_determ_red != NULL) { rivals[i++] = kmp_determ_red; - }; // if + } rivals[i++] = NULL; kmp_force_red->data = &force_data; if (kmp_determ_red != NULL) { kmp_determ_red->data = &determ_data; - }; // if + } } initialized = 1; - }; // if + } // Reset flags. int i; for (i = 0; i < __kmp_stg_count; ++i) { __kmp_stg_table[i].set = 0; - }; // for + } } // __kmp_stg_init @@ -4826,15 +4826,15 @@ static void __kmp_stg_parse(char const *name, char const *value) { // "=C:=C\\\x00=D:=D:\\\x00...", so let us skip them. if (name[0] == 0) { return; - }; // if + } if (value != NULL) { kmp_setting_t *setting = __kmp_stg_find(name); if (setting != NULL) { setting->parse(name, value, setting->data); setting->defined = 1; - }; // if - }; // if + } + } } // __kmp_stg_parse @@ -4864,13 +4864,13 @@ static int __kmp_stg_check_rivals( // 0 -- Ok, 1 -- errors found. if (rivals[i]->set) { KMP_WARNING(StgIgnored, name, rivals[i]->name); return 1; - }; // if - }; // while + } + } ++i; // Skip current setting. return 0; -}; // __kmp_stg_check_rivals +} // __kmp_stg_check_rivals static int __kmp_env_toPrint(char const *name, int flag) { int rc = 0; @@ -4879,8 +4879,8 @@ static int __kmp_env_toPrint(char const *name, int flag) { rc = setting->defined; if (flag >= 0) { setting->defined = flag; - }; // if - }; // if + } + } return rc; } @@ -4926,7 +4926,7 @@ void __kmp_env_initialize(char const *string) { // __kmp_max_nth = __kmp_sys_max_nth; __kmp_threads_capacity = __kmp_initial_threads_capacity(__kmp_dflt_team_nth_ub); - }; // if + } __kmp_env_blk_init(&block, string); // update the set flag on all entries that have an env var @@ -4941,7 +4941,7 @@ void __kmp_env_initialize(char const *string) { if (setting != NULL) { setting->set = 1; } - }; // for i + } // We need to know if blocktime was set when processing OMP_WAIT_POLICY blocktime_str = __kmp_env_blk_var(&block, "KMP_BLOCKTIME"); @@ -4952,7 +4952,7 @@ void __kmp_env_initialize(char const *string) { char const *name = "KMP_WARNINGS"; char const *value = __kmp_env_blk_var(&block, name); __kmp_stg_parse(name, value); - }; // if + } #if KMP_AFFINITY_SUPPORTED // Special case. KMP_AFFINITY is not a rival to other affinity env vars @@ -5035,7 +5035,7 @@ void __kmp_env_initialize(char const *string) { // Now process all of the settings. for (i = 0; i < block.count; ++i) { __kmp_stg_parse(block.vars[i].name, block.vars[i].value); - }; // for i + } // If user locks have been allocated yet, don't reset the lock vptr table. if (!__kmp_init_user_locks) { @@ -5296,7 +5296,7 @@ void __kmp_env_initialize(char const *string) { if (__kmp_version) { __kmp_print_version_1(); - }; // if + } // Post-initialization step: some env. vars need their value's further // processing @@ -5334,8 +5334,8 @@ void __kmp_env_print() { #endif // KMP_GOMP_COMPAT ) { __kmp_str_buf_print(&buffer, " %s=%s\n", name, value); - }; // if - }; // for + } + } __kmp_str_buf_print(&buffer, "\n"); // Print internal (effective) settings. @@ -5344,8 +5344,8 @@ void __kmp_env_print() { if (__kmp_stg_table[i].print != NULL) { __kmp_stg_table[i].print(&buffer, __kmp_stg_table[i].name, __kmp_stg_table[i].data); - }; // if - }; // for + } + } __kmp_printf("%s", buffer.str); @@ -5380,8 +5380,8 @@ void __kmp_env_print_2() { __kmp_display_env_verbose)) { __kmp_stg_table[i].print(&buffer, __kmp_stg_table[i].name, __kmp_stg_table[i].data); - }; // if - }; // for + } + } __kmp_str_buf_print(&buffer, "%s\n", KMP_I18N_STR(DisplayEnvEnd)); __kmp_str_buf_print(&buffer, "\n"); diff --git a/runtime/src/kmp_stats_timing.h b/runtime/src/kmp_stats_timing.h index 69195b9..9ffd6fb 100644 --- a/runtime/src/kmp_stats_timing.h +++ b/runtime/src/kmp_stats_timing.h @@ -34,7 +34,7 @@ public: explicit tsc_interval_t(int64_t _value) : value(_value) {} public: - tsc_interval_t() : value(0){}; // Construct 0 time duration + tsc_interval_t() : value(0) {} // Construct 0 time duration #if KMP_HAVE_TICK_TIME double seconds() const; // Return the length of a time interval in seconds #endif @@ -59,11 +59,11 @@ public: tsc_tick_count() : my_count(static_cast<int64_t>(__builtin_readcyclecounter())) {} #elif KMP_HAVE___RDTSC - tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())){}; + tsc_tick_count() : my_count(static_cast<int64_t>(__rdtsc())){} #else #error Must have high resolution timer defined #endif - tsc_tick_count(int64_t value) : my_count(value){}; + tsc_tick_count(int64_t value) : my_count(value){} int64_t getValue() const { return my_count; } tsc_tick_count later(tsc_tick_count const other) const { return my_count > other.my_count ? (*this) : other; diff --git a/runtime/src/kmp_str.cpp b/runtime/src/kmp_str.cpp index 75d33df..ed1bc3f 100644 --- a/runtime/src/kmp_str.cpp +++ b/runtime/src/kmp_str.cpp @@ -76,7 +76,7 @@ void __kmp_str_buf_clear(kmp_str_buf_t *buffer) { if (buffer->used > 0) { buffer->used = 0; buffer->str[0] = 0; - }; // if + } KMP_STR_BUF_INVARIANT(buffer); } // __kmp_str_buf_clear @@ -95,16 +95,15 @@ void __kmp_str_buf_reserve(kmp_str_buf_t *buffer, int size) { buffer->str = (char *)KMP_INTERNAL_MALLOC(buffer->size); if (buffer->str == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if + } KMP_MEMCPY_S(buffer->str, buffer->size, buffer->bulk, buffer->used + 1); } else { buffer->str = (char *)KMP_INTERNAL_REALLOC(buffer->str, buffer->size); if (buffer->str == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if - }; // if - - }; // if + } + } + } KMP_DEBUG_ASSERT(buffer->size > 0); KMP_DEBUG_ASSERT(buffer->size >= (unsigned)size); @@ -119,16 +118,16 @@ void __kmp_str_buf_detach(kmp_str_buf_t *buffer) { buffer->str = (char *)KMP_INTERNAL_MALLOC(buffer->size); if (buffer->str == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if + } KMP_MEMCPY_S(buffer->str, buffer->size, buffer->bulk, buffer->used + 1); - }; // if + } } // __kmp_str_buf_detach void __kmp_str_buf_free(kmp_str_buf_t *buffer) { KMP_STR_BUF_INVARIANT(buffer); if (buffer->size > sizeof(buffer->bulk)) { KMP_INTERNAL_FREE(buffer->str); - }; // if + } buffer->str = buffer->bulk; buffer->size = sizeof(buffer->bulk); buffer->used = 0; @@ -182,7 +181,7 @@ void __kmp_str_buf_vprint(kmp_str_buf_t *buffer, char const *format, if (rc >= 0 && rc < free) { buffer->used += rc; break; - }; // if + } // Error occurred, buffer is too small. if (rc >= 0) { @@ -191,13 +190,13 @@ void __kmp_str_buf_vprint(kmp_str_buf_t *buffer, char const *format, } else { // Older implementations just return -1. Double buffer size. size = buffer->size * 2; - }; // if + } // Enlarge buffer. __kmp_str_buf_reserve(buffer, size); // And try again. - }; // forever + } KMP_DEBUG_ASSERT(buffer->size > 0); KMP_STR_BUF_INVARIANT(buffer); @@ -220,8 +219,8 @@ void __kmp_str_buf_print_size(kmp_str_buf_t *buf, size_t size) { while ((size % 1024 == 0) && (u + 1 < units)) { size = size / 1024; ++u; - }; // while - }; // if + } + } __kmp_str_buf_print(buf, "%" KMP_SIZE_T_SPEC "%s", size, names[u]); } // __kmp_str_buf_print_size @@ -240,7 +239,7 @@ void __kmp_str_fname_init(kmp_str_fname_t *fname, char const *path) { // strdup with __kmp_str_format(). if (KMP_OS_WINDOWS) { __kmp_str_replace(fname->path, '\\', '/'); - }; // if + } fname->dir = __kmp_str_format("%s", fname->path); slash = strrchr(fname->dir, '/'); if (KMP_OS_WINDOWS && @@ -248,12 +247,12 @@ void __kmp_str_fname_init(kmp_str_fname_t *fname, char const *path) { char first = TOLOWER(fname->dir[0]); // look for drive. if ('a' <= first && first <= 'z' && fname->dir[1] == ':') { slash = &fname->dir[1]; - }; // if - }; // if + } + } base = (slash == NULL ? fname->dir : slash + 1); fname->base = __kmp_str_format("%s", base); // Copy basename *base = 0; // and truncate dir. - }; // if + } } // kmp_str_fname_init @@ -275,7 +274,7 @@ int __kmp_str_fname_match(kmp_str_fname_t const *fname, char const *pattern) { base_match = strcmp(ptrn.base, "*") == 0 || (fname->base != NULL && __kmp_str_eqf(fname->base, ptrn.base)); __kmp_str_fname_free(&ptrn); - }; // if + } return dir_match && base_match; } // __kmp_str_fname_match @@ -311,16 +310,15 @@ kmp_str_loc_t __kmp_str_loc_init(char const *psource, int init_fname) { loc.line = atoi(line); if (loc.line < 0) { loc.line = 0; - }; // if - }; // if + } + } if (col != NULL) { loc.col = atoi(col); if (loc.col < 0) { loc.col = 0; - }; // if - }; // if - - }; // if + } + } + } __kmp_str_fname_init(&loc.fname, init_fname ? loc.file : NULL); @@ -395,7 +393,7 @@ char *__kmp_str_format( // Allocated string. buffer = (char *)KMP_INTERNAL_MALLOC(size); if (buffer == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if + } for (;;) { // Try to format string. @@ -406,7 +404,7 @@ char *__kmp_str_format( // Allocated string. // No errors, string has been formatted. if (rc >= 0 && rc < size) { break; - }; // if + } // Error occurred, buffer is too small. if (rc >= 0) { @@ -416,14 +414,14 @@ char *__kmp_str_format( // Allocated string. } else { // Older implementations just return -1. size = size * 2; - }; // if + } // Enlarge buffer and try again. buffer = (char *)KMP_INTERNAL_REALLOC(buffer, size); if (buffer == NULL) { KMP_FATAL(MemoryAllocFailed); - }; // if - }; // forever + } + } return buffer; } // func __kmp_str_format @@ -443,12 +441,12 @@ int __kmp_str_match(char const *target, int len, char const *data) { int i; if (target == NULL || data == NULL) { return FALSE; - }; // if + } for (i = 0; target[i] && data[i]; ++i) { if (TOLOWER(target[i]) != TOLOWER(data[i])) { return FALSE; - }; // if - }; // for i + } + } return ((len > 0) ? i >= len : (!target[i] && (len || !data[i]))); } // __kmp_str_match @@ -475,7 +473,7 @@ void __kmp_str_replace(char *str, char search_for, char replace_with) { while (found) { *found = replace_with; found = strchr(found + 1, search_for); - }; // while + } } // __kmp_str_replace void __kmp_str_split(char *str, // I: String to split. @@ -490,14 +488,14 @@ void __kmp_str_split(char *str, // I: String to split. if (ptr != NULL) { *ptr = 0; t = ptr + 1; - }; // if - }; // if + } + } if (head != NULL) { *head = h; - }; // if + } if (tail != NULL) { *tail = t; - }; // if + } } // __kmp_str_split /* strtok_r() is not available on Windows* OS. This function reimplements @@ -512,7 +510,7 @@ char *__kmp_str_token( // On Windows* OS there is no strtok_r() function. Let us implement it. if (str != NULL) { *buf = str; // First call, initialize buf. - }; // if + } *buf += strspn(*buf, delim); // Skip leading delimiters. if (**buf != 0) { // Rest of the string is not yet empty. token = *buf; // Use it as result. @@ -520,14 +518,14 @@ char *__kmp_str_token( if (**buf != 0) { // Rest of the string is not yet empty. **buf = 0; // Terminate token here. *buf += 1; // Advance buf to start with the next token next time. - }; // if - }; // if + } + } #else // On Linux* OS and OS X*, strtok_r() is available. Let us use it. token = strtok_r(str, delim, buf); #endif return token; -}; // __kmp_str_token +} // __kmp_str_token int __kmp_str_to_int(char const *str, char sentinel) { int result, factor; @@ -601,13 +599,13 @@ void __kmp_str_to_size( // R: Error code. // Skip spaces. while (str[i] == ' ' || str[i] == '\t') { ++i; - }; // while + } // Parse number. if (str[i] < '0' || str[i] > '9') { *error = KMP_I18N_STR(NotANumber); return; - }; // if + } do { digit = str[i] - '0'; overflow = overflow || (value > (KMP_SIZE_T_MAX - digit) / 10); @@ -618,7 +616,7 @@ void __kmp_str_to_size( // R: Error code. // Skip spaces. while (str[i] == ' ' || str[i] == '\t') { ++i; - }; // while + } // Parse unit. #define _case(ch, exp) \ @@ -630,7 +628,7 @@ void __kmp_str_to_size( // R: Error code. factor = (size_t)(1) << shift; \ } else { \ overflow = 1; \ - }; \ + } \ } break; switch (str[i]) { _case('k', 1); // Kilo @@ -642,18 +640,18 @@ void __kmp_str_to_size( // R: Error code. _case('z', 7); // Zetta _case('y', 8); // Yotta // Oops. No more units... - }; // switch + } #undef _case if (str[i] == 'b' || str[i] == 'B') { // Skip optional "b". if (factor == 0) { factor = 1; } ++i; - }; // if + } if (!(str[i] == ' ' || str[i] == '\t' || str[i] == 0)) { // Bad unit *error = KMP_I18N_STR(BadUnit); return; - }; // if + } if (factor == 0) { factor = dfactor; @@ -666,18 +664,18 @@ void __kmp_str_to_size( // R: Error code. // Skip spaces. while (str[i] == ' ' || str[i] == '\t') { ++i; - }; // while + } if (str[i] != 0) { *error = KMP_I18N_STR(IllegalCharacters); return; - }; // if + } if (overflow) { *error = KMP_I18N_STR(ValueTooLarge); *out = KMP_SIZE_T_MAX; return; - }; // if + } *error = NULL; *out = value; @@ -698,13 +696,13 @@ void __kmp_str_to_uint( // R: Error code. // Skip spaces. while (str[i] == ' ' || str[i] == '\t') { ++i; - }; // while + } // Parse number. if (str[i] < '0' || str[i] > '9') { *error = KMP_I18N_STR(NotANumber); return; - }; // if + } do { digit = str[i] - '0'; overflow = overflow || (value > (KMP_SIZE_T_MAX - digit) / 10); @@ -715,18 +713,18 @@ void __kmp_str_to_uint( // R: Error code. // Skip spaces. while (str[i] == ' ' || str[i] == '\t') { ++i; - }; // while + } if (str[i] != 0) { *error = KMP_I18N_STR(IllegalCharacters); return; - }; // if + } if (overflow) { *error = KMP_I18N_STR(ValueTooLarge); *out = (kmp_uint64)-1; return; - }; // if + } *error = NULL; *out = value; diff --git a/runtime/src/kmp_stub.cpp b/runtime/src/kmp_stub.cpp index a0912ab..6f922ba 100644 --- a/runtime/src/kmp_stub.cpp +++ b/runtime/src/kmp_stub.cpp @@ -72,13 +72,13 @@ static size_t __kmps_init() { BOOL status = QueryPerformanceFrequency(&freq); if (status) { frequency = double(freq.QuadPart); - }; // if + } #endif initialized = 1; - }; // if + } return dummy; -}; // __kmps_init +} // __kmps_init #define i __kmps_init(); @@ -272,8 +272,8 @@ double __kmps_get_wtime(void) { BOOL status = QueryPerformanceCounter(&now); if (status) { wtime = double(now.QuadPart) / frequency; - }; // if - }; // if + } + } #else // gettimeofday() returns seconds and microseconds since the Epoch. struct timeval tval; @@ -283,10 +283,10 @@ double __kmps_get_wtime(void) { wtime = (double)(tval.tv_sec) + 1.0E-06 * (double)(tval.tv_usec); } else { // TODO: Assert or abort here. - }; // if + } #endif return wtime; -}; // __kmps_get_wtime +} // __kmps_get_wtime double __kmps_get_wtick(void) { // Number of seconds between successive clock ticks. @@ -304,13 +304,13 @@ double __kmps_get_wtick(void) { } else { // TODO: Assert or abort here. wtick = 1.0E-03; - }; // if + } } #else // TODO: gettimeofday() returns in microseconds, but what the precision? wtick = 1.0E-06; #endif return wtick; -}; // __kmps_get_wtick +} // __kmps_get_wtick // end of file // diff --git a/runtime/src/kmp_tasking.cpp b/runtime/src/kmp_tasking.cpp index e120fa8..370260e 100644 --- a/runtime/src/kmp_tasking.cpp +++ b/runtime/src/kmp_tasking.cpp @@ -914,8 +914,8 @@ static size_t __kmp_round_up_to_val(size_t size, size_t val) { size &= ~(val - 1); if (size <= KMP_SIZE_T_MAX - val) { size += val; // Round up if there is no overflow. - }; // if - }; // if + } + } return size; } // __kmp_round_up_to_va diff --git a/runtime/src/kmp_utility.cpp b/runtime/src/kmp_utility.cpp index 860d4a4..063b2a1 100644 --- a/runtime/src/kmp_utility.cpp +++ b/runtime/src/kmp_utility.cpp @@ -103,7 +103,7 @@ static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz. if (frequency == NULL) { return result; - }; // if + } value = strtod(frequency, CCAST(char **, &unit)); // strtod() does not like "const" if (0 < value && @@ -116,12 +116,12 @@ static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz. value = value * 1.0E+12; } else { // Wrong unit. return result; - }; // if + } result = value; - }; // if + } return result; -}; // func __kmp_parse_cpu_frequency +} // func __kmp_parse_cpu_frequency void __kmp_query_cpuid(kmp_cpuinfo_t *p) { struct kmp_cpuid buf; @@ -171,7 +171,7 @@ void __kmp_query_cpuid(kmp_cpuinfo_t *p) { for (t = buf.ebx, i = 0; i < 4; t >>= 8, ++i) { data[i] = (t & 0xff); - }; // for + } p->sse2 = (buf.edx >> 26) & 1; @@ -270,7 +270,7 @@ void __kmp_query_cpuid(kmp_cpuinfo_t *p) { KA_TRACE(trace_level, (" RTM")); } #endif - }; // if + } { // Parse CPU brand string for frequency, saving the string for later. int i; @@ -279,7 +279,7 @@ void __kmp_query_cpuid(kmp_cpuinfo_t *p) { // Get CPU brand string. for (i = 0; i < 3; ++i) { __kmp_x86_cpuid(0x80000002 + i, 0, base + i); - }; // for + } p->name[sizeof(p->name) - 1] = 0; // Just in case. ;-) KA_TRACE(trace_level, ("cpu brand string: \"%s\"\n", &p->name[0])); diff --git a/runtime/src/kmp_version.cpp b/runtime/src/kmp_version.cpp index 57720e5..55a6994 100644 --- a/runtime/src/kmp_version.cpp +++ b/runtime/src/kmp_version.cpp @@ -130,7 +130,7 @@ static int __kmp_version_1_printed = FALSE; void __kmp_print_version_1(void) { if (__kmp_version_1_printed) { return; - }; // if + } __kmp_version_1_printed = TRUE; #ifndef KMP_STUB @@ -167,7 +167,7 @@ void __kmp_print_version_1(void) { KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i], __kmp_barrier_gather_branch_bits[i], __kmp_barrier_release_branch_bits[i]); // __kmp_str_buf_print - }; // for i + } for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) { __kmp_str_buf_print( &buffer, "%s%s barrier pattern: gather=%s, release=%s\n", @@ -175,7 +175,7 @@ void __kmp_print_version_1(void) { __kmp_barrier_pattern_name[__kmp_barrier_gather_pattern[i]], __kmp_barrier_pattern_name [__kmp_barrier_release_pattern[i]]); // __kmp_str_buf_print - }; // for i + } __kmp_str_buf_print(&buffer, "%s\n", &__kmp_version_lock[KMP_VERSION_MAGIC_LEN]); #endif @@ -201,7 +201,7 @@ static int __kmp_version_2_printed = FALSE; void __kmp_print_version_2(void) { if (__kmp_version_2_printed) { return; - }; // if + } __kmp_version_2_printed = TRUE; } // __kmp_print_version_2 diff --git a/runtime/src/z_Linux_util.cpp b/runtime/src/z_Linux_util.cpp index 5735de5..2c128d5 100644 --- a/runtime/src/z_Linux_util.cpp +++ b/runtime/src/z_Linux_util.cpp @@ -435,7 +435,7 @@ void __kmp_terminate_thread(int gtid) { if (status != 0 && status != ESRCH) { __kmp_fatal(KMP_MSG(CantTerminateWorkerThread), KMP_ERR(status), __kmp_msg_null); - }; // if + } #endif __kmp_yield(TRUE); } // @@ -635,7 +635,7 @@ static void *__kmp_launch_monitor(void *thr) { if (__kmp_generate_warnings == kmp_warnings_off) { __kmp_str_free(&err_code.str); } - }; // if + } } else { // We cannot abort here, because number of CPUs may be enough for all // the threads, including the monitor thread, so application could @@ -643,8 +643,8 @@ static void *__kmp_launch_monitor(void *thr) { __kmp_msg(kmp_ms_warning, KMP_MSG(RunningAtMaxPriority), KMP_MSG(MonitorWillStarve), KMP_HNT(RunningAtMaxPriority), __kmp_msg_null); - }; // if - }; // if + } + } // AC: free thread that waits for monitor started TCW_4(__kmp_global.g.g_time.dt.t_value, 0); } @@ -698,9 +698,9 @@ static void *__kmp_launch_monitor(void *thr) { if (status != 0) { if (status != ETIMEDOUT && status != EINTR) { KMP_SYSFAIL("pthread_cond_timedwait", status); - }; - }; - }; + } + } + } status = pthread_mutex_unlock(&__kmp_wait_mx.m_mutex); KMP_CHECK_SYSFAIL("pthread_mutex_unlock", status); @@ -799,7 +799,7 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { __kmp_set_stack_info(gtid, th); __kmp_check_stack_overlap(th); return; - }; // if + } KA_TRACE(10, ("__kmp_create_worker: try to create thread (%d)\n", gtid)); @@ -809,11 +809,11 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { status = pthread_attr_init(&thread_attr); if (status != 0) { __kmp_fatal(KMP_MSG(CantInitThreadAttrs), KMP_ERR(status), __kmp_msg_null); - }; // if + } status = pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE); if (status != 0) { __kmp_fatal(KMP_MSG(CantSetWorkerState), KMP_ERR(status), __kmp_msg_null); - }; // if + } /* Set stack size for this thread now. The multiple of 2 is there because on some machines, requesting an unusual @@ -840,13 +840,13 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { "bytes\n", gtid, KMP_DEFAULT_STKSIZE, __kmp_stksize, stack_size)); status = pthread_attr_setstacksize(&thread_attr, stack_size); - }; // if - }; // if + } + } #endif /* KMP_BACKUP_STKSIZE */ if (status != 0) { __kmp_fatal(KMP_MSG(CantSetWorkerStackSize, stack_size), KMP_ERR(status), KMP_HNT(ChangeWorkerStackSize), __kmp_msg_null); - }; // if + } #endif /* _POSIX_THREAD_ATTR_STACKSIZE */ #endif /* KMP_THREAD_ATTR */ @@ -858,18 +858,18 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { if (status == EINVAL) { __kmp_fatal(KMP_MSG(CantSetWorkerStackSize, stack_size), KMP_ERR(status), KMP_HNT(IncreaseWorkerStackSize), __kmp_msg_null); - }; + } if (status == ENOMEM) { __kmp_fatal(KMP_MSG(CantSetWorkerStackSize, stack_size), KMP_ERR(status), KMP_HNT(DecreaseWorkerStackSize), __kmp_msg_null); - }; + } #endif /* _POSIX_THREAD_ATTR_STACKSIZE */ if (status == EAGAIN) { __kmp_fatal(KMP_MSG(NoResourcesForWorkerThread), KMP_ERR(status), KMP_HNT(Decrease_NUM_THREADS), __kmp_msg_null); - }; // if + } KMP_SYSFAIL("pthread_create", status); - }; // if + } th->th.th_info.ds.ds_thread = handle; @@ -882,7 +882,7 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { if (__kmp_generate_warnings == kmp_warnings_off) { __kmp_str_free(&err_code.str); } - }; // if + } #endif /* KMP_THREAD_ATTR */ KMP_MB(); /* Flush all pending memory write invalidates. */ @@ -928,11 +928,11 @@ void __kmp_create_monitor(kmp_info_t *th) { status = pthread_attr_init(&thread_attr); if (status != 0) { __kmp_fatal(KMP_MSG(CantInitThreadAttrs), KMP_ERR(status), __kmp_msg_null); - }; // if + } status = pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE); if (status != 0) { __kmp_fatal(KMP_MSG(CantSetMonitorState), KMP_ERR(status), __kmp_msg_null); - }; // if + } #ifdef _POSIX_THREAD_ATTR_STACKSIZE status = pthread_attr_getstacksize(&thread_attr, &size); @@ -972,7 +972,7 @@ retry: if (__kmp_generate_warnings == kmp_warnings_off) { __kmp_str_free(&err_code.str); } - }; // if + } #endif /* _POSIX_THREAD_ATTR_STACKSIZE */ status = @@ -988,19 +988,19 @@ retry: __kmp_fatal(KMP_MSG(CantSetMonitorStackSize, __kmp_monitor_stksize), KMP_ERR(status), KMP_HNT(IncreaseMonitorStackSize), __kmp_msg_null); - }; // if + } if (status == ENOMEM) { __kmp_fatal(KMP_MSG(CantSetMonitorStackSize, __kmp_monitor_stksize), KMP_ERR(status), KMP_HNT(DecreaseMonitorStackSize), __kmp_msg_null); - }; // if + } #endif /* _POSIX_THREAD_ATTR_STACKSIZE */ if (status == EAGAIN) { __kmp_fatal(KMP_MSG(NoResourcesForMonitorThread), KMP_ERR(status), KMP_HNT(DecreaseNumberOfThreadsInUse), __kmp_msg_null); - }; // if + } KMP_SYSFAIL("pthread_create", status); - }; // if + } th->th.th_info.ds.ds_thread = handle; @@ -1021,7 +1021,7 @@ retry: if (__kmp_generate_warnings == kmp_warnings_off) { __kmp_str_free(&err_code.str); } - }; // if + } #endif KMP_MB(); /* Flush all pending memory write invalidates. */ @@ -1054,7 +1054,7 @@ void __kmp_reap_monitor(kmp_info_t *th) { if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { KA_TRACE(10, ("__kmp_reap_monitor: monitor did not start, returning\n")); return; - }; // if + } KMP_MB(); /* Flush all pending memory write invalidates. */ @@ -1138,7 +1138,7 @@ static void __kmp_team_handler(int signo) { case SIGTERM: if (__kmp_debug_buf) { __kmp_dump_debug_buffer(); - }; // if + } KMP_MB(); // Flush all pending memory write invalidates. TCW_4(__kmp_global.g.g_abort, signo); KMP_MB(); // Flush all pending memory write invalidates. @@ -1150,8 +1150,8 @@ static void __kmp_team_handler(int signo) { __kmp_debug_printf("__kmp_team_handler: unknown signal type"); #endif break; - }; // switch - }; // if + } + } } // __kmp_team_handler static void __kmp_sigaction(int signum, const struct sigaction *act, @@ -1177,11 +1177,11 @@ static void __kmp_install_one_handler(int sig, sig_func_t handler_func, } else { // Restore/keep user's handler if one previously installed. __kmp_sigaction(sig, &old_action, NULL); - }; // if + } } else { // Save initial/system signal handlers to see if user handlers installed. __kmp_sigaction(sig, NULL, &__kmp_sighldrs[sig]); - }; // if + } KMP_MB(); // Flush all pending memory write invalidates. } // __kmp_install_one_handler @@ -1198,10 +1198,10 @@ static void __kmp_remove_one_handler(int sig) { "restoring: sig=%d\n", sig)); __kmp_sigaction(sig, &old, NULL); - }; // if + } sigdelset(&__kmp_sigset, sig); KMP_MB(); // Flush all pending memory write invalidates. - }; // if + } } // __kmp_remove_one_handler void __kmp_install_signals(int parallel_init) { @@ -1225,7 +1225,7 @@ void __kmp_install_signals(int parallel_init) { #ifdef SIGPIPE __kmp_install_one_handler(SIGPIPE, __kmp_team_handler, parallel_init); #endif // SIGPIPE - }; // if + } } // __kmp_install_signals void __kmp_remove_signals(void) { @@ -1233,7 +1233,7 @@ void __kmp_remove_signals(void) { KB_TRACE(10, ("__kmp_remove_signals()\n")); for (sig = 1; sig < NSIG; ++sig) { __kmp_remove_one_handler(sig); - }; // for sig + } } // __kmp_remove_signals #endif // KMP_HANDLE_SIGNALS @@ -1374,7 +1374,7 @@ static void __kmp_suspend_initialize_thread(kmp_info_t *th) { KMP_CHECK_SYSFAIL("pthread_mutex_init", status); *(volatile int *)&th->th.th_suspend_init_count = __kmp_fork_count + 1; ANNOTATE_HAPPENS_BEFORE(&th->th.th_suspend_init_count); - }; + } } void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { @@ -1386,11 +1386,11 @@ void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { status = pthread_cond_destroy(&th->th.th_suspend_cv.c_cond); if (status != 0 && status != EBUSY) { KMP_SYSFAIL("pthread_cond_destroy", status); - }; + } status = pthread_mutex_destroy(&th->th.th_suspend_mx.m_mutex); if (status != 0 && status != EBUSY) { KMP_SYSFAIL("pthread_mutex_destroy", status); - }; + } --th->th.th_suspend_init_count; KMP_DEBUG_ASSERT(th->th.th_suspend_init_count == __kmp_fork_count); } @@ -1774,7 +1774,7 @@ static int __kmp_get_xproc(void) { } else { KMP_WARNING(CantGetNumAvailCPU); KMP_INFORM(AssumedNumCPU); - }; // if + } #else @@ -1807,12 +1807,12 @@ void __kmp_runtime_initialize(void) { if (__kmp_init_runtime) { return; - }; // if + } #if (KMP_ARCH_X86 || KMP_ARCH_X86_64) if (!__kmp_cpuinfo.initialized) { __kmp_query_cpuid(&__kmp_cpuinfo); - }; // if + } #endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */ __kmp_xproc = __kmp_get_xproc(); @@ -1862,7 +1862,7 @@ void __kmp_runtime_destroy(void) { if (!__kmp_init_runtime) { return; // Nothing to do. - }; + } #if USE_ITT_BUILD __kmp_itt_destroy(); @@ -1962,7 +1962,7 @@ int __kmp_is_address_mapped(void *addr) { rc = fscanf(file, "%p-%p %4s %*[^\n]\n", &beginning, &ending, perms); if (rc == EOF) { break; - }; // if + } KMP_ASSERT(rc == 3 && KMP_STRLEN(perms) == 4); // Make sure all fields are read. @@ -1972,11 +1972,10 @@ int __kmp_is_address_mapped(void *addr) { if (strcmp(perms, "rw") == 0) { // Memory we are looking for should be readable and writable. found = 1; - }; // if + } break; - }; // if - - }; // forever + } + } // Free resources. fclose(file); @@ -1999,7 +1998,7 @@ int __kmp_is_address_mapped(void *addr) { if (rc == 0) { // Memory successfully read. found = 1; - }; // if + } #elif KMP_OS_FREEBSD || KMP_OS_NETBSD @@ -2097,11 +2096,11 @@ int __kmp_get_load_balance(int max) { if (permanent_error) { running_threads = -1; goto finish; - }; // if + } if (max <= 0) { max = INT_MAX; - }; // if + } // Open "/proc/" directory. proc_dir = opendir("/proc"); @@ -2111,7 +2110,7 @@ int __kmp_get_load_balance(int max) { running_threads = -1; permanent_error = 1; goto finish; - }; // if + } // Initialize fixed part of task_path. This part will not change. __kmp_str_buf_cat(&task_path, "/proc/", 6); @@ -2152,7 +2151,7 @@ int __kmp_get_load_balance(int max) { running_threads = -1; permanent_error = 1; goto finish; - }; // if + } } else { // Construct fixed part of stat file path. __kmp_str_buf_clear(&stat_path); @@ -2223,22 +2222,22 @@ int __kmp_get_load_balance(int max) { ++running_threads; if (running_threads >= max) { goto finish; - }; // if - }; // if - }; // if - }; // if + } + } + } + } close(stat_file); stat_file = -1; - }; // if - }; // if + } + } task_entry = readdir(task_dir); - }; // while + } closedir(task_dir); task_dir = NULL; - }; // if - }; // if + } + } proc_entry = readdir(proc_dir); - }; // while + } // There _might_ be a timing hole where the thread executing this // code get skipped in the load balance, and running_threads is 0. @@ -2251,15 +2250,15 @@ int __kmp_get_load_balance(int max) { finish: // Clean up and exit. if (proc_dir != NULL) { closedir(proc_dir); - }; // if + } __kmp_str_buf_free(&task_path); if (task_dir != NULL) { closedir(task_dir); - }; // if + } __kmp_str_buf_free(&stat_path); if (stat_file != -1) { close(stat_file); - }; // if + } glb_running_threads = running_threads; diff --git a/runtime/src/z_Windows_NT_util.cpp b/runtime/src/z_Windows_NT_util.cpp index 20a6fad..f13ff29 100644 --- a/runtime/src/z_Windows_NT_util.cpp +++ b/runtime/src/z_Windows_NT_util.cpp @@ -592,7 +592,7 @@ void __kmp_runtime_initialize(void) { if (__kmp_init_runtime) { return; - }; + } #if KMP_DYNAMIC_LIB /* Pin dynamic library for the lifetime of application */ @@ -618,7 +618,7 @@ void __kmp_runtime_initialize(void) { #if (KMP_ARCH_X86 || KMP_ARCH_X86_64) if (!__kmp_cpuinfo.initialized) { __kmp_query_cpuid(&__kmp_cpuinfo); - }; // if + } #endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */ /* Set up minimum number of threads to switch to TLS gtid */ @@ -662,7 +662,7 @@ void __kmp_runtime_initialize(void) { __kmp_str_buf_reserve(&path, path_size); path_size = GetSystemDirectory(path.str, path.size); KMP_DEBUG_ASSERT(path_size > 0); - }; // if + } if (path_size > 0 && path_size < path.size) { // Now we have system directory name in the buffer. // Append backslash and name of dll to form full path, @@ -1144,7 +1144,7 @@ void __kmp_create_monitor(kmp_info_t *th) { if (__kmp_monitor_ev == NULL) { DWORD error = GetLastError(); __kmp_fatal(KMP_MSG(CantCreateEvent), KMP_ERR(error), __kmp_msg_null); - }; // if + } #if USE_ITT_BUILD __kmp_itt_system_object_created(__kmp_monitor_ev, "Event"); #endif /* USE_ITT_BUILD */ @@ -1196,7 +1196,7 @@ int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val) { DWORD error = GetLastError(); __kmp_fatal(KMP_MSG(FunctionError, "GetExitCodeThread()"), KMP_ERR(error), __kmp_msg_null); - }; // if + } return (*exit_val == STILL_ACTIVE); } @@ -1244,7 +1244,7 @@ static void __kmp_reap_common(kmp_info_t *th) { KMP_FSYNC_CANCEL(obj); } else { KMP_FSYNC_SPIN_ACQUIRED(obj); - }; // if + } #endif /* USE_ITT_BUILD */ } @@ -1257,7 +1257,7 @@ static void __kmp_reap_common(kmp_info_t *th) { KA_TRACE(1, ("__kmp_reap_common: thread still active.\n")); } else if ((void *)exit_val != (void *)th) { KA_TRACE(1, ("__kmp_reap_common: ExitProcess / TerminateThread used?\n")); - }; // if + } KA_TRACE(10, ("__kmp_reap_common: done reaping (%d), handle = %" KMP_UINTPTR_SPEC @@ -1286,7 +1286,7 @@ void __kmp_reap_monitor(kmp_info_t *th) { if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { KA_TRACE(10, ("__kmp_reap_monitor: monitor did not start, returning\n")); return; - }; // if + } KMP_MB(); /* Flush all pending memory write invalidates. */ @@ -1318,7 +1318,7 @@ static void __kmp_team_handler(int signo) { // Stage 1 signal handler, let's shut down all of the threads. if (__kmp_debug_buf) { __kmp_dump_debug_buffer(); - }; // if + } KMP_MB(); // Flush all pending memory write invalidates. TCW_4(__kmp_global.g.g_abort, signo); KMP_MB(); // Flush all pending memory write invalidates. @@ -1333,7 +1333,7 @@ static sig_func_t __kmp_signal(int signum, sig_func_t handler) { int error = errno; __kmp_fatal(KMP_MSG(FunctionError, "signal"), KMP_ERR(error), __kmp_msg_null); - }; // if + } return old; } @@ -1349,7 +1349,7 @@ static void __kmp_install_one_handler(int sig, sig_func_t handler, __kmp_siginstalled[sig] = 1; } else { // Restore/keep user's handler if one previously installed. old = __kmp_signal(sig, old); - }; // if + } } else { // Save initial/system signal handlers to see if user handlers installed. // 2009-09-23: It is a dead code. On Windows* OS __kmp_install_signals @@ -1357,7 +1357,7 @@ static void __kmp_install_one_handler(int sig, sig_func_t handler, old = __kmp_signal(sig, SIG_DFL); __kmp_sighldrs[sig] = old; __kmp_signal(sig, old); - }; // if + } KMP_MB(); /* Flush all pending memory write invalidates. */ } // __kmp_install_one_handler @@ -1372,11 +1372,11 @@ static void __kmp_remove_one_handler(int sig) { "restoring: sig=%d\n", sig)); old = __kmp_signal(sig, old); - }; // if + } __kmp_sighldrs[sig] = NULL; __kmp_siginstalled[sig] = 0; KMP_MB(); // Flush all pending memory write invalidates. - }; // if + } } // __kmp_remove_one_handler void __kmp_install_signals(int parallel_init) { @@ -1385,7 +1385,7 @@ void __kmp_install_signals(int parallel_init) { KB_TRACE(10, ("__kmp_install_signals: KMP_HANDLE_SIGNALS is false - " "handlers not installed\n")); return; - }; // if + } __kmp_install_one_handler(SIGINT, __kmp_team_handler, parallel_init); __kmp_install_one_handler(SIGILL, __kmp_team_handler, parallel_init); __kmp_install_one_handler(SIGABRT, __kmp_team_handler, parallel_init); @@ -1399,7 +1399,7 @@ void __kmp_remove_signals(void) { KB_TRACE(10, ("__kmp_remove_signals: called\n")); for (sig = 1; sig < NSIG; ++sig) { __kmp_remove_one_handler(sig); - }; // for sig + } } // __kmp_remove_signals #endif // KMP_HANDLE_SIGNALS @@ -1480,11 +1480,11 @@ int __kmp_get_load_balance(int max) { if (NtQuerySystemInformation == NULL) { running_threads = -1; goto finish; - }; // if + } if (max <= 0) { max = INT_MAX; - }; // if + } do { @@ -1498,7 +1498,7 @@ int __kmp_get_load_balance(int max) { if (buffer == NULL) { running_threads = -1; goto finish; - }; // if + } status = NtQuerySystemInformation(SystemProcessInformation, buffer, buff_size, &info_size); first_time = 0; @@ -1531,7 +1531,7 @@ int __kmp_get_load_balance(int max) { if (spi->NextEntryOffset != 0) { CHECK(spi_size <= spi->NextEntryOffset); // And do not overlap with the next record. - }; // if + } // pid == 0 corresponds to the System Idle Process. It always has running // threads on all cores. So, we don't consider the running threads of this // process. @@ -1547,14 +1547,14 @@ int __kmp_get_load_balance(int max) { if (running_threads >= max) { goto finish; } - } // if - }; // for i - } // if + } + } + } if (spi->NextEntryOffset == 0) { break; - }; // if + } spi = PSYSTEM_PROCESS_INFORMATION(uintptr_t(spi) + spi->NextEntryOffset); - }; // forever + } #undef CHECK @@ -1562,7 +1562,7 @@ finish: // Clean up and exit. if (buffer != NULL) { KMP_INTERNAL_FREE(buffer); - }; // if + } glb_running_threads = running_threads; |