libc++: add NaCl and PNaCl support for std::random_device

Summary:
The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random.

This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided).

Test Plan: ninja check-libcxx

Reviewers: dschuff, mclow.lists, danalbert

Subscribers: jfb, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223068 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed