Remove support for pre-ANSI variadic function calls.
authorPaul Smith <psmith@gnu.org>
Sun, 28 Apr 2013 21:59:28 +0000 (17:59 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 28 Apr 2013 21:59:28 +0000 (17:59 -0400)
We've required support for ANSI C (ISO C 89) or better for quite a while.  Get
rid of the old varags.h, doprnt() stuff and simply assume ANSI C variadic
function capability and basic C runtime library support (vfprintf, vsprintf,
etc.)

ChangeLog
config.ami.template
config.h-vms.template
config.h.W32.template
configh.dos.template
configure.ac
makeint.h
misc.c

index 91802ae3be4c2f49c4e67463c88557a4d316fc80..254f9261813aa7c060f23add4186d886c552c350 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2013-04-28  Paul Smith  <psmith@gnu.org>
 
+       * configure.ac: Remove support for pre-ANSI variadic function calls.
+       * makeint.h: Ditto.
+       * misc.c: Ditto.
+       * config.ami.template: Ditto.
+       * config.h-vms.template: Ditto.
+       * config.h.W32.template: Ditto.
+       * configh.dos.template: Ditto.
+
        Implement a "per-job" output synchronization option.
 
        * main.c (decode_output_sync_flags): Recognize the new option.
index aa3a57e6307a1016e6fd14f65d5a94f12c70ec6d..8fe26bd8ab6befc683796c749b7cf72a5698d6c3 100644 (file)
@@ -53,9 +53,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
 /* #undef HAVE_ALLOCA_H */
 
-/* Define if you don't have vprintf but do have _doprnt.  */
-/* #undef HAVE_DOPRNT */
-
 /* Define if your system has a working fnmatch function.  */
 /* #undef HAVE_FNMATCH */
 
@@ -115,9 +112,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if you have <vfork.h>.  */
 /* #undef HAVE_VFORK_H */
 
-/* Define if you have the vprintf function.  */
-#define HAVE_VPRINTF 1
-
 /* Define if you have the wait3 system call.  */
 /* #undef HAVE_WAIT3 */
 
@@ -303,9 +297,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if you have the <ndir.h> header file.  */
 /* #undef HAVE_NDIR_H */
 
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
 /* Define if you have the <stdlib.h> header file.  */
 /* #undef HAVE_STDLIB_H */
 
index de7665e863bff9982f02ce83894e608342cc6c37..1b99dd4a87e4b2cabe28b5441d5c6fa86339707a 100644 (file)
@@ -75,9 +75,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).  */
 /* #undef HAVE_ALLOCA_H */
 
-/* Define to 1 if you don't have vprintf but do have _doprnt.  */
-/* #undef HAVE_DOPRNT */
-
 /* Define to 1 if you have the fdopen function.  */
 #define HAVE_FDOPEN 1
 
@@ -144,9 +141,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have <vfork.h>.  */
 /* #undef HAVE_VFORK_H */
 
-/* Define to 1 if you have the vprintf function.  */
-#define HAVE_VPRINTF 1
-
 /* Define to 1 if you have the wait3 system call.  */
 /* #undef HAVE_WAIT3 */
 
@@ -339,9 +333,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if your compiler conforms to the ANSI C standard. */
 #define HAVE_ANSI_COMPILER 1
 
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
 /* Define to 1 if you have the <stdlib.h> header file.  */
 #define HAVE_STDLIB_H 1
 
index a00e0958ca703e5ec97930d7deef6db5b961dec5..8818a76a968cd1ed009e3a937bd18c9a654fc688 100644 (file)
@@ -109,9 +109,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 # define HAVE_DIRECT_H 1
 #endif
 
-/* Define to 1 if you don't have 'vprintf' but do have '_doprnt.' */
-/* #undef HAVE_DOPRNT */
-
 /* Use platform specific coding */
 #define HAVE_DOS_PATHS 1
 
@@ -247,9 +244,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the 'socket' function. */
 /* #undef HAVE_SOCKET */
 
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #ifdef __MINGW32__
 #define HAVE_STDINT_H 1
@@ -348,19 +342,12 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #define HAVE_UNISTD_H 1
 #endif
 
-/* Define to 1 if you have the <varargs.h> header file. */
-/* #undef HAVE_VARARGS_H */
-
 /* Define to 1 if you have the 'vfork' function. */
 /* #undef HAVE_VFORK */
 
 /* Define to 1 if you have the <vfork.h> header file. */
 /* #undef HAVE_VFORK_H */
 
-/* Define to 1 if you have the 'vprintf' function. */
-#define HAVE_VPRINTF 1
-
-
 /* Define to 1 if you have the 'wait3' function. */
 /* #undef HAVE_WAIT3 */
 
index 10d848f7cf61deb9ddc0df9725c23e1465fc8c7e..61857ab4c44f7a03ffb2b1b36202f4ed7e0ba5aa 100644 (file)
@@ -79,13 +79,6 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if your compiler conforms to the ANSI C standard. */
 #define HAVE_ANSI_COMPILER 1
 
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the vprintf library function.  */
-#undef HAVE_VPRINTF
-#define HAVE_VPRINTF 1
-
 /* Define to 1 if you have the stricmp function.  */
 #define HAVE_STRICMP 1
 
index 2ba81adc6f7e566b5691496a949ec6e5c0e08a99..d6103432f48f3c5c85bb67f7e82ad6c95747f0b4 100644 (file)
@@ -70,10 +70,6 @@ AS_IF([test "$ac_cv_prog_cc_stdc" != no],
             [Define to 1 if your compiler conforms to the ANSI C standard.])
 ])
 
-
-# Determine what kind of variadic function calls we support
-AC_CHECK_HEADERS([stdarg.h varargs.h], [break])
-
 AM_PROG_CC_C_O
 AC_C_CONST
 AC_TYPE_SIGNAL
@@ -164,7 +160,6 @@ AC_FUNC_STRCOLL
 
 AC_FUNC_ALLOCA
 AC_FUNC_FORK([])
-AC_FUNC_VPRINTF
 AC_FUNC_CLOSEDIR_VOID
 
 # See if the user wants to add (or not) GNU Guile support
index 8ac3861429af5f348b6aabf086300ebef7c6b7f3..3b0336eb4ef1d10c9c5f8d149109274f31a9278d 100644 (file)
--- a/makeint.h
+++ b/makeint.h
@@ -382,16 +382,6 @@ extern struct rlimit stack_limit;
 #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s)
 
 \f
-/* We have to have stdarg.h or varargs.h AND v*printf or doprnt to use
-   variadic versions of these functions.  */
-
-#if HAVE_STDARG_H || HAVE_VARARGS_H
-# if HAVE_VPRINTF || HAVE_DOPRNT
-#  define USE_VARIADIC 1
-# endif
-#endif
-
-#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
 const char *concat (unsigned int, ...);
 void message (int prefix, const char *fmt, ...)
               __attribute__ ((__format__ (__printf__, 2, 3)));
@@ -399,12 +389,6 @@ void error (const gmk_floc *flocp, const char *fmt, ...)
             __attribute__ ((__format__ (__printf__, 2, 3)));
 void fatal (const gmk_floc *flocp, const char *fmt, ...)
                    __attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
-#else
-const char *concat ();
-void message ();
-void error ();
-void fatal ();
-#endif
 
 void die (int) __attribute__ ((noreturn));
 void log_working_directory (int, int);
diff --git a/misc.c b/misc.c
index 800e857e7cc6b0198535d832644b4d4f610e066c..366e856f639c5cce82a0ca926a78edd0ac89fc04 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -18,36 +18,9 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dep.h"
 #include "debug.h"
 
