public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC] libstdc++: Generate error_constants.h from <errno.h> [PR104883]
@ 2022-10-04 16:51 Jonathan Wakely
  2022-10-04 18:05 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2022-10-04 16:51 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Does anybody see any issues with generating the list of error numbers at
build time?


-- >8 --

Instead of having several very similar target-specific headers with
slightly different sets of enumerators, generate the error_constants.h
file as part of the build. This ensures that all enumerators are always
defined, with the value from the corresponding errno macro if present,
or a libstdc++-specific alternative value.

The libstdc++-specific values will be values greater than the positive
integer _GLIBCXX_ERRC_ORIGIN, which defaults to 9999 but can be set in
os_defines.h if a more suitable value exists for the OS (e.g. ELAST
could be used for BSD targets).

libstdc++-v3/ChangeLog:

	PR libstdc++/104883
	* configure.host (error_constants_dir): Remove.
	* include/Makefile.am (error_constants.h): Generate using
	make_errc.sh script.
	* include/Makefile.in: Regenerate.
	* scripts/make_errc.sh: New file.
---
 libstdc++-v3/configure.host       |   7 --
 libstdc++-v3/include/Makefile.am  |   6 +-
 libstdc++-v3/include/Makefile.in  |   6 +-
 libstdc++-v3/scripts/make_errc.sh | 165 ++++++++++++++++++++++++++++++
 4 files changed, 175 insertions(+), 9 deletions(-)
 create mode 100755 libstdc++-v3/scripts/make_errc.sh

diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index ec32980aa0d..6d51c5f6a11 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -56,9 +56,6 @@
 #   cpu_opt_ext_random     path name of random.h containing CPU-specific
 #                          optimizations for extensions
 #
-#   error_constants_dir    location of error_constants.h
-#                          defaults to os/generic.
-#
 # It possibly modifies the following variables:
 #
 #   OPT_LDFLAGS            extra flags to pass when linking the library, of
@@ -93,7 +90,6 @@ cpu_defines_dir="cpu/generic"
 try_cpu=generic
 abi_baseline_subdir_switch=--print-multi-directory
 abi_tweaks_dir="cpu/generic"
-error_constants_dir="os/generic"
 tmake_file=
 
 # HOST-SPECIFIC OVERRIDES
@@ -247,7 +243,6 @@ case "${host_os}" in
     ;;
   *djgpp*)      # leading * picks up "msdosdjgpp"
     os_include_dir="os/djgpp"
-    error_constants_dir="os/djgpp"
     ;;
   dragonfly*)
     os_include_dir="os/bsd/dragonfly"
@@ -274,11 +269,9 @@ case "${host_os}" in
     case "$host" in
       *-w64-*)
         os_include_dir="os/mingw32-w64"
-        error_constants_dir="os/mingw32-w64"
         ;;
       *)
         os_include_dir="os/mingw32"
