Commit 06f0b04c by Zack Weinberg

Purge cruft now we have build libiberty.

	* Makefile.in (OBSTACK, VFPRINTF, DOPRINT, STRSTR,
	HOST_OBSTACK, HOST_VFPRINTF, HOST_DOPRINT, HOST_STRSTR,
	USE_HOST_OBSTACK, USE_HOST_VFPRINTF, USE_HOST_DOPRINT,
	USE_HOST_STRSTR): Delete variables.
	(vfprintf.o, doprint.o, strstr.o, splay-tree.o, obstack.o,
	hashtab.o, safe-ctype.o, $(HOST_PREFIX_1)obstack.o,
	$(HOST_PREFIX_1)vfprintf.o, $(HOST_PREFIX_1)doprint.o,
	$(HOST_PREFIX_1)strstr.o), $(HOST_PREFIX_1)): Delete rules.
	(LIBIBERTY, BUILD_LIBIBERTY): New variables.
	(LIBDEPS): Now just $(INTLDEPS) $(LIBIBERTY).
	(LIBS): Now just $(INTLLIBS) @LIBS@ $(LIBIBERTY).
	(HOST_LIBDEPS): Now just $(BUILD_LIBIBERTY).
	(HOST_LIBS): Ditto.
	(HOST_RTL): Remove hashtab.o safe-ctype.o.
	(OBJS): Remove splay-tree.o.
	(gen-protos): Depend on $(HOST_LIBS), not ../libiberty/libiberty.a.
	(distclean): No need to delete splay-tree.c obstack.c
	hashtab.c safe-ctype.c.
	(mostlyclean): Delete build copies of print-rtl.c bitmap.c
	errors.c ggc-none.c (all prefixed with $(HOST_PREFIX_1).
	* aclocal.m4 (gcc_AC_FUNC_VFPRINTF_DOPRNT, gcc_AC_FUNC_STRSTR):
	Delete.
	* configure.in: Don't use them.
	Set and substitute @FORBUILD@.
	* config.in, configure: Regenerate.
	* doprint.c: Move to libiberty/_doprnt.c.
	* doc/configterms.texi: Document that libiberty is now built
	up to three times.  Fix typo.
	* f/Make-lang.in (f/fini, f/intdoc): Depend on $(HOST_LIBDEPS)
	and link with $(HOST_LIBS), not safe-ctype.o.

From-SVN: r47475
parent 998979e6
2001-11-29 Zack Weinberg <zack@codesourcery.com>
Purge cruft now we have build libiberty.
* Makefile.in (OBSTACK, VFPRINTF, DOPRINT, STRSTR,
HOST_OBSTACK, HOST_VFPRINTF, HOST_DOPRINT, HOST_STRSTR,
USE_HOST_OBSTACK, USE_HOST_VFPRINTF, USE_HOST_DOPRINT,
USE_HOST_STRSTR): Delete variables.
(vfprintf.o, doprint.o, strstr.o, splay-tree.o, obstack.o,
hashtab.o, safe-ctype.o, $(HOST_PREFIX_1)obstack.o,
$(HOST_PREFIX_1)vfprintf.o, $(HOST_PREFIX_1)doprint.o,
$(HOST_PREFIX_1)strstr.o), $(HOST_PREFIX_1)): Delete rules.
(LIBIBERTY, BUILD_LIBIBERTY): New variables.
(LIBDEPS): Now just $(INTLDEPS) $(LIBIBERTY).
(LIBS): Now just $(INTLLIBS) @LIBS@ $(LIBIBERTY).
(HOST_LIBDEPS): Now just $(BUILD_LIBIBERTY).
(HOST_LIBS): Ditto.
(HOST_RTL): Remove hashtab.o safe-ctype.o.
(OBJS): Remove splay-tree.o.
(gen-protos): Depend on $(HOST_LIBS), not ../libiberty/libiberty.a.
(distclean): No need to delete splay-tree.c obstack.c
hashtab.c safe-ctype.c.
(mostlyclean): Delete build copies of print-rtl.c bitmap.c
errors.c ggc-none.c (all prefixed with $(HOST_PREFIX_1).
* aclocal.m4 (gcc_AC_FUNC_VFPRINTF_DOPRNT, gcc_AC_FUNC_STRSTR):
Delete.
* configure.in: Don't use them.
Set and substitute @FORBUILD@.
* config.in, configure: Regenerate.
* doprint.c: Move to libiberty/_doprnt.c.
* doc/configterms.texi: Document that libiberty is now built
up to three times. Fix typo.
2001-11-30 Jason Merrill <jason@redhat.com> 2001-11-30 Jason Merrill <jason@redhat.com>
* dwarf2out.c (add_data_member_location_attribute): Do the * dwarf2out.c (add_data_member_location_attribute): Do the
......
...@@ -75,27 +75,6 @@ if test x = y ; then ...@@ -75,27 +75,6 @@ if test x = y ; then
fi fi
]) ])
dnl Check if we have vprintf and possibly _doprnt.
dnl Note autoconf checks for vprintf even though we care about vfprintf.
AC_DEFUN(gcc_AC_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 Check if we have strstr.
AC_DEFUN([gcc_AC_FUNC_STRSTR],
[AC_CHECK_FUNCS([strstr], [strstr=], [strstr=strstr.o])
AC_SUBST([strstr])])
dnl See if the printf functions in libc support %p in format strings. dnl See if the printf functions in libc support %p in format strings.
AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR, AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
[AC_CACHE_CHECK(whether the printf functions support %p, [AC_CACHE_CHECK(whether the printf functions support %p,
......
...@@ -12,8 +12,6 @@ HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) \ ...@@ -12,8 +12,6 @@ HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) \
$(XCFLAGS) -DGENERATOR_FILE $(XCFLAGS) -DGENERATOR_FILE
HOST_LDFLAGS=$(LDFLAGS) HOST_LDFLAGS=$(LDFLAGS)
HOST_CPPFLAGS=$(ALL_CPPFLAGS) HOST_CPPFLAGS=$(ALL_CPPFLAGS)
HOST_MALLOC=$(MALLOC)
HOST_OBSTACK=$(OBSTACK)
# To build the native compiler with the cross compiler, the headers # To build the native compiler with the cross compiler, the headers
# for the target are already fixed. And /usr/include is for host, not # for the target are already fixed. And /usr/include is for host, not
......
/* config.in. Generated automatically from configure.in by autoheader. */ /* config.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */ /* Define if using alloca.c. */
#undef C_ALLOCA #undef C_ALLOCA
...@@ -23,9 +23,6 @@ ...@@ -23,9 +23,6 @@
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ /* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H #undef HAVE_ALLOCA_H
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have the ANSI # stringizing operator in cpp. */ /* Define if you have the ANSI # stringizing operator in cpp. */
#undef HAVE_STRINGIZE #undef HAVE_STRINGIZE
...@@ -35,9 +32,6 @@ ...@@ -35,9 +32,6 @@
/* Define if you have <vfork.h>. */ /* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H #undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define as __inline if that's what the C compiler calls it. */ /* Define as __inline if that's what the C compiler calls it. */
#undef inline #undef inline
...@@ -216,9 +210,6 @@ ...@@ -216,9 +210,6 @@
/* Define if you have the strsignal function. */ /* Define if you have the strsignal function. */
#undef HAVE_STRSIGNAL #undef HAVE_STRSIGNAL
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the strtoul function. */ /* Define if you have the strtoul function. */
#undef HAVE_STRTOUL #undef HAVE_STRTOUL
......
...@@ -606,8 +606,6 @@ else ...@@ -606,8 +606,6 @@ else
fi fi
AC_SUBST(TARGET_GETGROUPS_T) AC_SUBST(TARGET_GETGROUPS_T)
gcc_AC_FUNC_VFPRINTF_DOPRNT
gcc_AC_FUNC_STRSTR
gcc_AC_FUNC_PRINTF_PTR gcc_AC_FUNC_PRINTF_PTR
case "${host}" in case "${host}" in
...@@ -838,6 +836,7 @@ fi ...@@ -838,6 +836,7 @@ fi
if test x$host = x$build if test x$host = x$build
then then
build_auto=auto-host.h build_auto=auto-host.h
FORBUILD=..
else else
# We create a subdir, then run autoconf in the subdir. # We create a subdir, then run autoconf in the subdir.
# To prevent recursion we set host and build for the new # To prevent recursion we set host and build for the new
...@@ -863,7 +862,9 @@ else ...@@ -863,7 +862,9 @@ else
cd .. cd ..
rm -rf $tempdir rm -rf $tempdir
build_auto=auto-build.h build_auto=auto-build.h
FORBUILD=../$build
fi fi
AC_SUBST(FORBUILD)
tm_file="${tm_file} defaults.h" tm_file="${tm_file} defaults.h"
host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}" host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}"
......
...@@ -37,7 +37,7 @@ different system. Some people call this a @dfn{host-x-host}, ...@@ -37,7 +37,7 @@ different system. Some people call this a @dfn{host-x-host},
@dfn{crossed native}, or @dfn{cross-built native}. If build and target @dfn{crossed native}, or @dfn{cross-built native}. If build and target
are the same, but host is different, you are using a cross compiler to are the same, but host is different, you are using a cross compiler to
build a cross compiler that produces code for the machine you're build a cross compiler that produces code for the machine you're
building on. This is rare, so there is no common say of describing it building on. This is rare, so there is no common way of describing it
(although I propose calling it a @dfn{crossback}). (although I propose calling it a @dfn{crossback}).
If build and host are the same, the GCC you are building will also be If build and host are the same, the GCC you are building will also be
...@@ -57,9 +57,8 @@ process will adjust these variables as needed. It also sets ...@@ -57,9 +57,8 @@ process will adjust these variables as needed. It also sets
@code{$with_cross_host} to the original @option{--host} value in case you @code{$with_cross_host} to the original @option{--host} value in case you
need it. need it.
Libiberty, for example, is built twice. The first time, host comes from The @code{libiberty} support library is built up to three times: once
@option{--host} and the second time host comes from @option{--target}. for the host, once for the target (even if they are the same), and once
Historically, libiberty has not been built for the build machine, for the build if build and host are different. This allows it to be
though, which causes some interesting issues with programs used to used by all programs which are generated in the course of the build
generate sources for the build. Fixing this, so that libiberty is built process.
three times, has long been on the to-do list.
/* Provide a version _doprnt in terms of fprintf.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.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 PARAMS ((const char * format, ...)) ATTRIBUTE_PRINTF_1;
static int
checkit VPARAMS ((const char* format, ...))
{
int result;
VA_OPEN (args, format);
VA_FIXEDARG (args, char *, format);
result = _doprnt (format, args, stdout);
VA_CLOSE (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 */
2001-11-29 Zack Weinberg <zack@codesourcery.com>
* Make-lang.in (f/fini, f/intdoc): Depend on $(HOST_LIBDEPS)
and link with $(HOST_LIBS), not safe-ctype.o.
2001-11-29 Joseph S. Myers <jsm28@cam.ac.uk> 2001-11-29 Joseph S. Myers <jsm28@cam.ac.uk>
* Make-lang.in (f77.generated-manpages): New target. * Make-lang.in (f77.generated-manpages): New target.
......
...@@ -129,9 +129,9 @@ f/str-op.h f/str-op.j: f/fini$(build_exeext) f/str-op.fin ...@@ -129,9 +129,9 @@ f/str-op.h f/str-op.j: f/fini$(build_exeext) f/str-op.fin
f/str-ot.h f/str-ot.j: f/fini$(build_exeext) f/str-ot.fin f/str-ot.h f/str-ot.j: f/fini$(build_exeext) f/str-ot.fin
./f/fini$(build_exeext) $(srcdir)/f/str-ot.fin f/str-ot.j f/str-ot.h ./f/fini$(build_exeext) $(srcdir)/f/str-ot.fin f/str-ot.j f/str-ot.h
f/fini$(build_exeext): f/fini.o f/proj-h.o safe-ctype.o f/fini$(build_exeext): f/fini.o f/proj-h.o $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o f/fini$(build_exeext) \ $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o f/fini$(build_exeext) \
f/fini.o f/proj-h.o safe-ctype.o f/fini.o f/proj-h.o $(HOST_LIBS)
f/fini.o: f/fini.o:
$(HOST_CC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ $(HOST_CC) $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
...@@ -218,9 +218,9 @@ $(srcdir)/f/intdoc.texi: $(INTDOC_DEPS) $(srcdir)/f/intdoc.in ...@@ -218,9 +218,9 @@ $(srcdir)/f/intdoc.texi: $(INTDOC_DEPS) $(srcdir)/f/intdoc.in
f/intdoc$(build_exeext) > $(srcdir)/f/intdoc.texi f/intdoc$(build_exeext) > $(srcdir)/f/intdoc.texi
f/intdoc$(build_exeext): $(INTDOC_DEPS) f/intdoc.h0 hconfig.h $(SYSTEM_H) \ f/intdoc$(build_exeext): $(INTDOC_DEPS) f/intdoc.h0 hconfig.h $(SYSTEM_H) \
safe-ctype.o $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(INCLUDES) \ $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(INCLUDES) \
$(srcdir)/f/intdoc.c safe-ctype.o -o f/intdoc$(build_exeext) $(srcdir)/f/intdoc.c $(HOST_LIBS) -o f/intdoc$(build_exeext)
f/intdoc.h0: f/intdoc.in f/ansify$(build_exeext) f/intdoc.h0: f/intdoc.in f/ansify$(build_exeext)
f/ansify$(build_exeext) $(srcdir)/f/intdoc.in \ f/ansify$(build_exeext) $(srcdir)/f/intdoc.in \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment