[libcxx] r223128 - libc++: support NaCl when building thread.cpp

JF Bastien jfb at google.com
Tue Dec 2 09:30:19 PST 2014


Author: jfb
Date: Tue Dec  2 11:30:19 2014
New Revision: 223128

URL: http://llvm.org/viewvc/llvm-project?rev=223128&view=rev
Log:
libc++: support NaCl when building thread.cpp

Summary: NaCl shouldn't include sysctl.h when trying to determine std::thread::hardware_concurrency, it should instead use sysconf(_SC_NPROCESSORS_ONLN) through unistd.h. No test needs to be changed, since hardware_concurrency.pass.cpp already tests that std::thread::hardware_concurrency > 0.

Test Plan: make check-libcxx

Reviewers: dschuff, danalbert

Subscribers: jfb, cfe-commits

Differential Revision: http://reviews.llvm.org/D6470

Modified:
    libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/src/thread.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=223128&r1=223127&r2=223128&view=diff
==============================================================================
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Tue Dec  2 11:30:19 2014
@@ -17,10 +17,10 @@
 #include "limits"
 #include <sys/types.h>
 #if !defined(_WIN32)
-#if !defined(__sun__) && !defined(__linux__) && !defined(_AIX)
-#include <sys/sysctl.h>
-#endif // !__sun__ && !__linux__ && !_AIX
-#include <unistd.h>
+# if !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && !defined(__native_client__)
+#   include <sys/sysctl.h>
+# endif // !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && !defined(__native_client__)
+# include <unistd.h>
 #endif // !_WIN32
 
 #if defined(__NetBSD__)





More information about the cfe-commits mailing list