diff options
-rw-r--r-- | libiberty/ChangeLog | 312 | ||||
-rw-r--r-- | libiberty/Makefile.in | 95 | ||||
-rw-r--r-- | libiberty/choose-temp.c | 7 | ||||
-rw-r--r-- | libiberty/config.in | 12 | ||||
-rwxr-xr-x | libiberty/configure | 267 | ||||
-rw-r--r-- | libiberty/configure.in | 56 | ||||
-rw-r--r-- | libiberty/cplus-dem.c | 443 | ||||
-rw-r--r-- | libiberty/pexecute.c | 58 | ||||
-rw-r--r-- | libiberty/splay-tree.c | 10 | ||||
-rw-r--r-- | libiberty/xmalloc.c | 12 |
10 files changed, 902 insertions, 370 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index fed58dd69a5..c59399a1fd6 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,8 +1,3 @@ -1999-12-27 Geoff Keating <geoffk@cygnus.com> - - * vasprintf.c (int_vasprintf): Don't re-read the format character - as this mishandles strings like '%%s'. - 1999-08-03 Ian Lance Taylor <ian@zembu.com> * floatformat.c: Add casts to avoid signed/unsigned warnings. @@ -18,17 +13,272 @@ * makefile.dos: Remove; obsolete. * configure.bat: Remove; obsolete. +1999-07-11 Ian Lance Taylor <ian@zembu.com> + + * splay-tree.c (splay_tree_insert): Add initialization to avoid + warning. + +2000-01-04 Mumit Khan <khan@xraylith.wisc.edu> + + * pexecute.c: Conditionally include string.h. + (fix_argv): Handle embedded whitespace in args for Mingw32. + +2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in (ac_libiberty_warn_cflags): Turn on warnings if + we're using gcc. + + * Makefile.in (COMPILE.c): Add @ac_libiberty_warn_cflags@ + +1999-12-27 Geoff Keating <geoffk@cygnus.com> + + * vasprintf.c (int_vasprintf): Don't re-read the format character + as this mishandles strings like '%%s'. + +1999-12-05 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.c (splay_tree_new): Use struct splay_tree_node_s + rather than struct splay_tree_node. + (splay_tree_insert): Use struct splay_tree_s rather than struct + splay_tree. + +Sun Nov 28 00:59:39 1999 Philippe De Muyter <phdm@macqel.be> + + * hashtab.c (sys/types.h): File included. + +1999-11-22 Jason Merrill <jason@casey.cygnus.com> + + * strtoul.c, strtol.c, random.c: Remove advertising clause from + BSD license, pursuant with + + ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + +Wed Nov 10 09:42:39 1999 Jeffrey A Law (law@cygnus.com) + + * hashtab.c: Include stdio.h. + +Mon Nov 8 09:23:41 1999 Jeffrey A Law (law@cygnus.com) + + * hashtab.c (traverse_hash_table): Protect prototype with PARAMS. + +Tue Nov 2 03:23:13 1999 Philippe De Muyter <phdm@macqel.be> + + * xstrdup (sys/types.h): Include this file. + +1999-10-28 Nathan Sidwell <nathan@acm.org> + + * Makefile.in (SUBDIRS): New macro. + (mostlyclean, clean, distclean, maintainer-clean): Adjust to + avoid multiple subdirectory cleaning. + (*-subdir): Use SUBDIRS. + +1999-10-25 Jim Kingdon <http://developer.redhat.com/> + + * cplus-dem.c: Move declarations of standard_symbol_characters and + hp_symbol_characters inside #ifdef MAIN to avoid compiler + warnings. + +1999-10-23 08:51 -0700 Zack Weinberg <zack@bitmover.com> + + * hashtab.c (find_hash_table_entry): When returning a + DELETED_ENTRY slot, change it to EMPTY_ENTRY first. + (clear_hash_table_slot): New function which deletes an entry + by its position in the table, not its value. + (traverse_hash_table): New function which calls a hook + function for every live entry in the table. + +1999-10-19 Mark Mitchell <mark@codesourcery.com> + + * cplus-dem.c (INTBUF_SIZE): New macro. + (string_append_template_idx): New function. + (demangle_expression): Likewise. + (demangle_integral_value): Use it. + (demangle_real_value): New function, split out from ... + (demangle_template_value_parm): ... here. Use + string_append_template_idx. Use demangle_real_value. + (demangle_template): Use string_append_template_idx. + (demangle_qualified): Use consume_count_with_underscores. + (get_count): Tweak formatting. + (do_type): Use string_append_template_idx. + +1999-10-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * calloc.c: Add a public domain notice. + +Mon Oct 18 02:30:47 1999 Philippe De Muyter <phdm@macqel.be> + + * setenv.c (sys/types.h, stdio.h): Include those files unconditionaly. + +Fri Oct 15 01:47:51 1999 Vladimir Makarov <vmakarov@loony.cygnus.com> + + * Makefile.in (CFILES): Add hashtab.c + (REQUIRED_OFILES): Add hashtab.o + (hashtab.o): Add dependencies. + * hashtab.c: New file + +Wed Oct 13 01:16:47 1999 Mumit Khan <khan@xraylith.wisc.edu> + + * basename.c (DIR_SEPARATOR): New macro. + (DIR_SEPARATOR_2): Likewise. + (HAVE_DOS_BASED_FILESYSTEM): Likewise. + (IS_DIR_SEPARATOR): Likewise. + (main): Handle MSDOS style pathname. + +1999-10-11 Mark Mitchell <mark@codesourcery.com> + + * cplus-dem.c (do_type): Handle pointer to member types whose + enclosing classes have namespace scope. + +Sun Oct 10 01:23:50 1999 Marc Espie <espie@cvs.openbsd.org> + + * config.table: Provide a backup shell for executing move-if-change. + +1999-10-02 Mark Mitchell <mark@codesourcery.com> + + * xmalloc.c (xmalloc): Fix spelling error. + (xcalloc, xrealloc): Likewise. + +1999-10-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (fancy_abort, demangle_integral_value, + demangle_arm_hp_template, recursively_demangle, + standard_symbol_characters, hp_symbol_characters, main): Add prototype. + (program_name, program_version, fatal): Constify a char*. + (usage, fatal): Mark with ATTRIBUTE_NORETURN. + (main): Call return, not exit. + +1999-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * choose-temp.c: Remove obsolete comment about gcc. + (make_temp_file): Constify a char*. + +Wed Sep 8 20:03:28 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * xmemdup.c: Include sys/types.h. + +1999-09-07 Jeff Garzik <jgarzik@pobox.com> + + * xmemdup.c: New xmemdup function. + * Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co]. + +Tue Sep 7 23:32:18 1999 Linas Vepstas <linas@linas.org> + + * config.table: Add openedition target. + * config/mh-openedition: New file. + +Thu Sep 2 01:36:12 1999 Marc Espie <espie@cvs.openbsd.org> + + * pexecute.c (pexecute): Fill in temp_base when needed. + +1999-08-31 Richard Henderson <rth@cygnus.com> + + * getpwd.c: Check HAVE_GETCWD before defining it away. + +1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (CFILES): Add calloc.c and getpwd.c. + (REQUIRED_OFILES): Add getpwd.o. + (getpwd.o): Add target. + + * configure.in (AC_PREREQ): Bump to 2.13. + (AC_CHECK_HEADERS): Add check for <sys/stat.h>. + + * getpwd.c: New file, moved here from gcc. + +1999-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (gnu_special): Cast a `size_t' to `long' when + comparing against a signed quantity. + (arm_special): Likewise. + (demangle_fund_type): Likewise. + (do_hpacc_template_const_value): Mark parameter `work' with + ATTRIBUTE_UNUSED. + (main): Constify variable `valid_symbols'. + +Tue Aug 24 02:50:45 1999 Philippe De Muyter <phdm@macqel.be> + + * strtoul.c (strtoul): Add parentheses around && within ||. + +Fri Aug 6 23:32:29 1999 Daniel Jacobowitz <drow@drow.them.org> + + * Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix, + libdir, libsubdir and tooldir. + +1999-08-01 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.c (splay_tree_insert): Return the new node. + 1999-07-14 Richard Henderson <rth@cygnus.com> - * argv.c: Include stdlib.h and string.h instead of + * argv.c: Include stdlib.h and string.h instead of prototyping directly. * choose-temp.c: Conditionally include string.h. +1999-07-12 Jason Merrill <jason@yorick.cygnus.com> + + * Makefile.in (NEEDED): Add bcmp, bcopy, bzero. + 1999-07-11 Ian Lance Taylor <ian@zembu.com> * splay-tree.c (splay_tree_insert): Add initialization to avoid warning. +1999-07-07 Jason Merrill <jason@yorick.cygnus.com> + + * Makefile.in (needed-list): Only include stuff we actually need + for libstdc++. + +1999-06-21 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> + + * configure.in (checkfuncs): Add gettimeofday. + * config.in, configure: Regenerated. + +Mon Jun 21 05:56:01 1999 Mumit Khan <khan@xraylith.wisc.edu> + + * configure.in (*-*-uwin*): UWIN has sys_{errlist,nerr} even if + the test fails. + * configure: Regenerate. + +1999-06-10 Mike Stump <mrs@wrs.com> + + * Makefile.in (setenv.o): Add config.h dep for setenv.o to fix + parallel builds. + +1999-05-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * putenv.c: Include ansidecl.h to define `const'. + * setenv.c: Likewise. + +Wed May 26 03:58:20 1999 "Melissa O'Neill" <oneill@cs.sfu.ca> + + * Makefile.in (CFILES): Add putenv.c and setenv.c. + * configure.in (funcs): Add putenv and setenv. + (AC_CHECK_FUNCS): Check for putenv and setenv. + * configure: Rebuilt. + * putenv.c setenv.c: New files. + + * getcwd.c (getcwd): If pathname is NULL, then obtain SIZE + bytes of space using malloc. + +Mon May 17 01:42:34 1999 Stu Grossman <grossman@babylon-5.cygnus.com> + + * cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance + the *mangled pointer beyond the end of the string. Clean up code to + match prevailing coding style. + +1999-05-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz> + + * tmpnam.c (L_tmpnam): Fix typo. + +Thu May 13 01:14:46 1999 Marc Espie <espie@cvs.openbsd.org> + + * cplus-dem.c (standard_symbol_characters): Renamed from + standard_symbol_alphabet. No longer modify TABLE. + (hp_symbol_characters): Renamed from hp_symbol_alphabet. No longer + modify TABLE. + (main): Corresponding changes. Use strchr to determine if a + character is valid. + 1999-05-11 Jim Blandy <jimb@zwingli.cygnus.com> * cplus-dem.c (main): Use table lookup to distinguish identifier @@ -42,6 +292,15 @@ Thu May 6 20:34:42 1999 Fred Fish <fnf@be.com> use getrusage if both HAVE_GETRUSAGE and HAVE_SYS_RESOURCE_H are defined. +Mon Apr 26 01:36:06 1999 Donn Terry (donn@interix.com) + + * configure.in (alloca detection): Handle alloca directly for interix. + * configure: Rebuilt. + +Sun Apr 25 01:18:21 1999 Mumit Khan <khan@xraylith.wisc.edu> + + * choose-temp.c (DIR_SEPARATOR): Use '\\' only for native windows32. + 1999-04-20 Jim Blandy <jimb@zwingli.cygnus.com> Fix from Dale Hawkins: @@ -51,10 +310,6 @@ Thu May 6 20:34:42 1999 Fred Fish <fnf@be.com> * cplus-dem.c (demangle_fund_type): Check for buffer overrun. Be stricter about syntax. Always null-terminate string. - Fix from Marcus Daniels: - * cplus-dem.c (demangle_fund_type): Don't run off the end of the - identifier looking for another underscore. - Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu> * configure.in (checkfuncs): Check for sbrk. @@ -62,6 +317,19 @@ Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu> * configure: Likewise. * xmalloc.c: Use HAVE_SBRK instead of the host specific definitions. +1999-04-12 Jim Blandy <jimb@zwingli.cygnus.com> + + Fix from Marcus Daniels: + * cplus-dem.c (demangle_fund_type): Don't run off the end of the + identifier looking for another underscore. + +Sun Apr 11 23:20:59 1999 Mumit Khan <khan@xraylith.wisc.edu> + + * pexecute.c: Change all references to __UWIN__ to _UWIN. + * xmalloc.c: Likewise. + (xcalloc): UWIN has sbrk. + (xrealloc): Fix guard macro. + 1999-04-11 Richard Henderson <rth@cygnus.com> * alloca-conf.h (alloca) [C_ALLOCA]: Don't use Gcc builtin @@ -73,6 +341,12 @@ Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu> * config.table: Use mh-beos. * config/mh-beos: New file. +1999-04-11 Mark Mitchell <mark@codesourcery.com> + + * cplus-dem.c (demangle_template_value_parm): Handle + pointers-to-members. + (do_type): Handle template parameters as qualifiers. + 1999-04-01 Jim Blandy <jimb@zwingli.cygnus.com> * cplus-dem.c: Attempt to handle overflows in counts with some @@ -82,10 +356,22 @@ Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu> (demangle_template_value_parm, demangle_template): Handle change to consume_count's return convention. -Thu Apr 8 14:43:28 1999 Andrew Cagney <cagney@b1.cygnus.com> +1999-04-05 Tom Tromey <tromey@cygnus.com> + + * testsuite/regress-demangle: New file. + * testsuite/demangle-expected: New file. - * xmalloc.c, pexecute.c: Define __CYGWIN__ when being compiled - with old __CYGWIN32__ compiler. + * Makefile.in (all, check, installcheck, info, install-info, + clean-info, dvi, install, etags, tags, mostlyclean, clean, + distclean, maintainer-clean, realclean): Depend on corresponding + `-subdir' target. + (all-subdir check-subdir installcheck-subdir info-subdir + install-info-subdir clean-info-subdir dvi-subdir + install-info-subdir etags-subdir mostlyclean-subdir clean-subdir + distclean-subdir maintainer-clean-subdir): New target. + * testsuite/Makefile.in: New file. + * configure: Rebuilt. + * configure.in: Create testsuite/Makefile. 1999-04-02 Mark Mitchell <mark@codesourcery.com> diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 3ea80d07499..cc25df5f3f9 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998 +# Copyright (C) 1990, 91 - 99, 2000 # Free Software Foundation # # This file is part of the libiberty library. @@ -85,25 +85,37 @@ FLAGS_TO_PASS = \ "LDFLAGS=$(LDFLAGS)" \ "LOADLIBES=$(LOADLIBES)" \ "RANLIB=$(RANLIB)" \ - "SHELL=$(SHELL)" + "SHELL=$(SHELL)" \ + "prefix=$(prefix)" \ + "exec_prefix=$(exec_prefix)" \ + "libdir=$(libdir)" \ + "libsubdir=$(libsubdir)" \ + "tooldir=$(tooldir)" -all: stamp-picdir $(TARGETLIB) needed-list required-list +# Subdirectories to recurse into. We need to override this during cleaning +SUBDIRS = testsuite + +all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all .PHONY: check installcheck -check installcheck: +check: check-subdir +installcheck: installcheck-subdir @host_makefile_frag@ INCDIR=$(srcdir)/$(MULTISRCTOP)../include -COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) +COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ .c.o: test x"$(enable_shared)" != xyes || \ $(COMPILE.c) $(PICFLAG) $< -o pic/$@ $(COMPILE.c) $< -info install-info clean-info dvi: +info: info-subdir +install-info: install-info-subdir +clean-info: clean-info-subdir +dvi: dvi-subdir # Include files that are in this directory. HFILES = alloca-conf.h @@ -112,22 +124,22 @@ HFILES = alloca-conf.h # (alphabetical), and add them to REQUIRED_OFILES or funcs in # configure.in. CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \ - bzero.c choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c \ - fnmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \ - getruntime.c floatformat.c hex.c index.c insque.c memchr.c \ + bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c \ + fnmatch.c getcwd.c getpwd.c getopt.c getopt1.c getpagesize.c \ + getruntime.c floatformat.c hashtab.c hex.c index.c insque.c memchr.c \ memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c \ - pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \ - splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c strerror.c \ - strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \ + pexecute.c putenv.c random.c rename.c rindex.c setenv.c sigsetmask.c \ + spaces.c splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c \ + strerror.c strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \ tmpnam.c vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \ - waitpid.c xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c + waitpid.c xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c # These are always included in the library. REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o \ - fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \ - floatformat.o objalloc.o obstack.o pexecute.o spaces.o \ + fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o getruntime.o hashtab.o \ + hex.o floatformat.o objalloc.o obstack.o pexecute.o spaces.o \ splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \ - xstrdup.o xstrerror.o + xmemdup.o xstrdup.o xstrerror.o $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA) rm -f $(TARGETLIB) @@ -136,7 +148,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA) $(RANLIB) $(TARGETLIB) INSTALL_DEST = @INSTALL_DEST@ -install: install_to_$(INSTALL_DEST) +install: install_to_$(INSTALL_DEST) install-subdir install_to_libdir: all $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n @@ -150,13 +162,21 @@ install_to_tooldir: all mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB) @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install -# needed-list is used by libstdc++. +# needed-list is used by libstdc++. NEEDED is the list of functions +# to include there. Do not add anything LGPL to this list; libstdc++ +# can't use anything encumbering. +NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \ + strerror strrchr strstr strtol strtoul tmpnam vfprintf vprintf \ + vfork waitpid bcmp bcopy bzero needed-list: Makefile - f="$(LIBOBJS) $(ALLOCA) $(EXTRA_OFILES)"; \ - case $$f in \ - *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \ - esac; \ - echo $$f > needed-list + rm -f needed-list; touch needed-list; \ + for f in $(NEEDED); do \ + for g in $(LIBOBJS) $(EXTRA_OFILES); do \ + case "$$g" in \ + *$$f*) echo $$g >> needed-list ;; \ + esac; \ + done; \ + done # required-list was used when building a shared bfd/opcodes/libiberty # library. I don't know if it used by anything currently. @@ -171,7 +191,7 @@ stamp-picdir: .PHONY: all etags tags ls clean stage1 stage2 -etags tags: TAGS +etags tags: TAGS etags-subdir TAGS: $(CFILES) $(HFILES) etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done` @@ -187,19 +207,24 @@ ls: # Need to deal with profiled libraries, too. -mostlyclean: +# Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS +# multiple times, hence our explicit recursion with an empty SUBDIRS. +mostlyclean: mostlyclean-subdir rm -rf *.o pic core errs \#* *.E a.out rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-* rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir @$(MULTICLEAN) multi-clean DO=mostlyclean -clean: mostlyclean +clean: clean-subdir + $(MAKE) SUBDIRS="" mostlyclean rm -f *.a required-list tmpmulti.out @$(MULTICLEAN) multi-clean DO=clean -distclean: clean +distclean: distclean-subdir + $(MAKE) SUBDIRS="" clean @$(MULTICLEAN) multi-clean DO=distclean rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out rm -f config.log -maintainer-clean realclean: distclean +maintainer-clean realclean: maintainer-clean-subdir + $(MAKE) SUBDIRS="" distclean force: @@ -213,6 +238,16 @@ stamp-h: config.in config.status config.status: $(srcdir)/configure $(srcdir)/config.table $(SHELL) ./config.status --recheck + +all-subdir check-subdir installcheck-subdir info-subdir \ +install-info-subdir clean-info-subdir dvi-subdir install-subdir \ +etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \ +maintainer-clean-subdir: + @target=`echo $@ | sed -e 's/-subdir//'`; \ + for dir in . $(SUBDIRS) ; do \ + test $$dir = . || (cd $$dir && $(MAKE) $$target) || exit 1; \ + done + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir alloca.o: config.h @@ -229,6 +264,7 @@ getcwd.o: config.h getopt.o: config.h $(INCDIR)/getopt.h getopt1.o: config.h $(INCDIR)/getopt.h getpagesize.o: config.h +getpwd.o: config.h $(INCDIR)/libiberty.h getruntime.o: config.h $(INCDIR)/libiberty.h hex.o: $(INCDIR)/libiberty.h floatformat.o: $(INCDIR)/floatformat.h @@ -236,6 +272,7 @@ mkstemps.o: config.h objalloc.o: $(INCDIR)/objalloc.h obstack.o: config.h $(INCDIR)/obstack.h pexecute.o: config.h $(INCDIR)/libiberty.h +setenv.o: config.h spaces.o: $(INCDIR)/libiberty.h splay-tree.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h $(INCDIR)/ansidecl.h strerror.o: config.h $(INCDIR)/libiberty.h @@ -243,5 +280,7 @@ strsignal.o: config.h $(INCDIR)/libiberty.h xatexit.o: $(INCDIR)/libiberty.h xexit.o: $(INCDIR)/libiberty.h xmalloc.o: $(INCDIR)/libiberty.h +xmemdup.o: config.h $(INCDIR)/libiberty.h xstrdup.o: config.h $(INCDIR)/libiberty.h xstrerror.o: config.h $(INCDIR)/libiberty.h +hashtab.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/ansidecl.h diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c index 7aae318f9eb..826d818ed62 100644 --- a/libiberty/choose-temp.c +++ b/libiberty/choose-temp.c @@ -19,9 +19,6 @@ Boston, MA 02111-1307, USA. */ /* This file exports two functions: choose_temp_base and make_temp_file. */ -/* This file lives in at least two places: libiberty and gcc. - Don't change one without the other. */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -51,7 +48,7 @@ Boston, MA 02111-1307, USA. */ extern int mkstemps (); #ifndef IN_GCC -#if defined (__MSDOS__) || defined (_WIN32) +#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) #define DIR_SEPARATOR '\\' #endif #endif @@ -148,7 +145,7 @@ choose_temp_base () char * make_temp_file (suffix) - char *suffix; + const char *suffix; { char *base = 0; char *temp_filename; diff --git a/libiberty/config.in b/libiberty/config.in index 4d256c9f5ff..6e64208da92 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -85,6 +85,9 @@ /* Define if you have the getrusage function. */ #undef HAVE_GETRUSAGE +/* Define if you have the gettimeofday function. */ +#undef HAVE_GETTIMEOFDAY + /* Define if you have the index function. */ #undef HAVE_INDEX @@ -115,6 +118,9 @@ /* Define if you have the psignal function. */ #undef HAVE_PSIGNAL +/* Define if you have the putenv function. */ +#undef HAVE_PUTENV + /* Define if you have the random function. */ #undef HAVE_RANDOM @@ -127,6 +133,9 @@ /* Define if you have the sbrk function. */ #undef HAVE_SBRK +/* Define if you have the setenv function. */ +#undef HAVE_SETENV + /* Define if you have the sigsetmask function. */ #undef HAVE_SIGSETMASK @@ -205,6 +214,9 @@ /* Define if you have the <sys/resource.h> header file. */ #undef HAVE_SYS_RESOURCE_H +/* Define if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H diff --git a/libiberty/configure b/libiberty/configure index 3ab9b64f2da..02c826d929e 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -34,7 +34,6 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= -sitefile= srcdir= target=NONE verbose= @@ -149,7 +148,6 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -320,11 +318,6 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -490,16 +483,12 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -else - CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -598,7 +587,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:602: checking host system type" >&5 +echo "configure:591: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -621,7 +610,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:625: checking build system type" >&5 +echo "configure:614: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -647,7 +636,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:651: checking for $ac_word" >&5 +echo "configure:640: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -679,7 +668,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:683: checking for $ac_word" >&5 +echo "configure:672: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -711,7 +700,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:715: checking for $ac_word" >&5 +echo "configure:704: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -753,10 +742,11 @@ fi + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:760: checking for $ac_word" >&5 +echo "configure:750: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -786,7 +776,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:790: checking for $ac_word" >&5 +echo "configure:780: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -835,7 +825,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:839: checking whether we are using GNU C" >&5 +echo "configure:829: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -844,7 +834,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -855,11 +845,12 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes + ac_libiberty_warn_cflags='-W -Wall -Wtraditional' ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:863: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:854: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -883,12 +874,13 @@ echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 fi else GCC= + ac_libiberty_warn_cflags= test "${CFLAGS+set}" = set || CFLAGS="-g" fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:892: checking for POSIXized ISC" >&5 +echo "configure:884: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -926,7 +918,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:930: checking for a BSD compatible install" >&5 +echo "configure:922: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -987,7 +979,7 @@ host_makefile_frag=${frag} # able to link anything, it had better be able to at least compile # something. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:991: checking how to run the C preprocessor" >&5 +echo "configure:983: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1002,13 +994,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1006 "configure" +#line 998 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1019,13 +1011,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1023 "configure" +#line 1015 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1036,13 +1028,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1040 "configure" +#line 1032 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1046: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1066,21 +1058,21 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h +for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1074: checking for $ac_hdr" >&5 +echo "configure:1066: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1079 "configure" +#line 1071 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1084: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1107,12 +1099,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1111: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1103: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1116 "configure" +#line 1108 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -1128,7 +1120,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1170,9 +1162,11 @@ funcs="$funcs memcpy" funcs="$funcs memmove" funcs="$funcs memset" funcs="$funcs mkstemps" +funcs="$funcs putenv" funcs="$funcs random" funcs="$funcs rename" funcs="$funcs rindex" +funcs="$funcs setenv" funcs="$funcs sigsetmask" funcs="$funcs strcasecmp" funcs="$funcs strchr" @@ -1194,7 +1188,7 @@ funcs="$funcs waitpid" vars="sys_errlist sys_nerr sys_siglist" -checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk" +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. @@ -1202,12 +1196,12 @@ if test "x" = "y"; then for ac_func in asprintf atexit basename bcmp bcopy bzero calloc clock getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1206: checking for $ac_func" >&5 +echo "configure:1200: 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 1211 "configure" +#line 1205 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1230,7 +1224,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1257,12 +1251,12 @@ done for ac_func in getpagesize index insque mkstemps memchr memcmp memcpy memmove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1261: checking for $ac_func" >&5 +echo "configure:1255: 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 1266 "configure" +#line 1260 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1285,7 +1279,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1309,15 +1303,15 @@ else fi done - for ac_func in memset random rename rindex sigsetmask strcasecmp + for ac_func in memset putenv random rename rindex sigsetmask strcasecmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1316: checking for $ac_func" >&5 +echo "configure:1310: 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 1321 "configure" +#line 1315 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1340,7 +1334,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1364,15 +1358,15 @@ else fi done - for ac_func in strchr strdup strncasecmp strrchr strstr strtod strtol + for ac_func in setenv strchr strdup strncasecmp strrchr strstr strtod strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1371: checking for $ac_func" >&5 +echo "configure:1365: 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 1376 "configure" +#line 1370 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1395,7 +1389,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1422,12 +1416,12 @@ done for ac_func in strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1426: checking for $ac_func" >&5 +echo "configure:1420: 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 1431 "configure" +#line 1425 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1450,7 +1444,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1489,12 +1483,12 @@ EOF for ac_func in getrusage on_exit psignal strerror strsignal sysconf times do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1493: checking for $ac_func" >&5 +echo "configure:1487: 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 1498 "configure" +#line 1492 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1517,7 +1511,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1541,15 +1535,15 @@ else fi done - for ac_func in sbrk + for ac_func in sbrk gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1548: checking for $ac_func" >&5 +echo "configure:1542: 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 1553 "configure" +#line 1547 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1572,7 +1566,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1604,6 +1598,7 @@ fi # if the host does not provide alloca, we set ALLOCA to alloca.o setobjs= +CHECK= if test -n "${with_target_subdir}"; then # We are being configured as a target library. AC_REPLACE_FUNCS @@ -1644,8 +1639,16 @@ EOF setobjs=yes fi + +else + + # Not a target library, so we set things up to run the test suite. + CHECK=check-cplus-dem + fi + + if test -z "${setobjs}"; then case "${host}" in @@ -1727,6 +1730,17 @@ EOF # can hang configure; on other versions, vfork exists just as a stub. # FIXME: This should be removed once vfork in uwin's runtime is fixed. ac_cv_func_vfork_works=no + # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are + # macros (actually, these are imported from a DLL, but the end effect + # is the same), so the test below won't find them. + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + ;; esac @@ -1734,7 +1748,7 @@ EOF # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1738: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1745,12 +1759,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1749 "configure" +#line 1763 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1776,19 +1790,19 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1780: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross for ac_func in $funcs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1787: checking for $ac_func" >&5 +echo "configure:1801: 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 1792 "configure" +#line 1806 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1811,7 +1825,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1837,22 +1851,40 @@ fi done - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works + + case "${host}" in + *-*-interix) + # On Interix, it wrongly concludes that the MSVC compiler supports alloca. + # (MSVC does on Win32, not on Interix.) + # This should be temporary. + + ac_cv_header_alloca_h=no + ac_cv_func_alloca_works=no + ALLOCA=alloca.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + cat >> confdefs.h <<EOF +#define STACK_DIRECTION -1 +EOF + ;; + *) + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1844: checking for working alloca.h" >&5 +echo "configure:1876: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1849 "configure" +#line 1881 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1873,12 +1905,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1877: checking for alloca" >&5 +echo "configure:1909: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1882 "configure" +#line 1914 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1906,7 +1938,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1938,12 +1970,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1942: checking whether alloca needs Cray hooks" >&5 +echo "configure:1974: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1947 "configure" +#line 1979 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1968,12 +2000,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1972: checking for $ac_func" >&5 +echo "configure:2004: 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 1977 "configure" +#line 2009 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1996,7 +2028,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2023,7 +2055,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2027: checking stack direction for C alloca" >&5 +echo "configure:2059: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2031,7 +2063,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2035 "configure" +#line 2067 "configure" #include "confdefs.h" find_stack_direction () { @@ -2050,7 +2082,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2071,13 +2103,16 @@ EOF fi + ;; + esac + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2076: checking for ANSI C header files" >&5 +echo "configure:2111: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2081 "configure" +#line 2116 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2085,7 +2120,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2102,7 +2137,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2106 "configure" +#line 2141 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2120,7 +2155,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2124 "configure" +#line 2159 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2141,7 +2176,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2145 "configure" +#line 2180 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2152,7 +2187,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2176,12 +2211,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2180: checking for pid_t" >&5 +echo "configure:2215: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2185 "configure" +#line 2220 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2210,17 +2245,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2214: checking for vfork.h" >&5 +echo "configure:2249: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2219 "configure" +#line 2254 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2245,18 +2280,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2249: checking for working vfork" >&5 +echo "configure:2284: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2255: checking for vfork" >&5 +echo "configure:2290: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2260 "configure" +#line 2295 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2279,7 +2314,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2301,7 +2336,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 2305 "configure" +#line 2340 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2396,7 +2431,7 @@ main() { } } EOF -if { (eval echo configure:2400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2423,19 +2458,19 @@ fi fi for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:2427: checking for $v" >&5 +echo "configure:2462: checking for $v" >&5 if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2432 "configure" +#line 2467 "configure" #include "confdefs.h" int *p; int main() { extern int $v; p = &$v; ; return 0; } EOF -if { (eval echo configure:2439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "libiberty_cv_var_$v=yes" else @@ -2461,12 +2496,12 @@ EOF for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2465: checking for $ac_func" >&5 +echo "configure:2500: 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 2470 "configure" +#line 2505 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2489,7 +2524,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2626,7 +2661,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile testsuite/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -2670,6 +2705,7 @@ s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g +s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g @@ -2677,6 +2713,7 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g /@host_makefile_frag@/r $host_makefile_frag s%@host_makefile_frag@%%g s%@CPP@%$CPP%g +s%@CHECK@%$CHECK%g s%@LIBOBJS@%$LIBOBJS%g s%@ALLOCA@%$ALLOCA%g s%@INSTALL_DEST@%$INSTALL_DEST%g @@ -2721,7 +2758,7 @@ EOF cat >> $CONFIG_STATUS <<EOF -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/libiberty/configure.in b/libiberty/configure.in index a1032a4a804..cc1b2c2082b 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script -AC_PREREQ(2.12.1) +AC_PREREQ(2.13) AC_INIT(pexecute.c) dnl We use these options to decide which functions to include. @@ -55,6 +55,7 @@ AC_PROG_CC_GNU if test $ac_cv_prog_gcc = yes; then GCC=yes + ac_libiberty_warn_cflags='-W -Wall -Wtraditional' dnl Check whether -g works, even if CFLAGS is set, in case the package dnl plays around with CFLAGS (such as to build both debugging and dnl normal versions of a library), tasteless as that idea is. @@ -71,9 +72,11 @@ dnl normal versions of a library), tasteless as that idea is. fi else GCC= + ac_libiberty_warn_cflags= test "${CFLAGS+set}" = set || CFLAGS="-g" fi ]) +AC_SUBST(ac_libiberty_warn_cflags) LIB_AC_PROG_CC @@ -106,7 +109,7 @@ AC_SUBST_FILE(host_makefile_frag) # It's OK to check for header files. Although the compiler may not be # able to link anything, it had better be able to at least compile # something. -AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h) +AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h) AC_HEADER_SYS_WAIT # This is the list of functions which libiberty will provide if they @@ -130,9 +133,11 @@ funcs="$funcs memcpy" funcs="$funcs memmove" funcs="$funcs memset" funcs="$funcs mkstemps" +funcs="$funcs putenv" funcs="$funcs random" funcs="$funcs rename" funcs="$funcs rindex" +funcs="$funcs setenv" funcs="$funcs sigsetmask" funcs="$funcs strcasecmp" funcs="$funcs strchr" @@ -154,21 +159,21 @@ funcs="$funcs waitpid" vars="sys_errlist sys_nerr sys_siglist" -checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk" +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. if test "x" = "y"; then AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero calloc clock getcwd) AC_CHECK_FUNCS(getpagesize index insque mkstemps memchr memcmp memcpy memmove) - AC_CHECK_FUNCS(memset random rename rindex sigsetmask strcasecmp) - AC_CHECK_FUNCS(strchr strdup strncasecmp strrchr strstr strtod strtol) + AC_CHECK_FUNCS(memset putenv random rename rindex sigsetmask strcasecmp) + AC_CHECK_FUNCS(setenv strchr strdup strncasecmp strrchr strstr strtod strtol) AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid) AC_DEFINE(HAVE_SYS_ERRLIST) AC_DEFINE(HAVE_SYS_NERR) AC_DEFINE(HAVE_SYS_SIGLIST) AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times) - AC_CHECK_FUNCS(sbrk) + AC_CHECK_FUNCS(sbrk gettimeofday) fi # For each of these functions, if the host does not provide the @@ -177,6 +182,7 @@ fi # if the host does not provide alloca, we set ALLOCA to alloca.o setobjs= +CHECK= if test -n "${with_target_subdir}"; then # We are being configured as a target library. AC_REPLACE_FUNCS @@ -211,8 +217,16 @@ if test -n "${with_target_subdir}"; then setobjs=yes fi + +else + + # Not a target library, so we set things up to run the test suite. + CHECK=check-cplus-dem + fi +AC_SUBST(CHECK) + if test -z "${setobjs}"; then case "${host}" in @@ -282,6 +296,11 @@ if test -z "${setobjs}"; then # can hang configure; on other versions, vfork exists just as a stub. # FIXME: This should be removed once vfork in uwin's runtime is fixed. ac_cv_func_vfork_works=no + # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are + # macros (actually, these are imported from a DLL, but the end effect + # is the same), so the test below won't find them. + AC_DEFINE(HAVE_SYS_NERR) + AC_DEFINE(HAVE_SYS_ERRLIST) ;; esac @@ -290,7 +309,28 @@ if test -z "${setobjs}"; then # tests. This will only work if the compiler works. AC_PROG_CC_WORKS AC_REPLACE_FUNCS($funcs) - AC_FUNC_ALLOCA + + case "${host}" in + *-*-interix) + # On Interix, it wrongly concludes that the MSVC compiler supports alloca. + # (MSVC does on Win32, not on Interix.) + # This should be temporary. + + ac_cv_header_alloca_h=no + ac_cv_func_alloca_works=no + ALLOCA=alloca.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + cat >> confdefs.h <<EOF +#define STACK_DIRECTION -1 +EOF + ;; + *) + AC_FUNC_ALLOCA + ;; + esac + AC_FUNC_VFORK if test $ac_cv_func_vfork_works = no; then LIBOBJS="$LIBOBJS vfork.o" @@ -322,7 +362,7 @@ fi AC_SUBST(INSTALL_DEST) # We need multilib support, but only if configuring for the target. -AC_OUTPUT(Makefile, +AC_OUTPUT(Makefile testsuite/Makefile, [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h if test -n "$CONFIG_FILES"; then if test -n "${with_target_subdir}"; then diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 14ef56a588d..52249d2b580 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -51,6 +51,14 @@ char * realloc (); #include "libiberty.h" +#define min(X,Y) (((X) < (Y)) ? (X) : (Y)) + +/* A value at least one greater than the maximum number of characters + that will be output when using the `%d' format with `printf'. */ +#define INTBUF_SIZE 32 + +extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN; + static const char *mystrstr PARAMS ((const char *, const char *)); static const char * @@ -343,6 +351,9 @@ string_prepend PARAMS ((string *, const char *)); static void string_prependn PARAMS ((string *, const char *, int)); +static void +string_append_template_idx PARAMS ((string *, int)); + static int get_count PARAMS ((const char **, int *)); @@ -420,6 +431,25 @@ qualifier_string PARAMS ((int)); static const char* demangle_qualifier PARAMS ((int)); +static int +demangle_expression PARAMS ((struct work_stuff *, const char **, string *, + type_kind_t)); + +static int +demangle_integral_value PARAMS ((struct work_stuff *, const char **, + string *)); + +static int +demangle_real_value PARAMS ((struct work_stuff *, const char **, string *)); + +static void +demangle_arm_hp_template PARAMS ((struct work_stuff *, const char **, int, + string *)); + +static void +recursively_demangle PARAMS ((struct work_stuff *, const char **, string *, + int)); + /* Translate count to integer, consuming tokens in the process. Conversion terminates on the first non-digit character. @@ -1326,87 +1356,155 @@ demangle_template_template_parm (work, mangled, tname) } static int -demangle_integral_value (work, mangled, s) +demangle_expression (work, mangled, s, tk) struct work_stuff *work; const char** mangled; string* s; + type_kind_t tk; { + int need_operator = 0; int success; - if (**mangled == 'E') + success = 1; + string_appendn (s, "(", 1); + (*mangled)++; + while (success && **mangled != 'W' && **mangled != '\0') { - int need_operator = 0; - - success = 1; - string_appendn (s, "(", 1); - (*mangled)++; - while (success && **mangled != 'W' && **mangled != '\0') + if (need_operator) { - if (need_operator) - { - size_t i; - size_t len; + size_t i; + size_t len; - success = 0; + success = 0; - len = strlen (*mangled); + len = strlen (*mangled); - for (i = 0; - i < sizeof (optable) / sizeof (optable [0]); - ++i) - { - size_t l = strlen (optable[i].in); + for (i = 0; + i < sizeof (optable) / sizeof (optable [0]); + ++i) + { + size_t l = strlen (optable[i].in); - if (l <= len - && memcmp (optable[i].in, *mangled, l) == 0) - { - string_appendn (s, " ", 1); - string_append (s, optable[i].out); - string_appendn (s, " ", 1); - success = 1; - (*mangled) += l; - break; - } + if (l <= len + && memcmp (optable[i].in, *mangled, l) == 0) + { + string_appendn (s, " ", 1); + string_append (s, optable[i].out); + string_appendn (s, " ", 1); + success = 1; + (*mangled) += l; + break; } - - if (!success) - break; } - else - need_operator = 1; - success = demangle_template_value_parm (work, mangled, s, - tk_integral); + if (!success) + break; } - - if (**mangled != 'W') - success = 0; else - { - string_appendn (s, ")", 1); - (*mangled)++; - } + need_operator = 1; + + success = demangle_template_value_parm (work, mangled, s, tk); } + + if (**mangled != 'W') + success = 0; + else + { + string_appendn (s, ")", 1); + (*mangled)++; + } + + return success; +} + +static int +demangle_integral_value (work, mangled, s) + struct work_stuff *work; + const char** mangled; + string* s; +{ + int success; + + if (**mangled == 'E') + success = demangle_expression (work, mangled, s, tk_integral); else if (**mangled == 'Q' || **mangled == 'K') success = demangle_qualified (work, mangled, s, 0, 1); else { + int value; + success = 0; + /* Negative numbers are indicated with a leading `m'. */ if (**mangled == 'm') { string_appendn (s, "-", 1); (*mangled)++; } + + /* Read the rest of the number. */ + value = consume_count_with_underscores (mangled); + if (value != -1) + { + char buf[INTBUF_SIZE]; + sprintf (buf, "%d", value); + string_append (s, buf); + + /* If the next character is an underscore, skip it. */ + if (**mangled == '_') + (*mangled)++; + + /* All is well. */ + success = 1; + } + } + + return success; +} + +/* Demangle the real value in MANGLED. */ + +static int +demangle_real_value (work, mangled, s) + struct work_stuff *work; + const char **mangled; + string* s; +{ + if (**mangled == 'E') + return demangle_expression (work, mangled, s, tk_real); + + if (**mangled == 'm') + { + string_appendn (s, "-", 1); + (*mangled)++; + } + while (isdigit ((unsigned char)**mangled)) + { + string_appendn (s, *mangled, 1); + (*mangled)++; + } + if (**mangled == '.') /* fraction */ + { + string_appendn (s, ".", 1); + (*mangled)++; + while (isdigit ((unsigned char)**mangled)) + { + string_appendn (s, *mangled, 1); + (*mangled)++; + } + } + if (**mangled == 'e') /* exponent */ + { + string_appendn (s, "e", 1); + (*mangled)++; while (isdigit ((unsigned char)**mangled)) { string_appendn (s, *mangled, 1); (*mangled)++; - success = 1; } } - return success; + return 1; } static int @@ -1432,11 +1530,7 @@ demangle_template_value_parm (work, mangled, s, tk) if (work->tmpl_argvec) string_append (s, work->tmpl_argvec[idx]); else - { - char buf[10]; - sprintf(buf, "T%d", idx); - string_append (s, buf); - } + string_append_template_idx (s, idx); } else if (tk == tk_integral) success = demangle_integral_value (work, mangled, s); @@ -1472,70 +1566,46 @@ demangle_template_value_parm (work, mangled, s, tk) success = 0; } else if (tk == tk_real) - { - if (**mangled == 'm') - { - string_appendn (s, "-", 1); - (*mangled)++; - } - while (isdigit ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - if (**mangled == '.') /* fraction */ - { - string_appendn (s, ".", 1); - (*mangled)++; - while (isdigit ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - } - if (**mangled == 'e') /* exponent */ - { - string_appendn (s, "e", 1); - (*mangled)++; - while (isdigit ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - } - } + success = demangle_real_value (work, mangled, s); else if (tk == tk_pointer || tk == tk_reference) { - int symbol_len = consume_count (mangled); - if (symbol_len == -1) - return -1; - if (symbol_len == 0) - string_appendn (s, "0", 1); + if (**mangled == 'Q') + success = demangle_qualified (work, mangled, s, + /*isfuncname=*/0, + /*append=*/1); else { - char *p = xmalloc (symbol_len + 1), *q; - strncpy (p, *mangled, symbol_len); - p [symbol_len] = '\0'; - /* We use cplus_demangle here, rather than - internal_cplus_demangle, because the name of the entity - mangled here does not make use of any of the squangling - or type-code information we have built up thus far; it is - mangled independently. */ - q = cplus_demangle (p, work->options); - if (tk == tk_pointer) - string_appendn (s, "&", 1); - /* FIXME: Pointer-to-member constants should get a - qualifying class name here. */ - if (q) + int symbol_len = consume_count (mangled); + if (symbol_len == -1) + return -1; + if (symbol_len == 0) + string_appendn (s, "0", 1); + else { - string_append (s, q); - free (q); + char *p = xmalloc (symbol_len + 1), *q; + strncpy (p, *mangled, symbol_len); + p [symbol_len] = '\0'; + /* We use cplus_demangle here, rather than + internal_cplus_demangle, because the name of the entity + mangled here does not make use of any of the squangling + or type-code information we have built up thus far; it is + mangled independently. */ + q = cplus_demangle (p, work->options); + if (tk == tk_pointer) + string_appendn (s, "&", 1); + /* FIXME: Pointer-to-member constants should get a + qualifying class name here. */ + if (q) + { + string_append (s, q); + free (q); + } + else + string_append (s, p); + free (p); } - else - string_append (s, p); - free (p); + *mangled += symbol_len; } - *mangled += symbol_len; } return success; @@ -1594,11 +1664,9 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) } else { - char buf[10]; - sprintf(buf, "T%d", idx); - string_append (tname, buf); + string_append_template_idx (tname, idx); if (trawname) - string_append (trawname, buf); + string_append_template_idx (trawname, idx); } } else @@ -2439,7 +2507,7 @@ gnu_special (work, mangled, declp) break; default: n = consume_count (mangled); - if (n < 0 || n > strlen (*mangled)) + if (n < 0 || n > (long) strlen (*mangled)) { success = 0; break; @@ -2606,7 +2674,7 @@ arm_special (mangled, declp) { n = consume_count (mangled); if (n == -1 - || n > strlen (*mangled)) + || n > (long) strlen (*mangled)) return 0; string_prependn (declp, *mangled, n); (*mangled) += n; @@ -2667,7 +2735,6 @@ demangle_qualified (work, mangled, result, isfuncname, append) { int qualifiers = 0; int success = 1; - const char *p; char num[2]; string temp; string last_name; @@ -2699,19 +2766,10 @@ demangle_qualified (work, mangled, result, isfuncname, append) /* GNU mangled name with more than 9 classes. The count is preceded by an underscore (to distinguish it from the <= 9 case) and followed by an underscore. */ - p = *mangled + 2; - qualifiers = atoi (p); - if (!isdigit ((unsigned char)*p) || *p == '0') - success = 0; - - /* Skip the digits. */ - while (isdigit ((unsigned char)*p)) - ++p; - - if (*p != '_') + (*mangled)++; + qualifiers = consume_count_with_underscores (mangled); + if (qualifiers == -1) success = 0; - - *mangled = p + 1; break; case '1': @@ -2902,9 +2960,7 @@ get_count (type, count) int n; if (!isdigit ((unsigned char)**type)) - { - return (0); - } + return (0); else { *count = **type - '0'; @@ -3041,14 +3097,14 @@ do_type (work, mangled, result) member = **mangled == 'M'; (*mangled)++; - if (!isdigit ((unsigned char)**mangled) && **mangled != 't') - { - success = 0; - break; - } string_append (&decl, ")"); - string_prepend (&decl, SCOPE_STRING (work)); + + /* We don't need to prepend `::' for a qualified name; + demangle_qualified will do that for us. */ + if (**mangled != 'Q') + string_prepend (&decl, SCOPE_STRING (work)); + if (isdigit ((unsigned char)**mangled)) { n = consume_count (mangled); @@ -3061,7 +3117,13 @@ do_type (work, mangled, result) string_prependn (&decl, *mangled, n); *mangled += n; } - else + else if (**mangled == 'X' || **mangled == 'Y') + { + string temp; + do_type (work, mangled, &temp); + string_prepends (&decl, &temp); + } + else if (**mangled == 't') { string temp; string_init (&temp); @@ -3075,6 +3137,20 @@ do_type (work, mangled, result) else break; } + else if (**mangled == 'Q') + { + success = demangle_qualified (work, mangled, &decl, + /*isfuncnam=*/0, + /*append=*/0); + if (!success) + break; + } + else + { + success = 0; + break; + } + string_prepend (&decl, "("); if (member) { @@ -3181,11 +3257,7 @@ do_type (work, mangled, result) if (work->tmpl_argvec) string_append (result, work->tmpl_argvec[idx]); else - { - char buf[10]; - sprintf(buf, "T%d", idx); - string_append (result, buf); - } + string_append_template_idx (result, idx); success = 1; } @@ -3359,14 +3431,14 @@ demangle_fund_type (work, mangled, result) break; } case 'I': - ++(*mangled); + (*mangled)++; if (**mangled == '_') { int i; - ++(*mangled); + (*mangled)++; for (i = 0; - (i < sizeof (buf) - 1 && **mangled && **mangled != '_'); - ++(*mangled), ++i) + i < (long) sizeof (buf) - 1 && **mangled && **mangled != '_'; + (*mangled)++, i++) buf[i] = **mangled; if (**mangled != '_') { @@ -3374,13 +3446,13 @@ demangle_fund_type (work, mangled, result) break; } buf[i] = '\0'; - ++(*mangled); + (*mangled)++; } else { strncpy (buf, *mangled, 2); buf[2] = '\0'; - *mangled += 2; + *mangled += min (strlen (*mangled), 2); } sscanf (buf, "%x", &dec); sprintf (buf, "int%i_t", dec); @@ -3434,7 +3506,7 @@ demangle_fund_type (work, mangled, result) static int do_hpacc_template_const_value (work, mangled, result) - struct work_stuff *work; + struct work_stuff *work ATTRIBUTE_UNUSED; const char **mangled; string *result; { @@ -4304,6 +4376,16 @@ string_prependn (p, s, n) } } +static void +string_append_template_idx (s, idx) + string *s; + int idx; +{ + char buf[INTBUF_SIZE + 1 /* 'T' */]; + sprintf(buf, "T%d", idx); + string_append (s, buf); +} + /* To generate a standalone demangler program for testing purposes, just compile and link this file with -DMAIN and libiberty.a. When run, it demangles each command line arg, or each stdin string, and @@ -4313,13 +4395,13 @@ string_prependn (p, s, n) #include "getopt.h" -static char *program_name; -static char *program_version = VERSION; +static const char *program_name; +static const char *program_version = VERSION; static int flags = DMGL_PARAMS | DMGL_ANSI; static void demangle_it PARAMS ((char *)); -static void usage PARAMS ((FILE *, int)); -static void fatal PARAMS ((char *)); +static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN; +static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN; static void demangle_it (mangled_name) @@ -4380,25 +4462,25 @@ fancy_abort () } -/* Fill in TABLE so that TABLE[C] is true iff C (as an unsigned char) - is a valid symbol component, in the standard assembler symbol - syntax. */ -void -standard_symbol_alphabet (char *table) -{ - int c; +static const char * +standard_symbol_characters PARAMS ((void)); + +static const char * +hp_symbol_characters PARAMS ((void)); - for (c = 0; c < 256; c++) - table[c] = isalnum(c); +/* Return the string of non-alnum characters that may occur + as a valid symbol component, in the standard assembler symbol + syntax. */ - table['_'] = 1; - table['$'] = 1; - table['.'] = 1; +static const char * +standard_symbol_characters () +{ + return "_$."; } -/* Fill in TABLE so that TABLE[C] is true iff C (as an unsigned char) - is a valid symbol name component in an HP object file. +/* Return the string of non-alnum characters that may occur + as a valid symbol name component in an HP object file. Note that, since HP's compiler generates object code straight from C++ source, without going through an assembler, its mangled @@ -4427,18 +4509,15 @@ standard_symbol_alphabet (char *table) non-digit character. So have fun. */ -void -hp_symbol_alphabet (char *table) +static const char * +hp_symbol_characters () { - char *c; - - standard_symbol_alphabet (table); - - for (c = "<>#,*&[]:(){}"; *c; c++) - table[(unsigned char) *c] = 1; + return "_$.<>#,*&[]:(){}"; } +extern int main PARAMS ((int, char **)); + int main (argc, argv) int argc; @@ -4446,7 +4525,7 @@ main (argc, argv) { char *result; int c; - char symbol_alphabet[256]; + const char *valid_symbols; program_name = argv[0]; @@ -4466,7 +4545,7 @@ main (argc, argv) break; case 'v': printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version); - exit (0); + return (0); case '_': strip_underscore = 1; break; @@ -4498,7 +4577,7 @@ main (argc, argv) { fprintf (stderr, "%s: unknown demangling style `%s'\n", program_name, optarg); - exit (1); + return (1); } break; } @@ -4519,10 +4598,10 @@ main (argc, argv) case lucid_demangling: case arm_demangling: case edg_demangling: - standard_symbol_alphabet (symbol_alphabet); + valid_symbols = standard_symbol_characters (); break; case hp_demangling: - hp_symbol_alphabet (symbol_alphabet); + valid_symbols = hp_symbol_characters (); break; default: /* Folks should explicitly indicate the appropriate alphabet for @@ -4536,7 +4615,7 @@ main (argc, argv) int i = 0; c = getchar (); /* Try to read a label. */ - while (c != EOF && symbol_alphabet[c]) + while (c != EOF && (isalnum (c) || strchr (valid_symbols, c))) { if (i >= MBUF_SIZE-1) break; @@ -4576,12 +4655,12 @@ main (argc, argv) } } - exit (0); + return (0); } static void fatal (str) - char *str; + const char *str; { fprintf (stderr, "%s: %s\n", program_name, str); exit (1); diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c index c644c98e0fe..56ddec78dd8 100644 --- a/libiberty/pexecute.c +++ b/libiberty/pexecute.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996-2000 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -29,6 +29,9 @@ Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <errno.h> +#ifdef HAVE_STRING_H +#include <string.h> +#endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -52,10 +55,6 @@ Boston, MA 02111-1307, USA. */ #include "libiberty.h" -#if !defined (__CYGWIN__) && defined (__CYGWIN32__) -#define __CYGWIN__ 1 -#endif - /* stdin file number. */ #define STDIN_FILE_NO 0 @@ -160,6 +159,8 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) FILE *argfile; int i, el = flags & PEXECUTE_SEARCH ? 4 : 0; + if (temp_base == 0) + temp_base = choose_temp_base (); scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el); rf = scmd + strlen(program) + 2 + el; sprintf (scmd, "%s%s @%s.gp", program, @@ -234,7 +235,7 @@ pwait (pid, status, flags) #endif /* MSDOS */ -#if defined (_WIN32) && ! defined (__UWIN__) +#if defined (_WIN32) && ! defined (_UWIN) #include <process.h> @@ -281,6 +282,45 @@ fix_argv (argvec) argvec[i] = temp; } + for (i = 0; argvec[i] != 0; i++) + { + if (strpbrk (argvec[i], " \t")) + { + int len, trailing_backslash; + char *temp; + + len = strlen (argvec[i]); + trailing_backslash = 0; + + /* There is an added complication when an arg with embedded white + space ends in a backslash (such as in the case of -iprefix arg + passed to cpp). The resulting quoted strings gets misinterpreted + by the command interpreter -- it thinks that the ending quote + is escaped by the trailing backslash and things get confused. + We handle this case by escaping the trailing backslash, provided + it was not escaped in the first place. */ + if (len > 1 + && argvec[i][len-1] == '\\' + && argvec[i][len-2] != '\\') + { + trailing_backslash = 1; + ++len; /* to escape the final backslash. */ + } + + len += 2; /* and for the enclosing quotes. */ + + temp = xmalloc (len + 1); + temp[0] = '"'; + strcpy (temp + 1, argvec[i]); + if (trailing_backslash) + temp[len-2] = '\\'; + temp[len-1] = '"'; + temp[len] = '\0'; + + argvec[i] = temp; + } + } + return (const char * const *) argvec; } #endif /* __CYGWIN__ */ @@ -423,7 +463,7 @@ pwait (pid, status, flags) #endif /* __CYGWIN__ */ } -#endif /* _WIN32 && ! __UWIN__ */ +#endif /* _WIN32 && ! _UWIN */ #ifdef OS2 @@ -606,7 +646,7 @@ pfinish () /* include for Unix-like environments but not for Dos-like environments */ #if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \ - && ! (defined (_WIN32) && ! defined (__UWIN__)) + && ! (defined (_WIN32) && ! defined (_UWIN)) extern int execv (); extern int execvp (); @@ -735,4 +775,4 @@ pwait (pid, status, flags) return pid; } -#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! __UWIN__) */ +#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */ diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index 1cb6bd91f22..22ea07d84ad 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -235,7 +235,7 @@ splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) splay_tree_delete_key_fn delete_key_fn; splay_tree_delete_value_fn delete_value_fn; { - splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree)); + splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree_s)); sp->root = 0; sp->comp = compare_fn; sp->delete_key = delete_key_fn; @@ -256,9 +256,9 @@ splay_tree_delete (sp) /* Insert a new node (associating KEY with DATA) into SP. If a previous node with the indicated KEY exists, its data is replaced - with the new value. */ + with the new value. Returns the new node. */ -void +splay_tree_node splay_tree_insert (sp, key, value) splay_tree sp; splay_tree_key key; @@ -284,7 +284,7 @@ splay_tree_insert (sp, key, value) /* Create a new node, and insert it at the root. */ splay_tree_node node; - node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node)); + node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node_s)); node->key = key; node->value = value; @@ -305,6 +305,8 @@ splay_tree_insert (sp, key, value) sp->root = node; } + + return sp->root; } /* Lookup KEY in SP, returning VALUE if present, and NULL diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index be25c5aca19..621c6d216c7 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -81,12 +81,12 @@ xmalloc (size) else allocated = (char *) sbrk (0) - (char *) &environ; fprintf (stderr, - "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", + "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); #else /* HAVE_SBRK */ fprintf (stderr, - "\n%s%sCan not allocate %lu bytes\n", + "\n%s%sCannot allocate %lu bytes\n", name, *name ? ": " : "", (unsigned long) size); #endif /* HAVE_SBRK */ @@ -116,12 +116,12 @@ xcalloc (nelem, elsize) else allocated = (char *) sbrk (0) - (char *) &environ; fprintf (stderr, - "\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n", + "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) (nelem * elsize), (unsigned long) allocated); #else /* HAVE_SBRK */ fprintf (stderr, - "\n%s%sCan not allocate %lu bytes\n", + "\n%s%sCannot allocate %lu bytes\n", name, *name ? ": " : "", (unsigned long) (nelem * elsize)); #endif /* HAVE_SBRK */ @@ -154,12 +154,12 @@ xrealloc (oldmem, size) else allocated = (char *) sbrk (0) - (char *) &environ; fprintf (stderr, - "\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n", + "\n%s%sCannot reallocate %lu bytes after allocating %lu bytes\n", name, *name ? ": " : "", (unsigned long) size, (unsigned long) allocated); #else /* HAVE_SBRK */ fprintf (stderr, - "\n%s%sCan not reallocate %lu bytes\n", + "\n%s%sCannot reallocate %lu bytes\n", name, *name ? ": " : "", (unsigned long) size); #endif /* HAVE_SBRK */ |