]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update 'error' module from gnulib.
authorBruno Haible <bruno@clisp.org>
Wed, 12 Jan 2005 12:58:56 +0000 (12:58 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:01 +0000 (12:12 +0200)
16 files changed:
gettext-runtime/ChangeLog
gettext-runtime/Makefile.am
gettext-runtime/configure.ac
gettext-runtime/lib/ChangeLog
gettext-runtime/lib/Makefile.am
gettext-tools/ChangeLog
gettext-tools/Makefile.am
gettext-tools/configure.ac
gettext-tools/lib/ChangeLog
gettext-tools/lib/Makefile.am
gettext-tools/lib/Makefile.msvc
gettext-tools/lib/Makefile.vms
gettext-tools/lib/error.c
gettext-tools/lib/error.h
gettext-tools/m4/ChangeLog
gettext-tools/m4/error.m4

index 8e9dd40fc3fe16a2fc1d8658bfc473915657ce65..58aa37b907a257a7025e85019b8aa2483ca335b7 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-06  Bruno Haible  <bruno@clisp.org>
+
+       * configure.ac: Invoke gl_ERROR instead of gt_FUNC_ERROR_AT_LINE.
+       * Makefile.am (config.h_vms, config.h.msvc): Remove setting of
+       HAVE_DECL_STRERROR.
+
 2005-01-06  Bruno Haible  <bruno@clisp.org>
 
        * configure.ac: Invoke gl_GETOPT.
index 3f4d93f7f35621d316e83c5476991d215b077e6e..23f10e03621b1300b488807b8f1b666fc5b7f86f 100644 (file)
@@ -48,7 +48,6 @@ config.h_vms: config.h.in ../version.sh
        (echo '#define KEEP_CRTL_SETLOCALE 1'; echo '#include <vms_jackets.h>'; echo '#undef realpath'; \
         sed -e 's/#undef ENABLE_NLS$$/#define ENABLE_NLS 1/' \
             -e 's/#undef HAVE_ALLOCA$$/#define HAVE_ALLOCA 1/' \
-            -e 's/#undef HAVE_DECL_STRERROR$$/#define HAVE_DECL_STRERROR 1/' \
             -e 's/#undef HAVE_DLFCN_H$$/#define HAVE_DLFCN_H 1/' \
             -e 's/#undef HAVE_ERRNO_DECL$$/#define HAVE_ERRNO_DECL 1/' \
             -e 's/#undef HAVE_GETCWD$$/#define HAVE_GETCWD 1/' \
index b3ca8068c294e4c2f73ecd50de91929f47ee3bc4..2a6296304f5c8976115b9949d42abdb48fb6d008 100644 (file)
@@ -90,7 +90,7 @@ gl_GETOPT
 gt_FUNC_SETENV
 gl_FUNC_STRERROR
 gl_FUNC_GLIBC_UNLOCKED_IO
-gt_FUNC_ERROR_AT_LINE
+gl_ERROR
 gl_PATHMAX
 gl_FUNC_READLINK
 gl_XREADLINK
index c6f22f3d9b2e28687e1cea7838c19568cd891534..eb1a68aaf707312ee020c52f06b0706858830e57 100644 (file)
@@ -1,3 +1,10 @@
+2005-01-06  Bruno Haible  <bruno@clisp.org>
+
+       * Makefile.am (libgrt_a_SOURCES): Remove error.h, error.c.
+       (LIBADD_SOURCE): Add error.h, error.c here.
+       * error.h: New file.
+       * error.c: New file.
+
 2005-01-06  Bruno Haible  <bruno@clisp.org>
 
        * Makefile.am (libgrt_a_SOURCES): Remove getopt files.
index 87e4de8f45d70865310896ca17340fd37b19d704..56c902d54408d7eadf7b2c9574bbca5786dc0dba 100644 (file)
@@ -29,7 +29,6 @@ noinst_LIBRARIES = libgrt.a
 libgrt_a_SOURCES = \
   ../../gettext-tools/lib/basename.h ../../gettext-tools/lib/basename.c \
   ../../gettext-tools/lib/closeout.h ../../gettext-tools/lib/closeout.c \
-  ../../gettext-tools/lib/error.h ../../gettext-tools/lib/error.c \
   ../../gettext-tools/lib/exit.h \
   ../../gettext-tools/lib/fwriteerror.h ../../gettext-tools/lib/fwriteerror.c \
   ../../gettext-tools/lib/pathmax.h \
@@ -44,6 +43,7 @@ libgrt_a_SOURCES = \
 LIBADD_SOURCE = \
   atexit.c \
   ../../gettext-tools/lib/canonicalize.h canonicalize.c \
+  error.h error.c \
   getopt.c getopt1.c ../../gettext-tools/lib/getopt_int.h \
   memmove.c \
   readlink.c \
index b78085806d8bdd2be29285b34ee7dd9826f0b410..86abc0bcc2eee6f016d707d0ae6bb1511c137058 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-06  Bruno Haible  <bruno@clisp.org>
+
+       * configure.ac: Invoke gl_ERROR instead of gt_FUNC_ERROR_AT_LINE.
+       * Makefile.am (config.h_vms, config.h.msvc): Remove setting of
+       HAVE_DECL_STRERROR.
+
 2005-01-06  Bruno Haible  <bruno@clisp.org>
 
        * configure.ac: Invoke gl_QUOTE.
index 3c44e5470c8fc6065449627b09a987a3c301b2a7..caa7b6f1b554fcce56784ab1492f3cd7b2d56bf5 100644 (file)
@@ -48,7 +48,6 @@ config.h_vms: config.h.in ../version.sh
             -e 's/#undef HAVE_BTOWC$$/#define HAVE_BTOWC 1/' \
             -e 's/#undef HAVE_CHOWN$$/#define HAVE_CHOWN 1/' \
             -e 's/#undef HAVE_DECL_GETENV$$/#define HAVE_DECL_GETENV 1/' \
-            -e 's/#undef HAVE_DECL_STRERROR$$/#define HAVE_DECL_STRERROR 1/' \
             -e 's/#undef HAVE_DECL_WCWIDTH$$/#define HAVE_DECL_WCWIDTH 1/' \
             -e 's/#undef HAVE_DIRENT_H$$/#define HAVE_DIRENT_H 1/' \
             -e 's/#undef HAVE_DLFCN_H$$/#define HAVE_DLFCN_H 1/' \
index a094db3cf291fd90c7e920b8a8cd6c42ef035ce7..0b574cc4873c6942358a58074db977de91e714ee 100644 (file)
@@ -142,7 +142,7 @@ gt_SIGINFO
 gt_FUNC_SETENV
 gl_FUNC_STRERROR
 gl_FUNC_GLIBC_UNLOCKED_IO
-gt_FUNC_ERROR_AT_LINE
+gl_ERROR
 gl_QUOTEARG
 gl_QUOTE
 gl_PATHMAX
index dda3cc554cc03bfe3eeae0abdf892e505eebf1e3..166e032fe2001040eb38359d58cddb5024e7a9d1 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-06  Bruno Haible  <bruno@clisp.org>
+
+       * error.h: Update from gnulib.
+       * error.c: Update from gnulib.
+       * Makefile.am (libgettextlib_la_SOURCES): Remove error.h, error.c.
+       (LIBADD_SOURCE): Add error.h, error.c here.
+       * Makefile.msvc: Update.
+       * Makefile.vms: Update.
+
 2005-01-06  Bruno Haible  <bruno@clisp.org>
 
        * argmatch.h: Update from gnulib, with DLL_VARIABLE modifications.
index ffa08123b4cf1e955b7ee35be11183df2170b732..8e60915af030ec10e5058a974b6442d1181ecb41 100644 (file)
@@ -43,7 +43,6 @@ libgettextlib_la_SOURCES = \
   copy-file.h copy-file.c \
   csharpcomp.h csharpcomp.c \
   csharpexec.h csharpexec.c \
-  error.h error.c \
   error-progname.h error-progname.c \
   execute.h execute.c w32spawn.h \
   exit.h \
@@ -88,6 +87,7 @@ libgettextlib_la_SOURCES = \
 LIBADD_SOURCE = \
   atexit.c \
   canonicalize.h canonicalize.c \
+  error.h error.c \
   fnmatch.c \
   getline.h getline.c \
   getndelim2.h getndelim2.c \
index 3ad6259131ce00e5de5062466bffc752fc9b71d9..812f13e4c10c92c74c1659c8be17ddcb38370967 100644 (file)
@@ -90,7 +90,6 @@ OBJECTS = \
   copy-file.obj \
   csharpcomp.obj \
   csharpexec.obj \
-  error.obj \
   error-progname.obj \
   execute.obj \
   exitfail.obj \
@@ -123,6 +122,7 @@ OBJECTS = \
   xerror.obj \
   xsetenv.obj \
   \
+  error.obj \
   fnmatch.obj \
   getline.obj \
   getndelim2.obj \
@@ -171,9 +171,6 @@ csharpcomp.obj : csharpcomp.c
 csharpexec.obj : csharpexec.c
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c csharpexec.c
 
-error.obj : error.c
-       $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c error.c
-
 error-progname.obj : error-progname.c
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c error-progname.c
 
@@ -273,6 +270,9 @@ xerror.obj : xerror.c
 xsetenv.obj : xsetenv.c
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c xsetenv.c
 
+error.obj : error.c
+       $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c error.c
+
 fnmatch.obj : fnmatch.c
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c fnmatch.c
 
index 4b7cd4d026bcc4638aef65a3875f777fede924a0..96a02d5ad8deb6b9551b58ba75dbdc0bec7904d0 100644 (file)
@@ -48,7 +48,6 @@ OBJECTS = \
   copy-file.obj, \
   csharpcomp.obj, \
   csharpexec.obj, \
-  error.obj, \
   error-progname.obj, \
   execute.obj, \
   exitfail.obj, \
@@ -81,6 +80,7 @@ OBJECTS = \
   xerror.obj, \
   xsetenv.obj, \
   \
+  error.obj, \
   fnmatch.obj, \
   getline.obj, \
   getndelim2.obj, \
@@ -132,9 +132,6 @@ csharpcomp.obj : csharpcomp.c,alloca.h
 csharpexec.obj : csharpexec.c,alloca.h
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) csharpexec.c
 
-error.obj : error.c
-       $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) error.c
-
 error-progname.obj : error-progname.c
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) error-progname.c
 
