forked from OSchip/llvm-project
On FreeBSD, PTHREADS_THREADS_MAX does not fit into an int, leading to
warnings similar to the following: runtime/src/kmp_global.c:117:35: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551615 to -1 [-Wconstant-conversion] int __kmp_sys_max_nth = KMP_MAX_NTH; ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~ runtime/src/kmp.h:849:34: note: expanded from macro 'KMP_MAX_NTH' # define KMP_MAX_NTH PTHREAD_THREADS_MAX ^~~~~~~~~~~~~~~~~~~ Clamp KMP_MAX_NTH to INT_MAX to avoid these warnings. Also use INT_MAX whenever PTHREAD_THREADS_MAX is not defined at all. Differential Revision: http://reviews.llvm.org/D13827 llvm-svn: 250708
This commit is contained in:
parent
3cb667edaa
commit
9b8c353c90
|
@ -845,10 +845,10 @@ extern int __kmp_place_num_threads_per_core;
|
|||
#define KMP_MIN_NTH 1
|
||||
|
||||
#ifndef KMP_MAX_NTH
|
||||
# ifdef PTHREAD_THREADS_MAX
|
||||
# if defined(PTHREAD_THREADS_MAX) && PTHREAD_THREADS_MAX < INT_MAX
|
||||
# define KMP_MAX_NTH PTHREAD_THREADS_MAX
|
||||
# else
|
||||
# define KMP_MAX_NTH (32 * 1024)
|
||||
# define KMP_MAX_NTH INT_MAX
|
||||
# endif
|
||||
#endif /* KMP_MAX_NTH */
|
||||
|
||||
|
|
Loading…
Reference in New Issue