[libcxx-commits] [libcxx] [libc++] Add FreeBSD-specific EINTEGRITY errc value (PR #76364)

Dimitry Andric via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 28 06:43:41 PST 2023


https://github.com/DimitryAndric updated https://github.com/llvm/llvm-project/pull/76364

>From 442e59bc4d137dc0df145652157d52c96afec9b7 Mon Sep 17 00:00:00 2001
From: Dimitry Andric <dimitry at andric.com>
Date: Mon, 25 Dec 2023 17:43:32 +0100
Subject: [PATCH 1/4] [libc++] Add FreeBSD-specific EINTEGRITY errc value

Since ~2019 we have been carrying a libc++ patch in FreeBSD, that adds
the `EINTEGRITY` errno value. At the time, I submitted
https://reviews.llvm.org/D56398 for this, but due to the complicated
`ELAST` handling in `errno.h`, which that patch made even more
complicated, it was put on hold.

I would like to try this again, but much simplified: there is no need to
modify `errno.h`, since all supported versions of FreeBSD define both
`EOWNERDEAD` and `ENOTRECOVERABLE`, so the part that attempts to
redefine `ELAST` is effectively never used, and for FreeBSD we can
simply ignore it.

The only proposed changes will now be to optionally add `EINTEGRITY` as
an `enum errc` value, and add a corresponding test to `errc.pass.cpp`.
---
 libcxx/include/__system_error/errc.h          | 30 +++++++++++--------
 .../test/std/diagnostics/syserr/errc.pass.cpp |  3 ++
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/libcxx/include/__system_error/errc.h b/libcxx/include/__system_error/errc.h
index f87df86a71e15a..9a84b478b36b12 100644
--- a/libcxx/include/__system_error/errc.h
+++ b/libcxx/include/__system_error/errc.h
@@ -45,6 +45,7 @@ enum class errc
     identifier_removed,                 // EIDRM
     illegal_byte_sequence,              // EILSEQ
     inappropriate_io_control_operation, // ENOTTY
+    integrity_check_failed,             // EINTEGRITY
     interrupted,                        // EINTR
     invalid_argument,                   // EINVAL
     invalid_seek,                       // ESPIPE
@@ -141,19 +142,22 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc){
     identifier_removed                 = EIDRM,
     illegal_byte_sequence              = EILSEQ,
     inappropriate_io_control_operation = ENOTTY,
-    interrupted                        = EINTR,
-    invalid_argument                   = EINVAL,
-    invalid_seek                       = ESPIPE,
-    io_error                           = EIO,
-    is_a_directory                     = EISDIR,
-    message_size                       = EMSGSIZE,
-    network_down                       = ENETDOWN,
-    network_reset                      = ENETRESET,
-    network_unreachable                = ENETUNREACH,
-    no_buffer_space                    = ENOBUFS,
-    no_child_process                   = ECHILD,
-    no_link                            = ENOLINK,
-    no_lock_available                  = ENOLCK,
+#ifdef EINTEGRITY
+    integrity_check_failed = EINTEGRITY,
+#endif
+    interrupted         = EINTR,
+    invalid_argument    = EINVAL,
+    invalid_seek        = ESPIPE,
+    io_error            = EIO,
+    is_a_directory      = EISDIR,
+    message_size        = EMSGSIZE,
+    network_down        = ENETDOWN,
+    network_reset       = ENETRESET,
+    network_unreachable = ENETUNREACH,
+    no_buffer_space     = ENOBUFS,
+    no_child_process    = ECHILD,
+    no_link             = ENOLINK,
+    no_lock_available   = ENOLCK,
 #ifdef ENODATA
     no_message_available = ENODATA,
 #else
diff --git a/libcxx/test/std/diagnostics/syserr/errc.pass.cpp b/libcxx/test/std/diagnostics/syserr/errc.pass.cpp
index e44cb50102e3e1..ef18904864b371 100644
--- a/libcxx/test/std/diagnostics/syserr/errc.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/errc.pass.cpp
@@ -44,6 +44,9 @@ int main(int, char**)
     static_assert(static_cast<int>(std::errc::identifier_removed) == EIDRM, "");
     static_assert(static_cast<int>(std::errc::illegal_byte_sequence) == EILSEQ, "");
     static_assert(static_cast<int>(std::errc::inappropriate_io_control_operation) == ENOTTY, "");
+#ifdef EINTEGRITY
+    static_assert(static_cast<int>(std::errc::integrity_check_failed) == EINTEGRITY, "");
+#endif
     static_assert(static_cast<int>(std::errc::interrupted) == EINTR, "");
     static_assert(static_cast<int>(std::errc::invalid_argument) == EINVAL, "");
     static_assert(static_cast<int>(std::errc::invalid_seek) == ESPIPE, "");

>From 2c44487e5515ac2e3039c6c184a47e8e781add91 Mon Sep 17 00:00:00 2001
From: Dimitry Andric <dimitry at andric.com>
Date: Thu, 28 Dec 2023 14:58:11 +0100
Subject: [PATCH 2/4] Mark EINTEGRITY value as FreeBSD extension, and add
 subsection "Extensions to <system_error>" to the "Libc++ Extensions" section
 in the libcxx documentation.

---
 libcxx/docs/UsingLibcxx.rst                      | 10 ++++++++++
 libcxx/include/__system_error/errc.h             |  4 ++--
 libcxx/test/std/diagnostics/syserr/errc.pass.cpp |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst
index 8d9f795da977e3..a01b6a72ede8f9 100644
--- a/libcxx/docs/UsingLibcxx.rst
+++ b/libcxx/docs/UsingLibcxx.rst
@@ -414,6 +414,16 @@ Extensions to the C++23 modules ``std`` and ``std.compat``
 Like other major implementations, libc++ provides C++23 modules ``std`` and
 ``std.compat`` in C++20 as an extension"
 
+Extensions to ``<system_error>``
+--------------------------------
+
+``std::errc`` contains the values documented in the C++ standard under
+``[system_error.syn]`` (``EINVAL``, ``ENOENT``, etc), but can also
+include platform-specific values as extensions.
+
+As of this writing, the only extension value is ``EINTEGRITY``, which is
+specific to FreeBSD.
+
 Constant-initialized std::string
 --------------------------------
 
diff --git a/libcxx/include/__system_error/errc.h b/libcxx/include/__system_error/errc.h
index 9a84b478b36b12..8e066748c9d857 100644
--- a/libcxx/include/__system_error/errc.h
+++ b/libcxx/include/__system_error/errc.h
@@ -45,7 +45,7 @@ enum class errc
     identifier_removed,                 // EIDRM
     illegal_byte_sequence,              // EILSEQ
     inappropriate_io_control_operation, // ENOTTY
-    integrity_check_failed,             // EINTEGRITY
+    integrity_check_failed,             // EINTEGRITY (FreeBSD extension)
     interrupted,                        // EINTR
     invalid_argument,                   // EINVAL
     invalid_seek,                       // ESPIPE
@@ -142,7 +142,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc){
     identifier_removed                 = EIDRM,
     illegal_byte_sequence              = EILSEQ,
     inappropriate_io_control_operation = ENOTTY,
-#ifdef EINTEGRITY
+#if defined(__FreeBSD__) && defined(EINTEGRITY) // FreeBSD extension
     integrity_check_failed = EINTEGRITY,
 #endif
     interrupted         = EINTR,
diff --git a/libcxx/test/std/diagnostics/syserr/errc.pass.cpp b/libcxx/test/std/diagnostics/syserr/errc.pass.cpp
index ef18904864b371..d5dbb1f145681d 100644
--- a/libcxx/test/std/diagnostics/syserr/errc.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/errc.pass.cpp
@@ -44,7 +44,7 @@ int main(int, char**)
     static_assert(static_cast<int>(std::errc::identifier_removed) == EIDRM, "");
     static_assert(static_cast<int>(std::errc::illegal_byte_sequence) == EILSEQ, "");
     static_assert(static_cast<int>(std::errc::inappropriate_io_control_operation) == ENOTTY, "");
-#ifdef EINTEGRITY
+#if defined(__FreeBSD__) && defined(EINTEGRITY) // FreeBSD extension
     static_assert(static_cast<int>(std::errc::integrity_check_failed) == EINTEGRITY, "");
 #endif
     static_assert(static_cast<int>(std::errc::interrupted) == EINTR, "");

>From 1609594b8ae294662af47547930adfb08d1573e7 Mon Sep 17 00:00:00 2001
From: Dimitry Andric <dimitry at andric.com>
Date: Thu, 28 Dec 2023 15:38:08 +0100
Subject: [PATCH 3/4] Turn off clang-format for `enum class errc`, as it gets
 confused by the `_LIBCPP_DECLARE_STRONG_ENUM` macro. Also, go back to the
 nicely aligned errno values, and indent the synopsis part similar to the
 actual code.

---
 libcxx/include/__system_error/errc.h | 329 ++++++++++++++-------------
 1 file changed, 166 insertions(+), 163 deletions(-)

diff --git a/libcxx/include/__system_error/errc.h b/libcxx/include/__system_error/errc.h
index 8e066748c9d857..082e85a376de76 100644
--- a/libcxx/include/__system_error/errc.h
+++ b/libcxx/include/__system_error/errc.h
@@ -18,85 +18,85 @@ namespace std
 
 enum class errc
 {
-    address_family_not_supported,       // EAFNOSUPPORT
-    address_in_use,                     // EADDRINUSE
-    address_not_available,              // EADDRNOTAVAIL
-    already_connected,                  // EISCONN
-    argument_list_too_long,             // E2BIG
-    argument_out_of_domain,             // EDOM
-    bad_address,                        // EFAULT
-    bad_file_descriptor,                // EBADF
-    bad_message,                        // EBADMSG
-    broken_pipe,                        // EPIPE
-    connection_aborted,                 // ECONNABORTED
-    connection_already_in_progress,     // EALREADY
-    connection_refused,                 // ECONNREFUSED
-    connection_reset,                   // ECONNRESET
-    cross_device_link,                  // EXDEV
-    destination_address_required,       // EDESTADDRREQ
-    device_or_resource_busy,            // EBUSY
-    directory_not_empty,                // ENOTEMPTY
-    executable_format_error,            // ENOEXEC
-    file_exists,                        // EEXIST
-    file_too_large,                     // EFBIG
-    filename_too_long,                  // ENAMETOOLONG
-    function_not_supported,             // ENOSYS
-    host_unreachable,                   // EHOSTUNREACH
-    identifier_removed,                 // EIDRM
-    illegal_byte_sequence,              // EILSEQ
-    inappropriate_io_control_operation, // ENOTTY
-    integrity_check_failed,             // EINTEGRITY (FreeBSD extension)
-    interrupted,                        // EINTR
-    invalid_argument,                   // EINVAL
-    invalid_seek,                       // ESPIPE
-    io_error,                           // EIO
-    is_a_directory,                     // EISDIR
-    message_size,                       // EMSGSIZE
-    network_down,                       // ENETDOWN
-    network_reset,                      // ENETRESET
-    network_unreachable,                // ENETUNREACH
-    no_buffer_space,                    // ENOBUFS
-    no_child_process,                   // ECHILD
-    no_link,                            // ENOLINK
-    no_lock_available,                  // ENOLCK
-    no_message_available,               // ENODATA
-    no_message,                         // ENOMSG
-    no_protocol_option,                 // ENOPROTOOPT
-    no_space_on_device,                 // ENOSPC
-    no_stream_resources,                // ENOSR
-    no_such_device_or_address,          // ENXIO
-    no_such_device,                     // ENODEV
-    no_such_file_or_directory,          // ENOENT
-    no_such_process,                    // ESRCH
-    not_a_directory,                    // ENOTDIR
-    not_a_socket,                       // ENOTSOCK
-    not_a_stream,                       // ENOSTR
-    not_connected,                      // ENOTCONN
-    not_enough_memory,                  // ENOMEM
-    not_supported,                      // ENOTSUP
-    operation_canceled,                 // ECANCELED
-    operation_in_progress,              // EINPROGRESS
-    operation_not_permitted,            // EPERM
-    operation_not_supported,            // EOPNOTSUPP
-    operation_would_block,              // EWOULDBLOCK
-    owner_dead,                         // EOWNERDEAD
-    permission_denied,                  // EACCES
-    protocol_error,                     // EPROTO
-    protocol_not_supported,             // EPROTONOSUPPORT
-    read_only_file_system,              // EROFS
-    resource_deadlock_would_occur,      // EDEADLK
-    resource_unavailable_try_again,     // EAGAIN
-    result_out_of_range,                // ERANGE
-    state_not_recoverable,              // ENOTRECOVERABLE
-    stream_timeout,                     // ETIME
-    text_file_busy,                     // ETXTBSY
-    timed_out,                          // ETIMEDOUT
-    too_many_files_open_in_system,      // ENFILE
-    too_many_files_open,                // EMFILE
-    too_many_links,                     // EMLINK
-    too_many_symbolic_link_levels,      // ELOOP
-    value_too_large,                    // EOVERFLOW
-    wrong_protocol_type                 // EPROTOTYPE
+  address_family_not_supported,       // EAFNOSUPPORT
+  address_in_use,                     // EADDRINUSE
+  address_not_available,              // EADDRNOTAVAIL
+  already_connected,                  // EISCONN
+  argument_list_too_long,             // E2BIG
+  argument_out_of_domain,             // EDOM
+  bad_address,                        // EFAULT
+  bad_file_descriptor,                // EBADF
+  bad_message,                        // EBADMSG
+  broken_pipe,                        // EPIPE
+  connection_aborted,                 // ECONNABORTED
+  connection_already_in_progress,     // EALREADY
+  connection_refused,                 // ECONNREFUSED
+  connection_reset,                   // ECONNRESET
+  cross_device_link,                  // EXDEV
+  destination_address_required,       // EDESTADDRREQ
+  device_or_resource_busy,            // EBUSY
+  directory_not_empty,                // ENOTEMPTY
+  executable_format_error,            // ENOEXEC
+  file_exists,                        // EEXIST
+  file_too_large,                     // EFBIG
+  filename_too_long,                  // ENAMETOOLONG
+  function_not_supported,             // ENOSYS
+  host_unreachable,                   // EHOSTUNREACH
+  identifier_removed,                 // EIDRM
+  illegal_byte_sequence,              // EILSEQ
+  inappropriate_io_control_operation, // ENOTTY
+  integrity_check_failed,             // EINTEGRITY (FreeBSD extension)
+  interrupted,                        // EINTR
+  invalid_argument,                   // EINVAL
+  invalid_seek,                       // ESPIPE
+  io_error,                           // EIO
+  is_a_directory,                     // EISDIR
+  message_size,                       // EMSGSIZE
+  network_down,                       // ENETDOWN
+  network_reset,                      // ENETRESET
+  network_unreachable,                // ENETUNREACH
+  no_buffer_space,                    // ENOBUFS
+  no_child_process,                   // ECHILD
+  no_link,                            // ENOLINK
+  no_lock_available,                  // ENOLCK
+  no_message_available,               // ENODATA
+  no_message,                         // ENOMSG
+  no_protocol_option,                 // ENOPROTOOPT
+  no_space_on_device,                 // ENOSPC
+  no_stream_resources,                // ENOSR
+  no_such_device_or_address,          // ENXIO
+  no_such_device,                     // ENODEV
+  no_such_file_or_directory,          // ENOENT
+  no_such_process,                    // ESRCH
+  not_a_directory,                    // ENOTDIR
+  not_a_socket,                       // ENOTSOCK
+  not_a_stream,                       // ENOSTR
+  not_connected,                      // ENOTCONN
+  not_enough_memory,                  // ENOMEM
+  not_supported,                      // ENOTSUP
+  operation_canceled,                 // ECANCELED
+  operation_in_progress,              // EINPROGRESS
+  operation_not_permitted,            // EPERM
+  operation_not_supported,            // EOPNOTSUPP
+  operation_would_block,              // EWOULDBLOCK
+  owner_dead,                         // EOWNERDEAD
+  permission_denied,                  // EACCES
+  protocol_error,                     // EPROTO
+  protocol_not_supported,             // EPROTONOSUPPORT
+  read_only_file_system,              // EROFS
+  resource_deadlock_would_occur,      // EDEADLK
+  resource_unavailable_try_again,     // EAGAIN
+  result_out_of_range,                // ERANGE
+  state_not_recoverable,              // ENOTRECOVERABLE
+  stream_timeout,                     // ETIME
+  text_file_busy,                     // ETXTBSY
+  timed_out,                          // ETIMEDOUT
+  too_many_files_open_in_system,      // ENFILE
+  too_many_files_open,                // EMFILE
+  too_many_links,                     // EMLINK
+  too_many_symbolic_link_levels,      // ELOOP
+  value_too_large,                    // EOVERFLOW
+  wrong_protocol_type                 // EPROTOTYPE
 };
 
 */
@@ -114,104 +114,107 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 // for them:
 
 // enum class errc
-_LIBCPP_DECLARE_STRONG_ENUM(errc){
-    address_family_not_supported       = EAFNOSUPPORT,
-    address_in_use                     = EADDRINUSE,
-    address_not_available              = EADDRNOTAVAIL,
-    already_connected                  = EISCONN,
-    argument_list_too_long             = E2BIG,
-    argument_out_of_domain             = EDOM,
-    bad_address                        = EFAULT,
-    bad_file_descriptor                = EBADF,
-    bad_message                        = EBADMSG,
-    broken_pipe                        = EPIPE,
-    connection_aborted                 = ECONNABORTED,
-    connection_already_in_progress     = EALREADY,
-    connection_refused                 = ECONNREFUSED,
-    connection_reset                   = ECONNRESET,
-    cross_device_link                  = EXDEV,
-    destination_address_required       = EDESTADDRREQ,
-    device_or_resource_busy            = EBUSY,
-    directory_not_empty                = ENOTEMPTY,
-    executable_format_error            = ENOEXEC,
-    file_exists                        = EEXIST,
-    file_too_large                     = EFBIG,
-    filename_too_long                  = ENAMETOOLONG,
-    function_not_supported             = ENOSYS,
-    host_unreachable                   = EHOSTUNREACH,
-    identifier_removed                 = EIDRM,
-    illegal_byte_sequence              = EILSEQ,
-    inappropriate_io_control_operation = ENOTTY,
+_LIBCPP_DECLARE_STRONG_ENUM(errc) {
+  // clang-format off: gets confused by _LIBCPP_DECLARE_STRONG_ENUM()
+  address_family_not_supported       = EAFNOSUPPORT,
+  address_in_use                     = EADDRINUSE,
+  address_not_available              = EADDRNOTAVAIL,
+  already_connected                  = EISCONN,
+  argument_list_too_long             = E2BIG,
+  argument_out_of_domain             = EDOM,
+  bad_address                        = EFAULT,
+  bad_file_descriptor                = EBADF,
+  bad_message                        = EBADMSG,
+  broken_pipe                        = EPIPE,
+  connection_aborted                 = ECONNABORTED,
+  connection_already_in_progress     = EALREADY,
+  connection_refused                 = ECONNREFUSED,
+  connection_reset                   = ECONNRESET,
+  cross_device_link                  = EXDEV,
+  destination_address_required       = EDESTADDRREQ,
+  device_or_resource_busy            = EBUSY,
+  directory_not_empty                = ENOTEMPTY,
+  executable_format_error            = ENOEXEC,
+  file_exists                        = EEXIST,
+  file_too_large                     = EFBIG,
+  filename_too_long                  = ENAMETOOLONG,
+  function_not_supported             = ENOSYS,
+  host_unreachable                   = EHOSTUNREACH,
+  identifier_removed                 = EIDRM,
+  illegal_byte_sequence              = EILSEQ,
+  inappropriate_io_control_operation = ENOTTY,
 #if defined(__FreeBSD__) && defined(EINTEGRITY) // FreeBSD extension
-    integrity_check_failed = EINTEGRITY,
+  integrity_check_failed             = EINTEGRITY,
 #endif
-    interrupted         = EINTR,
-    invalid_argument    = EINVAL,
-    invalid_seek        = ESPIPE,
-    io_error            = EIO,
-    is_a_directory      = EISDIR,
-    message_size        = EMSGSIZE,
-    network_down        = ENETDOWN,
-    network_reset       = ENETRESET,
-    network_unreachable = ENETUNREACH,
-    no_buffer_space     = ENOBUFS,
-    no_child_process    = ECHILD,
-    no_link             = ENOLINK,
-    no_lock_available   = ENOLCK,
+  interrupted                        = EINTR,
+  invalid_argument                   = EINVAL,
+  invalid_seek                       = ESPIPE,
+  io_error                           = EIO,
+  is_a_directory                     = EISDIR,
+  message_size                       = EMSGSIZE,
+  network_down                       = ENETDOWN,
+  network_reset                      = ENETRESET,
+  network_unreachable                = ENETUNREACH,
+  no_buffer_space                    = ENOBUFS,
+  no_child_process                   = ECHILD,
+  no_link                            = ENOLINK,
+  no_lock_available                  = ENOLCK,
 #ifdef ENODATA
-    no_message_available = ENODATA,
+  no_message_available               = ENODATA,
 #else
-    no_message_available = ENOMSG,
+  no_message_available               = ENOMSG,
 #endif
-    no_message         = ENOMSG,
-    no_protocol_option = ENOPROTOOPT,
-    no_space_on_device = ENOSPC,
+  no_message                         = ENOMSG,
+  no_protocol_option                 = ENOPROTOOPT,
+  no_space_on_device                 = ENOSPC,
 #ifdef ENOSR
-    no_stream_resources = ENOSR,
+  no_stream_resources                = ENOSR,
 #else
-    no_stream_resources = ENOMEM,
+  no_stream_resources                = ENOMEM,
 #endif
-    no_such_device_or_address = ENXIO,
-    no_such_device            = ENODEV,
-    no_such_file_or_directory = ENOENT,
-    no_such_process           = ESRCH,
-    not_a_directory           = ENOTDIR,
-    not_a_socket              = ENOTSOCK,
+  no_such_device_or_address          = ENXIO,
+  no_such_device                     = ENODEV,
+  no_such_file_or_directory          = ENOENT,
+  no_such_process                    = ESRCH,
+  not_a_directory                    = ENOTDIR,
+  not_a_socket                       = ENOTSOCK,
 #ifdef ENOSTR
-    not_a_stream = ENOSTR,
+  not_a_stream                       = ENOSTR,
 #else
-    not_a_stream = EINVAL,
+  not_a_stream                       = EINVAL,
 #endif
-    not_connected                  = ENOTCONN,
-    not_enough_memory              = ENOMEM,
-    not_supported                  = ENOTSUP,
-    operation_canceled             = ECANCELED,
-    operation_in_progress          = EINPROGRESS,
-    operation_not_permitted        = EPERM,
-    operation_not_supported        = EOPNOTSUPP,
-    operation_would_block          = EWOULDBLOCK,
-    owner_dead                     = EOWNERDEAD,
-    permission_denied              = EACCES,
-    protocol_error                 = EPROTO,
-    protocol_not_supported         = EPROTONOSUPPORT,
-    read_only_file_system          = EROFS,
-    resource_deadlock_would_occur  = EDEADLK,
-    resource_unavailable_try_again = EAGAIN,
-    result_out_of_range            = ERANGE,
-    state_not_recoverable          = ENOTRECOVERABLE,
+  not_connected                      = ENOTCONN,
+  not_enough_memory                  = ENOMEM,
+  not_supported                      = ENOTSUP,
+  operation_canceled                 = ECANCELED,
+  operation_in_progress              = EINPROGRESS,
+  operation_not_permitted            = EPERM,
+  operation_not_supported            = EOPNOTSUPP,
+  operation_would_block              = EWOULDBLOCK,
+  owner_dead                         = EOWNERDEAD,
+  permission_denied                  = EACCES,
+  protocol_error                     = EPROTO,
+  protocol_not_supported             = EPROTONOSUPPORT,
+  read_only_file_system              = EROFS,
+  resource_deadlock_would_occur      = EDEADLK,
+  resource_unavailable_try_again     = EAGAIN,
+  result_out_of_range                = ERANGE,
+  state_not_recoverable              = ENOTRECOVERABLE,
 #ifdef ETIME
-    stream_timeout = ETIME,
+  stream_timeout                     = ETIME,
 #else
-    stream_timeout = ETIMEDOUT,
+  stream_timeout                     = ETIMEDOUT,
 #endif
-    text_file_busy                = ETXTBSY,
-    timed_out                     = ETIMEDOUT,
-    too_many_files_open_in_system = ENFILE,
-    too_many_files_open           = EMFILE,
-    too_many_links                = EMLINK,
-    too_many_symbolic_link_levels = ELOOP,
-    value_too_large               = EOVERFLOW,
-    wrong_protocol_type           = EPROTOTYPE};
+  text_file_busy                     = ETXTBSY,
+  timed_out                          = ETIMEDOUT,
+  too_many_files_open_in_system      = ENFILE,
+  too_many_files_open                = EMFILE,
+  too_many_links                     = EMLINK,
+  too_many_symbolic_link_levels      = ELOOP,
+  value_too_large                    = EOVERFLOW,
+  wrong_protocol_type                = EPROTOTYPE
+  // clang-format on
+};
 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
 
 _LIBCPP_END_NAMESPACE_STD

>From 1296c0d7e113d147adc0d39f570686f2be5465ef Mon Sep 17 00:00:00 2001
From: Dimitry Andric <dimitry at andric.com>
Date: Thu, 28 Dec 2023 15:43:28 +0100
Subject: [PATCH 4/4] Minor nits.

---
 libcxx/include/__system_error/errc.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__system_error/errc.h b/libcxx/include/__system_error/errc.h
index 082e85a376de76..4eb624fe93c34a 100644
--- a/libcxx/include/__system_error/errc.h
+++ b/libcxx/include/__system_error/errc.h
@@ -13,11 +13,9 @@
 /*
     system_error synopsis
 
-namespace std
-{
+namespace std {
 
-enum class errc
-{
+enum class errc {
   address_family_not_supported,       // EAFNOSUPPORT
   address_in_use,                     // EADDRINUSE
   address_not_available,              // EADDRNOTAVAIL
@@ -99,6 +97,8 @@ enum class errc
   wrong_protocol_type                 // EPROTOTYPE
 };
 
+} // namespace std
+
 */
 
 #include <__config>



More information about the libcxx-commits mailing list