@@ -234,6 +231,9 @@ xerror.obj : xerror.c
 xsetenv.obj : xsetenv.c
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) xsetenv.c
 
+error.obj : error.c
+       $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) error.c
+
 fnmatch.obj : fnmatch.c fnmatch.h fnmatch_loop.c
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) fnmatch.c
 
index 2c8845769fd0641e7921b4d27ef29a0033b48b7a..6b3662d61d74ac843bbdd9fb3656269187a77061 100644 (file)
@@ -1,5 +1,7 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
    This program 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 2, or (at your option)
 # include <config.h>
 #endif
 
-#include <stdio.h>
+#include "error.h"
 
-#if !HAVE_ERROR_AT_LINE
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#ifdef _LIBC
-# include <libintl.h>
-#else
+#if !_LIBC && ENABLE_NLS
 # include "gettext.h"
 #endif
 
 # define mbsrtowcs __mbsrtowcs
 #endif
 
-#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
-# if __STDC__ || defined _MSC_VER
-#  include <stdarg.h>
-#  define VA_START(args, lastarg) va_start(args, lastarg)
-# else
-#  include <varargs.h>
-#  define VA_START(args, lastarg) va_start(args)
-# endif
-#else
-# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-#endif
-
-#if STDC_HEADERS || _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-void exit ();
-#endif
-
-#include "error.h"
-
-#if !_LIBC
+#if USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #endif
 
