[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2022-01-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma abandoned this revision. efriedma added a comment. Herald added a subscriber: libcxx-commits. A very similar patch was merged in e0d01294bc124211a8ffb55e69162eb34a242680 . Repository: rCXX libc++ CHANGES SINCE LAS

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-24 Thread Ben Craig via Phabricator via cfe-commits
bcraig added a comment. For those that would prefer random device to not exist if it isn't cryptographically secure, please write a wg21 paper. I will gladly review such a paper, and if you need a presenter, then I will present it if I am attending. I won't be at Rapperswil, but I will be at

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. In https://reviews.llvm.org/D41316#1054968, @efriedma wrote: > Yes, the standard says you're allowed to throw an exception from the > random_device constructor, or use a PRNG with an arbitrary seed, or even just > return zeros from operator(). But none of those beha

Re: [PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-06 Thread Jon Roelofs via cfe-commits
> the targets where you would want to use this can't run the libcxx testsuite anyway (because they don't have an operating system to run the test programs under). I used to run libcxx tests for an arm baremetal toolchain I was building via semihosted QEMU. It was awkward and slow (especially for

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-06 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a subscriber: efriedma. jroelofs added a comment. > the targets where you would want to use this can't run the libcxx testsuite anyway (because they don't have an operating system to run the test programs under). I used to run libcxx tests for an arm baremetal toolchain I was bu

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-05 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. Thanks Eli! Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma updated this revision to Diff 141255. efriedma added a comment. Get rid of the test changes. They were broken in multiple ways, and weren't really useful anyway because the targets where you would want to use this can't run the libcxx testsuite anyway (because they don't have an operat

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-02 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Yes, the standard says you're allowed to throw an exception from the random_device constructor, or use a PRNG with an arbitrary seed, or even just return zeros from operator(). But none of those behaviors are actually useful; the code will compile, but you won't get th

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-04-02 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. [rand.device]/2 seems to be the authoritative word here: If implementation limitations prevent generating nondeterministic random numbers, the implementation may employ a random number engine. https://reviews.llvm.org/D41316 ___

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-03-05 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: test/std/numerics/rand/rand.device/lit.local.cfg:1 +# Disable all of the random device tests if the correct feature is not available. +if 'libcpp-has-no-random-device' in config.available_features: EricWF wrote: > T

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-03-05 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. gentle ping? https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-02-23 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. ping? https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-02-12 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz updated this revision to Diff 133977. weimingz added a comment. Modified the random generator in filesystem_test_helper to use high_resolution_clock as seed. https://reviews.llvm.org/D41316 Files: CMakeLists.txt include/__config_site.in include/random src/random.cpp test/std

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-02-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments. Comment at: test/std/experimental/filesystem/lit.local.cfg:5 + +# filesystem_test_helper uses random_device to generate random path. +if 'libcpp-has-no-random-device' in config.available_features: EricWF wrote: > EricWF wrote: > > I

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-02-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments. Comment at: test/std/experimental/filesystem/lit.local.cfg:5 + +# filesystem_test_helper uses random_device to generate random path. +if 'libcpp-has-no-random-device' in config.available_features: EricWF wrote: > I would rather keep

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-02-09 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. I think the direction here is OK. Although I really hate allowing bits of libc++ to be "optional". In this case it should be OK, but often it makes the library trickier to maintain -- and these configurations often go untested between releases. Commen

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-02-09 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. ping? Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-30 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz updated this revision to Diff 132089. weimingz added a comment. Herald added a subscriber: hintonda. Disable tests that depend on random_device. filesystem tests rely on random_device as seed to create random path. Although it's possible to avoid the random_device but if the build targe

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-11 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment. > Should we go with current patch? You'll need a bunch of `UNSUPPORTED: has-no-random-device` or something like it, but other than that, I'm happy with the patch as-is. Repository: rCXX libc++ https://reviews.llvm.org/D41316 _

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-11 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. any suggestions? Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-05 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. We can wrap the random_device as a minstd_rand, a linear congruential enginer that a lot of C lib uses for rand(). However based on documentation, we should just provides dummy implementation which throws an exception in the constructor of random_device [1,2] But compar

Re: [PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-05 Thread Zhao, Weiming via cfe-commits
We can wrap the random_device as a minstd_rand, a linear congruential enginer that a lot of C lib uses for rand(). However based on documentation, we should just provides dummy implementation which throws an exception in the constructor of random_device [1,2] But again, compared with run-time ex

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-02 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment. @weimingz: Since your platform supports `srand(0)`, is it possible to look at how your platform implements `srand(0)` and "inline" that implementation into `random_device`? That seems like it would be more in keeping with the other ifdefs in this file. I'm confiden

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2018-01-02 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. Should we go with current patch? or provide a srand/rand based implementation as an option? Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.ll

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2017-12-16 Thread Brian Cain via Phabricator via cfe-commits
bcain added a comment. In https://reviews.llvm.org/D41316#957598, @jroelofs wrote: > I'd much rather provide no implementation than one that lies. Broken builds > are much safer than problems at runtime. Agreed! Especially the problems caused by a predictable random seed. Repository: rCXX

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2017-12-16 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz added a comment. Does it make sense to provide an implementation based on C99 rand? like #ifdef _LIBCPP_USING_C99_RANDOM srand(0), rand() Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commi

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2017-12-16 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment. I say that because there are contexts where it is **absolutely critical** that https://xkcd.com/221/ not be the implementation of an RNG. Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing l

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2017-12-16 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment. I'd much rather provide no implementation than one that lies. Broken builds are much safer than problems at runtime. Repository: rCXX libc++ https://reviews.llvm.org/D41316 ___ cfe-commits mailing list cfe-commits@lists

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2017-12-16 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment. I keep seeing patches go by for other targets where they're just implementing `random_device` for their target. It doesn't *have* to be based on an actual /dev/urandom. You can see all the other options under #ifdefs in this file: getentropy, /dev/random, nacl_secur

[PATCH] D41316: [libcxx] Allow random_device to be built optionally

2017-12-15 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz created this revision. weimingz added reviewers: EricWF, bcain. Herald added a subscriber: mgorny. The default implementation of random_device uses /dev/urandom, which may not be available to systems like bare-metals. This patch adds a CMake option "LIBCXX_ENABLE_RANDOM_DEVICE" to contr