(C++) errfn update

Jason Merrill jason@cygnus.com
Tue Feb 23 01:43:00 GMT 1999


1999-02-23  Jason Merrill  <jason@yorick.cygnus.com>

	* errfn.c: Change varargs code to look like toplev.c.

Index: errfn.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/errfn.c,v
retrieving revision 1.20
diff -c -p -r1.20 errfn.c
*** errfn.c	1998/12/16 21:15:18	1.20
--- errfn.c	1999/02/23 09:43:05
***************
*** 1,5 ****
  /* Provide a call-back mechanism for handling error output.
!    Copyright (C) 1993, 94-97, 1998 Free Software Foundation, Inc.
     Contributed by Jason Merrill (jason@cygnus.com)
  
     This file is part of GNU CC.
--- 1,5 ----
  /* Provide a call-back mechanism for handling error output.
!    Copyright (C) 1993, 94-98, 1999 Free Software Foundation, Inc.
     Contributed by Jason Merrill (jason@cygnus.com)
  
     This file is part of GNU CC.
*************** extern int   cp_line_of PROTO((tree));
*** 47,63 ****
  /* This function supports only `%s', `%d', `%%', and the C++ print
     codes.  */
  
- #ifdef __STDC__
  static void
- cp_thing (errorfn *errfn, int atarg1, const char *format, va_list ap)
- #else
- static void
  cp_thing (errfn, atarg1, format, ap)
       errorfn *errfn;
       int atarg1;
       const char *format;
       va_list ap;
- #endif
  {
    static char *buf;
    static long buflen;
--- 47,58 ----
*************** cp_thing (errfn, atarg1, format, ap)
*** 193,274 ****
      (*errfn) ("%s", buf);
  
  }
- 
- #ifdef __STDC__
- #define DECLARE(name) void name (const char *format, ...)
- #define INIT va_start (ap, format)
- #else
- #define DECLARE(name) void name (format, va_alist) char *format; va_dcl
- #define INIT va_start (ap)
- #endif
  
! DECLARE (cp_error)
  {
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing ((errorfn *) error, 0, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_warning)
  {
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing ((errorfn *) warning, 0, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_pedwarn)
  {
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing ((errorfn *) pedwarn, 0, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_compiler_error)
  {
!   extern errorfn compiler_error;
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing (compiler_error, 0, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_sprintf)
  {
    va_list ap;
!   INIT;
    cp_thing ((errorfn *) sprintf, 0, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_error_at)
  {
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_warning_at)
  {
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
    va_end (ap);
  }
  
! DECLARE (cp_pedwarn_at)
  {
    va_list ap;
!   INIT;
    if (! cp_silent)
      cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
    va_end (ap);
--- 188,342 ----
      (*errfn) ("%s", buf);
  
  }
  
! void
! cp_error VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing ((errorfn *) error, 0, format, ap);
    va_end (ap);
  }
  
! void
! cp_warning VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing ((errorfn *) warning, 0, format, ap);
    va_end (ap);
  }
  
! void
! cp_pedwarn VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing ((errorfn *) pedwarn, 0, format, ap);
    va_end (ap);
  }
+ 
+ extern errorfn compiler_error;
  
! void
! cp_compiler_error VPROTO((const char *format, ...))
  {
! #ifndef ANSI_PROTOTYPES
!   char *format;
! #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing (compiler_error, 0, format, ap);
    va_end (ap);
  }
  
! void
! cp_sprintf VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    cp_thing ((errorfn *) sprintf, 0, format, ap);
    va_end (ap);
  }
  
! void
! cp_error_at VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
    va_end (ap);
  }
  
! void
! cp_warning_at VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
    va_end (ap);
  }
  
! void
! cp_pedwarn_at VPROTO((const char *format, ...))
  {
+ #ifndef ANSI_PROTOTYPES
+   char *format;
+ #endif
    va_list ap;
! 
!   VA_START (ap, format);
! 
! #ifndef ANSI_PROTOTYPES
!   format = va_arg (ap, char *);
! #endif
! 
    if (! cp_silent)
      cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
    va_end (ap);


More information about the Gcc-patches mailing list