@@ -68,11 +49,7 @@ void exit ();
 /* If NULL, error will flush stdout, then print on stderr the program
    name, a colon and a space.  Otherwise, error will call this
    function without parameters instead.  */
-void (*error_print_progname) (
-#if __STDC__ - 0
-                             void
-#endif
-                             );
+void (*error_print_progname) (void);
 
 /* This variable is incremented each time `error' is called.  */
 unsigned int error_message_count;
@@ -95,12 +72,12 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 # define error __error
 # define error_at_line __error_at_line
 
-# ifdef USE_IN_LIBIO
-#  include <libio/iolibio.h>
-#  define fflush(s) INTUSE(_IO_fflush) (s)
-#  undef putc
-#  define putc(c, fp) INTUSE(_IO_putc) (c, fp)
-# endif
+# include <libio/iolibio.h>
+# define fflush(s) INTUSE(_IO_fflush) (s)
+# undef putc
+# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
+
+# include <bits/libc-lock.h>
 
 #else /* not _LIBC */
 
@@ -111,40 +88,23 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 char *strerror_r ();
 # endif
 
+# ifndef SIZE_MAX
+#  define SIZE_MAX ((size_t) -1)
+# endif
+
 /* The calling program should define program_name and set it to the
    name of the executing program.  */
 extern char *program_name;
 
 # if HAVE_STRERROR_R || defined strerror_r
 #  define __strerror_r strerror_r