-/* Variadic functions.  We go through contortions to allow proper function
-   prototypes for both ANSI and pre-ANSI C compilers, and also for those
-   which support stdarg.h vs. varargs.h, and finally those which have
-   vfprintf(), etc. and those who have _doprnt... or nothing.
-
-   This fancy stuff all came from GNU fileutils, except for the VA_PRINTF and
-   VA_END macros used here since we have multiple print functions.  */
-
-#if USE_VARIADIC
-# if HAVE_STDARG_H
-#  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
-# if HAVE_VPRINTF
-#  define VA_PRINTF(fp, lastarg, args) vfprintf((fp), (lastarg), (args))
-# else
-#  define VA_PRINTF(fp, lastarg, args) _doprnt((lastarg), (args), (fp))
-# endif
-# define VA_END(args) va_end(args)
-#else
-/* We can't use any variadic interface! */
-# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-# define VA_START(args, lastarg)
-# define VA_PRINTF(fp, lastarg, args) fprintf((fp), (lastarg), va_alist)
-# define VA_END(args)
-#endif
+/* GNU make no longer supports pre-ANSI89 environments.  */
+
+#include <stdarg.h>
 
 
 /* Compare strings *S1 and *S2.
@@ -164,23 +137,14 @@ print_spaces (unsigned int n)
    This string lives in static, re-used memory.  */
 
 const char *
-#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
 concat (unsigned int num, ...)
-#else
-concat (num, va_alist)
-     unsigned int num;
-     va_dcl
-#endif
 {
   static unsigned int rlen = 0;
   static char *result = NULL;
   unsigned int ri = 0;
-
-#if USE_VARIADIC
   va_list args;
-#endif
 
-  VA_START (args, num);
+  va_start (args, num);
 
   while (num-- > 0)
     {
@@ -200,7 +164,7 @@ concat (num, va_alist)
       ri += l;
     }
 
-  VA_END (args);
+  va_end (args);
 
   /* Get some more memory if we don't have enough space for the
      terminating '\0'.   */
@@ -218,18 +182,9 @@ concat (num, va_alist)
 /* Print a message on stdout.  */
 
 void
-#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
 message (int prefix, const char *fmt, ...)
-#else
-message (prefix, fmt, va_alist)
-     int prefix;
-     const char *fmt;
-     va_dcl
-#endif
 {
-#if USE_VARIADIC
   va_list args;
-#endif
 
   log_working_directory (1, 0);
 
@@ -245,9 +200,9 @@ message (prefix, fmt, va_alist)
          else
            printf ("%s[%u]: ", program, makelevel);
        }
-      VA_START (args, fmt);
-      VA_PRINTF (stdout, fmt, args);
-      VA_END (args);
+      va_start (args, fmt);
+      vfprintf (stdout, fmt, args);
+      va_end (args);
       putchar ('\n');
 
       if (output_sync)
@@ -260,18 +215,9 @@ message (prefix, fmt, va_alist)
 /* Print an error message.  */
 
 void
-#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
 error (const gmk_floc *flocp, const char *fmt, ...)
-#else
-error (flocp, fmt, va_alist)
-     const gmk_floc *flocp;
-     const char *fmt;
-     va_dcl
-#endif
 {
-#if USE_VARIADIC
   va_list args;
-#endif
 
   if (output_sync)
     log_working_directory (1, 1);
@@ -285,9 +231,9 @@ error (flocp, fmt, va_alist)
   else
     fprintf (stderr, "%s[%u]: ", program, makelevel);
 
-  VA_START(args, fmt);
-  VA_PRINTF (stderr, fmt, args);
-  VA_END (args);
+  va_start (args, fmt);
+  vfprintf (stderr, fmt, args);
+  va_end (args);
 
   putc ('\n', stderr);
   fflush (stderr);
@@ -299,18 +245,9 @@ error (flocp, fmt, va_alist)
 /* Print an error message and exit.  */
 
 void
-#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
 fatal (const gmk_floc *flocp, const char *fmt, ...)
-#else
-fatal (flocp, fmt, va_alist)
-     const gmk_floc *flocp;
-     const char *fmt;
-     va_dcl
-#endif
 {
-#if USE_VARIADIC
   va_list args;
-#endif
 
   if (output_sync)
     log_working_directory (1, 1);
@@ -324,9 +261,9 @@ fatal (flocp, fmt, va_alist)
   else
     fprintf (stderr, "%s[%u]: *** ", program, makelevel);
 
-  VA_START(args, fmt);
-  VA_PRINTF (stderr, fmt, args);
-  VA_END (args);
+  va_start (args, fmt);
+  vfprintf (stderr, fmt, args);
+  va_end (args);
 
   fputs (_(".  Stop.\n"), stderr);