-        error_constants_dir="os/mingw32"
         ;;
     esac
     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 97542524a69..28c5b3c4453 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1033,7 +1033,6 @@ host_headers = \
 	${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
 	${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
 	${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h \
-	${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
 	${glibcxx_srcdir}/include/precompiled/stdc++.h \
 	${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
 	${glibcxx_srcdir}/include/precompiled/extc++.h
@@ -1051,6 +1050,7 @@ host_headers_extra = \
 	${host_builddir}/c++allocator.h \
 	${host_builddir}/c++io.h \
 	${host_builddir}/c++locale.h \
+	${host_builddir}/error_constants.h \
 	${host_builddir}/messages_members.h \
 	${host_builddir}/time_members.h
 
@@ -1106,6 +1106,7 @@ allstamped = \
 # catenation.
 allcreated = \
 	${host_builddir}/c++config.h \
+	${host_builddir}/error_constants.h \
 	${host_builddir}/largefile-config.h \
 	${thread_host_headers} \
 	${pch_build}
@@ -1404,6 +1405,9 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
 	echo "" >> $@ ;\
 	echo "#endif // _GLIBCXX_CXX_CONFIG_H" >> $@
 
+${host_builddir}/error_constants.h: ${glibcxx_srcdir}/scripts/make_errc.sh
+	${glibcxx_srcdir}/scripts/make_errc.sh $@ "${CXXCPP}" ${AM_CPPFLAGS}
+
 # Host includes for threads
 uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
 
diff --git a/libstdc++-v3/scripts/make_errc.sh b/libstdc++-v3/scripts/make_errc.sh
new file mode 100755
index 00000000000..4b98abe2bed
--- /dev/null
+++ b/libstdc++-v3/scripts/make_errc.sh
@@ -0,0 +1,165 @@
+#!/bin/sh
+
+[ -z "$1" ] && exit 1
+target=$1
+shift
+CXXCPP="$@"
+
+{
+  dir=`(umask 077 && mktemp -d "$target.XXXXXX") 2>/dev/null` &&
+  test -d "$dir"
+} || {
+  dir=$target.$RANDOM$$
+  (umask 077 && mkdir "$dir")
+} || exit $?
+
+output_h=$dir/output.h
+constants_h=$dir/constants.h
+
+cat > "$output_h" << EOT
+// Definition of std::errc enumeration type  -*- C++ -*-
+
+// Copyright The GNU Toolchain Authors.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/errc.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{system_error}
+ */
+
+// This is a generated file. Do not edit directly.
+
+#ifndef _GLIBCXX_ERRC_H
+#define _GLIBCXX_ERRC_H 1
+
+#if __cplusplus >= 201103L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  enum class errc
+    {
+EOT
+
+cat > "$constants_h" <<EOT
+#if __has_include (<errno.h>)
+#include <errno.h>
+#endif
+#include <bits/c++config.h>
+#ifndef _GLIBCXX_ERRC_ORIGIN
+# define _GLIBCXX_ERRC_ORIGIN 9999
+#endif
+#line _GLIBCXX_ERRC_ORIGIN
+GLIBCXX ERROR CONSTANTS BELOW HERE
+      address_family_not_supported = EAFNOSUPPORT,
+      address_in_use = EADDRINUSE,
+      address_not_available = EADDRNOTAVAIL,
+      already_connected = EISCONN,
+      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,
+      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,
+EOT
+
+${CXXCPP} -P -D_POSIX_C_SOURCE=200809L -x c++ "$constants_h" \
+  | sed -e '1,/^GLIBCXX ERROR CONSTANTS BELOW HERE$/d' \
+  >> "$output_h" || exit $?
+
+cat >> "$output_h" << EOT
+    };
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++11
+#endif // _GLIBCXX_ERRC_H
+EOT
+
+mv "$output_h" "$target"
+rm -r $dir
-- 
2.37.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] libstdc++: Generate error_constants.h from <errno.h> [PR104883]
  2022-10-04 16:51 [RFC] libstdc++: Generate error_constants.h from <errno.h> [PR104883] Jonathan Wakely
@ 2022-10-04 18:05 ` Jonathan Wakely
  2022-10-04 18:30   ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2022-10-04 18:05 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On Tue, 4 Oct 2022 at 17:51, Jonathan Wakely via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Does anybody see any issues with generating the list of error numbers at
> build time?
>
>
> -- >8 --
>
> Instead of having several very similar target-specific headers with
> slightly different sets of enumerators, generate the error_constants.h
> file as part of the build. This ensures that all enumerators are always
> defined, with the value from the corresponding errno macro if present,
> or a libstdc++-specific alternative value.
>
> The libstdc++-specific values will be values greater than the positive
> integer _GLIBCXX_ERRC_ORIGIN, which defaults to 9999 but can be set in
> os_defines.h if a more suitable value exists for the OS (e.g. ELAST
> could be used for BSD targets).
...
> +${CXXCPP} -P -D_POSIX_C_SOURCE=200809L -x c++ "$constants_h" \
> +  | sed -e '1,/^GLIBCXX ERROR CONSTANTS BELOW HERE$/d' \
> +  >> "$output_h" || exit $?

Gah, this is the wrong version of the script! It's supposed to replace
unexpanded EXXX tokens with __LINE__ (which is why #line is used to
set the origin) but I seem to have committed the wrong version.

Let me dig that out of my git reflog ...


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] libstdc++: Generate error_constants.h from <errno.h> [PR104883]
  2022-10-04 18:05 ` Jonathan Wakely
@ 2022-10-04 18:30   ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2022-10-04 18:30 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

On Tue, 4 Oct 2022 at 19:05, Jonathan Wakely wrote:
>
> On Tue, 4 Oct 2022 at 17:51, Jonathan Wakely via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > Does anybody see any issues with generating the list of error numbers at
> > build time?
> >
> >
> > -- >8 --
> >
> > Instead of having several very similar target-specific headers with
> > slightly different sets of enumerators, generate the error_constants.h
> > file as part of the build. This ensures that all enumerators are always
> > defined, with the value from the corresponding errno macro if present,
> > or a libstdc++-specific alternative value.
> >
> > The libstdc++-specific values will be values greater than the positive
> > integer _GLIBCXX_ERRC_ORIGIN, which defaults to 9999 but can be set in
> > os_defines.h if a more suitable value exists for the OS (e.g. ELAST
> > could be used for BSD targets).
> ...
> > +${CXXCPP} -P -D_POSIX_C_SOURCE=200809L -x c++ "$constants_h" \
> > +  | sed -e '1,/^GLIBCXX ERROR CONSTANTS BELOW HERE$/d' \
> > +  >> "$output_h" || exit $?
>
> Gah, this is the wrong version of the script! It's supposed to replace
> unexpanded EXXX tokens with __LINE__ (which is why #line is used to
> set the origin) but I seem to have committed the wrong version.
>
> Let me dig that out of my git reflog ...

I was looking on the wrong machine. Here's the working patch that
expands undefined EXXX constants to __LINE__, which has been offset by
the _GLIBCXX_ERRC_ORIGIN value.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 9579 bytes --]

commit 5e6714e4c591d390e2b8aa5c673490e99d8c906a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Sep 22 21:54:44 2022

    libstdc++: Generate error_constants.h from <errno.h> [PR104883]
    
    Instead of having several very similar target-specific headers with
    slightly different sets of enumerators, generate the error_constants.h
    file as part of the build. This ensures that all enumerators are always
    defined, with the value from the corresponding errno macro if present,
    or a libstdc++-specific alternative value.
    
    The libstdc++-specific values will be values greater than the positive
    integer _GLIBCXX_ERRC_ORIGIN, which defaults to 9999 but can be set in
    os_defines.h if a more suitable value exists for the OS (e.g. ELAST
    could be used for BSD targets).
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/104883
            * configure.host (error_constants_dir): Remove.
            * include/Makefile.am (error_constants.h): Generate using
            make_errc.sh script.
            * include/Makefile.in: Regenerate.
            * scripts/make_errc.sh: New file.

diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index ec32980aa0d..6d51c5f6a11 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -56,9 +56,6 @@
 #   cpu_opt_ext_random     path name of random.h containing CPU-specific
 #                          optimizations for extensions
 #
-#   error_constants_dir    location of error_constants.h
-#                          defaults to os/generic.
-#
 # It possibly modifies the following variables:
 #
 #   OPT_LDFLAGS            extra flags to pass when linking the library, of
@@ -93,7 +90,6 @@ cpu_defines_dir="cpu/generic"
 try_cpu=generic
 abi_baseline_subdir_switch=--print-multi-directory
 abi_tweaks_dir="cpu/generic"
-error_constants_dir="os/generic"
 tmake_file=
 
 # HOST-SPECIFIC OVERRIDES
@@ -247,7 +243,6 @@ case "${host_os}" in
     ;;
   *djgpp*)      # leading * picks up "msdosdjgpp"
     os_include_dir="os/djgpp"
-    error_constants_dir="os/djgpp"
     ;;
   dragonfly*)
     os_include_dir="os/bsd/dragonfly"
@@ -274,11 +269,9 @@ case "${host_os}" in
     case "$host" in
       *-w64-*)
         os_include_dir="os/mingw32-w64"
