Saleem Abdulrasool: cleanup a few more compile warnings emitted by GCC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171173 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2012-12-27 23:24:31 +00:00
parent bf68bdc4ed
commit 5f767b7b28
2 changed files with 35 additions and 2 deletions

View File

@@ -67,8 +67,10 @@ thread::hardware_concurrency() _NOEXCEPT
return n;
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)
long result = sysconf(_SC_NPROCESSORS_ONLN);
if (result < 0 || result > UINT_MAX)
result = 0;
// sysconf returns -1 if the name is invalid, the option does not exist or
// does not have a definite limit.
if (result == -1)
return 0;
return result;
#else // defined(CTL_HW) && defined(HW_NCPU)
// TODO: grovel through /proc or check cpuid on x86 and similar