-# else
-#  if HAVE_STRERROR
-#   ifndef HAVE_DECL_STRERROR
-"this configure-time declaration test was not run"
-#   endif
-#   if !HAVE_DECL_STRERROR
-char *strerror ();
-#   endif
-#  else
-static char *
-private_strerror (int errnum)
-{
-  extern char *sys_errlist[];
-  extern int sys_nerr;
-
-  if (errnum > 0 && errnum <= sys_nerr)
-    return _(sys_errlist[errnum]);
-  return _("Unknown system error");
-}
-#   define strerror private_strerror
-#  endif /* HAVE_STRERROR */
-# endif        /* HAVE_STRERROR_R || defined strerror_r */
+# endif
 #endif /* not _LIBC */
 
 static void
 print_errno_message (int errnum)
 {
-  char const *s;
+  char const *s = NULL;
 
 #if defined HAVE_STRERROR_R || _LIBC
   char errbuf[1024];
@@ -153,19 +113,15 @@ print_errno_message (int errnum)
 # else
   if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
     s = errbuf;
-  else
-    s = 0;
 # endif
-#else
-  s = strerror (errnum);
 #endif
 
 #if !_LIBC
-  if (! s)
+  if (! s && ! (s = strerror (errnum)))
     s = _("Unknown system error");
 #endif
 
-#if _LIBC && USE_IN_LIBIO
+#if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     {
       __fwprintf (stderr, L": %s", s);
@@ -176,108 +132,81 @@ print_errno_message (int errnum)
   fprintf (stderr, ": %s", s);
 }
 
-#ifdef VA_START
 static void
 error_tail (int status, int errnum, const char *message, va_list args)
 {
-# if HAVE_VPRINTF || _LIBC
-#  if _LIBC && USE_IN_LIBIO
+#if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     {
-#   define ALLOCA_LIMIT        2000
+# define ALLOCA_LIMIT 2000
       size_t len = strlen (message) + 1;
-      wchar_t *wmessage = NULL;
-      mbstate_t st;
-      size_t res;
-      const char *tmp;
-
-      do
+      const wchar_t *wmessage = L"out of memory";
+      wchar_t *wbuf = (len < ALLOCA_LIMIT
+                      ? alloca (len * sizeof *wbuf)
+                      : len <= SIZE_MAX / sizeof *wbuf
+                      ? malloc (len * sizeof *wbuf)
+                      : NULL);
+
+      if (wbuf)
        {
-         if (len < ALLOCA_LIMIT)
-           wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
-         else
-           {
-             if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
-               wmessage = NULL;
-
-             wmessage = (wchar_t *) realloc (wmessage,
-                                             len * sizeof (wchar_t));
-
-             if (wmessage == NULL)
-               {
-                 fputws_unlocked (L"out of memory\n", stderr);
-                 return;
-               }
-           }
-
+         size_t res;
+         mbstate_t st;
+         const char *tmp = message;
          memset (&st, '\0', sizeof (st));
-         tmp =message;
+         res = mbsrtowcs (wbuf, &tmp, len, &st);
+         wmessage = res == (size_t) -1 ? L"???" : wbuf;
        }
-      while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
-
-      if (res == (size_t) -1)
-       /* The string cannot be converted.  */
-       wmessage = (wchar_t *) L"???";
 
       __vfwprintf (stderr, wmessage, args);
+      if (! (len < ALLOCA_LIMIT))
+       free (wbuf);
     }
   else
-#  endif
+#endif
     vfprintf (stderr, message, args);
-# else
-  _doprnt (message, args, stderr);
-# endif
   va_end (args);
 
   ++error_message_count;
   if (errnum)
     print_errno_message (errnum);
