Handle missing vfprintf() & _doprnt() functions with linked in modules,

plus do some general cleanup of variable argument handling.
        * aclocal.m4 (GCC_FUNC_VFPRINTF_DOPRNT): New macro.
        * configure.in: Add a call to GCC_FUNC_VFPRINTF_DOPRNT.
        (AC_CHECK_HEADERS): Remove unused check for varargs.h,sys/varargs.h.
        (AC_CHECK_FUNCS): Remove unused check for vprintf.
        * Makefile.in: Add support for linking in vfprintf.c and doprint.c.
        (cccp.o): Depend on gansidecl.h.
        (cexp.o): Likewise.
        * cccp.c: Convert from using PRINTF_ALIST/PRINTF_DCL to VPROTO as
        per the rest of gcc source.
        * cexp.y: Likewise.  Include gansidecl.h and remove all code made
        redundant.
        * cccp.c: Remove checks for HAVE_VPRINTF and the associated code
        used when vfprintf is missing.
        * cexp.y: Likewise.
        * gcc.c: Likewise.
        * genattrtab.c: Likewise.
        * mips-tfile.c: Likewise.
        * toplev.c: Likewise.
        * vfprintf.c: New file.
        * doprint.c: Likewise.

From-SVN: r19610
This commit is contained in:
Kaveh R. Ghazi 1998-05-07 11:44:09 +00:00 committed by Kaveh Ghazi
parent bebc46636d
commit 76b4b31ead
15 changed files with 669 additions and 296 deletions

View File

@ -1,3 +1,31 @@
Thu May 7 14:26:05 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* aclocal.m4 (GCC_FUNC_VFPRINTF_DOPRNT): New macro.
* configure.in: Add a call to GCC_FUNC_VFPRINTF_DOPRNT.
(AC_CHECK_HEADERS): Remove unused check for varargs.h,sys/varargs.h.
(AC_CHECK_FUNCS): Remove unused check for vprintf.
* Makefile.in: Add support for linking in vfprintf.c and doprint.c.
(cccp.o): Depend on gansidecl.h.
(cexp.o): Likewise.
* cccp.c: Convert from using PRINTF_ALIST/PRINTF_DCL to VPROTO as
per the rest of gcc source.
* cexp.y: Likewise. Include gansidecl.h and remove all code made
redundant.
* cccp.c: Remove checks for HAVE_VPRINTF and the associated code
used when vfprintf is missing.
* cexp.y: Likewise.
* gcc.c: Likewise.
* genattrtab.c: Likewise.
* mips-tfile.c: Likewise.
* toplev.c: Likewise.
* vfprintf.c: New file.
* doprint.c: New file.
Thu May 7 10:18:41 1998 Jeffrey A Law (law@cygnus.com)
* config/linux.h (ASM_COMMENT_START): Remove from here,

View File

