[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] 'fatal' patch to assume C89 or better
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] 'fatal' patch to assume C89 or better |
Date: |
08 Sep 2003 23:39:07 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
I installed this:
2003-09-08 Paul Eggert <address@hidden>
* lib/fatal.c: Include "fatal.h" first, to test interface.
Include <stdarg.h>, <stdlib.h>, <string.h> unconditionally.
(VA_START): Remove; all uses changed to va_start.
[! (HAVE_VPRINTF || HAVE_DOPRNT || _LIBC)]: Remove support for
this case.
(exit): Remove decl.
(fatal): Prototype unconditionally. Assume va_start works.
Abort at end, to pacify gcc.
* m4/fatal.m4 (gl_FATAL): Do not require STDC headers, and
do not check for doprnt or vprintf.
Index: lib/fatal.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fatal.c,v
retrieving revision 1.4
diff -p -u -r1.4 fatal.c
--- lib/fatal.c 29 May 2003 07:21:59 -0000 1.4
+++ lib/fatal.c 9 Sep 2003 06:32:35 -0000
@@ -22,22 +22,12 @@
/* FIXME: define EXIT_FAILURE */
-#include <stdio.h>
-
-#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
-# include <stdarg.h>
-# define VA_START(args, lastarg) va_start(args, lastarg)
-#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
+#include "fatal.h"
-#if STDC_HEADERS || _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-void exit ();
-#endif
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef _LIBC
# define program_name program_invocation_name
@@ -47,24 +37,14 @@ void exit ();
extern char *program_name;
#endif
-#include "fatal.h"
#include "unlocked-io.h"
/* Like error, but always exit with EXIT_FAILURE. */
void
-#if defined VA_START && __STDC__
fatal (int errnum, const char *message, ...)
-#else
-fatal (errnum, message, va_alist)
- int errnum;
- char *message;
- va_dcl
-#endif
{
-#ifdef VA_START
va_list args;
-#endif
if (error_print_progname)
(*error_print_progname) ();
@@ -74,11 +54,10 @@ fatal (errnum, message, va_alist)
fprintf (stderr, "%s: ", program_name);
}
-#ifdef VA_START
- VA_START (args, message);
+ va_start (args, message);
error (EXIT_FAILURE, errnum, message, args);
+
+ /* The following code isn't reachable, but pacifies some compilers. */
va_end (args);
-#else
- error (EXIT_FAILURE, errnum, message, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif
+ abort ();
}
Index: m4/fatal.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/fatal.m4,v
retrieving revision 1.1
diff -p -u -r1.1 fatal.m4
--- m4/fatal.m4 31 Dec 2002 13:42:06 -0000 1.1
+++ m4/fatal.m4 9 Sep 2003 06:32:35 -0000
@@ -1,14 +1,10 @@
-# fatal.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# fatal.m4 serial 2
+dnl Copyright (C) 2002, 2003 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
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.
-AC_DEFUN([gl_FATAL],
-[
- dnl Prerequisites of lib/fatal.c.
- AC_REQUIRE([AC_HEADER_STDC])
- AC_CHECK_FUNCS_ONCE(doprnt vprintf)
-])
+dnl Prerequisites of lib/fatal.c.
+AC_DEFUN([gl_FATAL], [:])
- [Bug-gnulib] 'fatal' patch to assume C89 or better,
Paul Eggert <=