-# if _LIBC && USE_IN_LIBIO
+#if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     putwc (L'\n', stderr);
   else
-# endif
+#endif
     putc ('\n', stderr);
   fflush (stderr);
   if (status)
     exit (status);
 }
-#endif
 
 
 /* Print the program name and error message MESSAGE, which is a printf-style
    format string with optional args.
    If ERRNUM is nonzero, print its corresponding system error message.
    Exit with status STATUS if it is nonzero.  */
-/* VARARGS */
 void
-#if defined VA_START && (__STDC__ || defined _MSC_VER)
 error (int status, int errnum, const char *message, ...)
-#else
-error (status, errnum, message, va_alist)
-     int status;
-     int errnum;
-     char *message;
-     va_dcl
-#endif
 {
-#ifdef VA_START
   va_list args;
+
+#if defined _LIBC && defined __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+                  0);
 #endif
 
   fflush (stdout);
 #ifdef _LIBC
-# ifdef USE_IN_LIBIO
   _IO_flockfile (stderr);
-# else
-  __flockfile (stderr);
-# endif
 #endif
   if (error_print_progname)
     (*error_print_progname) ();
   else
     {
-#if _LIBC && USE_IN_LIBIO
+#if _LIBC
       if (_IO_fwide (stderr, 0) > 0)
        __fwprintf (stderr, L"%s: ", program_name);
       else
@@ -285,26 +214,13 @@ error (status, errnum, message, va_alist)
        fprintf (stderr, "%s: ", program_name);
     }
 
-#ifdef VA_START
-  VA_START (args, message);
+  va_start (args, message);
   error_tail (status, errnum, message, args);
-#else
-  fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
-
-  ++error_message_count;
-  if (errnum)
-    print_errno_message (errnum);
-  putc ('\n', stderr);
-  fflush (stderr);
-  if (status)
-    exit (status);
-#endif
 
 #ifdef _LIBC
-# ifdef USE_IN_LIBIO
   _IO_funlockfile (stderr);
-# else
-  __funlockfile (stderr);
+# ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
 # endif
 #endif
 }
@@ -314,22 +230,10 @@ error (status, errnum, message, va_alist)
 int error_one_per_line;
 
 void
-#if defined VA_START && (__STDC__ || defined _MSC_VER)
 error_at_line (int status, int errnum, const char *file_name,
               unsigned int line_number, const char *message, ...)