@ -265,6 +265,10 @@ CLIB=
# system library.
OBSTACK=obstack.o
# Configure will set these if you need vfprintf and possibly _doprnt support.
VFPRINTF=@vfprintf@
DOPRINT=@doprint@
# Specify the rule for actually making libgcc.a,
LIBGCC = libgcc.a
# and the rule for installing it.
@ -410,6 +414,8 @@ HOST_CPPFLAGS=$(ALL_CPPFLAGS)
HOST_ALLOCA=$(ALLOCA)
HOST_MALLOC=$(MALLOC)
HOST_OBSTACK=$(OBSTACK)
HOST_VFPRINTF=$(VFPRINTF)
HOST_DOPRINT=$(DOPRINT)
# Actual name to use when installing a native compiler.
GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t`
@ -493,25 +499,27 @@ USE_ALLOCA= ${ALLOCA}
USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
USE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac `
USE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac `
# Dependency on obstack, alloca, malloc or whatever library facilities
# are not installed in the system libraries.
# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT)
# Likewise, for use in the tools that must run on this machine
# even if we are cross-building GCC.
# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT)
# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) $(CLIB)
# Likewise, for use in the tools that must run on this machine
# even if we are cross-building GCC.
HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
$(HOST_CLIB)
$(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) $(HOST_CLIB)
HOST_RTL = $(HOST_PREFIX)rtl.o
HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
@ -1731,6 +1739,16 @@ $(HOST_PREFIX_1)obstack.o: obstack.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
$(HOST_PREFIX_1)vfprintf.o: vfprintf.c
rm -f $(HOST_PREFIX)vfprintf.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/vfprintf.c > $(HOST_PREFIX)vfprintf.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c
$(HOST_PREFIX_1)doprint.o: doprint.c
rm -f $(HOST_PREFIX)doprint.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c
$(HOST_PREFIX_1)malloc.o: malloc.c
rm -f $(HOST_PREFIX)malloc.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
@ -1751,12 +1769,12 @@ cpp$(exeext): $(CCCP)$(exeext)
cccp$(exeext): cccp.o cexp.o version.o prefix.o $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o \
version.o $(LIBS)
cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h
cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h gansidecl.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
$(srcdir)/cexp.c: $(srcdir)/cexp.y
cd $(srcdir); $(BISON) -o cexp.c cexp.y
cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h
cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h gansidecl.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \

16
gcc/aclocal.m4 vendored
View File

@ -42,6 +42,22 @@ GCC_NEED_DECLARATION($ac_func)
done
])
dnl Check if we have vprintf and possibly _doprnt.
dnl Note autoconf checks for vprintf even though we care about vfprintf.
AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
[AC_FUNC_VPRINTF
vfprintf=
doprint=
if test $ac_cv_func_vprintf != yes ; then
vfprintf=vfprintf.o
if test $ac_cv_func__doprnt != yes ; then
doprint=doprint.o
fi
fi
AC_SUBST(vfprintf)
AC_SUBST(doprint)
])
dnl See if the printf functions in libc support %p in format strings.
AC_DEFUN(GCC_FUNC_PRINTF_PTR,
[AC_CACHE_CHECK(whether the printf functions support %p,

View File

@ -19,26 +19,14 @@ Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#if defined (__STDC__) && defined (HAVE_VPRINTF)
#ifdef __STDC__
# include <stdarg.h>
# define PRINTF_ALIST(msg) char *msg, ...
# define PRINTF_DCL(msg)
# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
#else
# include <varargs.h>
# define PRINTF_ALIST(msg) msg, va_alist
# define PRINTF_DCL(msg) char *msg; va_dcl
# define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
# define vfprintf(file, msg, args) \
{ \
char *a0 = va_arg(args, char *); \
char *a1 = va_arg(args, char *); \
char *a2 = va_arg(args, char *); \
char *a3 = va_arg(args, char *); \
fprintf (file, msg, a0, a1, a2, a3); \
}
#endif
#define PRINTF_PROTO(ARGS, m, n) PVPROTO (ARGS) ATTRIBUTE_PRINTF(m, n)
#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
#define PRINTF_PROTO_2(ARGS) PRINTF_PROTO(ARGS, 2, 3)
#define PRINTF_PROTO_3(ARGS) PRINTF_PROTO(ARGS, 3, 4)
@ -61,10 +49,6 @@ typedef unsigned char U_CHAR;
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
#ifndef STANDARD_INCLUDE_DIR
# define STANDARD_INCLUDE_DIR "/usr/include"
#endif
@ -8881,12 +8865,19 @@ my_strerror (errnum)
/* error - print error message and increment count of errors. */
void
error (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
error VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
verror (msg, args);
va_end (args);
}
@ -8947,12 +8938,19 @@ error_from_errno (name)
/* Print error message but don't count it. */
void
warning (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
warning VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
vwarning (msg, args);
va_end (args);
}
@ -8989,17 +8987,21 @@ vwarning (msg, args)
}
static void
#if defined (__STDC__) && defined (HAVE_VPRINTF)
error_with_line (int line, PRINTF_ALIST (msg))
#else
error_with_line (line, PRINTF_ALIST (msg))
int line;
PRINTF_DCL (msg)
#endif
error_with_line VPROTO ((int line, char * msg, ...))
{
#ifndef __STDC__
int line;
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
line = va_arg (args, int);
msg = va_arg (args, char *);
#endif
verror_with_line (line, msg, args);
va_end (args);
}
@ -9031,17 +9033,21 @@ verror_with_line (line, msg, args)
}
static void
#if defined (__STDC__) && defined (HAVE_VPRINTF)
warning_with_line (int line, PRINTF_ALIST (msg))
#else
warning_with_line (line, PRINTF_ALIST (msg))
int line;
PRINTF_DCL (msg)
#endif
warning_with_line VPROTO ((int line, char * msg, ...))
{
#ifndef __STDC__
int line;
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
line = va_arg (args, int);
msg = va_arg (args, char *);
#endif
vwarning_with_line (line, msg, args);
va_end (args);
}
@ -9081,12 +9087,19 @@ vwarning_with_line (line, msg, args)
/* Print an error message and maybe count it. */
void
pedwarn (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
pedwarn VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
if (pedantic_errors)
verror (msg, args);
else
@ -9095,17 +9108,21 @@ pedwarn (PRINTF_ALIST (msg))
}
void
#if defined (__STDC__) && defined (HAVE_VPRINTF)
pedwarn_with_line (int line, PRINTF_ALIST (msg))
#else
pedwarn_with_line (line, PRINTF_ALIST (msg))
int line;
PRINTF_DCL (msg)
#endif
pedwarn_with_line VPROTO ((int line, char * msg, ...))
{
#ifndef __STDC__
int line;
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
line = va_arg (args, int);
msg = va_arg (args, char *);
#endif
if (pedantic_errors)
verror_with_line (line, msg, args);
else
@ -9117,17 +9134,15 @@ pedwarn_with_line (line, PRINTF_ALIST (msg))
giving specified file name and line number, not current. */
static void
#if defined (__STDC__) && defined (HAVE_VPRINTF)
pedwarn_with_file_and_line (char *file, size_t file_len, int line,
PRINTF_ALIST (msg))
#else
pedwarn_with_file_and_line (file, file_len, line, PRINTF_ALIST (msg))
char *file;
size_t file_len;
int line;
PRINTF_DCL (msg)
#endif
pedwarn_with_file_and_line VPROTO ((char *file, size_t file_len, int line,
char * msg, ...))
{
#ifndef __STDC__
char *file;
size_t file_len;
int line;
char * msg;
#endif
va_list args;
if (!pedantic_errors && inhibit_warnings)
@ -9141,6 +9156,14 @@ pedwarn_with_file_and_line (file, file_len, line, PRINTF_ALIST (msg))
if (!pedantic_errors)
fprintf (stderr, "warning: ");
VA_START (args, msg);
#ifndef __STDC__
file = va_arg (args, char *);
file_len = va_arg (args, size_t);
line = va_arg (args, int);
msg = va_arg (args, char *);
#endif
vfprintf (stderr, msg, args);
va_end (args);
fprintf (stderr, "\n");
@ -10147,13 +10170,20 @@ deps_output (string, spacer)
}
static void
fatal (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
fatal VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
fprintf (stderr, "%s: ", progname);
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
vfprintf (stderr, msg, args);
va_end (args);
fprintf (stderr, "\n");

View File

@ -22,28 +22,14 @@
#line 27 "cexp.y"
#include "config.h"
#if defined (__STDC__) && defined (HAVE_VPRINTF)
#ifdef __STDC__
# include <stdarg.h>
# define VA_START(va_list, var) va_start (va_list, var)
# define PRINTF_ALIST(msg) char *msg, ...
# define PRINTF_DCL(msg)
# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
#else
# include <varargs.h>
# define VA_START(va_list, var) va_start (va_list)
# define PRINTF_ALIST(msg) msg, va_alist
# define PRINTF_DCL(msg) char *msg; va_dcl
# define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
# define vfprintf(file, msg, args) \
{ \
char *a0 = va_arg(args, char *); \
char *a1 = va_arg(args, char *); \
char *a2 = va_arg(args, char *); \
char *a3 = va_arg(args, char *); \
fprintf (file, msg, a0, a1, a2, a3); \
}
#endif
#define PRINTF_PROTO(ARGS, m, n) PVPROTO (ARGS) ATTRIBUTE_PRINTF(m, n)
#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
#include "system.h"
@ -54,6 +40,8 @@
#include <locale.h>
#endif
#include "gansidecl.h"
typedef unsigned char U_CHAR;
/* This is used for communicating lists of keywords with cccp.c. */
@ -64,24 +52,6 @@ struct arglist {
int argno;
};
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
#ifndef GENERIC_PTR
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define GENERIC_PTR void *
#else
#define GENERIC_PTR char *
#endif
#endif
#ifndef NULL_PTR
#define NULL_PTR ((GENERIC_PTR) 0)
#endif
/* Find the largest host integer type and set its size and type.
Watch out: on some crazy hosts `long' is shorter than `int'. */
@ -115,18 +85,6 @@ struct arglist {
#define HOST_BITS_PER_WIDE_INT (CHAR_BIT * sizeof (HOST_WIDE_INT))
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
#ifndef PROTO
# if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
# define PROTO(ARGS) ARGS
# else
# define PROTO(ARGS) ()
# endif
#endif
HOST_WIDE_INT parse_c_expression PROTO((char *, int));
static int yylex PROTO((void));
@ -2095,12 +2053,19 @@ initialize_random_junk ()
}
void
error (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
error VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
fprintf (stderr, "error: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");
@ -2108,12 +2073,19 @@ error (PRINTF_ALIST (msg))
}
void
pedwarn (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
pedwarn VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
fprintf (stderr, "pedwarn: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");
@ -2121,12 +2093,19 @@ pedwarn (PRINTF_ALIST (msg))
}
void
warning (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
warning VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
fprintf (stderr, "warning: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");

View File

@ -26,28 +26,14 @@ Boston, MA 02111-1307, USA.
%{
#include "config.h"
#if defined (__STDC__) && defined (HAVE_VPRINTF)
#ifdef __STDC__
# include <stdarg.h>
# define VA_START(va_list, var) va_start (va_list, var)
# define PRINTF_ALIST(msg) char *msg, ...
# define PRINTF_DCL(msg)
# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
#else
# include <varargs.h>
# define VA_START(va_list, var) va_start (va_list)
# define PRINTF_ALIST(msg) msg, va_alist
# define PRINTF_DCL(msg) char *msg; va_dcl
# define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
# define vfprintf(file, msg, args) \
{ \
char *a0 = va_arg(args, char *); \
char *a1 = va_arg(args, char *); \
char *a2 = va_arg(args, char *); \
char *a3 = va_arg(args, char *); \
fprintf (file, msg, a0, a1, a2, a3); \
}
#endif
#define PRINTF_PROTO(ARGS, m, n) PVPROTO (ARGS) ATTRIBUTE_PRINTF(m, n)
#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
#include "system.h"
@ -58,6 +44,8 @@ Boston, MA 02111-1307, USA.
#include <locale.h>
#endif
#include "gansidecl.h"
typedef unsigned char U_CHAR;
/* This is used for communicating lists of keywords with cccp.c. */
@ -68,24 +56,6 @@ struct arglist {
int argno;
};
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
#ifndef GENERIC_PTR
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define GENERIC_PTR void *
#else
#define GENERIC_PTR char *
#endif
#endif
#ifndef NULL_PTR
#define NULL_PTR ((GENERIC_PTR) 0)
#endif
/* Find the largest host integer type and set its size and type.
Watch out: on some crazy hosts `long' is shorter than `int'. */
@ -119,18 +89,6 @@ struct arglist {
#define HOST_BITS_PER_WIDE_INT (CHAR_BIT * sizeof (HOST_WIDE_INT))
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
#ifndef PROTO
# if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
# define PROTO(ARGS) ARGS
# else
# define PROTO(ARGS) ()
# endif
#endif
HOST_WIDE_INT parse_c_expression PROTO((char *, int));
static int yylex PROTO((void));
@ -1179,12 +1137,19 @@ initialize_random_junk ()
}
void
error (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
error VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
fprintf (stderr, "error: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");
@ -1192,12 +1157,19 @@ error (PRINTF_ALIST (msg))
}
void
pedwarn (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
pedwarn VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
fprintf (stderr, "pedwarn: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");
@ -1205,12 +1177,19 @@ pedwarn (PRINTF_ALIST (msg))
}
void
warning (PRINTF_ALIST (msg))
PRINTF_DCL (msg)
warning VPROTO ((char * msg, ...))
{
#ifndef __STDC__
char * msg;
#endif
va_list args;
VA_START (args, msg);
#ifndef __STDC__
msg = va_arg (args, char *);
#endif
fprintf (stderr, "warning: ");
vfprintf (stderr, msg, args);
fprintf (stderr, "\n");

View File

@ -47,6 +47,12 @@
/* Whether abort must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ABORT
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
@ -113,9 +119,6 @@
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
@ -152,9 +155,6 @@
/* Define if you have the <sys/times.h> header file. */
#undef HAVE_SYS_TIMES_H
/* Define if you have the <sys/varargs.h> header file. */
#undef HAVE_SYS_VARARGS_H
/* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
@ -164,8 +164,5 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <varargs.h> header file. */
#undef HAVE_VARARGS_H
/* Define if you have the <wait.h> header file. */
#undef HAVE_WAIT_H

146
gcc/configure vendored
View File

@ -1494,7 +1494,7 @@ EOF
fi
for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h varargs.h sys/varargs.h wait.h sys/wait.h
for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h wait.h sys/wait.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@ -1675,17 +1675,17 @@ fi
echo "$ac_t""$gcc_cv_header_inttypes_h" 1>&6
for ac_func in strtoul bsearch strerror putenv popen vprintf bcopy bzero bcmp \
for ac_func in strtoul bsearch strerror putenv popen bcopy bzero bcmp \
index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
sysconf isascii
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1683: checking for $ac_func" >&5
echo "configure:1684: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1688 "configure"
#line 1689 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1708,7 +1708,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1733,8 +1733,124 @@ fi
done
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
echo "configure:1738: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1743 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char vprintf();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_vprintf) || defined (__stub___vprintf)
choke me
#else
vprintf();
#endif
; return 0; }
EOF
if { (eval echo configure:1766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_vprintf=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_VPRINTF 1
EOF
else
echo "$ac_t""no" 1>&6
fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
echo "configure:1790: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1795 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char _doprnt();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub__doprnt) || defined (__stub____doprnt)
choke me
#else
_doprnt();
#endif
; return 0; }
EOF
if { (eval echo configure:1818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func__doprnt=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_DOPRNT 1
EOF
else
echo "$ac_t""no" 1>&6
fi
fi
vfprintf=
doprint=
if test $ac_cv_func_vprintf != yes ; then
vfprintf=vfprintf.o
if test $ac_cv_func__doprnt != yes ; then
doprint=doprint.o
fi
fi
echo $ac_n "checking whether the printf functions support %p""... $ac_c" 1>&6
echo "configure:1737: checking whether the printf functions support %p" >&5
echo "configure:1854: checking whether the printf functions support %p" >&5
if eval "test \"`echo '$''{'gcc_cv_func_printf_ptr'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1742,7 +1858,7 @@ else
gcc_cv_func_printf_ptr=no
else
cat > conftest.$ac_ext <<EOF
#line 1745 "configure"
#line 1862 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -1755,7 +1871,7 @@ main()
exit (p != q);
}
EOF
if { (eval echo configure:1758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
gcc_cv_func_printf_ptr=yes
else
@ -1783,12 +1899,12 @@ for ac_func in malloc realloc calloc free bcopy bzero bcmp \
index rindex getenv atol sbrk abort atof
do
echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6
echo "configure:1786: checking whether $ac_func must be declared" >&5
echo "configure:1903: checking whether $ac_func must be declared" >&5
if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1791 "configure"
#line 1908 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -1815,7 +1931,7 @@ int main() {
char *(*pfn) = (char *(*)) $ac_func
; return 0; }
EOF
if { (eval echo configure:1818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "gcc_cv_decl_needed_$ac_func=no"
else
@ -1842,12 +1958,12 @@ done
echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
echo "configure:1845: checking for sys_siglist declaration in signal.h or unistd.h" >&5
echo "configure:1962: checking for sys_siglist declaration in signal.h or unistd.h" >&5
if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1850 "configure"
#line 1967 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -1859,7 +1975,7 @@ int main() {
char *msg = *(sys_siglist + 1);
; return 0; }
EOF
if { (eval echo configure:1862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_decl_sys_siglist=yes
else
@ -5319,6 +5435,8 @@ s%@INSTALL@%$INSTALL%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CPP@%$CPP%g
s%@vfprintf@%$vfprintf%g
s%@doprint@%$doprint%g
s%@manext@%$manext%g
s%@objext@%$objext%g
s%@gthread_flags@%$gthread_flags%g

View File

@ -148,7 +148,7 @@ EGCS_PROG_INSTALL
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h varargs.h sys/varargs.h wait.h sys/wait.h)
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h wait.h sys/wait.h)
# Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@ -180,10 +180,11 @@ AC_CACHE_VAL(gcc_cv_header_inttypes_h,
gcc_cv_header_inttypes_h=no)])
AC_MSG_RESULT($gcc_cv_header_inttypes_h)
AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen vprintf bcopy bzero bcmp \
AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen bcopy bzero bcmp \
index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
sysconf isascii)
GCC_FUNC_VFPRINTF_DOPRNT
GCC_FUNC_PRINTF_PTR
GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \

286
gcc/doprint.c Normal file
View File

@ -0,0 +1,286 @@
/* Provide a version _doprnt in terms of fprintf.
By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
Copyright (C) 1998 Free Software Foundation, Inc.
*/
#include "config.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include "system.h"
#include "gansidecl.h"
#undef _doprnt
#ifdef TEST /* Make sure to use the internal one. */
#define _doprnt my_doprnt
#endif
#define COPY_VA_INT \
do { \
const int value = abs (va_arg (ap, int)); \
char buf[32]; \
ptr++; /* Go past the asterisk. */ \
*sptr = '\0'; /* NULL terminate sptr. */ \
sprintf(buf, "%d", value); \
strcat(sptr, buf); \
while (*sptr) sptr++; \
} while (0)
#define PRINT_CHAR(CHAR) \
do { \
putc(CHAR, stream); \
ptr++; \
total_printed++; \
continue; \
} while (0)
#define PRINT_TYPE(TYPE) \
do { \
int result; \
TYPE value = va_arg (ap, TYPE); \
*sptr++ = *ptr++; /* Copy the type specifier. */ \
*sptr = '\0'; /* NULL terminate sptr. */ \
result = fprintf(stream, specifier, value); \
if (result == -1) \
return -1; \
else \
{ \
total_printed += result; \
continue; \
} \
} while (0)
int
_doprnt (format, ap, stream)
const char * format;
va_list ap;
FILE * stream;
{
const char * ptr = format;
char specifier[128];
int total_printed = 0;
while (*ptr != '\0')
{
if (*ptr != '%') /* While we have regular characters, print them. */
PRINT_CHAR(*ptr);
else /* We got a format specifier! */
{
char * sptr = specifier;
int wide_width = 0, short_width = 0;
*sptr++ = *ptr++; /* Copy the % and move forward. */
while (strchr ("-+ #0", *ptr)) /* Move past flags. */
*sptr++ = *ptr++;
if (*ptr == '*')
COPY_VA_INT;
else
while (isdigit(*ptr)) /* Handle explicit numeric value. */
*sptr++ = *ptr++;
if (*ptr == '.')
{
*sptr++ = *ptr++; /* Copy and go past the period. */
if (*ptr == '*')
COPY_VA_INT;
else
while (isdigit(*ptr)) /* Handle explicit numeric value. */
*sptr++ = *ptr++;
}
while (strchr ("hlL", *ptr))
{
switch (*ptr)
{
case 'h':
short_width = 1;
break;
case 'l':
wide_width++;
break;
case 'L':
wide_width = 2;
break;
default:
abort();
}
*sptr++ = *ptr++;
}
switch (*ptr)
{
case 'd':
case 'i':
case 'o':
case 'u':
case 'x':
case 'X':
case 'c':
{
/* Short values are promoted to int, so just copy it
as an int and trust the C library printf to cast it
to the right width. */
if (short_width)
PRINT_TYPE(int);
else
{
switch (wide_width)
{
case 0:
PRINT_TYPE(int);
break;
case 1:
PRINT_TYPE(long);
break;
case 2:
default:
#if defined(__GNUC__) || defined(HAVE_LONG_LONG)
PRINT_TYPE(long long);
#else
PRINT_TYPE(long); /* Fake it and hope for the best. */
#endif
break;
} /* End of switch (wide_width) */
} /* End of else statement */
} /* End of integer case */
break;
case 'f':
case 'e':
case 'E':
case 'g':
case 'G':
{
if (wide_width == 0)
PRINT_TYPE(double);
else
{
#if defined(__GNUC__) || defined(HAVE_LONG_DOUBLE)
PRINT_TYPE(long double);
#else
PRINT_TYPE(double); /* Fake it and hope for the best. */
#endif
}
}
break;
case 's':
PRINT_TYPE(char *);
break;
case 'p':
PRINT_TYPE(void *);
break;
case '%':
PRINT_CHAR('%');
break;
default:
abort();
} /* End of switch (*ptr) */
} /* End of else statement */
}
return total_printed;
}
#ifdef TEST
#include <math.h>
#ifndef M_PI
#define M_PI (3.1415926535897932385)
#endif
#define RESULT(x) do \
{ \
int i = (x); \
printf ("printed %d characters\n", i); \
fflush(stdin); \
} while (0)
static int checkit PVPROTO ((const char * format, ...)) ATTRIBUTE_PRINTF_1;
static int
checkit VPROTO ((const char* format, ...))
{
va_list args;
int result;
#ifndef __STDC__
char *format;
#endif
VA_START (args, format);
#ifndef __STDC__
format = va_arg (args, char *);
#endif
result = _doprnt (format, args, stdout);
va_end(args);
return result;
}
int
main ()
{
RESULT(checkit ("<%d>\n", 0x12345678));
RESULT(printf ("<%d>\n", 0x12345678));
RESULT(checkit ("<%200d>\n", 5));
RESULT(printf ("<%200d>\n", 5));
RESULT(checkit ("<%.300d>\n", 6));
RESULT(printf ("<%.300d>\n", 6));
RESULT(checkit ("<%100.150d>\n", 7));
RESULT(printf ("<%100.150d>\n", 7));
RESULT(checkit ("<%s>\n",
"jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
777777777777777777333333333333366666666666622222222222777777777777733333"));
RESULT(printf ("<%s>\n",
"jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
777777777777777777333333333333366666666666622222222222777777777777733333"));
RESULT(checkit ("<%f><%0+#f>%s%d%s>\n",
1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
RESULT(printf ("<%f><%0+#f>%s%d%s>\n",
1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
RESULT(checkit ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
RESULT(printf ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
RESULT(checkit ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
RESULT(printf ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
75, 75, 75, 75, 75, 75, 75));
RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
75, 75, 75, 75, 75, 75, 75));
RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
75, 75, 75, 75, 75, 75, 75));
RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
75, 75, 75, 75, 75, 75, 75));
RESULT(checkit ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
RESULT(printf ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
#if defined(__GNUC__) || defined (HAVE_LONG_LONG)
RESULT(checkit ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
RESULT(printf ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
RESULT(checkit ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
RESULT(printf ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
#endif
#if defined(__GNUC__) || defined (HAVE_LONG_DOUBLE)
RESULT(checkit ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
1.23456, 1.234567890123456789L, 1.23456));
RESULT(printf ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
1.23456, 1.234567890123456789L, 1.23456));
#endif
return 0;
}
#endif /* TEST */

View File

@ -246,25 +246,15 @@ static void print_multilib_info PROTO((void));
static void pfatal_with_name PROTO((char *));
static void perror_with_name PROTO((char *));
static void pfatal_pexecute PROTO((char *, char *));
#ifdef HAVE_VPRINTF
static void fatal PVPROTO((char *, ...));
static void error PVPROTO((char *, ...));
#else
/* We must not provide any prototype here, even if ANSI C. */
static void fatal PROTO(());
static void error PROTO(());
#endif
void fancy_abort ();
char *xmalloc ();
char *xrealloc ();
#ifdef LANG_SPECIFIC_DRIVER
#ifdef HAVE_VPRINTF
extern void lang_specific_driver PROTO ((void (*) (char *, ...), int *, char ***, int *));
#else
extern void lang_specific_driver PROTO ((void (*) (), int *, char ***, int *));
#endif
extern void lang_specific_driver PROTO ((void (*) PVPROTO((char *, ...)), int *, char ***, int *));
#endif
/* Specs are strings containing lines, each of which (if not blank)
@ -5048,8 +5038,6 @@ fancy_abort ()
fatal ("Internal gcc abort.");
}
#ifdef HAVE_VPRINTF
/* Output an error message and exit */
static void
@ -5094,29 +5082,6 @@ error VPROTO((char *format, ...))
fprintf (stderr, "\n");
}
#else /* not HAVE_VPRINTF */
static void
fatal (msg, arg1, arg2)
char *msg, *arg1, *arg2;
{
error (msg, arg1, arg2);
delete_temp_files ();
exit (1);
}
static void
error (msg, arg1, arg2)
char *msg, *arg1, *arg2;
{
fprintf (stderr, "%s: ", programname);
fprintf (stderr, msg, arg1, arg2);
fprintf (stderr, "\n");
}
#endif /* not HAVE_VPRINTF */
static void
validate_all_switches ()

View File

@ -366,12 +366,7 @@ rtx pic_offset_table_rtx;
static void attr_hash_add_rtx PROTO((int, rtx));
static void attr_hash_add_string PROTO((int, char *));
static rtx attr_rtx PVPROTO((enum rtx_code, ...));
#ifdef HAVE_VPRINTF
static char *attr_printf PVPROTO((int, char *, ...));
#else
static char *attr_printf ();
#endif
static char *attr_string PROTO((char *, int));
static rtx check_attr_test PROTO((rtx, int));
static rtx check_attr_value PROTO((rtx, struct attr_desc *));
@ -736,8 +731,6 @@ attr_rtx VPROTO((enum rtx_code code, ...))
rtx attr_printf (len, format, [arg1, ..., argn]) */
#ifdef HAVE_VPRINTF
/*VARARGS2*/
static char *
attr_printf VPROTO((register int len, char *fmt, ...))
@ -764,24 +757,6 @@ attr_printf VPROTO((register int len, char *fmt, ...))
return attr_string (str, strlen (str));
}
#else /* not HAVE_VPRINTF */
static char *
attr_printf (len, fmt, arg1, arg2, arg3)
int len;
char *fmt;
char *arg1, *arg2, *arg3; /* also int */
{
register char *str;
/* Print the string into a temporary location. */
str = (char *) alloca (len);
sprintf (str, fmt, arg1, arg2, arg3);
return attr_string (str, strlen (str));
}
#endif /* not HAVE_VPRINTF */
rtx
attr_eq (name, value)
char *name, *value;

View File

@ -671,15 +671,8 @@ extern PTR_T xcalloc __proto((Size_t, Size_t));
extern PTR_T xrealloc __proto((PTR_T, Size_t));
extern void xfree __proto((PTR_T));
#ifdef HAVE_VPRINTF
extern void fatal PVPROTO((const char *format, ...));
extern void error PVPROTO((const char *format, ...));
#else
/* We must not provide any prototype here, even if ANSI C. */
extern void fatal __proto(());
extern void error __proto(());
#endif
#ifndef MIPS_DEBUGGING_INFO
@ -5565,8 +5558,6 @@ free_thead (ptr)
#endif /* MIPS_DEBUGGING_INFO */
#ifdef HAVE_VPRINTF
/* Output an error message and exit */
/*VARARGS*/
@ -5630,27 +5621,6 @@ error VPROTO((const char *format, ...))
saber_stop ();
}
#else /* not HAVE_VPRINTF */
void
fatal (msg, arg1, arg2)
char *msg, *arg1, *arg2;
{
error (msg, arg1, arg2);
exit (1);
}
void
error (msg, arg1, arg2)
char *msg, *arg1, *arg2;
{
fprintf (stderr, "%s: ", progname);
fprintf (stderr, msg, arg1, arg2);
fprintf (stderr, "\n");
}
#endif /* not HAVE_VPRINTF */
/* More 'friendly' abort that prints the line and file.
config.h can #define abort fancy_abort if you like that sort of thing. */

View File

@ -1262,17 +1262,7 @@ vmessage (prefix, s, ap)
if (prefix)
fprintf (stderr, "%s: ", prefix);
#ifdef HAVE_VPRINTF
vfprintf (stderr, s, ap);
#else
{
HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
HOST_WIDE_INT v4 = va_arg(ap, HOST_WIDE_INT);
fprintf (stderr, s, v1, v2, v3, v4);
}
#endif
}
/* Print a message relevant to line LINE of file FILE. */

21
gcc/vfprintf.c Normal file
View File

@ -0,0 +1,21 @@
/* Provide a version vfprintf in terms of _doprnt.
By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
Copyright (C) 1998 Free Software Foundation, Inc.
*/
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#undef vfprintf
int
vfprintf (stream, format, ap)
FILE * stream;
const char * format;
va_list ap;
{
return _doprnt (format, ap, stream);
}