mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 07:06:07 +00:00
[libc++] Avoids using ENODATA. (#86165)
This macro is deprecated in C++26. Fixes https://github.com/llvm/llvm-project/issues/81360 --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
This commit is contained in:
parent
eea3bd3954
commit
cf6feff56b
@ -117,7 +117,10 @@ TODO
|
||||
|
||||
ABI Affecting Changes
|
||||
---------------------
|
||||
TODO
|
||||
|
||||
- The optional POSIX macro ``ENODATA`` has been deprecated in C++ and POSIX 2017. The
|
||||
``random_device`` could throw a ``system_error`` with this value. It now
|
||||
throws ``ENOMSG``.
|
||||
|
||||
|
||||
Build System Changes
|
||||
|
@ -79,10 +79,8 @@ unsigned random_device::operator()() {
|
||||
char* p = reinterpret_cast<char*>(&r);
|
||||
while (n > 0) {
|
||||
ssize_t s = read(__f_, p, n);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
if (s == 0)
|
||||
__throw_system_error(ENODATA, "random_device got EOF"); // TODO ENODATA -> ENOMSG
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
__throw_system_error(ENOMSG, "random_device got EOF");
|
||||
if (s == -1) {
|
||||
if (errno != EINTR)
|
||||
__throw_system_error(errno, "random_device got an unexpected error");
|
||||
|
Loading…
x
Reference in New Issue
Block a user