-        error_constants_dir="os/mingw32-w64"
         ;;
       *)
         os_include_dir="os/mingw32"
-        error_constants_dir="os/mingw32"
         ;;
     esac
     OPT_LDFLAGS="${OPT_LDFLAGS} \$(lt_host_flags)"
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 97542524a69..28c5b3c4453 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1033,7 +1033,6 @@ host_headers = \
 	${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
 	${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
 	${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h \
-	${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
 	${glibcxx_srcdir}/include/precompiled/stdc++.h \
 	${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
 	${glibcxx_srcdir}/include/precompiled/extc++.h
@@ -1051,6 +1050,7 @@ host_headers_extra = \
 	${host_builddir}/c++allocator.h \
 	${host_builddir}/c++io.h \
 	${host_builddir}/c++locale.h \
+	${host_builddir}/error_constants.h \
 	${host_builddir}/messages_members.h \
 	${host_builddir}/time_members.h
 
@@ -1106,6 +1106,7 @@ allstamped = \
 # catenation.
 allcreated = \
 	${host_builddir}/c++config.h \
+	${host_builddir}/error_constants.h \
 	${host_builddir}/largefile-config.h \
 	${thread_host_headers} \
 	${pch_build}
@@ -1404,6 +1405,9 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
 	echo "" >> $@ ;\
 	echo "#endif // _GLIBCXX_CXX_CONFIG_H" >> $@
 
+${host_builddir}/error_constants.h: ${glibcxx_srcdir}/scripts/make_errc.sh
+	${glibcxx_srcdir}/scripts/make_errc.sh $@ "${CXXCPP}" ${AM_CPPFLAGS}
+
 # Host includes for threads
 uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
 
diff --git a/libstdc++-v3/scripts/make_errc.sh b/libstdc++-v3/scripts/make_errc.sh
new file mode 100755
index 00000000000..10cdfb1b3d4
--- /dev/null
+++ b/libstdc++-v3/scripts/make_errc.sh
@@ -0,0 +1,168 @@
+#!/bin/sh
+
+[ -z "$1" ] && exit 1
+target=$1
+shift
+CXXCPP="$@"
+
+{
+  dir=`(umask 077 && mktemp -d "$target.XXXXXX") 2>/dev/null` &&
+  test -d "$dir"
+} || {
+  dir=$target.$RANDOM$$
+  (umask 077 && mkdir "$dir")
+} || exit $?
+
+output_h=$dir/output.h
+constants_h=$dir/constants.h
+
+cat > "$output_h" << EOT
+// Definition of std::errc enumeration type  -*- C++ -*-
+
+// Copyright The GNU Toolchain Authors.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/errc.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{system_error}
+ */
+
+// This is a generated file. Do not edit directly.
+
+#ifndef _GLIBCXX_ERRC_H
+#define _GLIBCXX_ERRC_H 1
+
+#if __cplusplus >= 201103L
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  enum class errc
+    {
+EOT
+
+cat > "$constants_h" <<EOT
+#if __has_include (<errno.h>)
+#include <errno.h>
+#endif
+#include <bits/c++config.h>
+#ifndef _GLIBCXX_ERRC_ORIGIN
+# define _GLIBCXX_ERRC_ORIGIN 9999
+#endif
+GLIBCXX ERROR CONSTANTS BELOW HERE
+line _GLIBCXX_ERRC_ORIGIN
+      address_family_not_supported = EAFNOSUPPORT,
+      address_in_use = EADDRINUSE,
+      address_not_available = EADDRNOTAVAIL,
+      already_connected = EISCONN,
+      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,
+      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,
+EOT
+
+${CXXCPP} -P -D_POSIX_C_SOURCE=200809L -x c++ "$constants_h" \
+  | sed -e '1,/^GLIBCXX ERROR CONSTANTS BELOW HERE$/d' \
+	-e 's/^line [[:digit:]]*$/#&/' \
+	-e 's/ = E.*,/ = __LINE__,/' \
+  | ${CXXCPP} -P -x c++ - \
+  >> "$output_h" || exit $?
+
+cat >> "$output_h" << EOT
+    };
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+#endif // C++11
+#endif // _GLIBCXX_ERRC_H
+EOT
+
+mv "$output_h" "$target"
+rm -r $dir

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-04 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 16:51 [RFC] libstdc++: Generate error_constants.h from <errno.h> [PR104883] Jonathan Wakely
2022-10-04 18:05 ` Jonathan Wakely
2022-10-04 18:30   ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).