-#else
-error_at_line (status, errnum, file_name, line_number, message, va_alist)
-     int status;
-     int errnum;
-     const char *file_name;
-     unsigned int line_number;
-     char *message;
-     va_dcl
-#endif
 {
-#ifdef VA_START
   va_list args;
-#endif
 
   if (error_one_per_line)
     {
@@ -346,19 +250,23 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
       old_line_number = line_number;
     }
 
+#if defined _LIBC && defined __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+                  0);
+#endif
+
   fflush (stdout);
 #ifdef _LIBC
-# ifdef USE_IN_LIBIO
   _IO_flockfile (stderr);
-# else
-  __flockfile (stderr);
-# endif
 #endif
   if (error_print_progname)
     (*error_print_progname) ();
   else
     {
-#if _LIBC && USE_IN_LIBIO
+#if _LIBC
       if (_IO_fwide (stderr, 0) > 0)
        __fwprintf (stderr, L"%s: ", program_name);
       else
@@ -368,7 +276,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
 
   if (file_name != NULL)
     {
-#if _LIBC && USE_IN_LIBIO
+#if _LIBC
       if (_IO_fwide (stderr, 0) > 0)
        __fwprintf (stderr, L"%s:%d: ", file_name, line_number);
       else
@@ -376,26 +284,13 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
        fprintf (stderr, "%s:%d: ", file_name, line_number);
     }
 
-#ifdef VA_START
-  VA_START (args, message);
+  va_start (args, message);
   error_tail (status, errnum, message, args);
-#else
-  fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
-
-  ++error_message_count;
-  if (errnum)
-    print_errno_message (errnum);
-  putc ('\n', stderr);
-  fflush (stderr);
-  if (status)
-    exit (status);
-#endif
 
 #ifdef _LIBC
-# ifdef USE_IN_LIBIO
   _IO_funlockfile (stderr);
-# else
-  __funlockfile (stderr);
+# ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
 # endif
 #endif
 }
@@ -407,5 +302,3 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
 weak_alias (__error, error)
 weak_alias (__error_at_line, error_at_line)
 #endif
-
-#endif
index 5feacd02020d89d8abc9165a7bd0076adf684419..f1b47cec4cdf74f8d892a0236326549d09578935 100644 (file)
@@ -1,31 +1,27 @@
 /* Declaration for error-reporting function
    Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-
-   NOTE: The canonical source of this file is maintained with the GNU C Library.
-   Bugs can be reported to bug-glibc@gnu.org.
-
-   This program 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 2, or (at your option) any
-   later version.
+   This program 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 2, or (at your option)
+   any later version.
 
    This program 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.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-   USA.  */
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifndef _ERROR_H
 #define _ERROR_H 1
 
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
 #  define __attribute__(Spec) /* empty */
 # endif
 /* The __-protected variants of `format' and `printf' attributes
 extern "C" {
 #endif
 
-#if (defined (__STDC__) && __STDC__) || defined _MSC_VER
-
 /* Print a message with `fprintf (stderr, FORMAT, ...)';
    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
 
-extern void error (int status, int errnum, const char *format, ...)
+extern void error (int __status, int __errnum, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
 
-extern void error_at_line (int status, int errnum, const char *fname,
-                          unsigned int lineno, const char *format, ...)
+extern void error_at_line (int __status, int __errnum, const char *__fname,
+                          unsigned int __lineno, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 5, 6)));
 
 /* If NULL, error will flush stdout, then print on stderr the program
@@ -58,12 +52,6 @@ extern void error_at_line (int status, int errnum, const char *fname,
    function without parameters instead.  */
 extern DLL_VARIABLE void (*error_print_progname) (void);
 
-#else
-void error ();
-void error_at_line ();
-extern DLL_VARIABLE void (*error_print_progname) ();
-#endif
-
 /* This variable is incremented each time `error' is called.  */
 extern DLL_VARIABLE unsigned int error_message_count;
 
index 4cab5d624785016a1f950ccceb199643993c9345..dbab0f22c9020dea4ae516dcbbaa6a09ffbd242b 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-06  Bruno Haible  <bruno@clisp.org>
+
+       * error.m4: Upgrade from gnulib.
+
 2005-01-06  Bruno Haible  <bruno@clisp.org>
 
        * quote.m4: New file, from gnulib.
index caeb47d1d4c76ebce0e06f6cbf6e144af1192092..6c1091886f50610488f1a1b0f556b29fa8c2ddb6 100644 (file)
@@ -1,4 +1,4 @@
-# error.m4 serial 3 (gettext-0.14.2)
+# error.m4 serial 10 (gettext-0.14.2)
 dnl Copyright (C) 2002-2005 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -6,28 +6,16 @@ dnl Public License, this file may be distributed as part of a program
 dnl that contains a configuration script generated by Autoconf, under
 dnl the same distribution terms as the rest of that program.
 
-# A modified version of AM_FUNC_ERROR_AT_LINE that triggers HAVE_ERROR_AT_LINE
-# in config.h instead of modifying LIBOBJS.
-AC_DEFUN([gt_FUNC_ERROR_AT_LINE],
+AC_DEFUN([gl_ERROR],
 [
-  AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
-   [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
-                am_cv_lib_error_at_line=yes,
-               am_cv_lib_error_at_line=no)])
-  if test $am_cv_lib_error_at_line = yes; then
-    AC_DEFINE(HAVE_ERROR_AT_LINE, 1,
-      [Define to 1 if you have the functions error() and error_at_line().])
-  else
-    gl_PREREQ_ERROR
-  fi
+  AC_FUNC_ERROR_AT_LINE
+  dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
+  gl_PREREQ_ERROR
 ])
 
 # Prerequisites of lib/error.c.
 AC_DEFUN([gl_PREREQ_ERROR],
 [
-  AC_REQUIRE([AC_HEADER_STDC])
-  AC_REQUIRE([AC_FUNC_VPRINTF])
-  AC_CHECK_FUNCS(strerror)
-  AC_CHECK_DECLS([strerror])
-  AC_FUNC_STRERROR_R
+  AC_REQUIRE([AC_FUNC_STRERROR_R])
+  :
 ])