bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Make errno.h define EILSEQ on old LynxOS systems.


From: Paul Eggert
Subject: Re: [PATCH] Make errno.h define EILSEQ on old LynxOS systems.
Date: Mon, 05 Nov 2012 12:36:48 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1

On 11/05/2012 06:56 AM, Joel Brobecker wrote:

> some systems define EILSEQ in wchar.h rather than errno.h
> (I am not sure whether I had a list of some such systems at some
> point, or not).

Thanks, could you please dig that up, or let us know from memory
as best you can?  I'd like to add this info to the documentation.

> if feels awkward to be including another header file

True.  How about the following patch instead?  It builds on the
existing machinery to get the actual value from wchar.h.

diff --git a/ChangeLog b/ChangeLog
index 720b7a2..5b479ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-11-05  Paul Eggert  <address@hidden>
+
+       errno: port to LynxOS 178 2.2.2
+       Problem reported by Joel Brobecker in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2012-10/msg00088.html>.
+       * doc/posix-headers/errno.texi (errno.h): Document this.
+       * lib/errno.in.h (EILSEQ, GNULIB_defined_EILSEQ): New macros,
+       defined if @EILSEQ_HIDDEN@ or if EILSEQ is not defined.
+       * lib/strerror-override.c, lib/strerror-override.h (strerror_override):
+       Supply a string for EILSEQ.
+       * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Check for EILSEQ.
+       (gl_REPLACE_ERRNO_VALUE): New parameter $2, to specify what
+       to do when the errno value is hidden.  All uses changed.
+       * modules/errno (errno.h): Substitute EILSEQ_HIDDEN and EILSEQ_VALUE.
+
 2012-11-01  Akim Demaille  <address@hidden>
 
        quote: provide a means to escape strings with nul characters
diff --git a/doc/posix-headers/errno.texi b/doc/posix-headers/errno.texi
index 54e0249..0166ddc 100644
--- a/doc/posix-headers/errno.texi
+++ b/doc/posix-headers/errno.texi
@@ -42,6 +42,9 @@ The macros @code{EOWNERDEAD}, @code{ENOTRECOVERABLE} are not 
defined on
 some platforms:
 glibc/Linux 2.3.6, glibc/Hurd 2.15, glibc/kFreeBSD 2.15,
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, 
HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin, mingw without pthreads-win32, MSVC 9, 
Interix 3.5, BeOS.
address@hidden
+The macro @code{EILSEQ} is not defined on some platforms:
+LynxOS 178 2.2.2.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 4fba101..5626ee6 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -148,6 +148,11 @@
 # endif
 
 
+/* Some systems define EILSEQ in <wchar.h> instead of <errno.h>.  */
+# if @EILSEQ_HIDDEN@
+#  define EILSEQ @EILSEQ_VALUE@
+# endif
+
 /* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
    EMULTIHOP, ENOLINK, EOVERFLOW are not defined.  */
 # if @EMULTIHOP_HIDDEN@
@@ -270,5 +275,10 @@
 #  define GNULIB_defined_ENOTRECOVERABLE 1
 # endif
 
+# ifndef EILSEQ
+#  define EILSEQ 2015
+#  define GNULIB_defined_EILSEQ 1
+# endif
+
 #endif /* address@hidden@_ERRNO_H */
 #endif /* address@hidden@_ERRNO_H */
diff --git a/lib/strerror-override.c b/lib/strerror-override.c
index 9f55cfa..f7cac65 100644
--- a/lib/strerror-override.c
+++ b/lib/strerror-override.c
@@ -291,6 +291,11 @@ strerror_override (int errnum)
       return "State not recoverable";
 #endif
 
+#if GNULIB_defined_EILSEQ
+    case EILSEQ:
+      return "Invalid or incomplete multibyte or wide character";
+#endif
+
     default:
       return NULL;
     }
diff --git a/lib/strerror-override.h b/lib/strerror-override.h
index fe1fb2c..6468681 100644
--- a/lib/strerror-override.h
+++ b/lib/strerror-override.h
@@ -46,7 +46,8 @@
      || GNULIB_defined_EDQUOT \
      || GNULIB_defined_ECANCELED \
      || GNULIB_defined_EOWNERDEAD \
-     || GNULIB_defined_ENOTRECOVERABLE
+     || GNULIB_defined_ENOTRECOVERABLE \
+     || GNULIB_defined_EILSEQ
 extern const char *strerror_override (int errnum);
 # else
 #  define strerror_override(ignored) NULL
diff --git a/m4/errno_h.m4 b/m4/errno_h.m4
index 1e76ba2..aa63189 100644
--- a/m4/errno_h.m4
+++ b/m4/errno_h.m4
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 11
+# errno_h.m4 serial 13
 dnl Copyright (C) 2004, 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -58,6 +58,9 @@ booboo
 #if !defined ENOTRECOVERABLE
 booboo
 #endif
+#if !defined EILSEQ
+booboo
+#endif
       ],
       [gl_cv_header_errno_h_complete=no],
       [gl_cv_header_errno_h_complete=yes])
@@ -70,12 +73,13 @@ booboo
   fi
   AC_SUBST([ERRNO_H])
   AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
-  gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
-  gl_REPLACE_ERRNO_VALUE([ENOLINK])
-  gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
+  gl_REPLACE_ERRNO_VALUE([EMULTIHOP], [[#define _XOPEN_SOURCE_EXTENDED 1]])
+  gl_REPLACE_ERRNO_VALUE([ENOLINK], [[#define _XOPEN_SOURCE_EXTENDED 1]])
+  gl_REPLACE_ERRNO_VALUE([EOVERFLOW], [[#define _XOPEN_SOURCE_EXTENDED 1]])
+  gl_REPLACE_ERRNO_VALUE([EILSEQ], [[#include <wchar.h>]])
 ])
 
-# Assuming $1 = EOVERFLOW.
+# Assuming $1 = EOVERFLOW and $2 = #define _XOPEN_SOURCE_EXTENDED 1.
 # The EOVERFLOW errno value ought to be defined in <errno.h>, according to
 # POSIX.  But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
 # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
@@ -95,7 +99,7 @@ yes
       [gl_cv_header_errno_h_]$1[=no])
       if test $gl_cv_header_errno_h_]$1[ = no; then
         AC_EGREP_CPP([yes],[
-#define _XOPEN_SOURCE_EXTENDED 1
+]$2[
 #include <errno.h>
 #ifdef ]$1[
 yes
@@ -105,7 +109,7 @@ yes
           dnl The macro exists but is hidden.
           dnl Define it to the same value.
           AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
-#define _XOPEN_SOURCE_EXTENDED 1
+]$2[
 #include <errno.h>
 /* The following two lines are a workaround against an autoconf-2.52 bug.  */
 #include <stdio.h>
diff --git a/modules/errno b/modules/errno
index 2fee35d..5f813bd 100644
--- a/modules/errno
+++ b/modules/errno
@@ -25,6 +25,8 @@ errno.h: errno.in.h $(top_builddir)/config.status
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
+             -e 's|@''EILSEQ_HIDDEN''@|$(EILSEQ_HIDDEN)|g' \
+             -e 's|@''EILSEQ_VALUE''@|$(EILSEQ_VALUE)|g' \
              -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
              -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
              -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
@@ -48,4 +50,3 @@ LGPLv2+
 
 Maintainer:
 Bruno Haible
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]