summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-05-12 23:15:20 +0000
committerobrien <obrien@FreeBSD.org>2000-05-12 23:15:20 +0000
commit2a9ea95d682586d2b0c31da28d82a73d786c7c0a (patch)
tree9d4ce42d357c391a11d77254b770908c02ecf672 /contrib/binutils/libiberty
parentbffe850874e72664f78cf171ab1c4339b9b63cab (diff)
downloadFreeBSD-src-2a9ea95d682586d2b0c31da28d82a73d786c7c0a.zip
FreeBSD-src-2a9ea95d682586d2b0c31da28d82a73d786c7c0a.tar.gz
Import of Binutils 2.10 snapshot.
Diffstat (limited to 'contrib/binutils/libiberty')
-rw-r--r--contrib/binutils/libiberty/ChangeLog1343
-rw-r--r--contrib/binutils/libiberty/Makefile.in350
-rw-r--r--contrib/binutils/libiberty/README109
-rw-r--r--contrib/binutils/libiberty/acconfig.h11
-rw-r--r--contrib/binutils/libiberty/alloca-conf.h24
-rw-r--r--contrib/binutils/libiberty/alloca.c42
-rw-r--r--contrib/binutils/libiberty/argv.c12
-rw-r--r--contrib/binutils/libiberty/atexit.c6
-rw-r--r--contrib/binutils/libiberty/basename.c39
-rw-r--r--contrib/binutils/libiberty/calloc.c29
-rw-r--r--contrib/binutils/libiberty/choose-temp.c112
-rw-r--r--contrib/binutils/libiberty/clock.c24
-rw-r--r--contrib/binutils/libiberty/config.in224
-rw-r--r--contrib/binutils/libiberty/config.table75
-rw-r--r--contrib/binutils/libiberty/config/mh-cxux74
-rw-r--r--contrib/binutils/libiberty/config/mh-openedition3
-rwxr-xr-xcontrib/binutils/libiberty/configure2953
-rw-r--r--contrib/binutils/libiberty/configure.in424
-rw-r--r--contrib/binutils/libiberty/cplus-dem.c2547
-rw-r--r--contrib/binutils/libiberty/floatformat.c22
-rw-r--r--contrib/binutils/libiberty/fnmatch.c18
-rw-r--r--contrib/binutils/libiberty/getcwd.c14
-rw-r--r--contrib/binutils/libiberty/getopt.c116
-rw-r--r--contrib/binutils/libiberty/getopt1.c9
-rw-r--r--contrib/binutils/libiberty/getpagesize.c55
-rw-r--r--contrib/binutils/libiberty/getpwd.c115
-rw-r--r--contrib/binutils/libiberty/getruntime.c38
-rw-r--r--contrib/binutils/libiberty/hashtab.c429
-rw-r--r--contrib/binutils/libiberty/memchr.c4
-rw-r--r--contrib/binutils/libiberty/memcpy.c2
-rw-r--r--contrib/binutils/libiberty/memmove.c2
-rw-r--r--contrib/binutils/libiberty/mkstemps.c128
-rw-r--r--contrib/binutils/libiberty/objalloc.c4
-rw-r--r--contrib/binutils/libiberty/obstack.c177
-rw-r--r--contrib/binutils/libiberty/partition.c185
-rw-r--r--contrib/binutils/libiberty/pexecute.c186
-rw-r--r--contrib/binutils/libiberty/putenv.c68
-rw-r--r--contrib/binutils/libiberty/random.c43
-rw-r--r--contrib/binutils/libiberty/setenv.c163
-rw-r--r--contrib/binutils/libiberty/splay-tree.c370
-rw-r--r--contrib/binutils/libiberty/strchr.c2
-rw-r--r--contrib/binutils/libiberty/strerror.c18
-rw-r--r--contrib/binutils/libiberty/strrchr.c2
-rw-r--r--contrib/binutils/libiberty/strsignal.c18
-rw-r--r--contrib/binutils/libiberty/strtol.c9
-rw-r--r--contrib/binutils/libiberty/strtoul.c11
-rw-r--r--contrib/binutils/libiberty/tmpnam.c2
-rw-r--r--contrib/binutils/libiberty/vasprintf.c7
-rw-r--r--contrib/binutils/libiberty/vfprintf.c22
-rw-r--r--contrib/binutils/libiberty/vprintf.c2
-rw-r--r--contrib/binutils/libiberty/xmalloc.c64
-rw-r--r--contrib/binutils/libiberty/xmemdup.c22
-rw-r--r--contrib/binutils/libiberty/xstrdup.c16
53 files changed, 9265 insertions, 1409 deletions
diff --git a/contrib/binutils/libiberty/ChangeLog b/contrib/binutils/libiberty/ChangeLog
index e3f0773..c858409 100644
--- a/contrib/binutils/libiberty/ChangeLog
+++ b/contrib/binutils/libiberty/ChangeLog
@@ -1,3 +1,1226 @@
+Thu Mar 16 01:33:58 2000 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (partition.o): Depend on config.h
+
+2000-03-14 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * hashtab.c (find_empty_slot_for_expand): New function.
+ (htab_expand): Use it instead of htab_find_slot.
+ (htab_find_with_hash): Renamed from htab_find; now accepts extra
+ argument HASH.
+ (htab_find_slot_with_hash): Likewise for htab_find_slot.
+ (htab_find): New wrapper function.
+ (htab_find_slot): Likewise.
+ (htab_traverse): Pass slot, not entry, to called function.
+
+2000-03-09 Alex Samuel <samuel@codesourcery.com>
+
+ * Makefile.in (CFILES): Add partition.c.
+ (REQUIRED_OFILES): Add partition.o.
+ (partition.o): New rule.
+ * partition.c: New file.
+
+2000-03-09 Zack Weinberg <zack@wolery.cumb.org>
+
+ * hashtab.c (htab_create): Set del_f.
+ (htab_delete, htab_empty, htab_remove_elt, htab_clear_slot):
+ Use it.
+
+2000-03-08 Zack Weinberg <zack@wolery.cumb.org>
+
+ * hashtab.c: Remove debugging variables (all_searches,
+ all_collisions, all_expansions). Delete
+ all_hash_table_collisions.
+ (create_hash_table, delete_hash_table, empty_hash_table,
+ find_hash_table_entry, remove_element_from_hash_table_entry,
+ clear_hash_table_slot, traverse_hash_table, hash_table_size,
+ hash_table_elements_number, hash_table_collisions): Rename to:
+ htab_create, htab_delete, htab_empty, htab_find_slot,
+ htab_remove_elt, htab_clear_slot, htab_traverse, htab_size,
+ htab_elements, htab_collisions.
+ (htab_find): New function, handles common case where you don't
+ plan to add or delete an entry.
+ (htab_expand): Don't create a whole new table, just a new
+ entry vector.
+ (htab_find_slot): Simplify logic.
+
+1999-08-03 Ian Lance Taylor <ian@zembu.com>
+
+ * floatformat.c: Add casts to avoid signed/unsigned warnings.
+ * pexecute.c: Add ATTRIBUTE_UNUSED as needed on Unix.
+
+ * Makefile.in (install_to_libdir): Change $(TARGETLIB).n to
+ $(TARGETLIB)n so it works on MSDOS.
+ (install_to_tooldir): Likewise.
+
+1999-07-21 Ian Lance Taylor <ian@zembu.com>
+
+ From Mark Elbrecht:
+ * 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
+ 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
+ characters from non-identifier characters.
+ (standard_symbol_alphabet, hp_symbol_alphabet): New functions.
+
+Thu May 6 20:34:42 1999 Fred Fish <fnf@be.com>
+
+ * configure.in (sys/resource.h): Add to AC_CHECK_HEADERS list.
+ * getruntime.c: Only attempt to include sys/resource.h and
+ 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:
+ * cplus-dem.c (mop_up): Set typevec_size to zero, so it'll be
+ reallocated properly if we use it again.
+
+ * cplus-dem.c (demangle_fund_type): Check for buffer overrun. Be
+ stricter about syntax. Always null-terminate string.
+
+Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * configure.in (checkfuncs): Check for sbrk.
+ * config.in: Rebuilt.
+ * 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
+ or <alloca.h>.
+ * clock.c (GNU_HZ): New definition.
+ (clock): Use it.
+ * getruntime.c: Likewise.
+
+ * 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
+ semblance of grace.
+ (consume_count): Detect overflows. Return -1 to indicate errors,
+ instead of zero.
+ (demangle_template_value_parm, demangle_template): Handle change
+ to consume_count's return convention.
+
+1999-04-05 Tom Tromey <tromey@cygnus.com>
+
+ * testsuite/regress-demangle: New file.
+ * testsuite/demangle-expected: New file.
+
+ * 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>
+
+ * splay-tree.h (splay_tree_compare_pointers): Define.
+
+1999-03-30 Mark Mitchell <mark@codesourcery.com>
+
+ * splay-tree.c (splay_tree_compare_ints): Define.
+
+1999-03-30 Tom Tromey <tromey@cygnus.com>
+
+ * cplus-dem.c (consume_count): If `count' wraps, return 0 and
+ don't advance input pointer.
+ (demangle_class_name): If consume_count didn't find a count, do
+ nothing. Don't bother with `strlen' sanity check; consume_count
+ does it for us.
+
+1999-03-16 Stan Shebs <shebs@andros.cygnus.com>
+
+ From Art Haas <ahaas@neosoft.com>:
+ * cplus-dem.c (demangle_prefix): Don't grab all the '__' strings
+ when doing arm or hp style.
+ (demangle_nested_args): Decr forgetting_types field when done.
+
+Thu Mar 11 01:22:58 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * pexecute.c (__CYGWIN32__): Rename to
+ (__CYGWIN__): this.
+ * xmalloc.c: Likewise.
+
+ Changes to support i386-pc-uwin.
+ * configure.in (*-*-uwin*): Workaround for vfork bug.
+ * configure: Regenerate.
+ * pexecute.c (pexecute): Be like standard Unix.
+ (pwait): Likewise.
+ * xmalloc.c (first_break): Define.
+ (xmalloc_set_program_name): Use.
+ (xmalloc): Use.
+
+Thu Mar 11 01:07:55 1999 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ * config.table: Cleanup and add mh-*pic handling for alpha, arm, powerpc
+
+Sun Feb 28 22:30:44 1999 Geoffrey Noer <noer@cygnus.com>
+
+ * config.table: Check cygwin*, not cygwin32*.
+
+Tue Feb 9 16:39:01 1999 Dave Brolley <brolley@cygnus.com>
+
+ * Makefile.in: Change mkstemp -> mkstemps.
+
+Tue Feb 9 01:12:27 1999 Marc Espie <Marc.Espie@liafa.jussieu.fr>
+
+ * Makefile.in (REQUIRED_OFILES): remove mkstemp.o
+ * configure.in (funcs): Check for and conditionally add mkstemps to
+ the list of functions libiberty will provide.
+ * configure: Rebuilt.
+
+Wed Feb 3 00:01:15 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * clock.c (HZ): Define in terms of (ISO C) CLOCKS_PER_SEC on
+ platforms that don't have HZ.
+ * getruntime.c (HZ): Likewise.
+
+Sat Jan 30 13:28:04 1999 Richard Henderson <rth@cygnus.com>
+
+ * Makefile.in (xstrdup.o): Depend on config.h.
+
+Wed Jan 13 07:26:44 1999 H.J. Lu (hjl@gnu.org)
+
+ * cplus-dem.c (mop_up): Set work->previous_argument to NULL after
+ freeing it.
+
+Wed Jan 13 14:16:36 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * xstrdup.c (xstrdup): Switch from strcpy to memcpy for speed.
+
+Tue Jan 5 15:58:29 1999 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+
+ * Makefile.in (CFILES): fix typo, splay-tree.c instead of
+ splay-tree.o.
+
+1999-01-04 Jason Molenda (jsm@bugshack.cygnus.com)
+
+ * configure.in: Require autoconf 2.12.1 or higher.
+
+1998-12-30 Michael Meissner <meissner@cygnus.com>
+
+ * random.c (NULL): Don't redefine NULL if it is already defined.
+
+Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * argv.c (buildargv): Cast the result of alloca in assignment.
+
+ * choose-temp.c: Include stdlib.h.
+
+ * cplus-dem.c (demangle_arm_pt): Remove unused prototype.
+ (snarf_numeric_literal): Constify first parameter.
+ (code_for_qualifier): Avoid a gcc extension, make the parameter an
+ int, not a char.
+ (demangle_qualifier): Likewise.
+ (demangle_signature): Cast the argument of a ctype function to
+ unsigned char.
+ (arm_pt): Add parens around assignment used as truth value.
+ (demangle_arm_hp_template): Constify variable `args'.
+ (do_hpacc_template_const_value): Cast the argument of a ctype
+ function to unsigned char.
+ (do_hpacc_template_literal): Remove unused variable `i'.
+ (snarf_numeric_literal): Constify parameter `args'.
+ Cast the argument of a ctype function to unsigned char.
+
+ * floatformat.c (floatformat_to_double): Add explicit braces to
+ avoid ambiguous `else'.
+
+ * fnmatch.c (fnmatch): Change type of variables `c', `c1',
+ `cstart' and `cend' to unsigned char. Cast the argument of macro
+ `FOLD', which uses ctype functions, to unsigned char.
+
+ * objalloc.c (free): Add prototype.
+
+Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson <hp@axis.se>
+
+ * Makefile.in (CFILES): Fix typo: splay-tree.c, not splay-tree.o
+
+Fri Dec 18 17:50:18 1998 David Taylor <taylor@texas.cygnus.com>
+
+ * cplus-dem.c (demangle_arm_pt): remove declaration -- function
+ doesn't exist.
+ (do_hpacc_template_literal): remove unused variable `i'.
+
+Fri Dec 18 16:11:43 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * cplus-dem.c (demangle_fund_type): Process CV and u codes before
+ bumping the pointer we read from. Also prepend these codes,
+ as we do in other places.
+
+1998-12-18 Nick Clifton <nickc@cygnus.com>
+
+ * cplus-dem.c (demangle_arm_hp_template): Make variable 'args' be
+ 'const char *' in order to match its usage when calling siblings.
+ (snarf_numeric_literal): Make first arg 'const char **' in order
+ to match usage.
+
+Mon Dec 14 09:55:50 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * choose-temp.c: Don't check IN_GCC anymore.
+
+ * floatformat.c (floatformat_from_double): Use `const', not `CONST'.
+ * memchr.c (memchr): Likewise.
+ * memcpy.c (memcpy): Likewise.
+ * memmove.c (memmove): Likewise.
+
+ * mkstemp.c: Don't check IN_GCC anymore.
+ * pexecute.c: Likewise.
+ * splay-tree.c: Likewise.
+
+ * strchr.c (strchr): Use `const', not `CONST'.
+ * strrchr.c (strrchr): Likewise.
+ * strtol.c (strtol): Likewise.
+ * strtoul.c (strtoul): Likewise.
+
+Fri Dec 4 13:51:04 1998 David Taylor <taylor@texas.cygnus.com>
+ Elena Zannoni <ezannoni@cygnus.com>
+ Stan Shebs <shebs@cygnus.com>
+ Edith Epstein <eepstein@cygnus.com>
+ Andres MacLeod <amacleod@cygnus.com>
+ Satish Pai <pai@apollo.hp.com>
+
+ * HP aCC demangling support.
+ * cplus-dem.c
+ (main): Remove default to HP style demangling, set to EDG
+ demangling correctly when -edg specified; set the demangling style
+ when user specifies 'edg'. Set strip_underscore to
+ prepends_underscore, if not HPUXHPPA. Set
+ current_demangling_style to hp_demangling if HPUXHPPA. Set
+ current demangling style correctly if the switch is hp. Read
+ label correctly also in the HP style case.
+ (work_stuff): add temp_start field; add field for volatile member
+ function.
+ (arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP
+ style for this case is the same as ARM.
+ (demangle_args): handle EDG_DEMANGLING style; support HP style.
+ (demangle_arm_hp_template): new function. (It was
+ demangle_arm_pt.); check and set value of temp_start field in
+ multiple places. Also, when ceching for end of template args,
+ check to see if at end of static member of template class.
+ (demangle_class): new local variable : save_class_name_end Don't
+ include template args in string defining class.
+ (demangle_class_name): use demangel_arm_hp_template.
+ (demangle_function_name): handle case where demangling style is
+ HP_DEMANGLING and currently point at an 'X' in the mangled name.
+ Handle EDG_DEMANGLING style. Handle constructor and destructor
+ ops for HP style.
+ (demangle_prefix): handle EDG_DEMANGLING and ARM_DEMANGLING
+ styles. global destructor and constructor for HP style are same
+ as for ARM style. Same for local variables.
+ (demangle_qualified): handle EDG_DEMANGLING style.
+ (demangle_signature): add case for volatile member function. For
+ cases '1' - '9' : initialize the temp_start field to -1 and handle
+ the EDG_DEMANGLING style. for case 'F' : handle EDG_DEMANGLING
+ and AUTO_DEMANGLING styles. If expecting a function and managed
+ to demangle the funct args, then handle the LUCID_DEMANGLING,
+ ARM_DEMANGLING, and EDG_DEMANGLING styles. Add case for local
+ class name after "Lnnn_ in HP style case. HP style too needs to
+ forget types. _nnn is OK for HP style, so don't report failure.
+ (do_hpacc_template_const_value): new function. Handle template's
+ value param for HP/aCC.
+ (do_hpacc_template_literal): new function. Handle a template's
+ literal parameter for HP aCC.
+ (recursively_demangle): new function
+ (snarf_numeric_literal): new function.
+ (usage): add 'edg' to the list of demangling styles; add hp switch
+ to message.
+
+Sat Nov 28 17:25:22 1998 Christopher Faylor <cgf@cygnus.com>
+
+ * pexecute.c: Remove obsolete ifdefed cygwin code.
+
+Fri Nov 27 13:26:06 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * choose-temp.c: Always include libiberty.h. Avoid redundancies.
+ * cplus-dem.c: Likewise. Conform to libiberty.h.
+ * pexecute.c: Likewise.
+ * splay-tree.c: Likewise.
+
+1998-11-25 Mike Stump <mrs@wrs.com>
+
+ * Makefile.in (splay-tree.o): Add config.h dependency.
+
+Mon Nov 23 16:59:49 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Use AC_PREREQ(2.12.1).
+
+1998-11-16 Benjamin Kosnik <bkoz@haight.constant.com>
+
+ * cplus-dem.c (demangle_fund_type): Add demangling for C9x types.
+
+Thu Nov 19 22:15:50 1998 Jeffrey A Law (law@cygnus.com)
+
+ * mpw.c (mpw_access): Add missing parens.
+
+Thu Nov 19 12:59:21 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Call AC_HEADER_SYS_WAIT.
+
+ * pexecute.c: Include sys/wait.h when !IN_GCC.
+
+Thu Nov 19 14:38:20 1998 Geoffrey Noer <noer@cygnus.com>
+
+ * pexecute.c: revert back to checking old Cygwin
+ preprocessor symbol until some time has passed.
+
+Wed Nov 18 08:52:26 1998 Christopher Faylor <cgf@cygnus.com>
+
+ * pexecute.c: Reorganize WIN32 case to accomodate Cygwin
+ since it will now support similar constructs.
+
+Fri Nov 13 19:18:05 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * configure.in: Check for calloc.
+
+ * calloc.c: New file.
+
+ * xmalloc.c (xcalloc): New function.
+
+Fri Nov 13 08:51:46 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ *cplus-dem.c (demangle_prefix): Use the last "__"
+ in the mangled name when looking for the signature. This allows
+ template names to begin with "__".
+
+1998-11-08 Mark Mitchell <mark@markmitchell.com>
+
+ * cplus-dem.c (type_kind_t): Add tk_reference.
+ (demangle_template_value_parm): Handle it.
+ (do_type): Use it for references, instead of tk_pointer.
+
+ * cplus-dem.c (demangle_template_value_parm): Use cplus_demangle,
+ not internal_cplus_demangle.
+
+Sat Nov 7 16:02:10 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * choose-temp.c: Don't include gansidecl.h.
+ * mkstemp.c: Likewise.
+ * pexecute.c: Likewise.
+
+Mon Nov 2 15:05:33 1998 Geoffrey Noer <noer@cygnus.com>
+
+ * configure.in: detect cygwin* instead of cygwin32*
+ * configure: regenerate
+
+Mon Nov 2 10:22:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * pexecute.c: Check HAVE_CONFIG_H, not IN_GCC, when determining
+ whether to include config.h. Possibly include unistd.h in the
+ !IN_GCC case. Define VFORK_STRING as a printable function call
+ for error messages (either "vfork" or "fork".) If HAVE_VFORK_H is
+ defined, include vfork.h. If VMS is defined, define vfork()
+ appropriately. Remove vfork check on USG, we're using autoconf.
+ (pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking
+ locally what string to use.
+
+1998-10-26 Mark Mitchell <mark@markmitchell.com>
+
+ * splay-tree.c: Tweak include directives to make sure declarations of
+ xmalloc and free are available.
+
+1998-10-25 Mark Mitchell <mark@markmitchell.com>
+
+ * cplus-dem.c (gnu_special): Fix handling of virtual tables in
+ anonymous namespaces.
+
+1998-10-23 Mark Mitchell <mark@markmitchell.com>
+
+ * cplus-dem.c (work_stuff): Replace const_type and volatile_type
+ with type_quals.
+ (TYPE_UNQUALIFIED): New macro.
+ (TYPE_QUAL_CONST): Likewise.
+ (TYPE_QUAL_VOLATILE): Likewise.
+ (TYPE_QUAL_RESTRICT): Likewise.
+ (code_for_qualifier): New function.
+ (qualifier_string): Likewise.
+ (demangle_qualifier): Likewise.
+ (internal_cplus_demangle): Use them.
+ (demangle_signature): Likewise.
+ (demangle_template_value_parm): Likewise.
+ (do_type): Likewise.
+ (demangle_fund_type)): Likewise.
+
+Thu Oct 22 19:58:43 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * splay-tree.c (splay_tree_foreach_helper): Make definition static
+ to match prototype.
+
+1998-10-21 Mark Mitchell <mark@markmitchell.com>
+
+ * splay-tree.c: New file.
+ * Makefile.in (CFILES): Add it.
+ (REQUIRED_OFILES): Likewise.
+ (splay-tree.o): Add dependencies.
+
+Tue Oct 20 12:29:02 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * cplus-dem.c (demangle_qualified): Fix off-by-one when checking
+ range of 'K' index.
+
+Thu Oct 15 18:51:12 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * choose-temp.c: Prototype mkstemps() when IN_GCC.
+
+ * cplus-dem.c (consume_count): Cast argument of ctype macro to
+ `unsigned char'.
+ (cplus_demangle_opname): Cast the result of `strlen' to (int) when
+ comparing against one.
+ (cplus_mangle_opname): Likewise.
+ (demangle_integral_value): Cast argument of ctype macro to
+ `unsigned char'.
+ (demangle_template_value_parm): Likewise.
+ (demangle_template): Initialize variable `bindex'. Cast the
+ result of `strlen' to (int) when comparing against one. Remove
+ unused variable `start_of_value_parm'.
+ (demangle_class_name): Cast the result of `strlen' to (int) when
+ comparing against one.
+ (demangle_prefix): Cast argument of ctype macro to `unsigned char'.
+ (gnu_special): Likewise. Cast the result of `strlen' to (int)
+ when comparing against one.
+ (demangle_qualified): Cast argument of ctype macro to `unsigned char'.
+ (get_count): Likewise.
+ (do_type): Likewise. Cast the result of `strlen' to (int) when
+ comparing against one.
+ (demangle_fund_type): Cast argument of ctype macro to `unsigned char'.
+ (demangle_function_name): Cast the result of `strlen' to (int)
+ when comparing against one.
+
+ * mkstemp.c (mkstemps): Cast variable `len' to (int) when
+ comparing against one.
+
+Tue Oct 13 23:51:51 1998 Jeffrey A Law (law@cygnus.com)
+
+ * mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h
+ * configure.in (AC_CHECK_HEADERS): Check for sys/time.h too.
+ * config.in, configure: Rebuilt.
+
+ * getopt.c: Check HAVE_STRINGS_H before including strings.h.
+ * configure.in (AC_CHECK_HEADERS): Check for strings.h too.
+ * config.in, configure: Rebuilt.
+
+Mon Oct 12 19:15:59 1998 Geoffrey Noer <noer@cygnus.com>
+
+ * configure.in: in comment, call AC_EXEEXT instead of AM_EXEEXT
+
+Sun Oct 11 17:36:06 1998 Michael Tiemann <tiemann@holodeck.cygnus.com>
+
+ * Makefile.in (cplus-dem.o, obstack.o): Depend upon config.h.
+
+Thu Oct 8 23:42:08 1998 Jeffrey A Law (law@cygnus.com)
+
+ * Merge egcs & devo libiberty.
+
+1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * cplus-dem.c (demangle_arm_pt): Demangle anonymous namespaces.
+
+Mon Sep 7 23:29:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * mkstemp.c: Include config.h even when not IN_GCC. Wrap header
+ inclusions inside HAVE_*_H macros. Include ansidecl.h when not
+ IN_GCC.
+
+ * vasprintf.c: Include stdarg.h/varargs.h first.
+
+ * vprintf.c: Likewise.
+
+Sat Sep 5 03:24:49 1998 Jeffrey A Law (law@cygnus.com)
+
+ * pexecute.c: Updates from gcc. Copy in gcc has been removed. This
+ is the canonical copy. Define ISSPACE if !IN_GCC.
+ * alloca.c, vfprintf.c, choose-temp.c, mkstemp.c, getopt.c: Similarly.
+ * getopt1.c, obstack.c: Similarly.
+ * Makefile.in: Build mkstemp.o
+
+Tue Sep 1 23:12:47 1998 Christopher Faylor <cgf@cygnus.com>
+
+ * configure.in: Include asprintf in list of functions known not
+ to be in newlib.
+ * configure: Rebuild.
+
+Wed Aug 19 14:05:01 1998 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * cplus-dem.c (work_stuff): Add dllimported.
+ (demangled_prefix): Mark symbols imported from PE DLL.
+ (internal_cplus_demangled): Handle.
+
+1998-08-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cplus-dem.c (do_type): Fix simple array handling. If we fail,
+ stay failed.
+
+Mon Aug 17 10:40:34 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cplus-dem.c: Include config.h if it exists. Also, only
+ prototype malloc/realloc if we can't get stdlib.h.
+
+Sat Aug 15 16:15:01 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Switch back to checking --with-target-subdir when
+ deciding whether to check for newlib, undoing part of July 15
+ change.
+ * configure: Rebuild.
+
+Thu Aug 13 16:47:38 1998 Mark Mitchell <mark@markmitchell.com>
+
+ * cplus-dem.c (type_kind_t): New type.
+ (demangle_template_value_parm): Add type_kind_t parameter. Rely
+ on this paramter, rather than demangling the type again.
+ (demangle_integral_value): Pass tk_integral.
+ (demangle_template_: Pass the value returned from do_type.
+ (do_type): Return a type_kind_t. Pass tk_integral to
+ demangle_template_value_parm for array bounds.
+ (demangle_fund_type): Likewise.
+
+ Also incorporate from GCC version:
+
+ Tue Jul 21 13:28:19 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays.
+
+Thu Aug 13 16:47:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cplus-dem.c (demangle_nested_args): Make function definition
+ static to match the prototype.
+
+Tue Jul 28 11:33:09 1998 Mark Mitchell <mark@markmitchell.com>
+
+ * cplus-dem.c (type_kind_t): New type.
+ (demangle_template_value_parm): Add type_kind_t parameter. Rely
+ on this paramter, rather than demangling the type again.
+ (demangle_integral_value): Pass tk_integral.
+ (demangle_template_: Pass the value returned from do_type.
+ (do_type): Return a type_kind_t. Pass tk_integral to
+ demangle_template_value_parm for array bounds.
+ (demangle_fund_type): Likewise.
+
+ Also incorporate from GCC version:
+
+ Tue Jul 21 13:28:19 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays.
+
+Mon Jul 27 12:16:08 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (ALLOCA): New variable.
+ ($(TARGETLIB)): Add $(ALLOCA) to library.
+ (needed-list): Add $(ALLOCA).
+ ($(ALLOCA)): Depend upon stamp-picdir.
+
+Sun Jul 19 08:23:17 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cplus-dem.c (demangle_nested_args): Make function definition
+ static to match the prototype.
+
+Wed Jul 15 00:12:58 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Check --with-cross-host rather than
+ --with-target-subdir when deciding whether build uses a cross
+ compiler, and when deciding where to install the library.
+ * configure: Rebuild.
+
+Sun Jul 12 01:27:05 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cplus-dem.c (demangle_nested_args): Return a value.
+
+Sat Jul 11 16:19:48 1998 Mark Mitchell <mark@markmitchell.com>
+
+ * cplus-dem.c (string): Move definition before work_stuff.
+ (work_stuff): Add volatile_type, forgetting_types,
+ previous_argument, and nrepeats fields.
+ (SCOPE_STRING): New macro.
+ (demangle_template): Add `remember' parameter. Add comment.
+ Register the `B' code type here, if remembering. Tidy. Fix crash
+ on NULL tmpl_argvec. Be consistent with use of tname/trawname.
+ (demangle_nested_args): New function.
+ (internal_cplus_demangle): Handle volatile-qualified member
+ functions.
+ (mop_up): Delete the previous_argument string if present.
+ (demangle_signature): Tidy. Handle volatile-qualified member
+ functions. Handle back-references using the `B' code. Use extra
+ parameter to demangle_template and SCOPE_STRING where appropriate.
+ (demangle_template_value_parm): Fix thinko; 'B' is not an integral
+ code.
+ (demangle_class): Use SCOPE_STRING.
+ (gnu_special): Pass additional argument to demangle_template.
+ Use SCOPE_STRING.
+ (demangle_qualified): Save qualified types for later
+ back-references. Handle constructors and destructors for template
+ types correctly.
+ (do_type): Tidy. Use SCOPE_STRING. Pass extra argument to
+ demangle_template. Use demangled_nested_args. Don't remember
+ qualified types here; that's now done in demangle_qualified.
+ Similarly for templates.
+ (do_arg): Improve commment. Handle 'n' repeat code.
+ (remember_type): Check forgetting_types.
+ (demangle_args): Deal with 'n' repeat codes. Tidy.
+
+Thu Jul 2 16:26:24 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * config.table: Only use mh-fbsd21 on *-*-freebsd2.2.[012], not on
+ *-*-freebsd2.2.*. From Dmitrij Tejblum <tejblum@arc.hq.cti.ru>.
+
+Mon Jun 15 16:29:01 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in (setobjs): Correct quoting error in cygwin32 case.
+ From Chris Faylor <cgf@cygnus.com>.
+
+Mon Jun 1 13:47:55 1998 Jason Molenda (crash@bugshack.cygnus.com)
+
+ * obstack.c: Update to latest FSF version.
+
+Mon Jun 1 14:17:36 1998 Mike Stump <mrs@wrs.com>
+
+ * Makefile.in: Add a dependency on stamp-picdir for the
+ objects, so that we can do a parallel build.
+
+Sat May 30 22:17:13 1998 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * configure.in (checkfuncs): Add missing "'".
+
+Fri May 29 12:40:41 1998 Jason Molenda (crash@bugshack.cygnus.com)
+
+ * obstack.c (_obstack_memory_used): Elide this function if we're
+ on a system with GNU libc.
+
+Tue May 26 18:28:43 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (distclean): Remove config.log.
+
+Tue May 26 15:01:52 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makefile.in (distclean): Don't remove alloca-conf.h.
+
+Fri May 22 01:38:07 1998 Hans-Peter Nilsson <hp@axis.se>
+
+ * cplus-dem.c (MBUF_SIZE): Bumped from 512 to 32767.
+
+1998-05-21 Mark Mitchell <mmitchell@usa.net>
+
+ * cplus-dem.c (do_type): Handle volatile qualification.
+
+1998-05-21 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * configure.in: Check for unistd.h as well.
+ * configure: Rebuild.
+ * config.in: Rebuild.
+ * getpagesize.c (GNU_OUR_PAGESIZE): Use sysconf only if _SC_PAGESIZE
+ is defined in unistd.h. Reformat conditional block for easier reading.
+
+ * config.table (shared): Default to no if ${enable_shared}
+ is unset or empty; this logic is used by the toplevel
+ configure scripts, too.
+
+Sat May 16 14:01:26 1998 Jeffrey A Law (law@cygnus.com)
+
+ * config.table: Add line to set enable_shared in the Makefile
+ as needed.
+
+Wed May 13 14:24:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cplus-dem.c (squangle_mop_up): Change return type to void.
+ (internal_cplus_demangle): Remove unused parameter `options'.
+ All callers changed.
+ (cplus_demangle_opname): Remove function wide variable `int i' and
+ replace with `size_t i' at each location where it is used.
+ (cplus_mangle_opname): change type of `i' from int to size_t.
+
+Wed May 13 13:39:38 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * alloca-conf.h: Include config.h. Check HAVE_ALLOCA_H rather
+ than sparc or sun.
+ * Makefile.in (argv.o): Depend upon config.h and alloca-conf.h.
+
+Fri May 8 00:23:51 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Set libiberty_topdir correctly when srcdir is
+ "." and with_target_subdir is not set.
+ * configure: Rebuild.
+
+Thu May 7 13:01:44 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Add *-*-mingw32* case.
+ * configure: Rebuild.
+
+Wed May 6 11:33:51 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * config.table: Never use a PIC file for *-*-cygwin32*.
+
+ * Makefile.in (config.status): Depend upon config.table.
+
+ * configure.in: On a cygwin32 host, always compile random, and
+ don't test for sys_siglist, strsignal, or psignal.
+ * configure: Rebuild.
+
+ * clock.c: Check HAVE_SYS_PARAM_H rather than NO_SYS_PARAM_H.
+ * getcwd.c: Likewise.
+ * getpagesize.c: Likewise.
+ * getruntime.c: Likewise.
+
+Tue May 5 18:08:32 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ Use autoconf tests rather than the old dummy.c test:
+ * configure.in: Add AC_ARG_WITH calls for --with-target-subdir and
+ --with-newlib. Add AC_CONFIG_HEADER. Use AC_REPLACE_FUNCS for
+ most functions. Add special cases to handle newlib and VxWorks.
+ Remove target_makefile_frag. Create stamp-h in AC_OUTPUT if
+ CONFIG_HEADERS is set. Only call config-ml.in in AC_OUTPUT if
+ CONFIG_FILES is set; set ac_file before calling it.
+ * config.table (arm-*-riscix*, *-*-cygwin32): Remove.
+ (*-*-hpux*, *-*-hiux*, *-*-irix4*, *-*-solaris2*): Remove.
+ (*-*-sysv4*, *-*-go32, *-*-vxworks5*, *-*-vxworks): Remove
+ (i[3456]-*-mingw32*): Remove.
+ * Makefile.in (ERRORS_CC, CONFIG_H, NEEDED_LIST): Remove.
+ (LIBOBJS): New variable.
+ (HOST_OFILES, DO_ALSO, STAGESTUFF): Remove.
+ (all): Depend upon needed-list. Don't check RULE1.
+ (@target_makefile_frag@): Remove.
+ (COMPILE.c): Include @DEFS@.
+ (HFILES): Add alloca-conf.h.
+ (REQUIRED_OFILES): Remove basename.o.
+ ($(TARGETLIB)): New target.
+ (stamp-needed, lneeded-list, needed.awk, stamp-config): Remove.
+ (lconfig.h, needed2.awk, dummy.o, errors): Remove.
+ (needed-list, config.h): Rewrite.
+ (RULE1, $(RULE1), RULE2, $(RULE2)): Remove.
+ (.always.): Remove.
+ (Makefile): Set CONFIG_FILES and CONFIG_HEADERS.
+ (stamp-h): New target.
+ (atexit.o, clock.o, getcwd.o, getpagesize.o): New targets.
+ (basename.o): Don't depend upon config.h.
+ (getruntime.o): Depend upon config.h.
+ * atexit.c: Include config.h. Check HAVE_ON_EXIT rather than
+ NEED_on_exit.
+ * basename.c: Don't include config.h. Don't check NEED_basename.
+ * clock.c: Include config.h.
+ * getcwd.c: Likewise.
+ * getpagesize.c: Likewise.
+ * getruntime.c: Likewise. Fix checks which set HAVE_GETRUSAGE and
+ HAVE_TIMES.
+ * strerror.c: Change uses of NEED_sys_errlist to
+ HAVE_SYS_ERRLIST. Likewise for NEED_strerror and HAVE_STRERROR.
+ * strsignal.c: Likewise for NEED_sys_siglist and HAVE_SYS_SIGLIST,
+ and for NEED_strsignal and HAVE_STRSIGNAL and for NEED_psignal and
+ HAVE_PSIGNAL.
+ * acconfig.h: New file.
+ * dummy.c: Remove.
+ * functions.def: Remove.
+ * config/mh-cxux7 (HDEFINES): Remove -DHAVE_SYSCONF.
+ * config/mh-windows (HDEFINES): Remove.
+ * config/mh-cygwin32: Remove.
+ * config/mh-go32: Remove.
+ * config/mh-irix4: Remove.
+ * config/mh-riscix: Remove.
+ * config/mh-sysv4: Remove.
+ * config/mt-mingw32: Remove.
+ * config/mt-vxworks5: Remove.
+ * config.in: New file, generated using autoheader.
+ * configure: Rebuild.
+
+Mon May 4 13:00:28 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Rewrite to use autoconf.
+ * configure: Generate using autoconf.
+ * config/mh-a68bsd: Remove.
+ * config/mh-apollo68: Remove.
+ * config/mh-hpbsd: Remove.
+ * config/mh-ncr3000: Remove.
+ * config/mh-sysv: Remove.
+ * config/mh-aix (RANLIB, INSTALL): Don't define.
+ * config/mh-cxux7 (RANLIB, INSTALL): Don't define.
+ * config/mh-irix4 (CC, RANLIB, INSTALL): Don't define.
+ * config/mh-sysv4 (RANLIB, INSTALL): Don't define.
+ * config.table: Change config_shell to CONFIG_SHELL, and use
+ libiberty_topdir to find move-if-change.
+ (m68k-apollo-bsd*, m68k-apollo-sysv*): Remove.
+ (i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove.
+ (*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove.
+ * Makefile.in (srcdir): Set to @srcdir@.
+ (VPATH): Likewise.
+ (prefix, exec_prefix, bindir, libdir): Set to autoconf variables.
+ (SHELL, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Likewise.
+ (CC, CFLAGS, RANLIB)): Likewise.
+ (datadir, man*dir, infodir, includedir, MAKEINFO): Remove.
+ (target_makefile_frag, host_makefile_frag): Add substitutions.
+ (INSTALL_DEST): Set to @INSTALL_DEST@.
+ (Makefile): Depend upon config.status. Don't depend upon
+ $(host_makefile_frag) or $(target_makefile_frag).
+ (config.status): New target.
+
+Sun May 3 17:58:49 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * config/mt-sunos4: Remove. Should be handled by --with-headers
+ and --with-libraries options at top level.
+ * config.table: Never use mt-sunos4.
+
+ * alloca-conf.h: New file, combining alloca-norm.h and
+ alloca-botch.h.
+ * alloca-norm.h: Remove.
+ * alloca-botch.h: Remove.
+ * configure.in: Set shell variables files and links to empty.
+ * config.table: Don't set shell variable files.
+ * configure.bat: Don't create alloca-conf.h.
+ * makefile.vms: Likewise.
+ * mpw-config.in: Likewise.
+ * vmsbuild.com: Likewise.
+
+Fri May 1 11:41:42 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in ($(HOST_OFILES) $(REQUIRED_OFILES)): Remove old
+ target depending upon config.h.
+ (alloca.o): Add target depending upon config.h
+ (basename.o, choose-temp.o, fnmatch.o): Likewise.
+ (getopt.o, getopt1.o, pexecute.o, strerror.o): Likewise.
+ (strsignal.o, xstrerror.o): Likewise.
+
+Fri May 1 04:26:25 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
+
+ * cplus-dem.c (cplus_demangle_opname): Initialize work.
+
+Mon Apr 27 15:53:30 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * cplus-dem.c (demangle_qualified): Replace missing else.
+
+Sun Apr 26 15:38:50 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * cplus-dem.c (gnu_special): Fix off-by-one bug when checking the
+ length in the name of a virtual table.
+
+Wed Apr 22 10:53:49 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * cplus-dem.c (struct work stuff): Add field for B and K mangle codes.
+ (cplus_demangle_opname): Call mop_up_squangle.
+ (cplus_demangle): Initialize squangle info, then call
+ internal_cplus_demangle. (Most code moved there as well)
+ (internal_cplus_demangle): New function, performs most of what use
+ to be done in cplus_demangle, but is only called with this file.
+ (squangle_mop_up): New function to clean up B and K code data.
+ (mop_up): set pointers to NULL after freeing.
+ (demangle_signature, demangle_template, demangle_class): Add
+ switch elements to handle K and B codes.
+ (demangle_prefix, gnu_special, demangle_qualified): Add
+ code to handle K and B codes.
+ (do_type, demangle_fund_type): Handle B and K codes.
+ (remember_Ktype): New function to store K info.
+ (register_Btype, remember_Btype): New functions for B codes.
+ (forget_B_and_K_types): New function to destroy B and K info.
+
+Fri Apr 10 01:49:10 1998 Jeffrey A Law (law@cygnus.com)
+
+ * COPYING.LIB, choose-temp.c, cplus-dem.c: Sync with egcs & gcc.
+
+Thu Mar 5 09:23:28 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * config.table: Make locating frag files failsafe even for the
+ special case if configuring and building in srcdir.
+
Mon Feb 23 14:33:15 1998 Ian Lance Taylor <ian@cygnus.com>
* choose-temp.c: Fix handling of sys/file.h to work in libiberty.
@@ -16,10 +1239,16 @@ Tue Feb 10 16:58:33 1998 Stan Shebs <shebs@andros.cygnus.com>
* cplus-dem.c (gnu_special): Don't get confused by .<digits>
strings that are not actually lengths.
+Fri Feb 6 01:35:17 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * Makefile.in (FLAGS_TO_PASS): Don't pass PICFLAG.
+ (.c.o): Check value of enable_shared, not PICFLAG.
+ (stamp-picdir): Dito.
+
Thu Feb 5 18:48:56 1998 Geoffrey Noer <noer@cygnus.com>
- * config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES
- since it gets built automatically
+ * config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES
+ since it gets built automatically
Sun Feb 1 02:52:32 1998 Mike Stump <mrs@wrs.com>
@@ -42,7 +1271,7 @@ Sun Jan 18 15:57:28 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
* vasprintf.c (int_vasprintf): Increase buffer size for float/double
values.
-Sat Jan 17 22:28:38 1997 Mumit Khan <khan@xraylith.wisc.edu>
+Sat Jan 17 22:28:38 1998 Mumit Khan <khan@xraylith.wisc.edu>
J.J. VanderHeijden <J.J.vanderHeijden@student.utwente.nl>
Add mingw32 support.
@@ -104,24 +1333,24 @@ Mon Sep 29 12:28:41 1997 Ian Lance Taylor <ian@cygnus.com>
Mon Sep 29 12:27:59 1997 Ian Lance Taylor <ian@cygnus.com>
- * pexecute.c: Use spawn if __CYGWIN32__.
+ * pexecute.c: Use spawn if __CYGWIN32__.
1997-08-08 Paul Eggert <eggert@twinsun.com>
- * pexecute.c: Include "config.h" first, as per autoconf manual.
+ * pexecute.c: Include "config.h" first, as per autoconf manual.
Fri Jun 27 15:20:29 1997 Scott Christley <scottc@net-community.com>
- * pexecute.c (fix_argv): New function.
- (pexecute): Win32 but not Cygwin32 needs its arguments fixed.
- Add underscore to cwait function call.
+ * pexecute.c (fix_argv): New function.
+ (pexecute): Win32 but not Cygwin32 needs its arguments fixed.
+ Add underscore to cwait function call.
Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net>
- * cplus-dem.c (demangle_template): Add new parameter. Handle new
- template-function mangling.
- (consume_count_with_underscores): New function.
- (demangle_signature): Handle new name-mangling scheme.
+ * cplus-dem.c (demangle_template): Add new parameter. Handle new
+ template-function mangling.
+ (consume_count_with_underscores): New function.
+ (demangle_signature): Handle new name-mangling scheme.
Wed Sep 24 00:31:59 1997 Felix Lee <flee@yin.cygnus.com>
@@ -161,10 +1390,10 @@ Tue Aug 19 17:10:56 1997 Jason Merrill <jason@yorick.cygnus.com>
Wed Jul 30 11:42:19 1997 Per Bothner <bothner@cygnus.com>
- * cplus-dem.c: Various changes to produce Java output when passed
+ * cplus-dem.c: Various changes to produce Java output when passed
DMGL_JAVA. Thus "::" becomes "." and "JArray<Foo>" becomes "Foo[]".
- (main): Support --java and -j flags to set DMGL_JAVA.
-
+ (main): Support --java and -j flags to set DMGL_JAVA.
+
Tue Jul 22 19:05:23 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
* config/mh-go32 (CC, AR, RANLIB): Don't define.
@@ -219,7 +1448,7 @@ Wed Apr 30 12:15:45 1997 Jason Merrill <jason@yorick.cygnus.com>
Mon Apr 28 19:04:31 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
- * obstack.c: move _obstack_memory_used outside of ifdef. Cannot be
+ * obstack.c: move _obstack_memory_used outside of ifdef. Cannot be
elided; needed by gdb and not present in libc.
Thu Apr 24 19:33:47 1997 Ian Lance Taylor <ian@cygnus.com>
@@ -228,7 +1457,7 @@ Thu Apr 24 19:33:47 1997 Ian Lance Taylor <ian@cygnus.com>
Tue Apr 22 10:25:15 1997 Fred Fish <fnf@cygnus.com>
- * floatformat.c (floatformat_ieee_double_littlebyte_bigword):
+ * floatformat.c (floatformat_ieee_double_littlebyte_bigword):
Add new floatformat, mainly for ARM doubles.
Mon Apr 14 12:11:16 1997 Ian Lance Taylor <ian@cygnus.com>
@@ -285,7 +1514,7 @@ Sat Mar 15 18:49:41 1997 Ian Lance Taylor <ian@cygnus.com>
Fri Mar 14 14:18:47 1997 Ian Lance Taylor <ian@cygnus.com>
- * cplus-dem.c: Add prototypes for all static functions.
+ * cplus-dem.c: Add prototypes for all static functions.
(mystrstr): Make static. Make arguments and result const.
(cplus_match): Remove; not used.
@@ -356,13 +1585,13 @@ Mon Nov 18 14:08:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
Wed Nov 13 08:22:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
- * cplus-dem.c: Revert last two commits due to conflicts with
- hpux system headers.
+ * cplus-dem.c: Revert last two commits due to conflicts with
+ hpux system headers.
Wed Nov 13 08:22:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
* alloca.c, argv.c, spaces.c, strcasecmp.c, vasprintf.c, vprintf.c:
- Revert last commit due to conflicts with hpux system headers.
+ Revert last commit due to conflicts with hpux system headers.
Wed Nov 13 10:36:50 1996 Michael Meissner <meissner@tiktok.cygnus.com>
@@ -371,16 +1600,16 @@ Wed Nov 13 10:36:50 1996 Michael Meissner <meissner@tiktok.cygnus.com>
Tue Nov 12 16:31:00 1996 Dawn Perchik <dawn@critters.cygnus.com>
- * alloca.c: Include libiberty.h for definition of xmalloc.
+ * alloca.c: Include libiberty.h for definition of xmalloc.
Don't redefine NULL.
* argv.c: Move prototypes to libiberty.h.
- * cplus-dem.c: Include libiberty.h for definition of xmalloc.
+ * cplus-dem.c: Include libiberty.h for definition of xmalloc.
Don't redefine NULL.
Use casts to eliminate compiler warnings.
- * spaces.c: Remove prototypes for malloc and free which are
+ * spaces.c: Remove prototypes for malloc and free which are
already in libibrty.h.
* strcasecmp.c: Use casts to eliminate compiler warnings.
- * vasprintf.c: Include libiberty.h for definition of malloc.
+ * vasprintf.c: Include libiberty.h for definition of malloc.
Don't redefine NULL.
* vprintf.c: Include stdarg.h if __STDC__.
@@ -499,7 +1728,7 @@ Tue Jun 25 23:01:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
Tue Jun 25 22:50:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
- * Makefile.in (datadir): Set to $(prefix)/share.
+ * Makefile.in (datadir): Set to $(prefix)/share.
Thu Jun 20 21:17:52 1996 Ian Lance Taylor <ian@cygnus.com>
@@ -545,7 +1774,7 @@ Wed Apr 17 11:17:55 1996 Doug Evans <dje@canuck.cygnus.com>
Tue Apr 16 11:27:16 1996 Jeffrey A Law (law@cygnus.com)
- * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o.
+ * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o.
Reverts Feb 8, 1995 change.
Mon Apr 15 12:53:26 1996 Doug Evans <dje@canuck.cygnus.com>
@@ -591,7 +1820,7 @@ Tue Feb 27 12:00:50 1996 Raymond Jou <rjou@mexican.cygnus.com>
* mpw.c (mpwify_filename): Change 6 to 5 in
strncmp (unixname, "/tmp/", 5).
-
+
Tue Feb 20 10:55:53 1996 Ian Lance Taylor <ian@cygnus.com>
* cplus-dem.c (demangle_template): Initialize is_bool. Correctly
@@ -799,7 +2028,7 @@ Wed Jun 28 19:13:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* cplus-dem.c: Update from gcc.
* argv.c, dummy.c: If __STDC__, #include "alloca-conf.h" after
- <stddef.h>.
+ <stddef.h>.
* alloca-norm.h: If __STDC__, declare alloca with its parameter.
Thu Jun 22 18:57:47 1995 Stan Shebs <shebs@andros.cygnus.com>
@@ -892,17 +2121,17 @@ Mon May 15 19:53:17 1995 Per Bothner <bothner@kalessin.cygnus.com>
Thu May 4 14:36:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* cplus-dem.c: Use const instead of CONST. Don't include
- ansidecl.h directly.
+ ansidecl.h directly.
Wed Apr 19 01:30:27 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* cplus-dem.c: Don't include libiberty.h. Do declare xmalloc and
- xrealloc.
+ xrealloc.
(-DMAIN): Don't rely on an externally-defined version number;
- instead, require the version number to be defined as a
- preprocessor macro. Handle the RS/6000 leading dot. Define
- xmalloc, xrealloc and fatal. Don't strip a leading underscore
- if we couldn't demangle the word.
+ instead, require the version number to be defined as a
+ preprocessor macro. Handle the RS/6000 leading dot. Define
+ xmalloc, xrealloc and fatal. Don't strip a leading underscore
+ if we couldn't demangle the word.
Tue Apr 4 13:03:51 1995 Stan Shebs <shebs@andros.cygnus.com>
@@ -1076,7 +2305,7 @@ Fri Aug 19 15:29:12 1994 Kung Hsu (kung@mexican.cygnus.com)
Thu Aug 18 14:37:14 1994 Kung Hsu (kung@mexican.cygnus.com)
* cplus-dem.c (demangle args): Handle ARM repeat encoding where
- the type index is greater than 9.
+ the type index is greater than 9.
Wed Aug 17 16:13:49 1994 Kung Hsu (kung@mexican.cygnus.com)
@@ -1091,9 +2320,9 @@ Wed Aug 3 05:52:14 1994 D. V. Henkel-Wallace (gumby@cygnus.com)
newlib; includes and such don't belong to us). This is specific
to the Cygnus Support environment.
-Tue Aug 2 15:25:12 1994 Kung Hsu (kung@mexican.cygnus.com)
+Tue Aug 2 15:25:12 1994 Kung Hsu (kung@mexican.cygnus.com)
- * cplus-dem.c (demangle_template): demangle as xxx<'Q'> not
+ * cplus-dem.c (demangle_template): demangle as xxx<'Q'> not
xxx<ch=81>.
Mon Aug 1 17:02:48 1994 Kung Hsu (kung@mexican.cygnus.com)
@@ -1138,7 +2367,7 @@ Thu Jun 16 17:54:01 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Sun Jun 12 01:37:09 1994 Jason Merrill (jason@deneb.cygnus.com)
* cplus-dem.c (demangle_template): Separate consecutive >'s with a
- space.
+ space.
(gnu_special): Demangle template and qualified names in a vtable name.
Fri May 27 12:27:52 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
@@ -1173,7 +2402,7 @@ Fri May 13 16:20:28 1994 Jason Merrill (jason@deneb.cygnus.com)
Fri May 6 14:44:21 1994 Steve Chamberlain (sac@cygnus.com)
- * config.table: Add go32
+ * config.table: Add go32
* config/mh-go32: New template.
Fri May 6 11:01:59 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com)
@@ -1182,13 +2411,13 @@ Fri May 6 11:01:59 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com)
Mon Apr 11 00:54:33 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu)
- * getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]:
- Declare strlen to return int. Don't include stddef.h.
+ * getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]:
+ Declare strlen to return int. Don't include stddef.h.
Fri Apr 1 00:38:17 1994 Jim Wilson (wilson@mole.gnu.ai.mit.edu)
- * getopt.c: Delete use of IN_GCC to control whether
- stddef.h or gstddef.h is included.
+ * getopt.c: Delete use of IN_GCC to control whether
+ stddef.h or gstddef.h is included.
Thu Apr 14 14:00:56 1994 Kung Hsu (kung@mexican.cygnus.com)
@@ -1252,8 +2481,8 @@ Sun Feb 27 21:50:11 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
Thu Feb 24 11:51:12 1994 David J. Mackenzie (djm@rtl.cygnus.com)
* getopt.c: Remove #ifdef GETOPT_COMPAT and #if 0 code.
- (_getopt_initialize): New function, broken out of _getopt_internal.
- (_getopt_internal):
+ (_getopt_initialize): New function, broken out of _getopt_internal.
+ (_getopt_internal):
If long_only and the ARGV-element has the form "-f", where f is
a valid short option, don't consider it an abbreviated form of
a long option that starts with f. Otherwise there would be no
@@ -1261,27 +2490,27 @@ Thu Feb 24 11:51:12 1994 David J. Mackenzie (djm@rtl.cygnus.com)
Thu Feb 10 14:44:16 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu)
- * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]:
- Test just __STDC__, not emacs.
+ * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]:
+ Test just __STDC__, not emacs.
Wed Feb 9 00:14:00 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu)
- * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]
- [emacs] [not __STDC__]: Don't include stddef.h. Don't declare strlen.
+ * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]
+ [emacs] [not __STDC__]: Don't include stddef.h. Don't declare strlen.
Fri Dec 24 19:43:00 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu)
- * getopt.c (_NO_PROTO): Define before config.h is included.
+ * getopt.c (_NO_PROTO): Define before config.h is included.
Mon Sep 20 15:59:03 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
- * getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include
+ * getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include
<config.h> only under these, else "config.h".
Thu Aug 12 18:16:49 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
- * getopt.c, getopt1.c [HAVE_CONFIG_H]: Include
- <config.h> instead of "config.h".
+ * getopt.c, getopt1.c [HAVE_CONFIG_H]: Include
+ <config.h> instead of "config.h".
Sun Feb 20 17:17:01 1994 Ian Lance Taylor (ian@lisa.cygnus.com)
@@ -1585,7 +2814,7 @@ Fri Aug 6 17:03:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* obstack.c, alloca.c: Update from FSF.
* getopt.c, getopt1.c: Update to current FSF version, which
- doesn't use alloca.
+ doesn't use alloca.
Tue Jul 27 14:03:57 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
@@ -1657,7 +2886,7 @@ Fri May 21 09:53:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
Tue May 18 17:12:10 1993 Fred Fish (fnf@cygnus.com)
- (merge changes from dlong@cse.ucsc.edu)
+ (merge changes from dlong@cse.ucsc.edu)
* cplus-dem.c (consume_count): Simplify.
* cplus-dem.c (arm_pt, demangle_class_name): New functions.
* cplus-dem.c (various): Calls to arm_pt, demangle_class_name.
@@ -2228,7 +3457,7 @@ Wed Dec 11 17:40:39 1991 Steve Chamberlain (sac at rtl.cygnus.com)
* msdos.c: stub functions for dos.
* makefile.dos, configdj.bat: new.
* getopt.c: Don't include alloca-conf.h in a GO32 world.
-
+
Tue Dec 10 04:14:49 1991 K. Richard Pixley (rich at rtl.cygnus.com)
diff --git a/contrib/binutils/libiberty/Makefile.in b/contrib/binutils/libiberty/Makefile.in
index 58fabd5..9aa57f0 100644
--- a/contrib/binutils/libiberty/Makefile.in
+++ b/contrib/binutils/libiberty/Makefile.in
@@ -1,6 +1,7 @@
#
# Makefile
-# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation
+# Copyright (C) 1990, 91 - 99, 2000
+# Free Software Foundation
#
# This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or
@@ -19,37 +20,22 @@
# Boston, MA 02111-1307, USA.
#
-# This file was written, and is maintained by K. Richard Pixley
-# <rich@cygnus.com>.
+# This file was written by K. Richard Pixley <rich@cygnus.com>.
#
# Makefile for libiberty directory
#
-srcdir = .
+srcdir = @srcdir@
+VPATH = @srcdir@
-prefix = /usr/local
+prefix = @prefix@
-exec_prefix = $(prefix)
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
-datadir = $(prefix)/share
-
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-man9dir = $(mandir)/man9
-infodir = $(prefix)/info
-includedir = $(prefix)/include
-
-SHELL = /bin/sh
+SHELL = @SHELL@
# Multilib support variables.
MULTISRCTOP =
@@ -59,19 +45,17 @@ MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
-INSTALL = $(SHELL) $(srcdir)/../install-sh -c
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL)
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
-AR = ar
+AR = @AR@
AR_FLAGS = rc
-ERRORS_CC = $(CC)
-CC = cc
-CFLAGS = -g
+CC = @CC@
+CFLAGS = @CFLAGS@
LIBCFLAGS = $(CFLAGS)
-MAKEINFO = makeinfo
-RANLIB = ranlib
+RANLIB = @RANLIB@
PICFLAG =
@@ -79,19 +63,8 @@ MAKEOVERRIDES =
TARGETLIB = libiberty.a
-CONFIG_H = lconfig.h
-NEEDED_LIST = lneeded-list
-
-# HOST_OFILES contains the list of objects that should be in the
-# library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
-# A configuration may override this with a fixed list a object files
-# names (hard to maintain), or some other way to generate a list.
-HOST_OFILES=`cat needed-list`
-
-# Extra targets that the top-level target depends on.
-# Specifically, what needs to be made before HOST_OFILES can be used.
-# Can be empty if HOST_OFILES is just a list of file names.
-DO_ALSO = needed-list
+LIBOBJS = @LIBOBJS@
+ALLOCA = @ALLOCA@
# A configuration can specify extra .o files that should be included,
# even if they are in libc. (Perhaps the libc version is buggy.)
@@ -111,174 +84,115 @@ FLAGS_TO_PASS = \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"LDFLAGS=$(LDFLAGS)" \
"LOADLIBES=$(LOADLIBES)" \
- "PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
- "SHELL=$(SHELL)"
+ "SHELL=$(SHELL)" \
+ "prefix=$(prefix)" \
+ "exec_prefix=$(exec_prefix)" \
+ "libdir=$(libdir)" \
+ "libsubdir=$(libsubdir)" \
+ "tooldir=$(tooldir)"
-all: stamp-picdir $(TARGETLIB) required-list
- @if [ "$(RULE1)" != "not-used" ]; then \
- $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
- else true; \
- fi
+# Subdirectories to recurse into. We need to override this during cleaning
+SUBDIRS = testsuite
-.PHONY: check installcheck
-check installcheck:
+all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
+ @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
+.PHONY: check installcheck
+check: check-subdir
+installcheck: installcheck-subdir
-#### Host, target, and site specific Makefile fragments come in here.
-###
+@host_makefile_frag@
INCDIR=$(srcdir)/$(MULTISRCTOP)../include
-COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
+COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
.c.o:
- test -z "$(PICFLAG)" || \
+ test x"$(enable_shared)" != xyes || \
$(COMPILE.c) $(PICFLAG) $< -o pic/$@
$(COMPILE.c) $<
-# The default target just invokes make recursively.
-# However, the automatic configuration (in config/mh_default).
-# first causes it to figure out the objects missing in libc.
-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 =
+HFILES = alloca-conf.h
# NOTE: If you add new files to the library, add them to this list
-# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
-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 memcmp.c memcpy.c memmove.c memset.c objalloc.c \
- obstack.c pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.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
-# These are always included in the library.
-REQUIRED_OFILES = argv.o basename.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 strerror.o \
- strsignal.o xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o
-
-# Do we want/need any config overrides?
-#
+# (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 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 \
+ partition.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 xmemdup.c xstrdup.c xstrerror.c
-STAGESTUFF = $(TARGETLIB) *.o
+# 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 getpwd.o getruntime.o hashtab.o \
+ hex.o floatformat.o objalloc.o obstack.o partition.o pexecute.o spaces.o \
+ splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \
+ xmemdup.o xstrdup.o xstrerror.o
+
+$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
+ rm -f $(TARGETLIB)
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
+ $(RANLIB) $(TARGETLIB)
-INSTALL_DEST = libdir
-install: install_to_$(INSTALL_DEST)
+INSTALL_DEST = @INSTALL_DEST@
+install: install_to_$(INSTALL_DEST) install-subdir
install_to_libdir: all
- $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n
- ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
- mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
+ $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
+ ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
+ mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
install_to_tooldir: all
- $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n
- ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n )
- mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
+ $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
+ ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
+ mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
-# The default configuration adds to libiberty all those functions that are
-# missing in libc. More precisely, it includes whatever $(CC) fails to find.
-# Then a sed+awk combination translates the ld error messages into
-# a list of .o files.
-
-stamp-needed: stamp-picdir $(NEEDED_LIST)
- cp $(NEEDED_LIST) needed-tmp
- $(SHELL) $(srcdir)/$(MULTISRCTOP)../move-if-change needed-tmp needed-list
- touch stamp-needed
-
-needed-list: stamp-needed ; @true
-
-lneeded-list: $(EXTRA_OFILES) needed.awk errors
- rm -f lneeded-list
- f=""; \
- for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
- case " $$f " in \
- *" $$i "*) ;; \
- *) f="$$f $$i" ;; \
- esac ; \
- done ; \
- case $$f in \
- *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \
- esac ; \
- echo $$f >>lneeded-list
-
-# Generate an awk script that looks for functions in functions.def
-
-needed.awk: $(srcdir)/functions.def Makefile
- echo "# !Automatically generated from $(srcdir)/functions.def"\
- "- DO NOT EDIT!" >needed.awk
- grep '^DEF(' < $(srcdir)/functions.def \
- | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
- >>needed.awk
-
-stamp-config: $(CONFIG_H)
- cp $(CONFIG_H) config.tmp
- $(SHELL) $(srcdir)/$(MULTISRCTOP)../move-if-change config.tmp config.h
- touch stamp-config
-
-config.h: stamp-config ; @true
-
-lconfig.h: needed2.awk errors
- echo "/* !Automatically generated from $(srcdir)/functions.def"\
- "- DO NOT EDIT! */" >lconfig.h
- awk -f needed2.awk <errors >>lconfig.h
-
-# Generate an awk script that looks for variables in functions.def
-
-needed2.awk: $(srcdir)/functions.def Makefile
- echo "# !Automatically generated from $(srcdir)/functions.def"\
- "- DO NOT EDIT!" >needed2.awk
- grep '^DEFVAR(' < $(srcdir)/functions.def \
- | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
- >>needed2.awk
- grep '^DEFFUNC(' < $(srcdir)/functions.def \
- | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
- >>needed2.awk
-
-dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
- $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null
-
-errors: dummy.o $(EXTRA_OFILES)
- -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
-
-# required-list is used when building a shared bfd/opcodes/libiberty library.
+# 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
+ 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.
required-list: Makefile
echo $(REQUIRED_OFILES) > required-list
-$(HOST_OFILES) $(REQUIRED_OFILES) : config.h
-
-RULE1 = $(TARGETLIB)
-$(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
- @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
- "HOST_OFILES=$(HOST_OFILES)"
-
-# Rule invoked by recursive make in $(RULE1).
-RULE2 = not-used
-$(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
- rm -rf $(TARGETLIB)
- $(AR) $(AR_FLAGS) $(TARGETLIB) \
- $(REQUIRED_OFILES) $(HOST_OFILES)
- $(RANLIB) $(TARGETLIB)
-
stamp-picdir:
- if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
+ if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \
mkdir pic; \
else true; fi
touch stamp-picdir
-.always.:
-# Do nothing.
-
-.PHONY: all etags tags ls clean stage1 stage2 .always.
+.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`
@@ -294,43 +208,81 @@ 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 alloca-conf.h xhost-mkfrag TAGS multilib.out
-maintainer-clean realclean: distclean
+ rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
+ rm -f config.log
+maintainer-clean realclean: maintainer-clean-subdir
+ $(MAKE) SUBDIRS="" distclean
force:
-Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
- $(SHELL) ./config.status
+Makefile: $(srcdir)/Makefile.in config.status
+ CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
+
+config.h: stamp-h ; @true
+stamp-h: config.in config.status
+ CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./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
-argv.o: $(INCDIR)/libiberty.h
+alloca.o: config.h
+atexit.o: config.h
+argv.o: config.h alloca-conf.h $(INCDIR)/libiberty.h
basename.o: $(INCDIR)/libiberty.h
+choose-temp.o: config.h
+clock.o: config.h
concat.o: $(INCDIR)/libiberty.h
-cplus-dem.o: $(INCDIR)/demangle.h
+cplus-dem.o: config.h $(INCDIR)/demangle.h
fdmatch.o: $(INCDIR)/libiberty.h
-fnmatch.o: $(INCDIR)/fnmatch.h
-getopt.o: $(INCDIR)/getopt.h
-getopt1.o: $(INCDIR)/getopt.h
-getruntime.o: $(INCDIR)/libiberty.h
+fnmatch.o: config.h $(INCDIR)/fnmatch.h
+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
+mkstemps.o: config.h
objalloc.o: $(INCDIR)/objalloc.h
-obstack.o: $(INCDIR)/obstack.h
-pexecute.o: $(INCDIR)/libiberty.h
+obstack.o: config.h $(INCDIR)/obstack.h
+partition.o: config.h $(INCDIR)/partition.h
+pexecute.o: config.h $(INCDIR)/libiberty.h
+setenv.o: config.h
spaces.o: $(INCDIR)/libiberty.h
-strerror.o: $(INCDIR)/libiberty.h
-strsignal.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
+strsignal.o: config.h $(INCDIR)/libiberty.h
xatexit.o: $(INCDIR)/libiberty.h
xexit.o: $(INCDIR)/libiberty.h
xmalloc.o: $(INCDIR)/libiberty.h
-xstrdup.o: $(INCDIR)/libiberty.h
-xstrerror.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/contrib/binutils/libiberty/README b/contrib/binutils/libiberty/README
index 92dc202..9f5226a 100644
--- a/contrib/binutils/libiberty/README
+++ b/contrib/binutils/libiberty/README
@@ -27,62 +27,29 @@ that are "optional" will be included in the library only if "needed."
To add a new required file, edit Makefile to add the source file
name to CFILES and the object file to REQUIRED_OFILES.
-Adding a new optional file is more fragile. As a general rule,
-an optional file will be included in the library if it provides
-functionality missing in the "standard" C library.
-For most hosts, the Makefile automatically figures out which
-functionality is missing by compiling and linking a dummy test
-program, and examining the error messages.
-
-So to get this to work, you should do the following:
-
-1) Select one function defined in the file you're adding.
-For example, the getcwd function.
-2) Add that function to the list in the file functions.def.
-3) The name of the new file must be the same as the function
-you've chosen with the .c suffix added. E.g. getcwd() must be
-defined in getcwd.c. (The file can define other functions as well.)
-4) In Makefile.in, add the name of the source file (e.g. getcwd.c)
-to CFILES.
-
-The file you've added (e.g. getcwd.c) should compile and work
-on all hosts where it is needed (e.g. not found when linking
-the dummy.c program). It does not have to work or even
-compile on hosts where it is not needed.
+To add a new optional file, it must provide a single function, and the
+name of the function must be the same as the name of the file.
+
+ * Add the source file name to CFILES.
+
+ * Add the function to name to the funcs shell variable in
+ configure.in.
-HOW THE AUTOMATIC CONFIGURATION WORKS
-=====================================
-
-The libiberty.a target (in RULE1) depends on $(DO_ALSO).
-For normal configurations, DO_ALSO=needed-list.
-
-So needed-list is first made. The needed-list rule compiles
-dummy.c. Because dummy.c includes functions.def, the
-resulting object file will contain a call to each of the
-optional functions (for simplicity assume each optional file
-defines a single function). This object file will be linked
-against the standard libraries (as defined by using $(CC)
-and various flags). Any function missing will causes the
-linker to emit an error message. We assume the name
-of the missing function(s) are in the error message(s).
-The awk script find-needed.awk has been generated from
-functions.def. It is used to search the linker output
-messages for words that match the functions listed in
-functions.def. The list of functions found is written
-on a single line to the file needed-list.
-
-After needed-list has been generated, the libiberty.a
-target (in RULE1) just calls 'make' recursively.
-It passes the contents of needed-list using the
-definition (expanded) HOST_OFILES="`cat needed-list`".
-It also tells the inferior 'make' to use RULE2.
-
-The inferior 'make' is very conventional: The main
-rule is $(RULE2) (which is libiberty.a). It depends
-on a list of object files: $(REQUIRED_OFILES) $(HOST_OFILES)
-(and $(EXTRA_OFILES), which is usually empty). The superior
-'make' passes in $(HOST_OFILES); the others are fixed
-in the Makefile.
+ * Add the function to the AC_CHECK_FUNCS lists just after the
+ setting of the funcs shell variable. These AC_CHECK_FUNCS calls
+ are never executed; they are there to make autoheader work
+ better.
+
+ * Consider the special cases of building libiberty; as of this
+ writing, the special cases are newlib and VxWorks. If a
+ particular special case provides the function, you do not need
+ to do anything. If it does not provide the function, add the
+ object file to LIBOBJS, and add the function name to the case
+ controlling whether to define HAVE_func.
+
+The optional file you've added (e.g. getcwd.c) should compile and work
+on all hosts where it is needed. It does not have to work or even
+compile on hosts where it is not needed.
ADDING A NEW CONFIGURATION
==========================
@@ -95,34 +62,4 @@ If the fully automatic scheme doesn't work, you may be able to get
by with defining EXTRA_OFILES in your Makefile stub. This is
a list of object file names that should be treated as required
for this configuration - they will be included in libiberty.a,
-regardless of whatever might be in the C library. Moreover,
-when the dummy.c program is linked, it will be linked with
-$(EXTRA_OFILES). Therefore, if a function in functions.def
-is defined by one of the EXTRA_OFILES, it will not be listed as
-"needed". Thus if your hal9000 host needs a special implementation
-of getcwd, you can just create hal9000-getcwd.c, and define:
- EXTRA_OFILES=hal9000-getcwd.o
-Or if you want to use the libiberty version of strstr(),
-even though there is a version in the C library (it might be
-buggy or slow), just define:
- EXTRA_OFILES=strstr.o
-
-You can create a "manual" host configuration FOO with a file
-config/mh-FOO. In it, the HOST_OFILES macro should explicitly
-list that subset of the optional files that should be in the
-library. You should also set:
- DO_ALSO =
-This overrides all of the magic needed to automatically
-determine which files are "needed." However, keeping that list
-up to date is another matter...
-
-HOW THE MANUAL CONFIGURATION WORKS
-==================================
-
-This also uses a recursive make, but the superior make
-does not do anything interesting - it just calls the
-inferior make with HOST_OFILES defined as $(HOST_OFILES),
-which is the list you created in your configuration.
-
-You probably don't want to depend on manual configuration,
-because keeping the HOST_OFILES list up-to-date will be a pain.
+regardless of whatever might be in the C library.
diff --git a/contrib/binutils/libiberty/acconfig.h b/contrib/binutils/libiberty/acconfig.h
new file mode 100644
index 0000000..f7c599d
--- /dev/null
+++ b/contrib/binutils/libiberty/acconfig.h
@@ -0,0 +1,11 @@
+/* Define if you have the sys_errlist variable. */
+#undef HAVE_SYS_ERRLIST
+
+/* Define if you have the sys_nerr variable. */
+#undef HAVE_SYS_NERR
+
+/* Define if you have the sys_siglist variable. */
+#undef HAVE_SYS_SIGLIST
+
+/* Define if you have the strerror function. */
+#undef HAVE_STRERROR
diff --git a/contrib/binutils/libiberty/alloca-conf.h b/contrib/binutils/libiberty/alloca-conf.h
new file mode 100644
index 0000000..9c3eea3
--- /dev/null
+++ b/contrib/binutils/libiberty/alloca-conf.h
@@ -0,0 +1,24 @@
+#include "config.h"
+
+#if defined(__GNUC__) && !defined(C_ALLOCA)
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+#else /* ! defined (__GNUC__) */
+# ifdef _AIX
+ #pragma alloca
+# else
+# if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
+# include <alloca.h>
+# else /* ! defined (HAVE_ALLOCA_H) */
+# ifdef __STDC__
+extern PTR alloca (size_t);
+# else /* ! defined (__STDC__) */
+extern PTR alloca ();
+# endif /* ! defined (__STDC__) */
+# endif /* ! defined (HAVE_ALLOCA_H) */
+# ifdef _WIN32
+# include <malloc.h>
+# endif
+# endif /* ! defined (_AIX) */
+#endif /* ! defined (__GNUC__) */
diff --git a/contrib/binutils/libiberty/alloca.c b/contrib/binutils/libiberty/alloca.c
index 911d42f..0f8a215 100644
--- a/contrib/binutils/libiberty/alloca.c
+++ b/contrib/binutils/libiberty/alloca.c
@@ -22,10 +22,26 @@
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-/* If compiling with GCC, this file's not needed. */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef emacs
+#include "blockinput.h"
+#endif
+
+/* If compiling with GCC 2, this file's not needed. Except of course if
+ the C alloca is explicitly requested. */
+#if defined (USE_C_ALLOCA) || !defined (__GNUC__) || __GNUC__ < 2
+
+/* If someone has defined alloca as a macro,
+ there must be some other way alloca is supposed to work. */
#ifndef alloca
#ifdef emacs
@@ -53,11 +69,9 @@ long i00afunc ();
#endif
#if __STDC__
-#include <stddef.h>
typedef void *pointer;
#else
typedef char *pointer;
-typedef unsigned size_t;
#endif
#ifndef NULL
@@ -76,8 +90,8 @@ typedef unsigned size_t;
#ifndef emacs
#define malloc xmalloc
-extern pointer xmalloc ();
#endif
+extern pointer malloc ();
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
@@ -156,7 +170,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
pointer
alloca (size)
- size_t size;
+ unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
@@ -167,11 +181,15 @@ alloca (size)
#endif
/* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
+ was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
+#ifdef emacs
+ BLOCK_INPUT;
+#endif
+
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
@@ -186,6 +204,10 @@ alloca (size)
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
+
+#ifdef emacs
+ UNBLOCK_INPUT;
+#endif
}
if (size == 0)
@@ -197,6 +219,9 @@ alloca (size)
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
+ if (new == 0)
+ abort();
+
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
@@ -326,7 +351,7 @@ struct stk_trailer
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
+ I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
@@ -477,3 +502,4 @@ i00afunc (long address)
#endif /* CRAY */
#endif /* no alloca */
+#endif /* not GCC version 2 */
diff --git a/contrib/binutils/libiberty/argv.c b/contrib/binutils/libiberty/argv.c
index 824a029..f596ffd 100644
--- a/contrib/binutils/libiberty/argv.c
+++ b/contrib/binutils/libiberty/argv.c
@@ -35,12 +35,8 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stddef.h>
-extern void *memcpy (void *s1, const void *s2, size_t n); /* 4.11.2.1 */
-extern size_t strlen (const char *s); /* 4.11.6.3 */
-extern void *malloc (size_t size); /* 4.10.3.3 */
-extern void *realloc (void *ptr, size_t size); /* 4.10.3.4 */
-extern void free (void *ptr); /* 4.10.3.2 */
-extern char *strdup (const char *s); /* Non-ANSI */
+#include <string.h>
+#include <stdlib.h>
#else /* !__STDC__ */
@@ -82,7 +78,7 @@ SYNOPSIS
DESCRIPTION
Duplicate an argument vector. Simply scans through the
- vector, duplicating each argument argument until the
+ vector, duplicating each argument until the
terminating NULL is found.
RETURNS
@@ -225,7 +221,7 @@ char *input;
if (input != NULL)
{
- copybuf = alloca (strlen (input) + 1);
+ copybuf = (char *) alloca (strlen (input) + 1);
/* Is a do{}while to always execute the loop once. Always return an
argv, even for null strings. See NOTES above, test case below. */
do
diff --git a/contrib/binutils/libiberty/atexit.c b/contrib/binutils/libiberty/atexit.c
index 4463cb6..137d985 100644
--- a/contrib/binutils/libiberty/atexit.c
+++ b/contrib/binutils/libiberty/atexit.c
@@ -1,7 +1,10 @@
/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
/* This function is in the public domain. --Mike Stump. */
-#ifndef NEED_on_exit
+#include "config.h"
+
+#ifdef HAVE_ON_EXIT
+
int
atexit(f)
void (*f)();
@@ -11,4 +14,5 @@ atexit(f)
on_exit (f, 0);
return 0;
}
+
#endif
diff --git a/contrib/binutils/libiberty/basename.c b/contrib/binutils/libiberty/basename.c
index 689b0c2..7698f06 100644
--- a/contrib/binutils/libiberty/basename.c
+++ b/contrib/binutils/libiberty/basename.c
@@ -14,30 +14,53 @@ DESCRIPTION
last component of the pathname ("ls.c" in this case).
BUGS
- Presumes a UNIX style path with UNIX style separators.
+ Presumes a UNIX or DOS/Windows style path with UNIX or DOS/Windows
+ style separators.
*/
#include "ansidecl.h"
#include "libiberty.h"
+#include <ctype.h>
-#include "config.h"
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#ifndef DIR_SEPARATOR_2
+#define DIR_SEPARATOR_2 '\\'
+#endif
+#endif
-#ifdef NEED_basename
+/* Define IS_DIR_SEPARATOR. */
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
char *
basename (name)
const char *name;
{
- const char *base = name;
+ const char *base;
- while (*name)
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha (name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
{
- if (*name++ == '/')
+ if (IS_DIR_SEPARATOR (*name))
{
- base = name;
+ base = name + 1;
}
}
return (char *) base;
}
-#endif
diff --git a/contrib/binutils/libiberty/calloc.c b/contrib/binutils/libiberty/calloc.c
new file mode 100644
index 0000000..334b18d
--- /dev/null
+++ b/contrib/binutils/libiberty/calloc.c
@@ -0,0 +1,29 @@
+/* calloc -- allocate memory which has been initialized to zero.
+ This function is in the public domain. */
+
+#include "ansidecl.h"
+#include "libiberty.h"
+
+#ifdef ANSI_PROTOTYPES
+#include <stddef.h>
+#else
+#define size_t unsigned long
+#endif
+
+/* For systems with larger pointers than ints, this must be declared. */
+PTR malloc PARAMS ((size_t));
+
+PTR
+calloc (nelem, elsize)
+ size_t nelem, elsize;
+{
+ register PTR ptr;
+
+ if (nelem == 0 || elsize == 0)
+ nelem = elsize = 1;
+
+ ptr = malloc (nelem * elsize);
+ if (ptr) bzero (ptr, nelem * elsize);
+
+ return ptr;
+}
diff --git a/contrib/binutils/libiberty/choose-temp.c b/contrib/binutils/libiberty/choose-temp.c
index 5668f74..826d818 100644
--- a/contrib/binutils/libiberty/choose-temp.c
+++ b/contrib/binutils/libiberty/choose-temp.c
@@ -17,22 +17,24 @@ License along with libiberty; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* This file exports one function: choose_temp_base. */
+/* 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. */
-
-#if defined (IN_GCC) || defined (HAVE_CONFIG_H)
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-/* If we are in gcc, or we have a config.h, we assume that
- HAVE_SYS_FILE_H tells us whether to include sys/file.h. However,
- libiberty does not have a config.h, and instead arranges to define
- NO_SYS_FILE_H on the command line when there is no sys/file.h. */
-
-#if (defined (IN_GCC) || defined (HAVE_CONFIG_H)) ? defined (HAVE_SYS_FILE_H) : ! defined (NO_SYS_FILE_H)
+#include <stdio.h> /* May get P_tmpdir. */
#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
#endif
@@ -42,15 +44,11 @@ Boston, MA 02111-1307, USA. */
#define X_OK 1
#endif
-#include <stdio.h> /* May get P_tmpdir. */
-
-#ifdef IN_GCC
-#include "gansidecl.h"
-extern char *xmalloc ();
-#else
-#include "ansidecl.h"
#include "libiberty.h"
-#if defined (__MSDOS__) || defined (_WIN32)
+extern int mkstemps ();
+
+#ifndef IN_GCC
+#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
#define DIR_SEPARATOR '\\'
#endif
#endif
@@ -96,7 +94,10 @@ try (dir, base)
/* Return a prefix for temporary file names or NULL if unable to find one.
The current directory is chosen if all else fails so the program is
exited if a temporary directory can't be found (mktemp fails).
- The buffer for the result is obtained with xmalloc. */
+ The buffer for the result is obtained with xmalloc.
+
+ This function is provided for backwards compatability only. It use
+ is not recommended. */
char *
choose_temp_base ()
@@ -107,7 +108,6 @@ choose_temp_base ()
static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
-#ifndef MPW
base = try (getenv ("TMPDIR"), base);
base = try (getenv ("TMP"), base);
base = try (getenv ("TEMP"), base);
@@ -124,24 +124,15 @@ choose_temp_base ()
if (base == 0)
base = ".";
-#else /* MPW */
- base = ":";
-#endif
-
len = strlen (base);
temp_filename = xmalloc (len + 1 /*DIR_SEPARATOR*/
+ strlen (TEMP_FILE) + 1);
strcpy (temp_filename, base);
-#ifndef MPW
if (len != 0
&& temp_filename[len-1] != '/'
&& temp_filename[len-1] != DIR_SEPARATOR)
temp_filename[len++] = DIR_SEPARATOR;
-#else /* MPW */
- if (temp_filename[len-1] != ':')
- temp_filename[len++] = ':';
-#endif /* MPW */
strcpy (temp_filename + len, TEMP_FILE);
mktemp (temp_filename);
@@ -149,3 +140,64 @@ choose_temp_base ()
abort ();
return temp_filename;
}
+/* Return a temporary file name (as a string) or NULL if unable to create
+ one. */
+
+char *
+make_temp_file (suffix)
+ const char *suffix;
+{
+ char *base = 0;
+ char *temp_filename;
+ int base_len, suffix_len;
+ int fd;
+ static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
+ static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
+
+ base = try (getenv ("TMPDIR"), base);
+ base = try (getenv ("TMP"), base);
+ base = try (getenv ("TEMP"), base);
+
+#ifdef P_tmpdir
+ base = try (P_tmpdir, base);
+#endif
+
+ /* Try /usr/tmp, then /tmp. */
+ base = try (usrtmp, base);
+ base = try (tmp, base);
+
+ /* If all else fails, use the current directory! */
+ if (base == 0)
+ base = ".";
+
+ base_len = strlen (base);
+
+ if (suffix)
+ suffix_len = strlen (suffix);
+ else
+ suffix_len = 0;
+
+ temp_filename = xmalloc (base_len + 1 /*DIR_SEPARATOR*/
+ + strlen (TEMP_FILE)
+ + suffix_len + 1);
+ strcpy (temp_filename, base);
+
+ if (base_len != 0
+ && temp_filename[base_len-1] != '/'
+ && temp_filename[base_len-1] != DIR_SEPARATOR)
+ temp_filename[base_len++] = DIR_SEPARATOR;
+ strcpy (temp_filename + base_len, TEMP_FILE);
+
+ if (suffix)
+ strcat (temp_filename, suffix);
+
+ fd = mkstemps (temp_filename, suffix_len);
+ /* If mkstemps failed, then something bad is happening. Maybe we should
+ issue a message about a possible security attack in progress? */
+ if (fd == -1)
+ abort ();
+ /* Similarly if we can not close the file. */
+ if (close (fd))
+ abort ();
+ return temp_filename;
+}
diff --git a/contrib/binutils/libiberty/clock.c b/contrib/binutils/libiberty/clock.c
index b60de16..db2509c 100644
--- a/contrib/binutils/libiberty/clock.c
+++ b/contrib/binutils/libiberty/clock.c
@@ -1,5 +1,5 @@
/* ANSI-compatible clock function.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc.
This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the
@@ -22,18 +22,36 @@ the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
+#include "config.h"
+
#ifdef HAVE_GETRUSAGE
#include <sys/time.h>
#include <sys/resource.h>
#endif
#ifdef HAVE_TIMES
-#ifndef NO_SYS_PARAM_H
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/times.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef _SC_CLK_TCK
+#define GNU_HZ sysconf(_SC_CLK_TCK)
+#else
+#ifdef HZ
+#define GNU_HZ HZ
+#else
+#ifdef CLOCKS_PER_SEC
+#define GNU_HZ CLOCKS_PER_SEC
+#endif
+#endif
+#endif
+
/* FIXME: should be able to declare as clock_t. */
long
@@ -50,7 +68,7 @@ clock ()
struct tms tms;
times (&tms);
- return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
+ return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
#else
#ifdef VMS
struct
diff --git a/contrib/binutils/libiberty/config.in b/contrib/binutils/libiberty/config.in
new file mode 100644
index 0000000..6e64208
--- /dev/null
+++ b/contrib/binutils/libiberty/config.in
@@ -0,0 +1,224 @@
+/* config.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if using alloca.c. */
+#undef C_ALLOCA
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define if you have <vfork.h>. */
+#undef HAVE_VFORK_H
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef pid_t
+
+/* Define if you need to in order for stat and other things to work. */
+#undef _POSIX_SOURCE
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define vfork as fork if vfork does not work. */
+#undef vfork
+
+/* Define if you have the sys_errlist variable. */
+#undef HAVE_SYS_ERRLIST
+
+/* Define if you have the sys_nerr variable. */
+#undef HAVE_SYS_NERR
+
+/* Define if you have the sys_siglist variable. */
+#undef HAVE_SYS_SIGLIST
+
+/* Define if you have the strerror function. */
+#undef HAVE_STRERROR
+
+/* Define if you have the asprintf function. */
+#undef HAVE_ASPRINTF
+
+/* Define if you have the atexit function. */
+#undef HAVE_ATEXIT
+
+/* Define if you have the basename function. */
+#undef HAVE_BASENAME
+
+/* Define if you have the bcmp function. */
+#undef HAVE_BCMP
+
+/* Define if you have the bcopy function. */
+#undef HAVE_BCOPY
+
+/* Define if you have the bzero function. */
+#undef HAVE_BZERO
+
+/* Define if you have the calloc function. */
+#undef HAVE_CALLOC
+
+/* Define if you have the clock function. */
+#undef HAVE_CLOCK
+
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* 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
+
+/* Define if you have the insque function. */
+#undef HAVE_INSQUE
+
+/* Define if you have the memchr function. */
+#undef HAVE_MEMCHR
+
+/* Define if you have the memcmp function. */
+#undef HAVE_MEMCMP
+
+/* Define if you have the memcpy function. */
+#undef HAVE_MEMCPY
+
+/* Define if you have the memmove function. */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the memset function. */
+#undef HAVE_MEMSET
+
+/* Define if you have the mkstemps function. */
+#undef HAVE_MKSTEMPS
+
+/* Define if you have the on_exit function. */
+#undef HAVE_ON_EXIT
+
+/* 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
+
+/* Define if you have the rename function. */
+#undef HAVE_RENAME
+
+/* Define if you have the rindex function. */
+#undef HAVE_RINDEX
+
+/* 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
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strchr function. */
+#undef HAVE_STRCHR
+
+/* Define if you have the strdup function. */
+#undef HAVE_STRDUP
+
+/* Define if you have the strerror function. */
+#undef HAVE_STRERROR
+
+/* Define if you have the strncasecmp function. */
+#undef HAVE_STRNCASECMP
+
+/* Define if you have the strrchr function. */
+#undef HAVE_STRRCHR
+
+/* Define if you have the strsignal function. */
+#undef HAVE_STRSIGNAL
+
+/* Define if you have the strstr function. */
+#undef HAVE_STRSTR
+
+/* Define if you have the strtod function. */
+#undef HAVE_STRTOD
+
+/* Define if you have the strtol function. */
+#undef HAVE_STRTOL
+
+/* Define if you have the strtoul function. */
+#undef HAVE_STRTOUL
+
+/* Define if you have the sysconf function. */
+#undef HAVE_SYSCONF
+
+/* Define if you have the times function. */
+#undef HAVE_TIMES
+
+/* Define if you have the tmpnam function. */
+#undef HAVE_TMPNAM
+
+/* Define if you have the vasprintf function. */
+#undef HAVE_VASPRINTF
+
+/* Define if you have the vfprintf function. */
+#undef HAVE_VFPRINTF
+
+/* Define if you have the vprintf function. */
+#undef HAVE_VPRINTF
+
+/* Define if you have the vsprintf function. */
+#undef HAVE_VSPRINTF
+
+/* Define if you have the waitpid function. */
+#undef HAVE_WAITPID
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* 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
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
diff --git a/contrib/binutils/libiberty/config.table b/contrib/binutils/libiberty/config.table
index e367e1b..4e33746 100644
--- a/contrib/binutils/libiberty/config.table
+++ b/contrib/binutils/libiberty/config.table
@@ -1,50 +1,12 @@
case "${host}" in
rs6000-ibm-aix3.1 | rs6000-ibm-aix)
- frag=mh-aix
- files=${xsrcdir}alloca-botch.h ;;
- *-ibm-aix*) files=${xsrcdir}alloca-botch.h ;;
- arm-*-riscix*) frag=mh-riscix ;;
- m68k-apollo-bsd*) frag=mh-a68bsd ;;
- m68k-apollo-sysv*) frag=mh-apollo68 ;;
- i[3456]86-ncr-sysv4*) frag=mh-ncr3000 ;;
+ frag=mh-aix ;;
*-*-cxux7*) frag=mh-cxux7 ;;
- *-*-cygwin32) frag=mh-cygwin32 ;;
- *-*-dgux*) frag=mh-sysv ;;
*-*-freebsd2.1.*) frag=mh-fbsd21 ;;
- *-*-freebsd2.2.*) frag=mh-fbsd21 ;;
- hppa*-hp-bsd*) frag=mh-hpbsd ;;
- *-*-hpux*) frag=mh-hpux ;;
- *-*-hiux*) frag=mh-hpux ;;
- *-*-irix4*) frag=mh-irix4 ;;
- *-*-irix*) frag=mh-sysv ;;
- *-*-m88kbcs*) frag=mh-sysv ;;
- *-*-solaris2*) frag=mh-sysv4 ;;
- *-*-sysv4*) frag=mh-sysv4 ;;
- *-*-sysv*) frag=mh-sysv ;;
- *-*-go32) frag=mh-go32 ;;
+ *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
+ i370-*-opened*) frag=mh-openedition ;;
i[345]86-*-windows*) frag=mh-windows ;;
-
- *-*-vxworks5* | *-*-vxworks)
- # VxWorks 5 needs special action, because the usual
- # autoconfiguration scheme does not work.
- frag=mt-vxworks5
- ;;
-
- i[3456]86-*-mingw32*)
- # Mingw32 does not require strerror.o from REQUIRED_OFILES.
- # Worse: it will not compile it because of an incompatible sys_errlist
- # definition.
- frag=mt-mingw32
- ;;
-esac
-
-# Try to handle funky case of solaris 2 -> sun 4.
-case "${host}" in
- sparc-sun-sunos4.1.3)
- if [ "${with_cross_host}" != "${host}" ] ; then
- frag=mt-sunos4
- fi
- ;;
+ *-*-beos*) frag=mh-beos ;;
esac
frags=$frag
@@ -53,19 +15,33 @@ frags=$frag
case "${enable_shared}" in
yes) shared=yes ;;
no) shared=no ;;
+ "") shared=no ;;
*) shared=yes ;;
esac
if [ "${shared}" = "yes" ]; then
case "${host}" in
- hppa*-*-*) frags="${frags} ../../config/mh-papic" ;;
- i[3456]86-*-*) frags="${frags} ../../config/mh-x86pic" ;;
- *-*-*) frags="${frags} ../../config/mh-${host_cpu}pic" ;;
+ *-*-cygwin*) ;;
+ alpha*-*-linux*) frags="${frags} ../../config/mh-elfalphapic" ;;
+ arm*-*-*) frags="${frags} ../../config/mh-armpic" ;;
+ hppa*-*-*) frags="${frags} ../../config/mh-papic" ;;
+ i[3456]86-*-*) frags="${frags} ../../config/mh-x86pic" ;;
+ powerpc*-*-aix*) ;;
+ powerpc*-*-*) frags="${frags} ../../config/mh-ppcpic" ;;
+ *-*-*) frags="${frags} ../../config/mh-${host_cpu}pic" ;;
esac
fi
echo "# Warning: this fragment is automatically generated" > temp-frag
for frag in ${frags}; do
+ case ${frag} in
+ ../* )
+ if [ ${srcdir} = . ]; then
+ [ -n "${with_target_subdir}" ] && frag=../${frag}
+ [ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag}
+ fi
+ ;;
+ esac
frag=${srcdir}/${xsrcdir}config/$frag
if [ -f ${frag} ]; then
echo "Appending ${frag} to xhost-mkfrag"
@@ -74,5 +50,12 @@ for frag in ${frags}; do
fi
done
+# record if we want to build shared libs.
+if [ "${shared}" = "yes" ]; then
+ echo enable_shared = yes >> temp-frag
+else
+ echo enable_shared = no >> temp-frag
+fi
+
frag=xhost-mkfrag
-${config_shell} ${moveifchange} temp-frag xhost-mkfrag
+${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag
diff --git a/contrib/binutils/libiberty/config/mh-cxux7 b/contrib/binutils/libiberty/config/mh-cxux7
index 6d4d30b..a924b08 100644
--- a/contrib/binutils/libiberty/config/mh-cxux7
+++ b/contrib/binutils/libiberty/config/mh-cxux7
@@ -1,3 +1 @@
-HDEFINES = -DHAVE_SYSCONF -DHARRIS_FLOAT_FORMAT
-RANLIB=true
-INSTALL = cp
+HDEFINES = -DHARRIS_FLOAT_FORMAT
diff --git a/contrib/binutils/libiberty/config/mh-openedition b/contrib/binutils/libiberty/config/mh-openedition
new file mode 100644
index 0000000..6e8e354
--- /dev/null
+++ b/contrib/binutils/libiberty/config/mh-openedition
@@ -0,0 +1,3 @@
+HDEFINES = -D_ALL_SOURCE
+CC=c89
+
diff --git a/contrib/binutils/libiberty/configure b/contrib/binutils/libiberty/configure
new file mode 100755
index 0000000..02c826d
--- /dev/null
+++ b/contrib/binutils/libiberty/configure
@@ -0,0 +1,2953 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --with-target-subdir=SUBDIR Configuring in a subdirectory"
+ac_help="$ac_help
+ --with-cross-host=HOST Configuring with a cross compiler"
+ac_help="$ac_help
+ --with-newlib Configuring with newlib"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=pexecute.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+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
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+# Check whether --with-target-subdir or --without-target-subdir was given.
+if test "${with_target_subdir+set}" = set; then
+ withval="$with_target_subdir"
+ :
+fi
+
+# Check whether --with-cross-host or --without-cross-host was given.
+if test "${with_cross_host+set}" = set; then
+ withval="$with_cross_host"
+ :
+fi
+
+# Check whether --with-newlib or --without-newlib was given.
+if test "${with_newlib+set}" = set; then
+ withval="$with_newlib"
+ :
+fi
+
+
+if test "${srcdir}" = "."; then
+ if test -z "${with_target_subdir}"; then
+ libiberty_topdir="${srcdir}/.."
+ else
+ if test "${with_target_subdir}" != "."; then
+ libiberty_topdir="${srcdir}/${with_multisrctop}../.."
+ else
+ libiberty_topdir="${srcdir}/${with_multisrctop}.."
+ fi
+ fi
+else
+ libiberty_topdir="${srcdir}/.."
+fi
+ac_aux_dir=
+for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+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:591: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:614: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+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: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
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+ echo "$ac_t""$AR" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+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: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
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+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: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
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ RANLIB=":"
+fi
+fi
+
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+
+
+
+
+# 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: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
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+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: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
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+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
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+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
+fi
+fi
+
+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: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
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ 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: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
+ echo "$ac_t""yes" 1>&6
+ ISC=yes # If later tests want to check for ISC.
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ if test "$GCC" = yes; then
+ CC="$CC -posix"
+ else
+ CC="$CC -Xp"
+ fi
+else
+ echo "$ac_t""no" 1>&6
+ ISC=
+fi
+
+
+
+
+
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# 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: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
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+. ${srcdir}/config.table
+host_makefile_frag=${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.
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+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=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#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: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
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#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: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
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#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: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
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+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 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: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 1071 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (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*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+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 1108 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+
+# This is the list of functions which libiberty will provide if they
+# are not available on the host.
+
+funcs="asprintf"
+funcs="$funcs atexit"
+funcs="$funcs basename"
+funcs="$funcs bcmp"
+funcs="$funcs bcopy"
+funcs="$funcs bzero"
+funcs="$funcs calloc"
+funcs="$funcs clock"
+funcs="$funcs getcwd"
+funcs="$funcs getpagesize"
+funcs="$funcs index"
+funcs="$funcs insque"
+funcs="$funcs memchr"
+funcs="$funcs memcmp"
+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"
+funcs="$funcs strdup"
+funcs="$funcs strncasecmp"
+funcs="$funcs strrchr"
+funcs="$funcs strstr"
+funcs="$funcs strtod"
+funcs="$funcs strtol"
+funcs="$funcs strtoul"
+funcs="$funcs tmpnam"
+funcs="$funcs vasprintf"
+funcs="$funcs vfprintf"
+funcs="$funcs vprintf"
+funcs="$funcs vsprintf"
+funcs="$funcs waitpid"
+
+# Also in the old function.def file: alloca, vfork, getopt.
+
+vars="sys_errlist sys_nerr sys_siglist"
+
+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
+ 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: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 1205 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+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: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 1260 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ 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: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 1315 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ 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: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 1370 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+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: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 1425 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_ERRLIST 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_NERR 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_SIGLIST 1
+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: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 1492 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in sbrk gettimeofday
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+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 1547 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+# For each of these functions, if the host does not provide the
+# function we want to put FN.o in LIBOBJS, and if the host does
+# provide the function, we want to define HAVE_FN in config.h. Also,
+# 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
+ # may not work correctly, because the compiler may not be able to
+ # link executables. Note that we may still be being configured
+ # native.
+
+ # If we are being configured for newlib, we know which functions
+ # newlib provide and which ones we will be expected to provide.
+
+ if test "x${with_newlib}" = "xyes"; then
+ ALLOCA="alloca.o"
+ LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
+
+ for f in $funcs; do
+ case "$f" in
+ asprintf | basename | insque | random | strdup | vasprintf)
+ ;;
+ *)
+ n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $n 1
+EOF
+
+ ;;
+ esac
+ done
+
+ # newlib doesnt provide any of the variables in $vars, so we
+ # dont have to check them here.
+
+ # Of the functions in $checkfuncs, newlib only has strerror.
+ cat >> confdefs.h <<\EOF
+#define HAVE_STRERROR 1
+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
+
+ *-*-vxworks*)
+ # Handle VxWorks configuration specially, since on VxWorks the
+ # libraries are actually on the target board, not in the file
+ # system.
+ LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
+ LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
+ for f in $funcs; do
+ case "$f" in
+ basename | getpagesize | insque | random | strcasecmp)
+ ;;
+ strncasecmp | strdup | vfork | waitpid | vasprintf)
+ ;;
+ *)
+ n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $n 1
+EOF
+
+ ;;
+ esac
+ done
+
+ # VxWorks doesn't provide any of the variables in $vars, so we
+ # don't have to check them here.
+
+ # Of the functions in $checkfuncs, VxWorks only has strerror.
+ cat >> confdefs.h <<\EOF
+#define HAVE_STRERROR 1
+EOF
+
+
+ setobjs=yes
+ ;;
+
+ esac
+fi
+
+if test -z "${setobjs}"; then
+
+ case "${host}" in
+
+ *-*-cygwin*)
+ # The Cygwin library actually uses a couple of files from
+ # libiberty when it is built. If we are building a native
+ # Cygwin, and we run the tests, we will appear to have these
+ # files. However, when we go on to build winsup, we will wind up
+ # with a library which does not have the files, since they should
+ # have come from libiberty.
+
+ # We handle this by removing the functions the winsup library
+ # provides from our shell variables, so that they appear to be
+ # missing.
+
+ funcs="`echo $funcs | sed -e 's/random//'`"
+ LIBOBJS="$LIBOBJS random.o"
+ vars="`echo $vars | sed -e 's/sys_siglist//'`"
+ checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
+ ;;
+
+ *-*-mingw32*)
+ # Under mingw32, sys_nerr and sys_errlist exist, but they are
+ # macros, so the test below won't find them.
+ vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`"
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_NERR 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_ERRLIST 1
+EOF
+
+ ;;
+
+ *-*-uwin*)
+ # Under some versions of uwin, vfork is notoriously buggy and the test
+ # 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
+
+ # 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: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.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1763 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+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
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+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: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: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 1806 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+
+ 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: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 1881 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+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 1914 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+ # that cause trouble. Some versions do not even contain alloca or
+ # contain a buggy version. If you still want to use their alloca,
+ # use ar to extract alloca.o from them instead of compiling alloca.c.
+ ALLOCA=alloca.${ac_objext}
+ cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+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 1979 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "webecray" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_os_cray=yes
+else
+ rm -rf conftest*
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+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: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 2009 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+ break
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+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
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2067 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+ ;;
+ esac
+
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+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 2116 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (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*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+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 2141 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+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 2159 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2180 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+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 2220 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_pid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
+ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
+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 2254 "configure"
+#include "confdefs.h"
+#include <vfork.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (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*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_VFORK_H 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for working vfork""... $ac_c" 1>&6
+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: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 2295 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vfork(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char vfork();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_vfork) || defined (__stub___vfork)
+choke me
+#else
+vfork();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_vfork=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2340 "configure"
+#include "confdefs.h"
+/* Thanks to Paul Eggert for this test. */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent.
+ The compiler is told about this with #include <vfork.h>,
+ but some compilers (e.g. gcc -O) don't grok <vfork.h>.
+ Test for this by using a static variable whose address
+ is put into a register that is clobbered by the vfork. */
+static
+#ifdef __cplusplus
+sparc_address_test (int arg)
+#else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+main() {
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test ();
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems.
+ This test uses lots of local variables, at least
+ as many local variables as main has allocated so far
+ including compiler temporaries. 4 locals are enough for
+ gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
+ A buggy compiler should reuse the register of parent
+ for one of the local variables, since it will think that
+ parent can't possibly be used any more in this routine.
+ Assigning to the local variable will thus munge parent
+ in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3),
+ vfork doesn't separate parent from child file descriptors.
+ If the child closes a descriptor before it execs or exits,
+ this munges the parent's descriptor as well.
+ Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ exit(
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_vfork_works=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
+if test $ac_cv_func_vfork_works = no; then
+ cat >> confdefs.h <<\EOF
+#define vfork fork
+EOF
+
+fi
+
+ if test $ac_cv_func_vfork_works = no; then
+ LIBOBJS="$LIBOBJS vfork.o"
+ fi
+ for v in $vars; do
+ echo $ac_n "checking for $v""... $ac_c" 1>&6
+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 2467 "configure"
+#include "confdefs.h"
+int *p;
+int main() {
+extern int $v; p = &$v;
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "libiberty_cv_var_$v=no"
+fi
+rm -f conftest*
+fi
+
+ if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $n 1
+EOF
+
+ else
+ echo "$ac_t""no" 1>&6
+ fi
+ done
+ for ac_func in $checkfuncs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+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 2505 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+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
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+# Install a library built with a cross compiler in $(tooldir) rather
+# than $(libdir).
+if test -z "${with_cross_host}"; then
+ INSTALL_DEST=libdir
+else
+ INSTALL_DEST=tooldir
+fi
+
+
+# We need multilib support, but only if configuring for the target.
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+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
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+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
+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
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+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
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h:config.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+srcdir=${srcdir}
+host=${host}
+target=${target}
+with_target_subdir=${with_target_subdir}
+with_multisubdir=${with_multisubdir}
+ac_configure_args="--enable-multilib ${ac_configure_args}"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+libiberty_topdir=${libiberty_topdir}
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+if test -n "$CONFIG_FILES"; then
+ if test -n "${with_target_subdir}"; then
+ # FIXME: We shouldn't need to set ac_file
+ ac_file=Makefile
+ . ${libiberty_topdir}/config-ml.in
+ fi
+fi
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/contrib/binutils/libiberty/configure.in b/contrib/binutils/libiberty/configure.in
index b0020d8..cc1b2c2 100644
--- a/contrib/binutils/libiberty/configure.in
+++ b/contrib/binutils/libiberty/configure.in
@@ -1,66 +1,382 @@
-# This file is a shell script fragment that supplies the information
-# necessary for a configure script to process the program in
-# this directory. For more information, look at ../configure.
+dnl Process this file with autoconf to produce a configure script
-configdirs=
-srctrigger=getopt1.c
-srcname="-liberty library"
+AC_PREREQ(2.13)
+AC_INIT(pexecute.c)
-# per-host:
+dnl We use these options to decide which functions to include.
+AC_ARG_WITH(target-subdir,
+[ --with-target-subdir=SUBDIR Configuring in a subdirectory])
+AC_ARG_WITH(cross-host,
+[ --with-cross-host=HOST Configuring with a cross compiler])
+AC_ARG_WITH(newlib,
+[ --with-newlib Configuring with newlib])
-files="alloca-norm.h"
-links="alloca-conf.h"
+if test "${srcdir}" = "."; then
+ if test -z "${with_target_subdir}"; then
+ libiberty_topdir="${srcdir}/.."
+ else
+ if test "${with_target_subdir}" != "."; then
+ libiberty_topdir="${srcdir}/${with_multisrctop}../.."
+ else
+ libiberty_topdir="${srcdir}/${with_multisrctop}.."
+ fi
+ fi
+else
+ libiberty_topdir="${srcdir}/.."
+fi
+AC_CONFIG_AUX_DIR($libiberty_topdir)
+
+AC_CANONICAL_HOST
+
+dnl When we start using automake:
+dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
+
+dnl These must be called before AM_PROG_LIBTOOL, because it may want
+dnl to call AC_CHECK_PROG.
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+AC_PROVIDE([AC_PROG_CC])
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+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.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ ac_libiberty_warn_cflags=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+AC_SUBST(ac_libiberty_warn_cflags)
+
+LIB_AC_PROG_CC
+
+AC_ISC_POSIX
+
+dnl When we start using libtool:
+dnl Default to a non shared library. This may be overridden by the
+dnl configure option --enable-shared.
+dnl AM_DISABLE_SHARED
+
+dnl When we start using libtool:
+dnl AM_PROG_LIBTOOL
+
+dnl When we start using automake:
+dnl AM_CONFIG_HEADER(config.h:config.in)
+AC_CONFIG_HEADER(config.h:config.in)
+
+dnl When we start using automake:
+dnl AM_MAINTAINER_MODE
+dnl AC_EXEEXT
+
+dnl When we start using automake:
+dnl AM_PROG_INSTALL
+AC_PROG_INSTALL
. ${srcdir}/config.table
host_makefile_frag=${frag}
+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 sys/stat.h)
+AC_HEADER_SYS_WAIT
+
+# This is the list of functions which libiberty will provide if they
+# are not available on the host.
+
+funcs="asprintf"
+funcs="$funcs atexit"
+funcs="$funcs basename"
+funcs="$funcs bcmp"
+funcs="$funcs bcopy"
+funcs="$funcs bzero"
+funcs="$funcs calloc"
+funcs="$funcs clock"
+funcs="$funcs getcwd"
+funcs="$funcs getpagesize"
+funcs="$funcs index"
+funcs="$funcs insque"
+funcs="$funcs memchr"
+funcs="$funcs memcmp"
+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"
+funcs="$funcs strdup"
+funcs="$funcs strncasecmp"
+funcs="$funcs strrchr"
+funcs="$funcs strstr"
+funcs="$funcs strtod"
+funcs="$funcs strtol"
+funcs="$funcs strtoul"
+funcs="$funcs tmpnam"
+funcs="$funcs vasprintf"
+funcs="$funcs vfprintf"
+funcs="$funcs vprintf"
+funcs="$funcs vsprintf"
+funcs="$funcs waitpid"
+
+# Also in the old function.def file: alloca, vfork, getopt.
-# per-target:
-
-# post-target:
-
-# If this is the target libiberty, check at compile time whether we are using
-# newlib. If we are, we already know the files we need, since the linker
-# will fail when run on some of the newlib targets.
-if [ -n "${with_target_subdir}" ] ; then
- cat > Makefile.tem <<'!EOF!'
-CONFIG_H = xconfig.h
-NEEDED_LIST = xneeded-list
-
-xconfig.h: Makefile
- if [ -f ../newlib/Makefile ]; then \
- echo "#define NEED_sys_nerr 1" >xconfig.h; \
- echo "#define NEED_sys_errlist 1" >>xconfig.h; \
- echo "#define NEED_sys_siglist 1" >>xconfig.h; \
- echo "#define NEED_strsignal 1" >>xconfig.h; \
- echo "#define NEED_psignal 1" >>xconfig.h; \
- else \
- $(MAKE) $(FLAGS_TO_PASS) lconfig.h; \
- cp lconfig.h xconfig.h; \
- fi
-
-xneeded-list: Makefile
- if [ -f ../newlib/Makefile ]; then \
- echo insque.o random.o strdup.o alloca.o vasprintf.o >xneeded-list; \
- else \
- $(MAKE) $(FLAGS_TO_PASS) lneeded-list; \
- cp lneeded-list xneeded-list; \
- fi
-!EOF!
-sed -e "/^####/ r Makefile.tem" \
- -e '/INSTALL_DEST =/s/libdir/tooldir/' ${Makefile} > Makefile.tem3
-mv Makefile.tem3 ${Makefile}
-rm -f Makefile.tem
+vars="sys_errlist sys_nerr sys_siglist"
+
+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 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 gettimeofday)
fi
-# We need multilib support, but only if configuring for the target.
-if [ -n "${with_target_subdir}" ] ; then
- if [ "${srcdir}" = "." ] ; then
- if [ "${with_target_subdir}" != "." ] ; then
- . ${with_multisrctop}../../config-ml.in
+# For each of these functions, if the host does not provide the
+# function we want to put FN.o in LIBOBJS, and if the host does
+# provide the function, we want to define HAVE_FN in config.h. Also,
+# 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
+ # may not work correctly, because the compiler may not be able to
+ # link executables. Note that we may still be being configured
+ # native.
+
+ # If we are being configured for newlib, we know which functions
+ # newlib provide and which ones we will be expected to provide.
+
+ if test "x${with_newlib}" = "xyes"; then
+ ALLOCA="alloca.o"
+ LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
+
+ for f in $funcs; do
+ case "$f" in
+ asprintf | basename | insque | random | strdup | vasprintf)
+ ;;
+ *)
+ n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($n)
+ ;;
+ esac
+ done
+
+ # newlib doesnt provide any of the variables in $vars, so we
+ # dont have to check them here.
+
+ # Of the functions in $checkfuncs, newlib only has strerror.
+ AC_DEFINE(HAVE_STRERROR)
+
+ 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
+
+ *-*-vxworks*)
+ # Handle VxWorks configuration specially, since on VxWorks the
+ # libraries are actually on the target board, not in the file
+ # system.
+ LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
+ LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
+ for f in $funcs; do
+ case "$f" in
+ basename | getpagesize | insque | random | strcasecmp)
+ ;;
+ strncasecmp | strdup | vfork | waitpid | vasprintf)
+ ;;
+ *)
+ n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($n)
+ ;;
+ esac
+ done
+
+ # VxWorks doesn't provide any of the variables in $vars, so we
+ # don't have to check them here.
+
+ # Of the functions in $checkfuncs, VxWorks only has strerror.
+ AC_DEFINE(HAVE_STRERROR)
+
+ setobjs=yes
+ ;;
+
+ esac
+fi
+
+if test -z "${setobjs}"; then
+
+ case "${host}" in
+
+ *-*-cygwin*)
+ # The Cygwin library actually uses a couple of files from
+ # libiberty when it is built. If we are building a native
+ # Cygwin, and we run the tests, we will appear to have these
+ # files. However, when we go on to build winsup, we will wind up
+ # with a library which does not have the files, since they should
+ # have come from libiberty.
+
+ # We handle this by removing the functions the winsup library
+ # provides from our shell variables, so that they appear to be
+ # missing.
+
+ funcs="`echo $funcs | sed -e 's/random//'`"
+ LIBOBJS="$LIBOBJS random.o"
+ vars="`echo $vars | sed -e 's/sys_siglist//'`"
+ checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
+ ;;
+
+ *-*-mingw32*)
+ # Under mingw32, sys_nerr and sys_errlist exist, but they are
+ # macros, so the test below won't find them.
+ vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`"
+ AC_DEFINE(HAVE_SYS_NERR)
+ AC_DEFINE(HAVE_SYS_ERRLIST)
+ ;;
+
+ *-*-uwin*)
+ # Under some versions of uwin, vfork is notoriously buggy and the test
+ # 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
+
+ # We haven't set the list of objects yet. Use the standard autoconf
+ # tests. This will only work if the compiler works.
+ AC_PROG_CC_WORKS
+ AC_REPLACE_FUNCS($funcs)
+
+ 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"
+ fi
+ for v in $vars; do
+ AC_MSG_CHECKING([for $v])
+ AC_CACHE_VAL(libiberty_cv_var_$v,
+ [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
+ [eval "libiberty_cv_var_$v=yes"],
+ [eval "libiberty_cv_var_$v=no"])])
+ if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($n)
else
- . ${with_multisrctop}../config-ml.in
+ AC_MSG_RESULT(no)
fi
- else
- . ${srcdir}/../config-ml.in
- fi
+ done
+ AC_CHECK_FUNCS($checkfuncs)
fi
+
+# Install a library built with a cross compiler in $(tooldir) rather
+# than $(libdir).
+if test -z "${with_cross_host}"; then
+ INSTALL_DEST=libdir
+else
+ INSTALL_DEST=tooldir
+fi
+AC_SUBST(INSTALL_DEST)
+
+# We need multilib support, but only if configuring for the target.
+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
+ # FIXME: We shouldn't need to set ac_file
+ ac_file=Makefile
+ . ${libiberty_topdir}/config-ml.in
+ fi
+fi],
+srcdir=${srcdir}
+host=${host}
+target=${target}
+with_target_subdir=${with_target_subdir}
+with_multisubdir=${with_multisubdir}
+ac_configure_args="--enable-multilib ${ac_configure_args}"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+libiberty_topdir=${libiberty_topdir}
+)
diff --git a/contrib/binutils/libiberty/cplus-dem.c b/contrib/binutils/libiberty/cplus-dem.c
index f4d7123..52249d2 100644
--- a/contrib/binutils/libiberty/cplus-dem.c
+++ b/contrib/binutils/libiberty/cplus-dem.c
@@ -1,8 +1,9 @@
-/* Demangler for GNU C++
- Copyright 1989, 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Demangler for GNU C++
+ Copyright 1989, 91, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.uucp)
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
-
+ Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
+
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -28,16 +29,35 @@ Boston, MA 02111-1307, USA. */
/* This file lives in both GCC and libiberty. When making changes, please
try not to break either. */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <ctype.h>
+#include <sys/types.h>
#include <string.h>
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+char * malloc ();
+char * realloc ();
+#endif
+
#include <demangle.h>
#undef CURRENT_DEMANGLING_STYLE
#define CURRENT_DEMANGLING_STYLE work->options
-extern char *xmalloc PARAMS((unsigned));
-extern char *xrealloc PARAMS((char *, unsigned));
+#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 *));
@@ -82,6 +102,8 @@ enum demangling_styles current_demangling_style = gnu_demangling;
static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' };
+static char char_str[2] = { '\000', '\000' };
+
void
set_cplus_marker_for_demangling (ch)
int ch;
@@ -89,6 +111,13 @@ set_cplus_marker_for_demangling (ch)
cplus_markers[0] = ch;
}
+typedef struct string /* Beware: these aren't required to be */
+{ /* '\0' terminated. */
+ char *b; /* pointer to start of string */
+ char *p; /* pointer after last character */
+ char *e; /* pointer after end of allocated space */
+} string;
+
/* Stuff that is shared between sub-routines.
Using a shared structure allows cplus_demangle to be reentrant. */
@@ -96,14 +125,27 @@ struct work_stuff
{
int options;
char **typevec;
+ char **ktypevec;
+ char **btypevec;
+ int numk;
+ int numb;
+ int ksize;
+ int bsize;
int ntypes;
int typevec_size;
int constructor;
int destructor;
int static_type; /* A static member function */
- int const_type; /* A const member function */
+ int temp_start; /* index in demangled to start of template args */
+ int type_quals; /* The type qualifiers. */
+ int dllimported; /* Symbol imported from a PE DLL */
char **tmpl_argvec; /* Template function arguments. */
int ntmpl_args; /* The number of template function arguments. */
+ int forgetting_types; /* Nonzero if we are not remembering the types
+ we see. */
+ string* previous_argument; /* The last function argument demangled. */
+ int nrepeats; /* The number of times to repeat the previous
+ argument. */
};
#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
@@ -192,22 +234,34 @@ static const struct optable
{"min", "<?", 0}, /* old */
{"mn", "<?", DMGL_ANSI}, /* pseudo-ansi */
{"nop", "", 0}, /* old (for operator=) */
- {"rm", "->*", DMGL_ANSI} /* ansi */
+ {"rm", "->*", DMGL_ANSI}, /* ansi */
+ {"sz", "sizeof ", DMGL_ANSI} /* pseudo-ansi */
};
-
-typedef struct string /* Beware: these aren't required to be */
-{ /* '\0' terminated. */
- char *b; /* pointer to start of string */
- char *p; /* pointer after last character */
- char *e; /* pointer after end of allocated space */
-} string;
+/* These values are used to indicate the various type varieties.
+ They are all non-zero so that they can be used as `success'
+ values. */
+typedef enum type_kind_t
+{
+ tk_none,
+ tk_pointer,
+ tk_reference,
+ tk_integral,
+ tk_bool,
+ tk_char,
+ tk_real
+} type_kind_t;
#define STRING_EMPTY(str) ((str) -> b == (str) -> p)
#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
string_prepend(str, " ");}
#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
string_append(str, " ");}
+#define LEN_STRING(str) ( (STRING_EMPTY(str))?0:((str)->p - (str)->b))
+
+/* The scope separator appropriate for the language being demangled. */
+
+#define SCOPE_STRING(work) ((work->options & DMGL_JAVA) ? "." : "::")
#define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */
#define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */
@@ -217,22 +271,29 @@ typedef struct string /* Beware: these aren't required to be */
static char *
mop_up PARAMS ((struct work_stuff *, string *, int));
+static void
+squangle_mop_up PARAMS ((struct work_stuff *));
+
#if 0
static int
-demangle_method_args PARAMS ((struct work_stuff *work, const char **, string *));
+demangle_method_args PARAMS ((struct work_stuff *, const char **, string *));
#endif
+static char *
+internal_cplus_demangle PARAMS ((struct work_stuff *, const char *));
+
+static int
+demangle_template_template_parm PARAMS ((struct work_stuff *work,
+ const char **, string *));
+
static int
demangle_template PARAMS ((struct work_stuff *work, const char **, string *,
- string *, int));
+ string *, int, int));
static int
arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **,
const char **));
-static void
-demangle_arm_pt PARAMS ((struct work_stuff *, const char **, int, string *));
-
static int
demangle_class_name PARAMS ((struct work_stuff *, const char **, string *));
@@ -256,7 +317,7 @@ static int
gnu_special PARAMS ((struct work_stuff *, const char **, string *));
static int
-arm_special PARAMS ((struct work_stuff *, const char **, string *));
+arm_special PARAMS ((const char **, string *));
static void
string_need PARAMS ((string *, int));
@@ -290,19 +351,25 @@ 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 *));
static int
consume_count PARAMS ((const char **));
-static int
+static int
consume_count_with_underscores PARAMS ((const char**));
static int
demangle_args PARAMS ((struct work_stuff *, const char **, string *));
static int
+demangle_nested_args PARAMS ((struct work_stuff*, const char**, string*));
+
+static int
do_type PARAMS ((struct work_stuff *, const char **, string *));
static int
@@ -316,15 +383,80 @@ static void
remember_type PARAMS ((struct work_stuff *, const char *, int));
static void
+remember_Btype PARAMS ((struct work_stuff *, const char *, int, int));
+
+static int
+register_Btype PARAMS ((struct work_stuff *));
+
+static void
+remember_Ktype PARAMS ((struct work_stuff *, const char *, int));
+
+static void
forget_types PARAMS ((struct work_stuff *));
static void
+forget_B_and_K_types PARAMS ((struct work_stuff *));
+
+static void
string_prepends PARAMS ((string *, string *));
-/* Translate count to integer, consuming tokens in the process.
- Conversion terminates on the first non-digit character.
- Trying to consume something that isn't a count results in
- no consumption of input and a return of 0. */
+static int
+demangle_template_value_parm PARAMS ((struct work_stuff*, const char**,
+ string*, type_kind_t));
+
+static int
+do_hpacc_template_const_value PARAMS ((struct work_stuff *, const char **, string *));
+
+static int
+do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *));
+
+static int
+snarf_numeric_literal PARAMS ((const char **, string *));
+
+/* There is a TYPE_QUAL value for each type qualifier. They can be
+ combined by bitwise-or to form the complete set of qualifiers for a
+ type. */
+
+#define TYPE_UNQUALIFIED 0x0
+#define TYPE_QUAL_CONST 0x1
+#define TYPE_QUAL_VOLATILE 0x2
+#define TYPE_QUAL_RESTRICT 0x4
+
+static int
+code_for_qualifier PARAMS ((int));
+
+static const char*
+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.
+
+ Trying to consume something that isn't a count results in no
+ consumption of input and a return of -1.
+
+ Overflow consumes the rest of the digits, and returns -1. */
static int
consume_count (type)
@@ -332,17 +464,34 @@ consume_count (type)
{
int count = 0;
- while (isdigit (**type))
+ if (! isdigit ((unsigned char)**type))
+ return -1;
+
+ while (isdigit ((unsigned char)**type))
{
count *= 10;
+
+ /* Check for overflow.
+ We assume that count is represented using two's-complement;
+ no power of two is divisible by ten, so if an overflow occurs
+ when multiplying by ten, the result will not be a multiple of
+ ten. */
+ if ((count % 10) != 0)
+ {
+ while (isdigit ((unsigned char) **type))
+ (*type)++;
+ return -1;
+ }
+
count += **type - '0';
(*type)++;
}
+
return (count);
}
-/* Like consume_count, but for counts that are preceeded and followed
+/* Like consume_count, but for counts that are preceded and followed
by '_' if they are greater than 10. Also, -1 is returned for
failure, since 0 can be a valid value. */
@@ -355,21 +504,21 @@ consume_count_with_underscores (mangled)
if (**mangled == '_')
{
(*mangled)++;
- if (!isdigit (**mangled))
+ if (!isdigit ((unsigned char)**mangled))
return -1;
idx = consume_count (mangled);
if (**mangled != '_')
/* The trailing underscore was missing. */
return -1;
-
+
(*mangled)++;
}
else
{
if (**mangled < '0' || **mangled > '9')
return -1;
-
+
idx = **mangled - '0';
(*mangled)++;
}
@@ -377,13 +526,91 @@ consume_count_with_underscores (mangled)
return idx;
}
+/* C is the code for a type-qualifier. Return the TYPE_QUAL
+ corresponding to this qualifier. */
+
+static int
+code_for_qualifier (c)
+ int c;
+{
+ switch (c)
+ {
+ case 'C':
+ return TYPE_QUAL_CONST;
+
+ case 'V':
+ return TYPE_QUAL_VOLATILE;
+
+ case 'u':
+ return TYPE_QUAL_RESTRICT;
+
+ default:
+ break;
+ }
+
+ /* C was an invalid qualifier. */
+ abort ();
+}
+
+/* Return the string corresponding to the qualifiers given by
+ TYPE_QUALS. */
+
+static const char*
+qualifier_string (type_quals)
+ int type_quals;
+{
+ switch (type_quals)
+ {
+ case TYPE_UNQUALIFIED:
+ return "";
+
+ case TYPE_QUAL_CONST:
+ return "const";
+
+ case TYPE_QUAL_VOLATILE:
+ return "volatile";
+
+ case TYPE_QUAL_RESTRICT:
+ return "__restrict";
+
+ case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE:
+ return "const volatile";
+
+ case TYPE_QUAL_CONST | TYPE_QUAL_RESTRICT:
+ return "const __restrict";
+
+ case TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT:
+ return "volatile __restrict";
+
+ case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT:
+ return "const volatile __restrict";
+
+ default:
+ break;
+ }
+
+ /* TYPE_QUALS was an invalid qualifier set. */
+ abort ();
+}
+
+/* C is the code for a type-qualifier. Return the string
+ corresponding to this qualifier. This function should only be
+ called with a valid qualifier code. */
+
+static const char*
+demangle_qualifier (c)
+ int c;
+{
+ return qualifier_string (code_for_qualifier (c));
+}
+
int
cplus_demangle_opname (opname, result, options)
const char *opname;
char *result;
int options;
{
- int len, i, len1, ret;
+ int len, len1, ret;
string type;
struct work_stuff work[1];
const char *tem;
@@ -391,8 +618,9 @@ cplus_demangle_opname (opname, result, options)
len = strlen(opname);
result[0] = '\0';
ret = 0;
+ memset ((char *) work, 0, sizeof (work));
work->options = options;
-
+
if (opname[0] == '_' && opname[1] == '_'
&& opname[2] == 'o' && opname[3] == 'p')
{
@@ -414,6 +642,7 @@ cplus_demangle_opname (opname, result, options)
if (opname[4] == '\0')
{
/* Operator. */
+ size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
if (strlen (optable[i].in) == 2
@@ -431,6 +660,7 @@ cplus_demangle_opname (opname, result, options)
if (opname[2] == 'a' && opname[5] == '\0')
{
/* Assignment. */
+ size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
if (strlen (optable[i].in) == 3
@@ -440,12 +670,12 @@ cplus_demangle_opname (opname, result, options)
strcat (result, optable[i].out);
ret = 1;
break;
- }
+ }
}
}
}
}
- else if (len >= 3
+ else if (len >= 3
&& opname[0] == 'o'
&& opname[1] == 'p'
&& strchr (cplus_markers, opname[2]) != NULL)
@@ -454,10 +684,11 @@ cplus_demangle_opname (opname, result, options)
if (len >= 10 /* op$assign_ */
&& memcmp (opname + 3, "assign_", 7) == 0)
{
+ size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
len1 = len - 10;
- if (strlen (optable[i].in) == len1
+ if ((int) strlen (optable[i].in) == len1
&& memcmp (optable[i].in, opname + 10, len1) == 0)
{
strcat (result, "operator");
@@ -470,10 +701,11 @@ cplus_demangle_opname (opname, result, options)
}
else
{
+ size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
len1 = len - 3;
- if (strlen (optable[i].in) == len1
+ if ((int) strlen (optable[i].in) == len1
&& memcmp (optable[i].in, opname + 3, len1) == 0)
{
strcat (result, "operator");
@@ -497,6 +729,7 @@ cplus_demangle_opname (opname, result, options)
ret = 1;
}
}
+ squangle_mop_up (work);
return ret;
}
@@ -511,13 +744,13 @@ cplus_mangle_opname (opname, options)
const char *opname;
int options;
{
- int i;
+ size_t i;
int len;
len = strlen (opname);
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
- if (strlen (optable[i].out) == len
+ if ((int) strlen (optable[i].out) == len
&& (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI)
&& memcmp (optable[i].out, opname, len) == 0)
return optable[i].in;
@@ -540,7 +773,7 @@ cplus_mangle_opname (opname, options)
DMGL_PARAMS Function parameters are included.
For example,
-
+
cplus_demangle ("foo__1Ai", DMGL_PARAMS) => "A::foo(int)"
cplus_demangle ("foo__1Ai", DMGL_PARAMS | DMGL_ANSI) => "A::foo(int)"
cplus_demangle ("foo__1Ai", 0) => "A::foo"
@@ -558,18 +791,45 @@ cplus_demangle (mangled, options)
const char *mangled;
int options;
{
+ char *ret;
+ struct work_stuff work[1];
+ memset ((char *) work, 0, sizeof (work));
+ work -> options = options;
+ if ((work -> options & DMGL_STYLE_MASK) == 0)
+ work -> options |= (int) current_demangling_style & DMGL_STYLE_MASK;
+
+ ret = internal_cplus_demangle (work, mangled);
+ squangle_mop_up (work);
+ return (ret);
+}
+
+
+/* This function performs most of what cplus_demangle use to do, but
+ to be able to demangle a name with a B, K or n code, we need to
+ have a longer term memory of what types have been seen. The original
+ now intializes and cleans up the squangle code info, while internal
+ calls go directly to this routine to avoid resetting that info. */
+
+static char *
+internal_cplus_demangle (work, mangled)
+ struct work_stuff *work;
+ const char *mangled;
+{
+
string decl;
int success = 0;
- struct work_stuff work[1];
char *demangled = NULL;
+ int s1,s2,s3,s4;
+ s1 = work->constructor;
+ s2 = work->destructor;
+ s3 = work->static_type;
+ s4 = work->type_quals;
+ work->constructor = work->destructor = 0;
+ work->type_quals = TYPE_UNQUALIFIED;
+ work->dllimported = 0;
if ((mangled != NULL) && (*mangled != '\0'))
{
- memset ((char *) work, 0, sizeof (work));
- work -> options = options;
- if ((work->options & DMGL_STYLE_MASK) == 0)
- work->options |= (int)current_demangling_style & DMGL_STYLE_MASK;
-
string_init (&decl);
/* First check to see if gnu style demangling is active and if the
@@ -593,19 +853,48 @@ cplus_demangle (mangled, options)
}
if (work->constructor == 2)
{
- string_prepend(&decl, "global constructors keyed to ");
+ string_prepend (&decl, "global constructors keyed to ");
work->constructor = 0;
}
else if (work->destructor == 2)
{
- string_prepend(&decl, "global destructors keyed to ");
+ string_prepend (&decl, "global destructors keyed to ");
work->destructor = 0;
}
+ else if (work->dllimported == 1)
+ {
+ string_prepend (&decl, "import stub for ");
+ work->dllimported = 0;
+ }
demangled = mop_up (work, &decl, success);
}
+ work->constructor = s1;
+ work->destructor = s2;
+ work->static_type = s3;
+ work->type_quals = s4;
return (demangled);
}
+
+/* Clear out and squangling related storage */
+static void
+squangle_mop_up (work)
+ struct work_stuff *work;
+{
+ /* clean up the B and K type mangling types. */
+ forget_B_and_K_types (work);
+ if (work -> btypevec != NULL)
+ {
+ free ((char *) work -> btypevec);
+ }
+ if (work -> ktypevec != NULL)
+ {
+ free ((char *) work -> ktypevec);
+ }
+}
+
+/* Clear out any mangled storage */
+
static char *
mop_up (work, declp, success)
struct work_stuff *work;
@@ -615,11 +904,13 @@ mop_up (work, declp, success)
char *demangled = NULL;
/* Discard the remembered types, if any. */
-
+
forget_types (work);
if (work -> typevec != NULL)
{
free ((char *) work -> typevec);
+ work -> typevec = NULL;
+ work -> typevec_size = 0;
}
if (work->tmpl_argvec)
{
@@ -628,13 +919,20 @@ mop_up (work, declp, success)
for (i = 0; i < work->ntmpl_args; i++)
if (work->tmpl_argvec[i])
free ((char*) work->tmpl_argvec[i]);
-
+
free ((char*) work->tmpl_argvec);
+ work->tmpl_argvec = NULL;
+ }
+ if (work->previous_argument)
+ {
+ string_delete (work->previous_argument);
+ free ((char*) work->previous_argument);
+ work->previous_argument = NULL;
}
/* If demangling was successful, ensure that the demangled string is null
terminated and return it. Otherwise, free the demangling decl. */
-
+
if (!success)
{
string_delete (declp);
@@ -699,16 +997,22 @@ demangle_signature (work, mangled, declp)
oldmangled = *mangled;
success = demangle_qualified (work, mangled, declp, 1, 0);
if (success)
- {
- remember_type (work, oldmangled, *mangled - oldmangled);
- }
+ remember_type (work, oldmangled, *mangled - oldmangled);
+ if (AUTO_DEMANGLING || GNU_DEMANGLING)
+ expect_func = 1;
+ oldmangled = NULL;
+ break;
+
+ case 'K':
+ oldmangled = *mangled;
+ success = demangle_qualified (work, mangled, declp, 1, 0);
if (AUTO_DEMANGLING || GNU_DEMANGLING)
{
expect_func = 1;
}
oldmangled = NULL;
break;
-
+
case 'S':
/* Static member function */
if (oldmangled == NULL)
@@ -720,36 +1024,70 @@ demangle_signature (work, mangled, declp)
break;
case 'C':
- /* a const member function */
+ case 'V':
+ case 'u':
+ work->type_quals |= code_for_qualifier (**mangled);
+
+ /* a qualified member function */
if (oldmangled == NULL)
+ oldmangled = *mangled;
+ (*mangled)++;
+ break;
+
+ case 'L':
+ /* Local class name follows after "Lnnn_" */
+ if (HP_DEMANGLING)
{
- oldmangled = *mangled;
+ while (**mangled && (**mangled != '_'))
+ (*mangled)++;
+ if (!**mangled)
+ success = 0;
+ else
+ (*mangled)++;
}
- (*mangled)++;
- work -> const_type = 1;
+ else
+ success = 0;
break;
-
+
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (oldmangled == NULL)
{
oldmangled = *mangled;
}
+ work->temp_start = -1; /* uppermost call to demangle_class */
success = demangle_class (work, mangled, declp);
if (success)
{
remember_type (work, oldmangled, *mangled - oldmangled);
}
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
+ if (AUTO_DEMANGLING || GNU_DEMANGLING || EDG_DEMANGLING)
{
- expect_func = 1;
+ /* EDG and others will have the "F", so we let the loop cycle
+ if we are looking at one. */
+ if (**mangled != 'F')
+ expect_func = 1;
}
oldmangled = NULL;
break;
-
+
+ case 'B':
+ {
+ string s;
+ success = do_type (work, mangled, &s);
+ if (success)
+ {
+ string_append (&s, SCOPE_STRING (work));
+ string_prepends (declp, &s);
+ }
+ oldmangled = NULL;
+ expect_func = 1;
+ }
+ break;
+
case 'F':
/* Function */
- /* ARM style demangling includes a specific 'F' character after
+ /* ARM/HP style demangling includes a specific 'F' character after
the class name. For GNU style, it is just implied. So we can
safely just consume any 'F' at this point and be compatible
with either style. */
@@ -758,32 +1096,45 @@ demangle_signature (work, mangled, declp)
func_done = 1;
(*mangled)++;
- /* For lucid/ARM style we have to forget any types we might
+ /* For lucid/ARM/HP style we have to forget any types we might
have remembered up to this point, since they were not argument
types. GNU style considers all types seen as available for
back references. See comment in demangle_args() */
- if (LUCID_DEMANGLING || ARM_DEMANGLING)
+ if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
{
forget_types (work);
}
success = demangle_args (work, mangled, declp);
+ /* After picking off the function args, we expect to either
+ find the function return type (preceded by an '_') or the
+ end of the string. */
+ if (success && (AUTO_DEMANGLING || EDG_DEMANGLING) && **mangled == '_')
+ {
+ ++(*mangled);
+ /* At this level, we do not care about the return type. */
+ success = do_type (work, mangled, &tname);
+ string_delete (&tname);
+ }
+
break;
-
+
case 't':
/* G++ Template */
- string_init(&trawname);
+ string_init(&trawname);
string_init(&tname);
if (oldmangled == NULL)
{
oldmangled = *mangled;
}
- success = demangle_template (work, mangled, &tname, &trawname, 1);
+ success = demangle_template (work, mangled, &tname,
+ &trawname, 1, 1);
if (success)
{
remember_type (work, oldmangled, *mangled - oldmangled);
}
- string_append(&tname, (work -> options & DMGL_JAVA) ? "." : "::");
+ string_append (&tname, SCOPE_STRING (work));
+
string_prepends(declp, &tname);
if (work -> destructor & 1)
{
@@ -803,7 +1154,7 @@ demangle_signature (work, mangled, declp)
break;
case '_':
- if (GNU_DEMANGLING && expect_return_type)
+ if (GNU_DEMANGLING && expect_return_type)
{
/* Read the return type. */
string return_type;
@@ -823,14 +1174,25 @@ demangle_signature (work, mangled, declp)
a mangled name that is either bogus, or has been mangled by
some algorithm we don't know how to deal with. So just
reject the entire demangling. */
- success = 0;
+ /* However, "_nnn" is an expected suffix for alternate entry point
+ numbered nnn for a function, with HP aCC, so skip over that
+ without reporting failure. pai/1997-09-04 */
+ if (HP_DEMANGLING)
+ {
+ (*mangled)++;
+ while (**mangled && isdigit ((unsigned char)**mangled))
+ (*mangled)++;
+ }
+ else
+ success = 0;
break;
case 'H':
- if (GNU_DEMANGLING)
+ if (GNU_DEMANGLING)
{
/* A G++ template function. Read the template arguments. */
- success = demangle_template (work, mangled, declp, 0, 0);
+ success = demangle_template (work, mangled, declp, 0, 0,
+ 0);
if (!(work->constructor & 1))
expect_return_type = 1;
(*mangled)++;
@@ -838,7 +1200,7 @@ demangle_signature (work, mangled, declp)
}
else
/* fall through */
- ;
+ {;}
default:
if (AUTO_DEMANGLING || GNU_DEMANGLING)
@@ -852,7 +1214,7 @@ demangle_signature (work, mangled, declp)
{
/* Non-GNU demanglers use a specific token to mark the start
of the outermost function argument tokens. Typically 'F',
- for ARM-demangling, for example. So if we find something
+ for ARM/HP-demangling, for example. So if we find something
we are not prepared for, it must be an error. */
success = 0;
}
@@ -865,6 +1227,10 @@ demangle_signature (work, mangled, declp)
if (success && expect_func)
{
func_done = 1;
+ if (LUCID_DEMANGLING || ARM_DEMANGLING || EDG_DEMANGLING)
+ {
+ forget_types (work);
+ }
success = demangle_args (work, mangled, declp);
/* Since template include the mangling of their return types,
we must set expect_func to 0 so that we don't try do
@@ -880,20 +1246,23 @@ demangle_signature (work, mangled, declp)
/* With GNU style demangling, bar__3foo is 'foo::bar(void)', and
bar__3fooi is 'foo::bar(int)'. We get here when we find the
first case, and need to ensure that the '(void)' gets added to
- the current declp. Note that with ARM, the first case
+ the current declp. Note that with ARM/HP, the first case
represents the name of a static data member 'foo::bar',
which is in the current declp, so we leave it alone. */
success = demangle_args (work, mangled, declp);
}
}
- if (success && work -> static_type && PRINT_ARG_TYPES)
+ if (success && PRINT_ARG_TYPES)
{
- string_append (declp, " static");
- }
- if (success && work -> const_type && PRINT_ARG_TYPES)
- {
- string_append (declp, " const");
+ if (work->static_type)
+ string_append (declp, " static");
+ if (work->type_quals != TYPE_UNQUALIFIED)
+ {
+ APPEND_BLANK (declp);
+ string_append (declp, qualifier_string (work->type_quals));
+ }
}
+
return (success);
}
@@ -923,47 +1292,400 @@ demangle_method_args (work, mangled, declp)
#endif
static int
-demangle_template (work, mangled, tname, trawname, is_type)
+demangle_template_template_parm (work, mangled, tname)
+ struct work_stuff *work;
+ const char **mangled;
+ string *tname;
+{
+ int i;
+ int r;
+ int need_comma = 0;
+ int success = 1;
+ string temp;
+
+ string_append (tname, "template <");
+ /* get size of template parameter list */
+ if (get_count (mangled, &r))
+ {
+ for (i = 0; i < r; i++)
+ {
+ if (need_comma)
+ {
+ string_append (tname, ", ");
+ }
+
+ /* Z for type parameters */
+ if (**mangled == 'Z')
+ {
+ (*mangled)++;
+ string_append (tname, "class");
+ }
+ /* z for template parameters */
+ else if (**mangled == 'z')
+ {
+ (*mangled)++;
+ success =
+ demangle_template_template_parm (work, mangled, tname);
+ if (!success)
+ {
+ break;
+ }
+ }
+ else
+ {
+ /* temp is initialized in do_type */
+ success = do_type (work, mangled, &temp);
+ if (success)
+ {
+ string_appends (tname, &temp);
+ }
+ string_delete(&temp);
+ if (!success)
+ {
+ break;
+ }
+ }
+ need_comma = 1;
+ }
+
+ }
+ if (tname->p[-1] == '>')
+ string_append (tname, " ");
+ string_append (tname, "> class");
+ return (success);
+}
+
+static int
+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;
+
+ success = 1;
+ string_appendn (s, "(", 1);
+ (*mangled)++;
+ while (success && **mangled != 'W' && **mangled != '\0')
+ {
+ if (need_operator)
+ {
+ size_t i;
+ size_t len;
+
+ success = 0;
+
+ len = strlen (*mangled);
+
+ 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 (!success)
+ break;
+ }
+ else
+ 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)++;
+ }
+ }
+
+ return 1;
+}
+
+static int
+demangle_template_value_parm (work, mangled, s, tk)
+ struct work_stuff *work;
+ const char **mangled;
+ string* s;
+ type_kind_t tk;
+{
+ int success = 1;
+
+ if (**mangled == 'Y')
+ {
+ /* The next argument is a template parameter. */
+ int idx;
+
+ (*mangled)++;
+ idx = consume_count_with_underscores (mangled);
+ if (idx == -1
+ || (work->tmpl_argvec && idx >= work->ntmpl_args)
+ || consume_count_with_underscores (mangled) == -1)
+ return -1;
+ if (work->tmpl_argvec)
+ string_append (s, work->tmpl_argvec[idx]);
+ else
+ string_append_template_idx (s, idx);
+ }
+ else if (tk == tk_integral)
+ success = demangle_integral_value (work, mangled, s);
+ else if (tk == tk_char)
+ {
+ char tmp[2];
+ int val;
+ if (**mangled == 'm')
+ {
+ string_appendn (s, "-", 1);
+ (*mangled)++;
+ }
+ string_appendn (s, "'", 1);
+ val = consume_count(mangled);
+ if (val <= 0)
+ success = 0;
+ else
+ {
+ tmp[0] = (char)val;
+ tmp[1] = '\0';
+ string_appendn (s, &tmp[0], 1);
+ string_appendn (s, "'", 1);
+ }
+ }
+ else if (tk == tk_bool)
+ {
+ int val = consume_count (mangled);
+ if (val == 0)
+ string_appendn (s, "false", 5);
+ else if (val == 1)
+ string_appendn (s, "true", 4);
+ else
+ success = 0;
+ }
+ else if (tk == tk_real)
+ success = demangle_real_value (work, mangled, s);
+ else if (tk == tk_pointer || tk == tk_reference)
+ {
+ if (**mangled == 'Q')
+ success = demangle_qualified (work, mangled, s,
+ /*isfuncname=*/0,
+ /*append=*/1);
+ else
+ {
+ int symbol_len = consume_count (mangled);
+ if (symbol_len == -1)
+ return -1;
+ if (symbol_len == 0)
+ string_appendn (s, "0", 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)
+ {
+ string_append (s, q);
+ free (q);
+ }
+ else
+ string_append (s, p);
+ free (p);
+ }
+ *mangled += symbol_len;
+ }
+ }
+
+ return success;
+}
+
+/* Demangle the template name in MANGLED. The full name of the
+ template (e.g., S<int>) is placed in TNAME. The name without the
+ template parameters (e.g. S) is placed in TRAWNAME if TRAWNAME is
+ non-NULL. If IS_TYPE is nonzero, this template is a type template,
+ not a function template. If both IS_TYPE and REMEMBER are nonzero,
+ the tmeplate is remembered in the list of back-referenceable
+ types. */
+
+static int
+demangle_template (work, mangled, tname, trawname, is_type, remember)
struct work_stuff *work;
const char **mangled;
string *tname;
string *trawname;
int is_type;
+ int remember;
{
int i;
- int is_pointer;
- int is_real;
- int is_integral;
- int is_char;
- int is_bool;
int r;
int need_comma = 0;
int success = 0;
- int done;
- const char *old_p;
const char *start;
- int symbol_len;
int is_java_array = 0;
string temp;
+ int bindex = 0;
(*mangled)++;
if (is_type)
{
+ if (remember)
+ bindex = register_Btype (work);
start = *mangled;
/* get template name */
- if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r)
+ if (**mangled == 'z')
{
- return (0);
+ int idx;
+ (*mangled)++;
+ (*mangled)++;
+
+ idx = consume_count_with_underscores (mangled);
+ if (idx == -1
+ || (work->tmpl_argvec && idx >= work->ntmpl_args)
+ || consume_count_with_underscores (mangled) == -1)
+ return (0);
+
+ if (work->tmpl_argvec)
+ {
+ string_append (tname, work->tmpl_argvec[idx]);
+ if (trawname)
+ string_append (trawname, work->tmpl_argvec[idx]);
+ }
+ else
+ {
+ string_append_template_idx (tname, idx);
+ if (trawname)
+ string_append_template_idx (trawname, idx);
+ }
}
- if (trawname)
- string_appendn (trawname, *mangled, r);
- is_java_array = (work -> options & DMGL_JAVA)
- && strncmp (*mangled, "JArray1Z", 8) == 0;
- if (! is_java_array)
+ else
{
- string_appendn (tname, *mangled, r);
+ if ((r = consume_count (mangled)) <= 0
+ || (int) strlen (*mangled) < r)
+ {
+ return (0);
+ }
+ is_java_array = (work -> options & DMGL_JAVA)
+ && strncmp (*mangled, "JArray1Z", 8) == 0;
+ if (! is_java_array)
+ {
+ string_appendn (tname, *mangled, r);
+ }
+ if (trawname)
+ string_appendn (trawname, *mangled, r);
+ *mangled += r;
}
- *mangled += r;
}
if (!is_java_array)
string_append (tname, "<");
@@ -1011,35 +1733,46 @@ demangle_template (work, mangled, tname, trawname, is_type)
break;
}
}
+ /* z for template parameters */
+ else if (**mangled == 'z')
+ {
+ int r2;
+ (*mangled)++;
+ success = demangle_template_template_parm (work, mangled, tname);
+
+ if (success
+ && (r2 = consume_count (mangled)) > 0
+ && (int) strlen (*mangled) >= r2)
+ {
+ string_append (tname, " ");
+ string_appendn (tname, *mangled, r2);
+ if (!is_type)
+ {
+ /* Save the template argument. */
+ int len = r2;
+ work->tmpl_argvec[i] = xmalloc (len + 1);
+ memcpy (work->tmpl_argvec[i], *mangled, len);
+ work->tmpl_argvec[i][len] = '\0';
+ }
+ *mangled += r2;
+ }
+ if (!success)
+ {
+ break;
+ }
+ }
else
{
string param;
string* s;
/* otherwise, value parameter */
- old_p = *mangled;
- is_pointer = 0;
- is_real = 0;
- is_integral = 0;
- is_char = 0;
- is_bool = 0;
- done = 0;
+
/* temp is initialized in do_type */
success = do_type (work, mangled, &temp);
- /*
- if (success)
- {
- string_appends (s, &temp);
- }
- */
string_delete(&temp);
if (!success)
- {
- break;
- }
- /*
- string_append (s, "=");
- */
+ break;
if (!is_type)
{
@@ -1049,200 +1782,24 @@ demangle_template (work, mangled, tname, trawname, is_type)
else
s = tname;
- while (*old_p && !done)
- {
- switch (*old_p)
- {
- case 'P':
- case 'p':
- case 'R':
- done = is_pointer = 1;
- break;
- case 'C': /* const */
- case 'S': /* explicitly signed [char] */
- case 'U': /* unsigned */
- case 'V': /* volatile */
- case 'F': /* function */
- case 'M': /* member function */
- case 'O': /* ??? */
- case 'J': /* complex */
- old_p++;
- continue;
- case 'Q': /* qualified name */
- done = is_integral = 1;
- break;
- case 'T': /* remembered type */
- abort ();
- break;
- case 'v': /* void */
- abort ();
- break;
- case 'x': /* long long */
- case 'l': /* long */
- case 'i': /* int */
- case 's': /* short */
- case 'w': /* wchar_t */
- done = is_integral = 1;
- break;
- case 'b': /* bool */
- done = is_bool = 1;
- break;
- case 'c': /* char */
- done = is_char = 1;
- break;
- case 'r': /* long double */
- case 'd': /* double */
- case 'f': /* float */
- done = is_real = 1;
- break;
- default:
- /* it's probably user defined type, let's assume
- it's integral, it seems hard to figure out
- what it really is */
- done = is_integral = 1;
- }
- }
- if (**mangled == 'Y')
- {
- /* The next argument is a template parameter. */
- int idx;
+ success = demangle_template_value_parm (work, mangled, s,
+ (type_kind_t) success);
- (*mangled)++;
- idx = consume_count_with_underscores (mangled);
- if (idx == -1
- || (work->tmpl_argvec && idx >= work->ntmpl_args)
- || consume_count_with_underscores (mangled) == -1)
- {
- success = 0;
- if (!is_type)
- string_delete (s);
- break;
- }
- if (work->tmpl_argvec)
- string_append (s, work->tmpl_argvec[idx]);
- else
- {
- char buf[10];
- sprintf(buf, "T%d", idx);
- string_append (s, buf);
- }
- }
- else if (is_integral)
- {
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- while (isdigit (**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- }
- else if (is_char)
- {
- char tmp[2];
- int val;
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- string_appendn (s, "'", 1);
- val = consume_count(mangled);
- if (val == 0)
- {
- success = 0;
- if (!is_type)
- string_delete (s);
- break;
- }
- tmp[0] = (char)val;
- tmp[1] = '\0';
- string_appendn (s, &tmp[0], 1);
- string_appendn (s, "'", 1);
- }
- else if (is_bool)
- {
- int val = consume_count (mangled);
- if (val == 0)
- string_appendn (s, "false", 5);
- else if (val == 1)
- string_appendn (s, "true", 4);
- else
- success = 0;
- }
- else if (is_real)
- {
- if (**mangled == 'm')
- {
- string_appendn (s, "-", 1);
- (*mangled)++;
- }
- while (isdigit (**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- if (**mangled == '.') /* fraction */
- {
- string_appendn (s, ".", 1);
- (*mangled)++;
- while (isdigit (**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- }
- if (**mangled == 'e') /* exponent */
- {
- string_appendn (s, "e", 1);
- (*mangled)++;
- while (isdigit (**mangled))
- {
- string_appendn (s, *mangled, 1);
- (*mangled)++;
- }
- }
- }
- else if (is_pointer)
+ if (!success)
{
- symbol_len = consume_count (mangled);
- if (symbol_len == 0)
- {
- success = 0;
- if (!is_type)
- string_delete (s);
- break;
- }
- if (symbol_len == 0)
- string_appendn (s, "0", 1);
- else
- {
- char *p = xmalloc (symbol_len + 1), *q;
- strncpy (p, *mangled, symbol_len);
- p [symbol_len] = '\0';
- q = cplus_demangle (p, work->options);
- string_appendn (s, "&", 1);
- if (q)
- {
- string_append (s, q);
- free (q);
- }
- else
- string_append (s, p);
- free (p);
- }
- *mangled += symbol_len;
+ if (!is_type)
+ string_delete (s);
+ success = 0;
+ break;
}
+
if (!is_type)
{
int len = s->p - s->b;
work->tmpl_argvec[i] = xmalloc (len + 1);
memcpy (work->tmpl_argvec[i], s->b, len);
work->tmpl_argvec[i][len] = '\0';
-
+
string_appends (tname, s);
string_delete (s);
}
@@ -1259,7 +1816,10 @@ demangle_template (work, mangled, tname, trawname, is_type)
string_append (tname, " ");
string_append (tname, ">");
}
-
+
+ if (is_type && remember)
+ remember_Btype (work, tname->b, LEN_STRING (tname), bindex);
+
/*
if (work -> static_type)
{
@@ -1283,23 +1843,58 @@ arm_pt (work, mangled, n, anchor, args)
int n;
const char **anchor, **args;
{
- /* ARM template? */
- if (ARM_DEMANGLING && (*anchor = mystrstr (mangled, "__pt__")))
+ /* Check if ARM template with "__pt__" in it ("parameterized type") */
+ /* Allow HP also here, because HP's cfront compiler follows ARM to some extent */
+ if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = mystrstr (mangled, "__pt__")))
{
int len;
*args = *anchor + 6;
len = consume_count (args);
+ if (len == -1)
+ return 0;
if (*args + len == mangled + n && **args == '_')
{
++*args;
return 1;
}
}
+ if (AUTO_DEMANGLING || EDG_DEMANGLING)
+ {
+ if ((*anchor = mystrstr (mangled, "__tm__"))
+ || (*anchor = mystrstr (mangled, "__ps__"))
+ || (*anchor = mystrstr (mangled, "__pt__")))
+ {
+ int len;
+ *args = *anchor + 6;
+ len = consume_count (args);
+ if (len == -1)
+ return 0;
+ if (*args + len == mangled + n && **args == '_')
+ {
+ ++*args;
+ return 1;
+ }
+ }
+ else if ((*anchor = mystrstr (mangled, "__S")))
+ {
+ int len;
+ *args = *anchor + 3;
+ len = consume_count (args);
+ if (len == -1)
+ return 0;
+ if (*args + len == mangled + n && **args == '_')
+ {
+ ++*args;
+ return 1;
+ }
+ }
+ }
+
return 0;
}
static void
-demangle_arm_pt (work, mangled, n, declp)
+demangle_arm_hp_template (work, mangled, n, declp)
struct work_stuff *work;
const char **mangled;
int n;
@@ -1308,32 +1903,150 @@ demangle_arm_pt (work, mangled, n, declp)
const char *p;
const char *args;
const char *e = *mangled + n;
+ string arg;
- /* ARM template? */
- if (arm_pt (work, *mangled, n, &p, &args))
+ /* Check for HP aCC template spec: classXt1t2 where t1, t2 are
+ template args */
+ if (HP_DEMANGLING && ((*mangled)[n] == 'X'))
+ {
+ char *start_spec_args = NULL;
+
+ /* First check for and omit template specialization pseudo-arguments,
+ such as in "Spec<#1,#1.*>" */
+ start_spec_args = strchr (*mangled, '<');
+ if (start_spec_args && (start_spec_args - *mangled < n))
+ string_appendn (declp, *mangled, start_spec_args - *mangled);
+ else
+ string_appendn (declp, *mangled, n);
+ (*mangled) += n + 1;
+ string_init (&arg);
+ if (work->temp_start == -1) /* non-recursive call */
+ work->temp_start = declp->p - declp->b;
+ string_append (declp, "<");
+ while (1)
+ {
+ string_clear (&arg);
+ switch (**mangled)
+ {
+ case 'T':
+ /* 'T' signals a type parameter */
+ (*mangled)++;
+ if (!do_type (work, mangled, &arg))
+ goto hpacc_template_args_done;
+ break;
+
+ case 'U':
+ case 'S':
+ /* 'U' or 'S' signals an integral value */
+ if (!do_hpacc_template_const_value (work, mangled, &arg))
+ goto hpacc_template_args_done;
+ break;
+
+ case 'A':
+ /* 'A' signals a named constant expression (literal) */
+ if (!do_hpacc_template_literal (work, mangled, &arg))
+ goto hpacc_template_args_done;
+ break;
+
+ default:
+ /* Today, 1997-09-03, we have only the above types
+ of template parameters */
+ /* FIXME: maybe this should fail and return null */
+ goto hpacc_template_args_done;
+ }
+ string_appends (declp, &arg);
+ /* Check if we're at the end of template args.
+ 0 if at end of static member of template class,
+ _ if done with template args for a function */
+ if ((**mangled == '\000') || (**mangled == '_'))
+ break;
+ else
+ string_append (declp, ",");
+ }
+ hpacc_template_args_done:
+ string_append (declp, ">");
+ string_delete (&arg);
+ if (**mangled == '_')
+ (*mangled)++;
+ return;
+ }
+ /* ARM template? (Also handles HP cfront extensions) */
+ else if (arm_pt (work, *mangled, n, &p, &args))
{
- string arg;
+ string type_str;
+
string_init (&arg);
string_appendn (declp, *mangled, p - *mangled);
+ if (work->temp_start == -1) /* non-recursive call */
+ work->temp_start = declp->p - declp->b;
string_append (declp, "<");
/* should do error checking here */
while (args < e) {
string_clear (&arg);
- do_type (work, &args, &arg);
+
+ /* Check for type or literal here */
+ switch (*args)
+ {
+ /* HP cfront extensions to ARM for template args */
+ /* spec: Xt1Lv1 where t1 is a type, v1 is a literal value */
+ /* FIXME: We handle only numeric literals for HP cfront */
+ case 'X':
+ /* A typed constant value follows */
+ args++;
+ if (!do_type (work, &args, &type_str))
+ goto cfront_template_args_done;
+ string_append (&arg, "(");
+ string_appends (&arg, &type_str);
+ string_append (&arg, ")");
+ if (*args != 'L')
+ goto cfront_template_args_done;
+ args++;
+ /* Now snarf a literal value following 'L' */
+ if (!snarf_numeric_literal (&args, &arg))
+ goto cfront_template_args_done;
+ break;
+
+ case 'L':
+ /* Snarf a literal following 'L' */
+ args++;
+ if (!snarf_numeric_literal (&args, &arg))
+ goto cfront_template_args_done;
+ break;
+ default:
+ /* Not handling other HP cfront stuff */
+ if (!do_type (work, &args, &arg))
+ goto cfront_template_args_done;
+ }
string_appends (declp, &arg);
string_append (declp, ",");
}
+ cfront_template_args_done:
string_delete (&arg);
- --declp->p;
+ if (args >= e)
+ --declp->p; /* remove extra comma */
string_append (declp, ">");
}
+ else if (n>10 && strncmp (*mangled, "_GLOBAL_", 8) == 0
+ && (*mangled)[9] == 'N'
+ && (*mangled)[8] == (*mangled)[10]
+ && strchr (cplus_markers, (*mangled)[8]))
+ {
+ /* A member of the anonymous namespace. */
+ string_append (declp, "{anonymous}");
+ }
else
{
+ if (work->temp_start == -1) /* non-recursive call only */
+ work->temp_start = 0; /* disable in recursive calls */
string_appendn (declp, *mangled, n);
}
*mangled += n;
}
+/* Extract a class name, possibly a template with arguments, from the
+ mangled string; qualifiers, local class indicators, etc. have
+ already been dealt with */
+
static int
demangle_class_name (work, mangled, declp)
struct work_stuff *work;
@@ -1344,9 +2057,11 @@ demangle_class_name (work, mangled, declp)
int success = 0;
n = consume_count (mangled);
- if (strlen (*mangled) >= n)
+ if (n == -1)
+ return 0;
+ if ((int) strlen (*mangled) >= n)
{
- demangle_arm_pt (work, mangled, n, declp);
+ demangle_arm_hp_template (work, mangled, n, declp);
success = 1;
}
@@ -1395,13 +2110,22 @@ demangle_class (work, mangled, declp)
string *declp;
{
int success = 0;
+ int btype;
string class_name;
+ char *save_class_name_end = 0;
string_init (&class_name);
+ btype = register_Btype (work);
if (demangle_class_name (work, mangled, &class_name))
{
+ save_class_name_end = class_name.p;
if ((work->constructor & 1) || (work->destructor & 1))
{
+ /* adjust so we don't include template args */
+ if (work->temp_start && (work->temp_start != -1))
+ {
+ class_name.p = class_name.b + work->temp_start;
+ }
string_prepends (declp, &class_name);
if (work -> destructor & 1)
{
@@ -1410,10 +2134,13 @@ demangle_class (work, mangled, declp)
}
else
{
- work -> constructor -= 1;
+ work -> constructor -= 1;
}
}
- string_prepend (declp, (work -> options & DMGL_JAVA) ? "." : "::");
+ class_name.p = save_class_name_end;
+ remember_Ktype (work, class_name.b, LEN_STRING(&class_name));
+ remember_Btype (work, class_name.b, LEN_STRING(&class_name), btype);
+ string_prepend (declp, SCOPE_STRING (work));
string_prepends (declp, &class_name);
success = 1;
}
@@ -1448,7 +2175,7 @@ DESCRIPTION
the mangled name. Upon exit, it should point to the first character
of the signature if demangling was successful, or to the first
unconsumed character if demangling of the prefix was unsuccessful.
-
+
Returns 1 on success, 0 otherwise.
*/
@@ -1462,7 +2189,17 @@ demangle_prefix (work, mangled, declp)
const char *scan;
int i;
- if (strlen(*mangled) >= 11 && strncmp(*mangled, "_GLOBAL_", 8) == 0)
+ if (strlen(*mangled) > 6
+ && (strncmp(*mangled, "_imp__", 6) == 0
+ || strncmp(*mangled, "__imp_", 6) == 0))
+ {
+ /* it's a symbol imported from a PE dynamic library. Check for both
+ new style prefix _imp__ and legacy __imp_ used by older versions
+ of dlltool. */
+ (*mangled) += 6;
+ work->dllimported = 1;
+ }
+ else if (strlen(*mangled) >= 11 && strncmp(*mangled, "_GLOBAL_", 8) == 0)
{
char *marker = strchr (cplus_markers, (*mangled)[8]);
if (marker != NULL && *marker == (*mangled)[10])
@@ -1485,13 +2222,13 @@ demangle_prefix (work, mangled, declp)
}
}
}
- else if (ARM_DEMANGLING && strncmp(*mangled, "__std__", 7) == 0)
+ else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__std__", 7) == 0)
{
/* it's a ARM global destructor to be executed at program exit */
(*mangled) += 7;
work->destructor = 2;
}
- else if (ARM_DEMANGLING && strncmp(*mangled, "__sti__", 7) == 0)
+ else if ((ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING) && strncmp(*mangled, "__sti__", 7) == 0)
{
/* it's a ARM global constructor to be executed at program initial */
(*mangled) += 7;
@@ -1519,35 +2256,36 @@ demangle_prefix (work, mangled, declp)
i = strspn (scan, "_");
if (i > 2)
{
- scan += (i - 2);
+ scan += (i - 2);
}
}
-
+
if (scan == NULL)
{
success = 0;
}
else if (work -> static_type)
{
- if (!isdigit (scan[0]) && (scan[0] != 't'))
+ if (!isdigit ((unsigned char)scan[0]) && (scan[0] != 't'))
{
success = 0;
}
}
else if ((scan == *mangled)
- && (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't')
- || (scan[2] == 'H')))
+ && (isdigit ((unsigned char)scan[2]) || (scan[2] == 'Q')
+ || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H')))
{
/* The ARM says nothing about the mangling of local variables.
But cfront mangles local variables by prepending __<nesting_level>
to them. As an extension to ARM demangling we handle this case. */
- if ((LUCID_DEMANGLING || ARM_DEMANGLING) && isdigit (scan[2]))
+ if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING)
+ && isdigit ((unsigned char)scan[2]))
{
*mangled = scan + 2;
consume_count (mangled);
string_append (declp, *mangled);
*mangled += strlen (*mangled);
- success = 1;
+ success = 1;
}
else
{
@@ -1555,18 +2293,37 @@ demangle_prefix (work, mangled, declp)
names like __Q2_3foo3bar for nested type names. So don't accept
this style of constructor for cfront demangling. A GNU
style member-template constructor starts with 'H'. */
- if (!(LUCID_DEMANGLING || ARM_DEMANGLING))
+ if (!(LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING))
work -> constructor += 1;
*mangled = scan + 2;
}
}
- else if ((scan == *mangled) && !isdigit (scan[2]) && (scan[2] != 't'))
+ else if (ARM_DEMANGLING && scan[2] == 'p' && scan[3] == 't')
+ {
+ /* Cfront-style parameterized type. Handled later as a signature. */
+ success = 1;
+
+ /* ARM template? */
+ demangle_arm_hp_template (work, mangled, strlen (*mangled), declp);
+ }
+ else if (EDG_DEMANGLING && ((scan[2] == 't' && scan[3] == 'm')
+ || (scan[2] == 'p' && scan[3] == 's')
+ || (scan[2] == 'p' && scan[3] == 't')))
+ {
+ /* EDG-style parameterized type. Handled later as a signature. */
+ success = 1;
+
+ /* EDG template? */
+ demangle_arm_hp_template (work, mangled, strlen (*mangled), declp);
+ }
+ else if ((scan == *mangled) && !isdigit ((unsigned char)scan[2])
+ && (scan[2] != 't'))
{
/* Mangled name starts with "__". Skip over any leading '_' characters,
then find the next "__" that separates the prefix from the signature.
*/
- if (!(ARM_DEMANGLING || LUCID_DEMANGLING)
- || (arm_special (work, mangled, declp) == 0))
+ if (!(ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
+ || (arm_special (mangled, declp) == 0))
{
while (*scan == '_')
{
@@ -1580,18 +2337,22 @@ demangle_prefix (work, mangled, declp)
}
else
{
- demangle_function_name (work, mangled, declp, scan);
+ const char *tmp;
+
+ /* Look for the LAST occurrence of __, allowing names to
+ have the '__' sequence embedded in them. */
+ if (!(ARM_DEMANGLING || HP_DEMANGLING))
+ {
+ while ((tmp = mystrstr (scan + 2, "__")) != NULL)
+ scan = tmp;
+ }
+ if (*(scan + 2) == '\0')
+ success = 0;
+ else
+ demangle_function_name (work, mangled, declp, scan);
}
}
}
- else if (ARM_DEMANGLING && scan[2] == 'p' && scan[3] == 't')
- {
- /* Cfront-style parameterized type. Handled later as a signature. */
- success = 1;
-
- /* ARM template? */
- demangle_arm_pt (work, mangled, strlen (*mangled), declp);
- }
else if (*(scan + 2) != '\0')
{
/* Mangled name does not start with "__" but does have one somewhere
@@ -1610,7 +2371,7 @@ demangle_prefix (work, mangled, declp)
string_append (declp, *mangled);
*mangled += strlen (*mangled);
success = 1;
- }
+ }
return (success);
}
@@ -1679,24 +2440,25 @@ gnu_special (work, mangled, declp)
(*mangled) += 4; /* Old style, no thunks: "_vt<CPLUS_MARKER>" */
while (**mangled != '\0')
{
- p = strpbrk (*mangled, cplus_markers);
switch (**mangled)
{
case 'Q':
+ case 'K':
success = demangle_qualified (work, mangled, declp, 0, 1);
break;
case 't':
- success = demangle_template (work, mangled, declp, 0, 1);
+ success = demangle_template (work, mangled, declp, 0, 1,
+ 1);
break;
default:
- if (isdigit(*mangled[0]))
+ if (isdigit((unsigned char)*mangled[0]))
{
n = consume_count(mangled);
/* We may be seeing a too-large size, or else a
".<digits>" indicating a static local symbol. In
any case, declare victory and move on; *don't* try
to use n to allocate. */
- if (n >= strlen (*mangled))
+ if (n > (int) strlen (*mangled))
{
success = 1;
break;
@@ -1710,12 +2472,12 @@ gnu_special (work, mangled, declp)
(*mangled) += n;
}
+ p = strpbrk (*mangled, cplus_markers);
if (success && ((p == NULL) || (p == *mangled)))
{
if (p != NULL)
{
- string_append (declp,
- (work -> options & DMGL_JAVA) ? "." : "::");
+ string_append (declp, SCOPE_STRING (work));
(*mangled)++;
}
}
@@ -1737,13 +2499,19 @@ gnu_special (work, mangled, declp)
switch (**mangled)
{
case 'Q':
+ case 'K':
success = demangle_qualified (work, mangled, declp, 0, 1);
break;
case 't':
- success = demangle_template (work, mangled, declp, 0, 1);
+ success = demangle_template (work, mangled, declp, 0, 1, 1);
break;
default:
n = consume_count (mangled);
+ if (n < 0 || n > (long) strlen (*mangled))
+ {
+ success = 0;
+ break;
+ }
string_appendn (declp, *mangled, n);
(*mangled) += n;
}
@@ -1752,7 +2520,7 @@ gnu_special (work, mangled, declp)
/* Consumed everything up to the cplus_marker, append the
variable name. */
(*mangled)++;
- string_append (declp, (work -> options & DMGL_JAVA) ? "." : "::");
+ string_append (declp, SCOPE_STRING (work));
n = strlen (*mangled);
string_appendn (declp, *mangled, n);
(*mangled) += n;
@@ -1764,21 +2532,30 @@ gnu_special (work, mangled, declp)
}
else if (strncmp (*mangled, "__thunk_", 8) == 0)
{
- int delta = ((*mangled) += 8, consume_count (mangled));
- char *method = cplus_demangle (++*mangled, work->options);
- if (method)
- {
- char buf[50];
- sprintf (buf, "virtual function thunk (delta:%d) for ", -delta);
- string_append (declp, buf);
- string_append (declp, method);
- free (method);
- n = strlen (*mangled);
- (*mangled) += n;
- }
+ int delta;
+
+ (*mangled) += 8;
+ delta = consume_count (mangled);
+ if (delta == -1)
+ success = 0;
else
{
- success = 0;
+ char *method = internal_cplus_demangle (work, ++*mangled);
+
+ if (method)
+ {
+ char buf[50];
+ sprintf (buf, "virtual function thunk (delta:%d) for ", -delta);
+ string_append (declp, buf);
+ string_append (declp, method);
+ free (method);
+ n = strlen (*mangled);
+ (*mangled) += n;
+ }
+ else
+ {
+ success = 0;
+ }
}
}
else if (strncmp (*mangled, "__t", 3) == 0
@@ -1789,10 +2566,11 @@ gnu_special (work, mangled, declp)
switch (**mangled)
{
case 'Q':
+ case 'K':
success = demangle_qualified (work, mangled, declp, 0, 1);
break;
case 't':
- success = demangle_template (work, mangled, declp, 0, 1);
+ success = demangle_template (work, mangled, declp, 0, 1, 1);
break;
default:
success = demangle_fund_type (work, mangled, declp);
@@ -1810,6 +2588,35 @@ gnu_special (work, mangled, declp)
return (success);
}
+static void
+recursively_demangle(work, mangled, result, namelength)
+ struct work_stuff *work;
+ const char **mangled;
+ string *result;
+ int namelength;
+{
+ char * recurse = (char *)NULL;
+ char * recurse_dem = (char *)NULL;
+
+ recurse = (char *) xmalloc (namelength + 1);
+ memcpy (recurse, *mangled, namelength);
+ recurse[namelength] = '\000';
+
+ recurse_dem = cplus_demangle (recurse, work->options);
+
+ if (recurse_dem)
+ {
+ string_append (result, recurse_dem);
+ free (recurse_dem);
+ }
+ else
+ {
+ string_appendn (result, *mangled, namelength);
+ }
+ free (recurse);
+ *mangled += namelength;
+}
+
/*
LOCAL FUNCTION
@@ -1819,8 +2626,8 @@ LOCAL FUNCTION
SYNOPSIS
static int
- arm_special (struct work_stuff *work, const char **mangled,
- string *declp);
+ arm_special (const char **mangled,
+ string *declp);
DESCRIPTION
@@ -1834,8 +2641,7 @@ DESCRIPTION
*/
static int
-arm_special (work, mangled, declp)
- struct work_stuff *work;
+arm_special (mangled, declp)
const char **mangled;
string *declp;
{
@@ -1853,7 +2659,7 @@ arm_special (work, mangled, declp)
while (*scan != '\0') /* first check it can be demangled */
{
n = consume_count (&scan);
- if (n==0)
+ if (n == -1)
{
return (0); /* no good */
}
@@ -1867,6 +2673,9 @@ arm_special (work, mangled, declp)
while (**mangled != '\0')
{
n = consume_count (mangled);
+ if (n == -1
+ || n > (long) strlen (*mangled))
+ return 0;
string_prependn (declp, *mangled, n);
(*mangled) += n;
if ((*mangled)[0] == '_' && (*mangled)[1] == '_')
@@ -1924,33 +2733,43 @@ demangle_qualified (work, mangled, result, isfuncname, append)
int isfuncname;
int append;
{
- int qualifiers;
- int namelength;
+ int qualifiers = 0;
int success = 1;
- const char *p;
char num[2];
string temp;
+ string last_name;
+ int bindex = register_Btype (work);
+
+ /* We only make use of ISFUNCNAME if the entity is a constructor or
+ destructor. */
+ isfuncname = (isfuncname
+ && ((work->constructor & 1) || (work->destructor & 1)));
string_init (&temp);
- switch ((*mangled)[1])
+ string_init (&last_name);
+
+ if ((*mangled)[0] == 'K')
+ {
+ /* Squangling qualified name reuse */
+ int idx;
+ (*mangled)++;
+ idx = consume_count_with_underscores (mangled);
+ if (idx == -1 || idx >= work -> numk)
+ success = 0;
+ else
+ string_append (&temp, work -> ktypevec[idx]);
+ }
+ else
+ switch ((*mangled)[1])
{
case '_':
/* 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 (*p) || *p == '0')
- success = 0;
-
- /* Skip the digits. */
- while (isdigit (*p))
- ++p;
-
- if (*p != '_')
+ (*mangled)++;
+ qualifiers = consume_count_with_underscores (mangled);
+ if (qualifiers == -1)
success = 0;
-
- *mangled = p + 1;
break;
case '1':
@@ -1990,67 +2809,98 @@ demangle_qualified (work, mangled, result, isfuncname, append)
while (qualifiers-- > 0)
{
- if (*mangled[0] == '_')
- *mangled = *mangled + 1;
+ int remember_K = 1;
+ string_clear (&last_name);
+
+ if (*mangled[0] == '_')
+ (*mangled)++;
+
if (*mangled[0] == 't')
{
- success = demangle_template(work, mangled, &temp, 0, 1);
- if (!success) break;
+ /* Here we always append to TEMP since we will want to use
+ the template name without the template parameters as a
+ constructor or destructor name. The appropriate
+ (parameter-less) value is returned by demangle_template
+ in LAST_NAME. We do not remember the template type here,
+ in order to match the G++ mangling algorithm. */
+ success = demangle_template(work, mangled, &temp,
+ &last_name, 1, 0);
+ if (!success)
+ break;
}
- else if (*mangled[0] == 'X')
+ else if (*mangled[0] == 'K')
{
- success = do_type (work, mangled, &temp);
+ int idx;
+ (*mangled)++;
+ idx = consume_count_with_underscores (mangled);
+ if (idx == -1 || idx >= work->numk)
+ success = 0;
+ else
+ string_append (&temp, work->ktypevec[idx]);
+ remember_K = 0;
+
if (!success) break;
}
else
- {
- namelength = consume_count (mangled);
- if (strlen (*mangled) < namelength)
- {
- /* Simple sanity check failed */
- success = 0;
- break;
- }
- string_appendn (&temp, *mangled, namelength);
- *mangled += namelength;
+ {
+ if (EDG_DEMANGLING)
+ {
+ int namelength;
+ /* Now recursively demangle the qualifier
+ * This is necessary to deal with templates in
+ * mangling styles like EDG */
+ namelength = consume_count (mangled);
+ if (namelength == -1)
+ {
+ success = 0;
+ break;
+ }
+ recursively_demangle(work, mangled, &temp, namelength);
+ }
+ else
+ {
+ success = do_type (work, mangled, &last_name);
+ if (!success)
+ break;
+ string_appends (&temp, &last_name);
+ }
}
+
+ if (remember_K)
+ remember_Ktype (work, temp.b, LEN_STRING (&temp));
+
if (qualifiers > 0)
- {
- string_append (&temp, (work -> options & DMGL_JAVA) ? "." : "::");
- }
+ string_append (&temp, SCOPE_STRING (work));
}
+ remember_Btype (work, temp.b, LEN_STRING (&temp), bindex);
+
/* If we are using the result as a function name, we need to append
the appropriate '::' separated constructor or destructor name.
We do this here because this is the most convenient place, where
we already have a pointer to the name and the length of the name. */
- if (isfuncname && (work->constructor & 1 || work->destructor & 1))
+ if (isfuncname)
{
- string_append (&temp, (work -> options & DMGL_JAVA) ? "." : "::");
+ string_append (&temp, SCOPE_STRING (work));
if (work -> destructor & 1)
- {
- string_append (&temp, "~");
- }
- string_appendn (&temp, (*mangled) - namelength, namelength);
+ string_append (&temp, "~");
+ string_appends (&temp, &last_name);
}
- /* Now either prepend the temp buffer to the result, or append it,
+ /* Now either prepend the temp buffer to the result, or append it,
depending upon the state of the append flag. */
if (append)
- {
- string_appends (result, &temp);
- }
+ string_appends (result, &temp);
else
{
if (!STRING_EMPTY (result))
- {
- string_append (&temp, (work -> options & DMGL_JAVA) ? "." : "::");
- }
+ string_append (&temp, SCOPE_STRING (work));
string_prepends (result, &temp);
}
+ string_delete (&last_name);
string_delete (&temp);
return (success);
}
@@ -2068,7 +2918,37 @@ SYNOPSIS
DESCRIPTION
- Return 0 if no conversion is performed, 1 if a string is converted.
+ Assume that *type points at a count in a mangled name; set
+ *count to its value, and set *type to the next character after
+ the count. There are some weird rules in effect here.
+
+ If *type does not point at a string of digits, return zero.
+
+ If *type points at a string of digits followed by an
+ underscore, set *count to their value as an integer, advance
+ *type to point *after the underscore, and return 1.
+
+ If *type points at a string of digits not followed by an
+ underscore, consume only the first digit. Set *count to its
+ value as an integer, leave *type pointing after that digit,
+ and return 1.
+
+ The excuse for this odd behavior: in the ARM and HP demangling
+ styles, a type can be followed by a repeat count of the form
+ `Nxy', where:
+
+ `x' is a single digit specifying how many additional copies
+ of the type to append to the argument list, and
+
+ `y' is one or more digits, specifying the zero-based index of
+ the first repeated argument in the list. Yes, as you're
+ unmangling the name you can figure this out yourself, but
+ it's there anyway.
+
+ So, for example, in `bar__3fooFPiN51', the first argument is a
+ pointer to an integer (`Pi'), and then the next five arguments
+ are the same (`N5'), and the first repeat is the function's
+ second argument (`1').
*/
static int
@@ -2079,25 +2959,23 @@ get_count (type, count)
const char *p;
int n;
- if (!isdigit (**type))
- {
- return (0);
- }
+ if (!isdigit ((unsigned char)**type))
+ return (0);
else
{
*count = **type - '0';
(*type)++;
- if (isdigit (**type))
+ if (isdigit ((unsigned char)**type))
{
p = *type;
n = *count;
- do
+ do
{
n *= 10;
n += *p - '0';
p++;
- }
- while (isdigit (*p));
+ }
+ while (isdigit ((unsigned char)*p));
if (*p == '_')
{
*type = p + 1;
@@ -2108,7 +2986,8 @@ get_count (type, count)
return (1);
}
-/* result will be initialised here; it will be freed on failure */
+/* RESULT will be initialised here; it will be freed on failure. The
+ value returned is really a type_kind_t. */
static int
do_type (work, mangled, result)
@@ -2121,9 +3000,11 @@ do_type (work, mangled, result)
int success;
string decl;
const char *remembered_type;
- int constp;
- int volatilep;
+ int type_quals;
+ string btype;
+ type_kind_t tk = tk_none;
+ string_init (&btype);
string_init (&decl);
string_init (result);
@@ -2141,33 +3022,35 @@ do_type (work, mangled, result)
(*mangled)++;
if (! (work -> options & DMGL_JAVA))
string_prepend (&decl, "*");
+ if (tk == tk_none)
+ tk = tk_pointer;
break;
/* A reference type */
case 'R':
(*mangled)++;
string_prepend (&decl, "&");
+ if (tk == tk_none)
+ tk = tk_reference;
break;
/* An array */
case 'A':
{
- const char *p = ++(*mangled);
-
- string_prepend (&decl, "(");
- string_append (&decl, ")[");
- /* Copy anything up until the next underscore (the size of the
- array). */
- while (**mangled && **mangled != '_')
- ++(*mangled);
- if (**mangled == '_')
+ ++(*mangled);
+ if (!STRING_EMPTY (&decl)
+ && (decl.b[0] == '*' || decl.b[0] == '&'))
{
- string_appendn (&decl, p, *mangled - p);
- string_append (&decl, "]");
- *mangled += 1;
+ string_prepend (&decl, "(");
+ string_append (&decl, ")");
}
- else
- success = 0;
+ string_append (&decl, "[");
+ if (**mangled != '_')
+ success = demangle_template_value_parm (work, mangled, &decl,
+ tk_integral);
+ if (**mangled == '_')
+ ++(*mangled);
+ string_append (&decl, "]");
break;
}
@@ -2188,7 +3071,8 @@ do_type (work, mangled, result)
/* A function */
case 'F':
(*mangled)++;
- if (!STRING_EMPTY (&decl) && decl.b[0] == '*')
+ if (!STRING_EMPTY (&decl)
+ && (decl.b[0] == '*' || decl.b[0] == '&'))
{
string_prepend (&decl, "(");
string_append (&decl, ")");
@@ -2196,37 +3080,36 @@ do_type (work, mangled, result)
/* After picking off the function args, we expect to either find the
function return type (preceded by an '_') or the end of the
string. */
- if (!demangle_args (work, mangled, &decl)
+ if (!demangle_nested_args (work, mangled, &decl)
|| (**mangled != '_' && **mangled != '\0'))
{
success = 0;
+ break;
}
if (success && (**mangled == '_'))
- {
- (*mangled)++;
- }
+ (*mangled)++;
break;
case 'M':
case 'O':
{
- constp = 0;
- volatilep = 0;
+ type_quals = TYPE_UNQUALIFIED;
member = **mangled == 'M';
(*mangled)++;
- if (!isdigit (**mangled) && **mangled != 't')
- {
- success = 0;
- break;
- }
string_append (&decl, ")");
- string_prepend (&decl, (work -> options & DMGL_JAVA) ? "." : "::");
- if (isdigit (**mangled))
+
+ /* 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);
- if (strlen (*mangled) < n)
+ if (n == -1
+ || (int) strlen (*mangled) < n)
{
success = 0;
break;
@@ -2234,11 +3117,18 @@ 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);
- success = demangle_template (work, mangled, &temp, NULL, 1);
+ success = demangle_template (work, mangled, &temp,
+ NULL, 1, 1);
if (success)
{
string_prependn (&decl, temp.b, temp.p - temp.b);
@@ -2247,26 +3137,43 @@ 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)
{
- if (**mangled == 'C')
- {
- (*mangled)++;
- constp = 1;
- }
- if (**mangled == 'V')
+ switch (**mangled)
{
+ case 'C':
+ case 'V':
+ case 'u':
+ type_quals |= code_for_qualifier (**mangled);
(*mangled)++;
- volatilep = 1;
+ break;
+
+ default:
+ break;
}
+
if (*(*mangled)++ != 'F')
{
success = 0;
break;
}
}
- if ((member && !demangle_args (work, mangled, &decl))
+ if ((member && !demangle_nested_args (work, mangled, &decl))
|| **mangled != '_')
{
success = 0;
@@ -2277,15 +3184,10 @@ do_type (work, mangled, result)
{
break;
}
- if (constp)
+ if (type_quals != TYPE_UNQUALIFIED)
{
APPEND_BLANK (&decl);
- string_append (&decl, "const");
- }
- if (volatilep)
- {
- APPEND_BLANK (&decl);
- string_append (&decl, "volatile");
+ string_append (&decl, qualifier_string (type_quals));
}
break;
}
@@ -2294,19 +3196,16 @@ do_type (work, mangled, result)
break;
case 'C':
- (*mangled)++;
- /*
- if ((*mangled)[1] == 'P')
- {
- */
+ case 'V':
+ case 'u':
if (PRINT_ANSI_QUALIFIERS)
{
if (!STRING_EMPTY (&decl))
- {
- string_prepend (&decl, " ");
- }
- string_prepend (&decl, "const");
+ string_prepend (&decl, " ");
+
+ string_prepend (&decl, demangle_qualifier (**mangled));
}
+ (*mangled)++;
break;
/*
}
@@ -2319,11 +3218,23 @@ do_type (work, mangled, result)
}
}
- switch (**mangled)
+ if (success) switch (**mangled)
{
/* A qualified name, such as "Outer::Inner". */
case 'Q':
- success = demangle_qualified (work, mangled, result, 0, 1);
+ case 'K':
+ {
+ success = demangle_qualified (work, mangled, result, 0, 1);
+ break;
+ }
+
+ /* A back reference to a previously seen squangled type */
+ case 'B':
+ (*mangled)++;
+ if (!get_count (mangled, &n) || n >= work -> numb)
+ success = 0;
+ else
+ string_append (result, work->btypevec[n]);
break;
case 'X':
@@ -2331,12 +3242,11 @@ do_type (work, mangled, result)
/* A template parm. We substitute the corresponding argument. */
{
int idx;
- int lvl;
(*mangled)++;
idx = consume_count_with_underscores (mangled);
- if (idx == -1
+ if (idx == -1
|| (work->tmpl_argvec && idx >= work->ntmpl_args)
|| consume_count_with_underscores (mangled) == -1)
{
@@ -2347,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;
}
@@ -2359,6 +3265,8 @@ do_type (work, mangled, result)
default:
success = demangle_fund_type (work, mangled, result);
+ if (tk == tk_none)
+ tk = (type_kind_t) success;
break;
}
@@ -2371,11 +3279,14 @@ do_type (work, mangled, result)
}
}
else
- {
- string_delete (result);
- }
+ string_delete (result);
string_delete (&decl);
- return (success);
+
+ if (success)
+ /* Assume an integral type, if we're not sure. */
+ return (int) ((tk == tk_none) ? tk_integral : tk);
+ else
+ return 0;
}
/* Given a pointer to a type string that represents a fundamental type
@@ -2389,7 +3300,7 @@ do_type (work, mangled, result)
"Sl" => "signed long"
"CUs" => "const unsigned short"
- */
+ The value returned is really a type_kind_t. */
static int
demangle_fund_type (work, mangled, result)
@@ -2399,6 +3310,12 @@ demangle_fund_type (work, mangled, result)
{
int done = 0;
int success = 1;
+ char buf[10];
+ int dec = 0;
+ string btype;
+ type_kind_t tk = tk_integral;
+
+ string_init (&btype);
/* First pick off any type qualifiers. There can be more than one. */
@@ -2407,12 +3324,15 @@ demangle_fund_type (work, mangled, result)
switch (**mangled)
{
case 'C':
- (*mangled)++;
+ case 'V':
+ case 'u':
if (PRINT_ANSI_QUALIFIERS)
{
- APPEND_BLANK (result);
- string_append (result, "const");
+ if (!STRING_EMPTY (result))
+ string_prepend (result, " ");
+ string_prepend (result, demangle_qualifier (**mangled));
}
+ (*mangled)++;
break;
case 'U':
(*mangled)++;
@@ -2424,14 +3344,6 @@ demangle_fund_type (work, mangled, result)
APPEND_BLANK (result);
string_append (result, "signed");
break;
- case 'V':
- (*mangled)++;
- if (PRINT_ANSI_QUALIFIERS)
- {
- APPEND_BLANK (result);
- string_append (result, "volatile");
- }
- break;
case 'J':
(*mangled)++;
APPEND_BLANK (result);
@@ -2479,39 +3391,75 @@ demangle_fund_type (work, mangled, result)
(*mangled)++;
APPEND_BLANK (result);
string_append (result, "bool");
+ tk = tk_bool;
break;
case 'c':
(*mangled)++;
APPEND_BLANK (result);
string_append (result, "char");
+ tk = tk_char;
break;
case 'w':
(*mangled)++;
APPEND_BLANK (result);
string_append (result, "wchar_t");
+ tk = tk_char;
break;
case 'r':
(*mangled)++;
APPEND_BLANK (result);
string_append (result, "long double");
+ tk = tk_real;
break;
case 'd':
(*mangled)++;
APPEND_BLANK (result);
string_append (result, "double");
+ tk = tk_real;
break;
case 'f':
(*mangled)++;
APPEND_BLANK (result);
string_append (result, "float");
+ tk = tk_real;
break;
case 'G':
(*mangled)++;
- if (!isdigit (**mangled))
+ if (!isdigit ((unsigned char)**mangled))
{
success = 0;
break;
}
+ case 'I':
+ (*mangled)++;
+ if (**mangled == '_')
+ {
+ int i;
+ (*mangled)++;
+ for (i = 0;
+ i < (long) sizeof (buf) - 1 && **mangled && **mangled != '_';
+ (*mangled)++, i++)
+ buf[i] = **mangled;
+ if (**mangled != '_')
+ {
+ success = 0;
+ break;
+ }
+ buf[i] = '\0';
+ (*mangled)++;
+ }
+ else
+ {
+ strncpy (buf, *mangled, 2);
+ buf[2] = '\0';
+ *mangled += min (strlen (*mangled), 2);
+ }
+ sscanf (buf, "%x", &dec);
+ sprintf (buf, "int%i_t", dec);
+ APPEND_BLANK (result);
+ string_append (result, buf);
+ break;
+
/* fall through */
/* An explicit type, such as "6mytype" or "7integer" */
case '0':
@@ -2524,24 +3472,171 @@ demangle_fund_type (work, mangled, result)
case '7':
case '8':
case '9':
- APPEND_BLANK (result);
- if (!demangle_class_name (work, mangled, result)) {
- --result->p;
- success = 0;
+ {
+ int bindex = register_Btype (work);
+ string btype;
+ string_init (&btype);
+ if (demangle_class_name (work, mangled, &btype)) {
+ remember_Btype (work, btype.b, LEN_STRING (&btype), bindex);
+ APPEND_BLANK (result);
+ string_appends (result, &btype);
+ }
+ else
+ success = 0;
+ string_delete (&btype);
+ break;
}
- break;
case 't':
- success = demangle_template(work,mangled, result, 0, 1);
- break;
+ {
+ success = demangle_template (work, mangled, &btype, 0, 1, 1);
+ string_appends (result, &btype);
+ break;
+ }
default:
success = 0;
break;
}
- return (success);
+ return success ? ((int) tk) : 0;
+}
+
+
+/* Handle a template's value parameter for HP aCC (extension from ARM)
+ **mangled points to 'S' or 'U' */
+
+static int
+do_hpacc_template_const_value (work, mangled, result)
+ struct work_stuff *work ATTRIBUTE_UNUSED;
+ const char **mangled;
+ string *result;
+{
+ int unsigned_const;
+
+ if (**mangled != 'U' && **mangled != 'S')
+ return 0;
+
+ unsigned_const = (**mangled == 'U');
+
+ (*mangled)++;
+
+ switch (**mangled)
+ {
+ case 'N':
+ string_append (result, "-");
+ /* fall through */
+ case 'P':
+ (*mangled)++;
+ break;
+ case 'M':
+ /* special case for -2^31 */
+ string_append (result, "-2147483648");
+ (*mangled)++;
+ return 1;
+ default:
+ return 0;
+ }
+
+ /* We have to be looking at an integer now */
+ if (!(isdigit ((unsigned char)**mangled)))
+ return 0;
+
+ /* We only deal with integral values for template
+ parameters -- so it's OK to look only for digits */
+ while (isdigit ((unsigned char)**mangled))
+ {
+ char_str[0] = **mangled;
+ string_append (result, char_str);
+ (*mangled)++;
+ }
+
+ if (unsigned_const)
+ string_append (result, "U");
+
+ /* FIXME? Some day we may have 64-bit (or larger :-) ) constants
+ with L or LL suffixes. pai/1997-09-03 */
+
+ return 1; /* success */
+}
+
+/* Handle a template's literal parameter for HP aCC (extension from ARM)
+ **mangled is pointing to the 'A' */
+
+static int
+do_hpacc_template_literal (work, mangled, result)
+ struct work_stuff *work;
+ const char **mangled;
+ string *result;
+{
+ int literal_len = 0;
+ char * recurse;
+ char * recurse_dem;
+
+ if (**mangled != 'A')
+ return 0;
+
+ (*mangled)++;
+
+ literal_len = consume_count (mangled);
+
+ if (literal_len <= 0)
+ return 0;
+
+ /* Literal parameters are names of arrays, functions, etc. and the
+ canonical representation uses the address operator */
+ string_append (result, "&");
+
+ /* Now recursively demangle the literal name */
+ recurse = (char *) xmalloc (literal_len + 1);
+ memcpy (recurse, *mangled, literal_len);
+ recurse[literal_len] = '\000';
+
+ recurse_dem = cplus_demangle (recurse, work->options);
+
+ if (recurse_dem)
+ {
+ string_append (result, recurse_dem);
+ free (recurse_dem);
+ }
+ else
+ {
+ string_appendn (result, *mangled, literal_len);
+ }
+ (*mangled) += literal_len;
+ free (recurse);
+
+ return 1;
+}
+
+static int
+snarf_numeric_literal (args, arg)
+ const char ** args;
+ string * arg;
+{
+ if (**args == '-')
+ {
+ char_str[0] = '-';
+ string_append (arg, char_str);
+ (*args)++;
+ }
+ else if (**args == '+')
+ (*args)++;
+
+ if (!isdigit ((unsigned char)**args))
+ return 0;
+
+ while (isdigit ((unsigned char)**args))
+ {
+ char_str[0] = **args;
+ string_append (arg, char_str);
+ (*args)++;
+ }
+
+ return 1;
}
-/* `result' will be initialized in do_type; it will be freed on failure */
+/* Demangle the next argument, given by MANGLED into RESULT, which
+ *should be an uninitialized* string. It will be initialized here,
+ and free'd should anything go wrong. */
static int
do_arg (work, mangled, result)
@@ -2549,17 +3644,67 @@ do_arg (work, mangled, result)
const char **mangled;
string *result;
{
+ /* Remember where we started so that we can record the type, for
+ non-squangling type remembering. */
const char *start = *mangled;
- if (!do_type (work, mangled, result))
+ string_init (result);
+
+ if (work->nrepeats > 0)
{
- return (0);
+ --work->nrepeats;
+
+ if (work->previous_argument == 0)
+ return 0;
+
+ /* We want to reissue the previous type in this argument list. */
+ string_appends (result, work->previous_argument);
+ return 1;
+ }
+
+ if (**mangled == 'n')
+ {
+ /* A squangling-style repeat. */
+ (*mangled)++;
+ work->nrepeats = consume_count(mangled);
+
+ if (work->nrepeats <= 0)
+ /* This was not a repeat count after all. */
+ return 0;
+
+ if (work->nrepeats > 9)
+ {
+ if (**mangled != '_')
+ /* The repeat count should be followed by an '_' in this
+ case. */
+ return 0;
+ else
+ (*mangled)++;
+ }
+
+ /* Now, the repeat is all set up. */
+ return do_arg (work, mangled, result);
}
+
+ /* Save the result in WORK->previous_argument so that we can find it
+ if it's repeated. Note that saving START is not good enough: we
+ do not want to add additional types to the back-referenceable
+ type vector when processing a repeated type. */
+ if (work->previous_argument)
+ string_clear (work->previous_argument);
else
{
- remember_type (work, start, *mangled - start);
- return (1);
+ work->previous_argument = (string*) xmalloc (sizeof (string));
+ string_init (work->previous_argument);
}
+
+ if (!do_type (work, mangled, work->previous_argument))
+ return 0;
+
+ string_appends (result, work->previous_argument);
+
+ remember_type (work, start, *mangled - start);
+ return 1;
}
static void
@@ -2570,6 +3715,9 @@ remember_type (work, start, len)
{
char *tem;
+ if (work->forgetting_types)
+ return;
+
if (work -> ntypes >= work -> typevec_size)
{
if (work -> typevec_size == 0)
@@ -2592,6 +3740,112 @@ remember_type (work, start, len)
work -> typevec[work -> ntypes++] = tem;
}
+
+/* Remember a K type class qualifier. */
+static void
+remember_Ktype (work, start, len)
+ struct work_stuff *work;
+ const char *start;
+ int len;
+{
+ char *tem;
+
+ if (work -> numk >= work -> ksize)
+ {
+ if (work -> ksize == 0)
+ {
+ work -> ksize = 5;
+ work -> ktypevec
+ = (char **) xmalloc (sizeof (char *) * work -> ksize);
+ }
+ else
+ {
+ work -> ksize *= 2;
+ work -> ktypevec
+ = (char **) xrealloc ((char *)work -> ktypevec,
+ sizeof (char *) * work -> ksize);
+ }
+ }
+ tem = xmalloc (len + 1);
+ memcpy (tem, start, len);
+ tem[len] = '\0';
+ work -> ktypevec[work -> numk++] = tem;
+}
+
+/* Register a B code, and get an index for it. B codes are registered
+ as they are seen, rather than as they are completed, so map<temp<char> >
+ registers map<temp<char> > as B0, and temp<char> as B1 */
+
+static int
+register_Btype (work)
+ struct work_stuff *work;
+{
+ int ret;
+
+ if (work -> numb >= work -> bsize)
+ {
+ if (work -> bsize == 0)
+ {
+ work -> bsize = 5;
+ work -> btypevec
+ = (char **) xmalloc (sizeof (char *) * work -> bsize);
+ }
+ else
+ {
+ work -> bsize *= 2;
+ work -> btypevec
+ = (char **) xrealloc ((char *)work -> btypevec,
+ sizeof (char *) * work -> bsize);
+ }
+ }
+ ret = work -> numb++;
+ work -> btypevec[ret] = NULL;
+ return(ret);
+}
+
+/* Store a value into a previously registered B code type. */
+
+static void
+remember_Btype (work, start, len, index)
+ struct work_stuff *work;
+ const char *start;
+ int len, index;
+{
+ char *tem;
+
+ tem = xmalloc (len + 1);
+ memcpy (tem, start, len);
+ tem[len] = '\0';
+ work -> btypevec[index] = tem;
+}
+
+/* Lose all the info related to B and K type codes. */
+static void
+forget_B_and_K_types (work)
+ struct work_stuff *work;
+{
+ int i;
+
+ while (work -> numk > 0)
+ {
+ i = --(work -> numk);
+ if (work -> ktypevec[i] != NULL)
+ {
+ free (work -> ktypevec[i]);
+ work -> ktypevec[i] = NULL;
+ }
+ }
+
+ while (work -> numb > 0)
+ {
+ i = --(work -> numb);
+ if (work -> btypevec[i] != NULL)
+ {
+ free (work -> btypevec[i]);
+ work -> btypevec[i] = NULL;
+ }
+ }
+}
/* Forget the remembered types, but not the type vector itself. */
static void
@@ -2643,8 +3897,8 @@ forget_types (work)
foo__FiR3fooT1T2T1T2
__ct__3fooFiR3fooT1T2T1T2
- Note that g++ bases it's type numbers starting at zero and counts all
- previously seen types, while lucid/ARM bases it's type numbers starting
+ Note that g++ bases its type numbers starting at zero and counts all
+ previously seen types, while lucid/ARM bases its type numbers starting
at one and only considers types after it has seen the 'F' character
indicating the start of the function args. For lucid/ARM style, we
account for this difference by discarding any previously seen types when
@@ -2675,12 +3929,13 @@ demangle_args (work, mangled, declp)
}
}
- while (**mangled != '_' && **mangled != '\0' && **mangled != 'e')
+ while ((**mangled != '_' && **mangled != '\0' && **mangled != 'e')
+ || work->nrepeats > 0)
{
if ((**mangled == 'N') || (**mangled == 'T'))
{
temptype = *(*mangled)++;
-
+
if (temptype == 'N')
{
if (!get_count (mangled, &r))
@@ -2692,7 +3947,7 @@ demangle_args (work, mangled, declp)
{
r = 1;
}
- if (ARM_DEMANGLING && work -> ntypes >= 10)
+ if ((HP_DEMANGLING || ARM_DEMANGLING || EDG_DEMANGLING) && work -> ntypes >= 10)
{
/* If we have 10 or more types we might have more than a 1 digit
index so we'll have to consume the whole count here. This
@@ -2700,7 +3955,7 @@ demangle_args (work, mangled, declp)
count but it's impossible to demangle that case properly
anyway. Eg if we already have 12 types is T12Pc "(..., type1,
Pc, ...)" or "(..., type12, char *, ...)" */
- if ((t = consume_count(mangled)) == 0)
+ if ((t = consume_count(mangled)) <= 0)
{
return (0);
}
@@ -2712,7 +3967,7 @@ demangle_args (work, mangled, declp)
return (0);
}
}
- if (LUCID_DEMANGLING || ARM_DEMANGLING)
+ if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
{
t--;
}
@@ -2722,7 +3977,7 @@ demangle_args (work, mangled, declp)
{
return (0);
}
- while (--r >= 0)
+ while (work->nrepeats > 0 || --r >= 0)
{
tem = work -> typevec[t];
if (need_comma && PRINT_ARG_TYPES)
@@ -2743,18 +3998,12 @@ demangle_args (work, mangled, declp)
}
else
{
- if (need_comma & PRINT_ARG_TYPES)
- {
- string_append (declp, ", ");
- }
+ if (need_comma && PRINT_ARG_TYPES)
+ string_append (declp, ", ");
if (!do_arg (work, mangled, &arg))
- {
- return (0);
- }
+ return (0);
if (PRINT_ARG_TYPES)
- {
- string_appends (declp, &arg);
- }
+ string_appends (declp, &arg);
string_delete (&arg);
need_comma = 1;
}
@@ -2780,6 +4029,45 @@ demangle_args (work, mangled, declp)
return (1);
}
+/* Like demangle_args, but for demangling the argument lists of function
+ and method pointers or references, not top-level declarations. */
+
+static int
+demangle_nested_args (work, mangled, declp)
+ struct work_stuff *work;
+ const char **mangled;
+ string *declp;
+{
+ string* saved_previous_argument;
+ int result;
+ int saved_nrepeats;
+
+ /* The G++ name-mangling algorithm does not remember types on nested
+ argument lists, unless -fsquangling is used, and in that case the
+ type vector updated by remember_type is not used. So, we turn
+ off remembering of types here. */
+ ++work->forgetting_types;
+
+ /* For the repeat codes used with -fsquangling, we must keep track of
+ the last argument. */
+ saved_previous_argument = work->previous_argument;
+ saved_nrepeats = work->nrepeats;
+ work->previous_argument = 0;
+ work->nrepeats = 0;
+
+ /* Actually demangle the arguments. */
+ result = demangle_args (work, mangled, declp);
+
+ /* Restore the previous_argument field. */
+ if (work->previous_argument)
+ string_delete (work->previous_argument);
+ work->previous_argument = saved_previous_argument;
+ --work->forgetting_types;
+ work->nrepeats = saved_nrepeats;
+
+ return result;
+}
+
static void
demangle_function_name (work, mangled, declp, scan)
struct work_stuff *work;
@@ -2787,8 +4075,7 @@ demangle_function_name (work, mangled, declp, scan)
string *declp;
const char *scan;
{
- int i;
- int len;
+ size_t i;
string type;
const char *tem;
@@ -2801,8 +4088,18 @@ demangle_function_name (work, mangled, declp, scan)
separator. */
(*mangled) = scan + 2;
+ /* We may be looking at an instantiation of a template function:
+ foo__Xt1t2_Ft3t4, where t1, t2, ... are template arguments and a
+ following _F marks the start of the function arguments. Handle
+ the template arguments first. */
+
+ if (HP_DEMANGLING && (**mangled == 'X'))
+ {
+ demangle_arm_hp_template (work, mangled, 0, declp);
+ /* This leaves MANGLED pointing to the 'F' marking func args */
+ }
- if (LUCID_DEMANGLING || ARM_DEMANGLING)
+ if (LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING)
{
/* See if we have an ARM style constructor or destructor operator.
@@ -2824,7 +4121,7 @@ demangle_function_name (work, mangled, declp, scan)
}
}
- if (declp->p - declp->b >= 3
+ if (declp->p - declp->b >= 3
&& declp->b[0] == 'o'
&& declp->b[1] == 'p'
&& strchr (cplus_markers, declp->b[2]) != NULL)
@@ -2835,8 +4132,8 @@ demangle_function_name (work, mangled, declp, scan)
{
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
- len = declp->p - declp->b - 10;
- if (strlen (optable[i].in) == len
+ int len = declp->p - declp->b - 10;
+ if ((int) strlen (optable[i].in) == len
&& memcmp (optable[i].in, declp->b + 10, len) == 0)
{
string_clear (declp);
@@ -2852,7 +4149,7 @@ demangle_function_name (work, mangled, declp, scan)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
int len = declp->p - declp->b - 3;
- if (strlen (optable[i].in) == len
+ if ((int) strlen (optable[i].in) == len
&& memcmp (optable[i].in, declp->b + 3, len) == 0)
{
string_clear (declp);
@@ -2923,7 +4220,7 @@ demangle_function_name (work, mangled, declp, scan)
string_append (declp, "operator");
string_append (declp, optable[i].out);
break;
- }
+ }
}
}
}
@@ -2977,7 +4274,7 @@ string_init (s)
s->b = s->p = s->e = NULL;
}
-static void
+static void
string_clear (s)
string *s;
{
@@ -3079,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
@@ -3088,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)
@@ -3118,16 +4425,16 @@ static void
usage (stream, status)
FILE *stream;
int status;
-{
+{
fprintf (stream, "\
-Usage: %s [-_] [-n] [-s {gnu,lucid,arm}] [--strip-underscores]\n\
- [--no-strip-underscores] [--format={gnu,lucid,arm}]\n\
+Usage: %s [-_] [-n] [-s {gnu,lucid,arm,hp,edg}] [--strip-underscores]\n\
+ [--no-strip-underscores] [--format={gnu,lucid,arm,hp,edg}]\n\
[--help] [--version] [arg...]\n",
program_name);
exit (status);
}
-#define MBUF_SIZE 512
+#define MBUF_SIZE 32767
char mbuffer[MBUF_SIZE];
/* Defined in the automatically-generated underscore.c. */
@@ -3145,6 +4452,72 @@ static struct option long_options[] = {
{0, no_argument, 0, 0}
};
+/* More 'friendly' abort that prints the line and file.
+ config.h can #define abort fancy_abort if you like that sort of thing. */
+
+void
+fancy_abort ()
+{
+ fatal ("Internal gcc abort.");
+}
+
+
+static const char *
+standard_symbol_characters PARAMS ((void));
+
+static const char *
+hp_symbol_characters PARAMS ((void));
+
+/* Return the string of non-alnum characters that may occur
+ as a valid symbol component, in the standard assembler symbol
+ syntax. */
+
+static const char *
+standard_symbol_characters ()
+{
+ return "_$.";
+}
+
+
+/* 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
+ identifiers can use all sorts of characters that no assembler would
+ tolerate, so the alphabet this function creates is a little odd.
+ Here are some sample mangled identifiers offered by HP:
+
+ typeid*__XT24AddressIndExpClassMember_
+ [Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv
+ __ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv
+
+ This still seems really weird to me, since nowhere else in this
+ file is there anything to recognize curly brackets, parens, etc.
+ I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me
+ this is right, but I still strongly suspect that there's a
+ misunderstanding here.
+
+ If we decide it's better for c++filt to use HP's assembler syntax
+ to scrape identifiers out of its input, here's the definition of
+ the symbol name syntax from the HP assembler manual:
+
+ Symbols are composed of uppercase and lowercase letters, decimal
+ digits, dollar symbol, period (.), ampersand (&), pound sign(#) and
+ underscore (_). A symbol can begin with a letter, digit underscore or
+ dollar sign. If a symbol begins with a digit, it must contain a
+ non-digit character.
+
+ So have fun. */
+static const char *
+hp_symbol_characters ()
+{
+ return "_$.<>#,*&[]:(){}";
+}
+
+
+extern int main PARAMS ((int, char **));
+
int
main (argc, argv)
int argc;
@@ -3152,6 +4525,7 @@ main (argc, argv)
{
char *result;
int c;
+ const char *valid_symbols;
program_name = argv[0];
@@ -3170,8 +4544,8 @@ main (argc, argv)
strip_underscore = 0;
break;
case 'v':
- printf ("GNU %s version %s\n", program_name, program_version);
- exit (0);
+ printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version);
+ return (0);
case '_':
strip_underscore = 1;
break;
@@ -3191,11 +4565,19 @@ main (argc, argv)
{
current_demangling_style = arm_demangling;
}
+ else if (strcmp (optarg, "hp") == 0)
+ {
+ current_demangling_style = hp_demangling;
+ }
+ else if (strcmp (optarg, "edg") == 0)
+ {
+ current_demangling_style = edg_demangling;
+ }
else
{
fprintf (stderr, "%s: unknown demangling style `%s'\n",
program_name, optarg);
- exit (1);
+ return (1);
}
break;
}
@@ -3210,12 +4592,30 @@ main (argc, argv)
}
else
{
+ switch (current_demangling_style)
+ {
+ case gnu_demangling:
+ case lucid_demangling:
+ case arm_demangling:
+ case edg_demangling:
+ valid_symbols = standard_symbol_characters ();
+ break;
+ case hp_demangling:
+ valid_symbols = hp_symbol_characters ();
+ break;
+ default:
+ /* Folks should explicitly indicate the appropriate alphabet for
+ each demangling. Providing a default would allow the
+ question to go unconsidered. */
+ abort ();
+ }
+
for (;;)
{
int i = 0;
c = getchar ();
/* Try to read a label. */
- while (c != EOF && (isalnum(c) || c == '_' || c == '$' || c == '.'))
+ while (c != EOF && (isalnum (c) || strchr (valid_symbols, c)))
{
if (i >= MBUF_SIZE-1)
break;
@@ -3235,7 +4635,7 @@ main (argc, argv)
skip_first = i;
mbuffer[i] = 0;
-
+
result = cplus_demangle (mbuffer + skip_first, flags);
if (result)
{
@@ -3255,36 +4655,33 @@ 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);
}
-char * malloc ();
-char * realloc ();
-
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *value = (char *) malloc (size);
+ register PTR value = (PTR) malloc (size);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- register char *value = (char *) realloc (ptr, size);
+ register PTR value = (PTR) realloc (ptr, size);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
diff --git a/contrib/binutils/libiberty/floatformat.c b/contrib/binutils/libiberty/floatformat.c
index 7f6086f..1d8f16d 100644
--- a/contrib/binutils/libiberty/floatformat.c
+++ b/contrib/binutils/libiberty/floatformat.c
@@ -1,5 +1,5 @@
/* IEEE floating point support routines, for GDB, the GNU Debugger.
- Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1999 Free Software Foundation, Inc.
This file is part of GDB.
@@ -128,7 +128,7 @@ get_field (data, order, total_len, start, len)
--cur_byte;
/* Move towards the most significant part of the field. */
- while (cur_bitshift < len)
+ while ((unsigned int) cur_bitshift < len)
{
if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
/* This is the last byte; zero out the bits which are not part of
@@ -179,7 +179,7 @@ floatformat_to_double (fmt, from, to)
mant_off = fmt->man_start;
dto = 0.0;
- special_exponent = exponent == 0 || exponent == fmt->exp_nan;
+ special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan;
/* Don't bias zero's, denorms or NaNs. */
if (!special_exponent)
@@ -192,10 +192,12 @@ floatformat_to_double (fmt, from, to)
increment the exponent by one to account for the integer bit. */
if (!special_exponent)
- if (fmt->intbit == floatformat_intbit_no)
- dto = ldexp (1.0, exponent);
- else
- exponent++;
+ {
+ if (fmt->intbit == floatformat_intbit_no)
+ dto = ldexp (1.0, exponent);
+ else
+ exponent++;
+ }
while (mant_bits_left > 0)
{
@@ -253,7 +255,7 @@ put_field (data, order, total_len, start, len, stuff_to_put)
--cur_byte;
/* Move towards the most significant part of the field. */
- while (cur_bitshift < len)
+ while ((unsigned int) cur_bitshift < len)
{
if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
{
@@ -279,7 +281,7 @@ put_field (data, order, total_len, start, len, stuff_to_put)
void
floatformat_from_double (fmt, from, to)
- CONST struct floatformat *fmt;
+ const struct floatformat *fmt;
double *from;
char *to;
{
@@ -333,7 +335,7 @@ floatformat_from_double (fmt, from, to)
If we are discarding a zero, we should be (but are not) creating
a denormalized number which means adjusting the exponent
(I think). */
- if (mant_bits_left == fmt->man_len
+ if ((unsigned int) mant_bits_left == fmt->man_len
&& fmt->intbit == floatformat_intbit_no)
{
mant_long &= 0x7fffffff;
diff --git a/contrib/binutils/libiberty/fnmatch.c b/contrib/binutils/libiberty/fnmatch.c
index 685d9e4..0a9bfe6 100644
--- a/contrib/binutils/libiberty/fnmatch.c
+++ b/contrib/binutils/libiberty/fnmatch.c
@@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#if defined (CONFIG_BROKETS)
@@ -71,7 +72,7 @@ fnmatch (pattern, string, flags)
int flags;
{
register const char *p = pattern, *n = string;
- register char c;
+ register unsigned char c;
/* Note that this evalutes C many times. */
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
@@ -98,7 +99,7 @@ fnmatch (pattern, string, flags)
c = *p++;
c = FOLD (c);
}
- if (FOLD (*n) != c)
+ if (FOLD ((unsigned char)*n) != c)
return FNM_NOMATCH;
break;
@@ -116,10 +117,10 @@ fnmatch (pattern, string, flags)
return 0;
{
- char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
+ unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
c1 = FOLD (c1);
for (--p; *n != '\0'; ++n)
- if ((c == '[' || FOLD (*n) == c1) &&
+ if ((c == '[' || FOLD ((unsigned char)*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0;
return FNM_NOMATCH;
@@ -144,7 +145,7 @@ fnmatch (pattern, string, flags)
c = *p++;
for (;;)
{
- register char cstart = c, cend = c;
+ register unsigned char cstart = c, cend = c;
if (!(flags & FNM_NOESCAPE) && c == '\\')
cstart = cend = *p++;
@@ -174,7 +175,8 @@ fnmatch (pattern, string, flags)
c = *p++;
}
- if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
+ if (FOLD ((unsigned char)*n) >= cstart
+ && FOLD ((unsigned char)*n) <= cend)
goto matched;
if (c == ']')
@@ -203,7 +205,7 @@ fnmatch (pattern, string, flags)
break;
default:
- if (c != FOLD (*n))
+ if (c != FOLD ((unsigned char)*n))
return FNM_NOMATCH;
}
diff --git a/contrib/binutils/libiberty/getcwd.c b/contrib/binutils/libiberty/getcwd.c
index 60c1dd8..47b1c1e 100644
--- a/contrib/binutils/libiberty/getcwd.c
+++ b/contrib/binutils/libiberty/getcwd.c
@@ -14,13 +14,18 @@ DESCRIPTION
current directory's path doesn't fit in LEN characters, the result
is NULL and errno is set.
+ If pathname is a null pointer, getcwd() will obtain size bytes of
+ space using malloc.
+
BUGS
Emulated via the getwd() call, which is reasonable for most
systems that do not have getcwd().
*/
-#ifndef NO_SYS_PARAM_H
+#include "config.h"
+
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <errno.h>
@@ -46,6 +51,13 @@ getcwd (buf, len)
errno = ERANGE;
return 0;
}
+ if (!buf) {
+ buf = (char*)malloc(len);
+ if (!buf) {
+ errno = ENOMEM;
+ return 0;
+ }
+ }
strcpy (buf, ourbuf);
}
return buf;
diff --git a/contrib/binutils/libiberty/getopt.c b/contrib/binutils/libiberty/getopt.c
index fc87ce6..c41531e 100644
--- a/contrib/binutils/libiberty/getopt.c
+++ b/contrib/binutils/libiberty/getopt.c
@@ -1,13 +1,13 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+ "Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
- Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ Bugs can be reported to bug-glibc@gnu.org.
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
@@ -27,19 +27,19 @@
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
#ifndef _NO_PROTO
-#define _NO_PROTO
+# define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
-#if !defined (__STDC__) || !__STDC__
+#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
+# ifndef const
+# define const
+# endif
#endif
#include <stdio.h>
@@ -53,11 +53,11 @@
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+# include <gnu-versions.h>
+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+# define ELIDE_CODE
+# endif
#endif
#ifndef ELIDE_CODE
@@ -68,26 +68,26 @@
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
-#include <stdlib.h>
-#include <unistd.h>
+# include <stdlib.h>
+# include <unistd.h>
#endif /* GNU C library. */
#ifdef VMS
-#include <unixlib.h>
-#if HAVE_STRING_H - 0
-#include <string.h>
-#endif
+# include <unixlib.h>
+# if HAVE_STRING_H - 0
+# include <string.h>
+# endif
#endif
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
-#ifdef HAVE_LIBINTL_H
-# include <libintl.h>
-# define _(msgid) gettext (msgid)
-#else
-# define _(msgid) (msgid)
-#endif
+# ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+# else
+# define _(msgid) (msgid)
+# endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
@@ -197,14 +197,24 @@ static char *posixly_correct;
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
-#include <string.h>
-#define my_index strchr
+# include <string.h>
+# define my_index strchr
#else
+# if HAVE_STRING_H
+# include <string.h>
+# else
+# if HAVE_STRINGS_H
+# include <strings.h>
+# endif
+# endif
+
/* Avoid depending on library functions or files
whose names are inconsistent. */
-char *getenv ();
+#ifndef getenv
+extern char *getenv ();
+#endif
static char *
my_index (str, chr)
@@ -225,11 +235,11 @@ my_index (str, chr)
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
-#if !defined (__STDC__) || !__STDC__
+# if (!defined __STDC__ || !__STDC__) && !defined strlen
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
-#endif /* not __STDC__ */
+# endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
@@ -292,7 +302,7 @@ text_set_element (__libc_subinit, store_args_and_env);
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
-#if defined (__STDC__) && __STDC__
+#if defined __STDC__ && __STDC__
static void exchange (char **);
#endif
@@ -378,7 +388,7 @@ exchange (argv)
/* Initialize the internal data when the first call is made. */
-#if defined (__STDC__) && __STDC__
+#if defined __STDC__ && __STDC__
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
@@ -527,11 +537,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
from the shell indicating it is not an option. The later information
is only used when the used in the GNU libc. */
#ifdef _LIBC
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && __getopt_nonoption_flags[optind] == '1'))
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
+ || (optind < nonoption_flags_len \
+ && __getopt_nonoption_flags[optind] == '1'))
#else
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif
if (nextchar == NULL || *nextchar == '\0')
@@ -690,21 +700,23 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else
{
if (opterr)
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
-
- nextchar += strlen (nextchar);
-
- optopt = pfound->val;
- return '?';
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+
+ nextchar += strlen (nextchar);
+
+ optopt = pfound->val;
+ return '?';
+ }
}
}
else if (pfound->has_arg == 1)
diff --git a/contrib/binutils/libiberty/getopt1.c b/contrib/binutils/libiberty/getopt1.c
index af8e681..ff25737 100644
--- a/contrib/binutils/libiberty/getopt1.c
+++ b/contrib/binutils/libiberty/getopt1.c
@@ -1,8 +1,9 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+ Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
+ Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ Bugs can be reported to bug-glibc@gnu.org.
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
@@ -25,7 +26,7 @@
#include "getopt.h"
-#if !defined (__STDC__) || !__STDC__
+#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
@@ -44,7 +45,7 @@
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
diff --git a/contrib/binutils/libiberty/getpagesize.c b/contrib/binutils/libiberty/getpagesize.c
index e9784b8..564d6c0 100644
--- a/contrib/binutils/libiberty/getpagesize.c
+++ b/contrib/binutils/libiberty/getpagesize.c
@@ -28,36 +28,43 @@ BUGS
#ifndef VMS
+#include "config.h"
+
#include <sys/types.h>
-#ifndef NO_SYS_PARAM_H
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYSCONF
+#undef GNU_OUR_PAGESIZE
+#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
#include <unistd.h>
+#ifdef _SC_PAGESIZE
#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
-#else
-#ifdef PAGESIZE
-#define GNU_OUR_PAGESIZE PAGESIZE
-#else /* no PAGESIZE */
-#ifdef EXEC_PAGESIZE
-#define GNU_OUR_PAGESIZE EXEC_PAGESIZE
-#else /* no EXEC_PAGESIZE */
-#ifdef NBPG
-#define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* CLSIZE */
-#else /* no NBPG */
-#ifdef NBPC
-#define GNU_OUR_PAGESIZE NBPC
-#else /* no NBPC */
-#define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
-#endif /* NBPC */
-#endif /* NBPG */
-#endif /* EXEC_PAGESIZE */
-#endif /* PAGESIZE */
-#endif /* HAVE_SYSCONF */
+#endif
+#endif
+
+#ifndef GNU_OUR_PAGESIZE
+# ifdef PAGESIZE
+# define GNU_OUR_PAGESIZE PAGESIZE
+# else /* no PAGESIZE */
+# ifdef EXEC_PAGESIZE
+# define GNU_OUR_PAGESIZE EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define GNU_OUR_PAGESIZE NBPC
+# else /* no NBPC */
+# define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
+# endif /* NBPC */
+# endif /* NBPG */
+# endif /* EXEC_PAGESIZE */
+# endif /* PAGESIZE */
+#endif /* GNU_OUR_PAGESIZE */
int
getpagesize ()
diff --git a/contrib/binutils/libiberty/getpwd.c b/contrib/binutils/libiberty/getpwd.c
new file mode 100644
index 0000000..de6e039
--- /dev/null
+++ b/contrib/binutils/libiberty/getpwd.c
@@ -0,0 +1,115 @@
+/* getpwd.c - get the working directory */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+/* Prototype these in case the system headers don't provide them. */
+extern char *getpwd ();
+extern char *getwd ();
+
+#include "libiberty.h"
+
+/* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
+ BSD systems) now provides getcwd as called for by POSIX. Allow for
+ the few exceptions to the general rule here. */
+
+#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
+#define getcwd(buf,len) getwd(buf)
+#endif
+
+#ifdef MAXPATHLEN
+#define GUESSPATHLEN (MAXPATHLEN + 1)
+#else
+#define GUESSPATHLEN 100
+#endif
+
+#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
+
+/* Get the working directory. Use the PWD environment variable if it's
+ set correctly, since this is faster and gives more uniform answers
+ to the user. Yield the working directory if successful; otherwise,
+ yield 0 and set errno. */
+
+char *
+getpwd ()
+{
+ static char *pwd;
+ static int failure_errno;
+
+ char *p = pwd;
+ size_t s;
+ struct stat dotstat, pwdstat;
+
+ if (!p && !(errno = failure_errno))
+ {
+ if (! ((p = getenv ("PWD")) != 0
+ && *p == '/'
+ && stat (p, &pwdstat) == 0
+ && stat (".", &dotstat) == 0
+ && dotstat.st_ino == pwdstat.st_ino
+ && dotstat.st_dev == pwdstat.st_dev))
+
+ /* The shortcut didn't work. Try the slow, ``sure'' way. */
+ for (s = GUESSPATHLEN; ! getcwd (p = xmalloc (s), s); s *= 2)
+ {
+ int e = errno;
+ free (p);
+#ifdef ERANGE
+ if (e != ERANGE)
+#endif
+ {
+ errno = failure_errno = e;
+ p = 0;
+ break;
+ }
+ }
+
+ /* Cache the result. This assumes that the program does
+ not invoke chdir between calls to getpwd. */
+ pwd = p;
+ }
+ return p;
+}
+
+#else /* VMS || _WIN32 && !__CYGWIN__ */
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 255
+#endif
+
+char *
+getpwd ()
+{
+ static char *pwd = 0;
+
+ if (!pwd)
+ pwd = getcwd (xmalloc (MAXPATHLEN + 1), MAXPATHLEN + 1
+#ifdef VMS
+ , 0
+#endif
+ );
+ return pwd;
+}
+
+#endif /* VMS || _WIN32 && !__CYGWIN__ */
diff --git a/contrib/binutils/libiberty/getruntime.c b/contrib/binutils/libiberty/getruntime.c
index 1be3b4c..b855ea6 100644
--- a/contrib/binutils/libiberty/getruntime.c
+++ b/contrib/binutils/libiberty/getruntime.c
@@ -1,5 +1,5 @@
/* Return time used so far, in microseconds.
- Copyright (C) 1994 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1999 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@ -17,6 +17,8 @@ License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include "config.h"
+
#include "ansidecl.h"
#include "libiberty.h"
@@ -26,28 +28,22 @@ Boston, MA 02111-1307, USA. */
#include <time.h>
-/* These should go away when libiberty uses autoconf. */
-
-#if defined(__sun__) && !defined(__svr4__)
-#define HAVE_GETRUSAGE
-#endif
-
-#ifdef HAVE_SYSCONF
-#define HAVE_TIMES
-#endif
-
-#ifdef HAVE_GETRUSAGE
+#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
#include <sys/time.h>
#include <sys/resource.h>
#endif
#ifdef HAVE_TIMES
-#ifndef NO_SYS_PARAM_H
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/times.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* This is a fallback; if wrong, it will likely make obviously wrong
results. */
@@ -55,10 +51,22 @@ Boston, MA 02111-1307, USA. */
#define CLOCKS_PER_SEC 1
#endif
+#ifdef _SC_CLK_TCK
+#define GNU_HZ sysconf(_SC_CLK_TCK)
+#else
+#ifdef HZ
+#define GNU_HZ HZ
+#else
+#ifdef CLOCKS_PER_SEC
+#define GNU_HZ CLOCKS_PER_SEC
+#endif
+#endif
+#endif
+
long
get_run_time ()
{
-#ifdef HAVE_GETRUSAGE
+#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
struct rusage rusage;
getrusage (0, &rusage);
@@ -69,7 +77,7 @@ get_run_time ()
struct tms tms;
times (&tms);
- return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
+ return (tms.tms_utime + tms.tms_stime) * (1000000 / GNU_HZ);
#else /* ! HAVE_TIMES */
/* Fall back on clock and hope it's correctly implemented. */
const long clocks_per_sec = CLOCKS_PER_SEC;
diff --git a/contrib/binutils/libiberty/hashtab.c b/contrib/binutils/libiberty/hashtab.c
new file mode 100644
index 0000000..16c5d3e
--- /dev/null
+++ b/contrib/binutils/libiberty/hashtab.c
@@ -0,0 +1,429 @@
+/* An expandable hash tables datatype.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ Contributed by Vladimir Makarov (vmakarov@cygnus.com).
+
+This file is part of the libiberty library.
+Libiberty is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+Libiberty 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with libiberty; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* This package implements basic hash table functionality. It is possible
+ to search for an entry, create an entry and destroy an entry.
+
+ Elements in the table are generic pointers.
+
+ The size of the table is not fixed; if the occupancy of the table
+ grows too high the hash table will be expanded.
+
+ The abstract data implementation is based on generalized Algorithm D
+ from Knuth's book "The art of computer programming". Hash table is
+ expanded by creation of new hash table and transferring elements from
+ the old table to the new table. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <stdio.h>
+
+#include "libiberty.h"
+#include "hashtab.h"
+
+/* This macro defines reserved value for empty table entry. */
+
+#define EMPTY_ENTRY ((void *) 0)
+
+/* This macro defines reserved value for table entry which contained
+ a deleted element. */
+
+#define DELETED_ENTRY ((void *) 1)
+
+/* The following function returns the nearest prime number which is
+ greater than given source number. */
+
+static unsigned long
+higher_prime_number (n)
+ unsigned long n;
+{
+ unsigned long i;
+
+ n |= 0x01; /* Force N to be odd. */
+ if (n < 9)
+ return n; /* All odd numbers < 9 are prime. */
+
+ next:
+ n += 2;
+ i = 3;
+ do
+ {
+ if (n % i == 0)
+ goto next;
+ i += 2;
+ }
+ while ((i * i) <= n);
+
+ return n;
+}
+
+/* This function creates table with length slightly longer than given
+ source length. Created hash table is initiated as empty (all the
+ hash table entries are EMPTY_ENTRY). The function returns the
+ created hash table. */
+
+htab_t
+htab_create (size, hash_f, eq_f, del_f)
+ size_t size;
+ htab_hash hash_f;
+ htab_eq eq_f;
+ htab_del del_f;
+{
+ htab_t result;
+
+ size = higher_prime_number (size);
+ result = (htab_t) xcalloc (1, sizeof (struct htab));
+ result->entries = (void **) xcalloc (size, sizeof (void *));
+ result->size = size;
+ result->hash_f = hash_f;
+ result->eq_f = eq_f;
+ result->del_f = del_f;
+ return result;
+}
+
+/* This function frees all memory allocated for given hash table.
+ Naturally the hash table must already exist. */
+
+void
+htab_delete (htab)
+ htab_t htab;
+{
+ int i;
+ if (htab->del_f)
+ for (i = htab->size - 1; i >= 0; i--)
+ {
+ if (htab->entries[i] != EMPTY_ENTRY
+ && htab->entries[i] != DELETED_ENTRY)
+ (*htab->del_f) (htab->entries[i]);
+ }
+
+ free (htab->entries);
+ free (htab);
+}
+
+/* This function clears all entries in the given hash table. */
+
+void
+htab_empty (htab)
+ htab_t htab;
+{
+ int i;
+ if (htab->del_f)
+ for (i = htab->size - 1; i >= 0; i--)
+ {
+ if (htab->entries[i] != EMPTY_ENTRY
+ && htab->entries[i] != DELETED_ENTRY)
+ (*htab->del_f) (htab->entries[i]);
+ }
+
+ memset (htab->entries, 0, htab->size * sizeof (void *));
+}
+
+/* Similar to htab_find_slot, but without several unwanted side effects:
+ - Does not call htab->eq_f when it finds an existing entry.
+ - Does not change the count of elements/searches/collisions in the
+ hash table.
+ This function also assumes there are no deleted entries in the table.
+ HASH is the hash value for the element to be inserted. */
+static void **
+find_empty_slot_for_expand (htab, hash)
+ htab_t htab;
+ unsigned int hash;
+{
+ size_t size = htab->size;
+ unsigned int hash2 = 1 + hash % (size - 2);
+ unsigned int index = hash % size;
+
+ for (;;)
+ {
+ void **slot = htab->entries + index;
+ if (*slot == EMPTY_ENTRY)
+ return slot;
+
+ if (*slot == DELETED_ENTRY)
+ abort ();
+
+ index += hash2;
+ if (index >= size)
+ index -= size;
+ }
+}
+
+/* The following function changes size of memory allocated for the
+ entries and repeatedly inserts the table elements. The occupancy
+ of the table after the call will be about 50%. Naturally the hash
+ table must already exist. Remember also that the place of the
+ table entries is changed. */
+
+static void
+htab_expand (htab)
+ htab_t htab;
+{
+ void **oentries;
+ void **olimit;
+ void **p;
+
+ oentries = htab->entries;
+ olimit = oentries + htab->size;
+
+ htab->size = higher_prime_number (htab->size * 2);
+ htab->entries = xcalloc (htab->size, sizeof (void **));
+
+ htab->n_elements -= htab->n_deleted;
+ htab->n_deleted = 0;
+
+ p = oentries;
+ do
+ {
+ void *x = *p;
+ if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
+ {
+ void **q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
+ *q = x;
+ }
+ p++;
+ }
+ while (p < olimit);
+ free (oentries);
+}
+
+/* This function searches for a hash table entry equal to the given
+ element. It cannot be used to insert or delete an element. */
+
+void *
+htab_find_with_hash (htab, element, hash)
+ htab_t htab;
+ const void *element;
+ unsigned int hash;
+{
+ unsigned int index, hash2;
+ size_t size;
+
+ htab->searches++;
+ size = htab->size;
+ hash2 = 1 + hash % (size - 2);
+ index = hash % size;
+
+ for (;;)
+ {
+ void *entry = htab->entries[index];
+ if (entry == EMPTY_ENTRY)
+ return NULL;
+ else if (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element))
+ return entry;
+
+ htab->collisions++;
+ index += hash2;
+ if (index >= size)
+ index -= size;
+ }
+}
+
+/* Like htab_find_slot_with_hash, but compute the hash value from the
+ element. */
+void *
+htab_find (htab, element)
+ htab_t htab;
+ const void *element;
+{
+ return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
+}
+
+/* This function searches for a hash table slot containing an entry
+ equal to the given element. To delete an entry, call this with
+ INSERT = 0, then call htab_clear_slot on the slot returned (possibly
+ after doing some checks). To insert an entry, call this with
+ INSERT = 1, then write the value you want into the returned slot. */
+
+void **
+htab_find_slot_with_hash (htab, element, hash, insert)
+ htab_t htab;
+ const void *element;
+ unsigned int hash;
+ int insert;
+{
+ void **first_deleted_slot;
+ unsigned int index, hash2;
+ size_t size;
+
+ if (insert && htab->size * 3 <= htab->n_elements * 4)
+ htab_expand (htab);
+
+ size = htab->size;
+ hash2 = 1 + hash % (size - 2);
+ index = hash % size;
+
+ htab->searches++;
+ first_deleted_slot = NULL;
+
+ for (;;)
+ {
+ void *entry = htab->entries[index];
+ if (entry == EMPTY_ENTRY)
+ {
+ if (!insert)
+ return NULL;
+
+ htab->n_elements++;
+
+ if (first_deleted_slot)
+ {
+ *first_deleted_slot = EMPTY_ENTRY;
+ return first_deleted_slot;
+ }
+
+ return &htab->entries[index];
+ }
+
+ if (entry == DELETED_ENTRY)
+ {
+ if (!first_deleted_slot)
+ first_deleted_slot = &htab->entries[index];
+ }
+ else
+ {
+ if ((*htab->eq_f) (entry, element))
+ return &htab->entries[index];
+ }
+
+ htab->collisions++;
+ index += hash2;
+ if (index >= size)
+ index -= size;
+ }
+}
+
+/* Like htab_find_slot_with_hash, but compute the hash value from the
+ element. */
+void **
+htab_find_slot (htab, element, insert)
+ htab_t htab;
+ const void *element;
+ int insert;
+{
+ return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
+ insert);
+}
+
+/* This function deletes an element with the given value from hash
+ table. If there is no matching element in the hash table, this
+ function does nothing. */
+
+void
+htab_remove_elt (htab, element)
+ htab_t htab;
+ void *element;
+{
+ void **slot;
+
+ slot = htab_find_slot (htab, element, 0);
+ if (*slot == EMPTY_ENTRY)
+ return;
+
+ if (htab->del_f)
+ (*htab->del_f) (*slot);
+
+ *slot = DELETED_ENTRY;
+ htab->n_deleted++;
+}
+
+/* This function clears a specified slot in a hash table. It is
+ useful when you've already done the lookup and don't want to do it
+ again. */
+
+void
+htab_clear_slot (htab, slot)
+ htab_t htab;
+ void **slot;
+{
+ if (slot < htab->entries || slot >= htab->entries + htab->size
+ || *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
+ abort ();
+ if (htab->del_f)
+ (*htab->del_f) (*slot);
+ *slot = DELETED_ENTRY;
+ htab->n_deleted++;
+}
+
+/* This function scans over the entire hash table calling
+ CALLBACK for each live entry. If CALLBACK returns false,
+ the iteration stops. INFO is passed as CALLBACK's second
+ argument. */
+
+void
+htab_traverse (htab, callback, info)
+ htab_t htab;
+ htab_trav callback;
+ void *info;
+{
+ void **slot, **limit;
+ slot = htab->entries;
+ limit = slot + htab->size;
+ do
+ {
+ void *x = *slot;
+ if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
+ if (!(*callback) (slot, info))
+ break;
+ }
+ while (++slot < limit);
+}
+
+/* The following function returns current size of given hash table. */
+
+size_t
+htab_size (htab)
+ htab_t htab;
+{
+ return htab->size;
+}
+
+/* The following function returns current number of elements in given
+ hash table. */
+
+size_t
+htab_elements (htab)
+ htab_t htab;
+{
+ return htab->n_elements - htab->n_deleted;
+}
+
+/* The following function returns number of percents of fixed
+ collisions during all work with given hash table. */
+
+double
+htab_collisions (htab)
+ htab_t htab;
+{
+ int searches;
+
+ searches = htab->searches;
+ if (searches == 0)
+ return 0.0;
+ return (double)htab->collisions / (double)searches;
+}
diff --git a/contrib/binutils/libiberty/memchr.c b/contrib/binutils/libiberty/memchr.c
index 93ef43d..cce3003 100644
--- a/contrib/binutils/libiberty/memchr.c
+++ b/contrib/binutils/libiberty/memchr.c
@@ -44,11 +44,11 @@ QUICKREF
PTR
memchr (src_void, c, length)
- register CONST PTR src_void;
+ register const PTR src_void;
int c;
size_t length;
{
- CONST unsigned char *src = (CONST unsigned char *)src_void;
+ const unsigned char *src = (const unsigned char *)src_void;
while (--length >= 0)
{
diff --git a/contrib/binutils/libiberty/memcpy.c b/contrib/binutils/libiberty/memcpy.c
index c28208a0..707a9f5 100644
--- a/contrib/binutils/libiberty/memcpy.c
+++ b/contrib/binutils/libiberty/memcpy.c
@@ -21,7 +21,7 @@ DESCRIPTION
#endif
PTR
-DEFUN(memcpy, (out, in, length), PTR out AND CONST PTR in AND size_t length)
+DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length)
{
bcopy(in, out, length);
return out;
diff --git a/contrib/binutils/libiberty/memmove.c b/contrib/binutils/libiberty/memmove.c
index 818fc24..176c326 100644
--- a/contrib/binutils/libiberty/memmove.c
+++ b/contrib/binutils/libiberty/memmove.c
@@ -10,7 +10,7 @@
PTR
memmove (s1, s2, n)
PTR s1;
- CONST PTR s2;
+ const PTR s2;
size_t n;
{
bcopy (s2, s1, n);
diff --git a/contrib/binutils/libiberty/mkstemps.c b/contrib/binutils/libiberty/mkstemps.c
new file mode 100644
index 0000000..16c16a2
--- /dev/null
+++ b/contrib/binutils/libiberty/mkstemps.c
@@ -0,0 +1,128 @@
+/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
+ This file is derived from mkstemp.c from the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include "ansidecl.h"
+
+/* We need to provide a type for gcc_uint64_t. */
+#ifdef __GNUC__
+typedef unsigned long long gcc_uint64_t;
+#else
+typedef unsigned long gcc_uint64_t;
+#endif
+
+#ifndef TMP_MAX
+#define TMP_MAX 16384
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE.
+
+ TEMPLATE has the form:
+
+ <path>/ccXXXXXX<suffix>
+
+ SUFFIX_LEN tells us how long <suffix> is (it can be zero length).
+
+ The last six characters of TEMPLATE before <suffix> must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+
+ Returns a file descriptor open on the file for reading and writing. */
+int
+mkstemps (template, suffix_len)
+ char *template;
+ int suffix_len;
+{
+ static const char letters[]
+ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ static gcc_uint64_t value;
+#ifdef HAVE_GETTIMEOFDAY
+ struct timeval tv;
+#endif
+ char *XXXXXX;
+ size_t len;
+ int count;
+
+ len = strlen (template);
+
+ if ((int) len < 6 + suffix_len
+ || strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
+ {
+ return -1;
+ }
+
+ XXXXXX = &template[len - 6 - suffix_len];
+
+#ifdef HAVE_GETTIMEOFDAY
+ /* Get some more or less random data. */
+ gettimeofday (&tv, NULL);
+ value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
+#else
+ value += getpid ();
+#endif
+
+ for (count = 0; count < TMP_MAX; ++count)
+ {
+ gcc_uint64_t v = value;
+ int fd;
+
+ /* Fill in the random bits. */
+ XXXXXX[0] = letters[v % 62];
+ v /= 62;
+ XXXXXX[1] = letters[v % 62];
+ v /= 62;
+ XXXXXX[2] = letters[v % 62];
+ v /= 62;
+ XXXXXX[3] = letters[v % 62];
+ v /= 62;
+ XXXXXX[4] = letters[v % 62];
+ v /= 62;
+ XXXXXX[5] = letters[v % 62];
+
+ fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
+ if (fd >= 0)
+ /* The file does not exist. */
+ return fd;
+
+ /* This is a random value. It is only necessary that the next
+ TMP_MAX values generated by adding 7777 to VALUE are different
+ with (module 2^32). */
+ value += 7777;
+ }
+
+ /* We return the null string if we can't find a unique file name. */
+ template[0] = '\0';
+ return -1;
+}
diff --git a/contrib/binutils/libiberty/objalloc.c b/contrib/binutils/libiberty/objalloc.c
index 34687d3..57754a8 100644
--- a/contrib/binutils/libiberty/objalloc.c
+++ b/contrib/binutils/libiberty/objalloc.c
@@ -14,7 +14,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#include "ansidecl.h"
#include "objalloc.h"
@@ -34,6 +35,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* For systems with larger pointers than ints, this must be declared. */
extern PTR malloc PARAMS ((size_t));
+extern void free PARAMS ((PTR));
#endif
/* These routines allocate space for an object. Freeing allocated
diff --git a/contrib/binutils/libiberty/obstack.c b/contrib/binutils/libiberty/obstack.c
index a6880ca..bc318b3 100644
--- a/contrib/binutils/libiberty/obstack.c
+++ b/contrib/binutils/libiberty/obstack.c
@@ -1,19 +1,28 @@
/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+ Copyright (C) 1988,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
-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.
+ NOTE: The canonical source of this file is maintained with the GNU C Library.
+ Bugs can be reported to bug-glibc@gnu.org.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "obstack.h"
@@ -39,23 +48,6 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
#endif
-/* CYGNUS LOCAL (not to be elided!) */
-
-int
-_obstack_memory_used (h)
- struct obstack *h;
-{
- register struct _obstack_chunk* lp;
- register int nbytes = 0;
-
- for (lp = h->chunk; lp != 0; lp = lp->prev)
- {
- nbytes += lp->limit - (char *) lp;
- }
- return nbytes;
-}
-
-/* END CYGNUS LOCAL */
#ifndef ELIDE_CODE
@@ -84,6 +76,28 @@ union fooround {long x; double d;};
#define COPYING_UNIT int
#endif
+
+/* The functions allocating more room by calling `obstack_chunk_alloc'
+ jump to the handler pointed to by `obstack_alloc_failed_handler'.
+ This variable by default points to the internal function
+ `print_and_abort'. */
+#if defined (__STDC__) && __STDC__
+static void print_and_abort (void);
+void (*obstack_alloc_failed_handler) (void) = print_and_abort;
+#else
+static void print_and_abort ();
+void (*obstack_alloc_failed_handler) () = print_and_abort;
+#endif
+
+/* Exit value used when `print_and_abort' is used. */
+#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+int obstack_exit_failure = EXIT_FAILURE;
+
/* The non-GNU-C macros copy the obstack into this global variable
to avoid multiple evaluation. */
@@ -95,6 +109,20 @@ struct obstack *_obstack;
For free, do not use ?:, since some compilers, like the MIPS compilers,
do not allow (expr) ? void : void. */
+#if defined (__STDC__) && __STDC__
+#define CALL_CHUNKFUN(h, size) \
+ (((h) -> use_extra_arg) \
+ ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
+ : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
+
+#define CALL_FREEFUN(h, old_chunk) \
+ do { \
+ if ((h) -> use_extra_arg) \
+ (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
+ else \
+ (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
+ } while (0)
+#else
#define CALL_CHUNKFUN(h, size) \
(((h) -> use_extra_arg) \
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
@@ -107,6 +135,7 @@ struct obstack *_obstack;
else \
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
} while (0)
+#endif
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
@@ -123,13 +152,18 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
struct obstack *h;
int size;
int alignment;
+#if defined (__STDC__) && __STDC__
+ POINTER (*chunkfun) (long);
+ void (*freefun) (void *);
+#else
POINTER (*chunkfun) ();
void (*freefun) ();
+#endif
{
register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
- alignment = DEFAULT_ALIGNMENT;
+ alignment = (int) DEFAULT_ALIGNMENT;
if (size == 0)
/* Default size is what GNU malloc can fit in a 4096-byte block. */
{
@@ -147,25 +181,27 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
size = 4096 - extra;
}
+#if defined (__STDC__) && __STDC__
+ h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
+ h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
+#else
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
h->freefun = freefun;
+#endif
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->use_extra_arg = 0;
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
- {
- h->alloc_failed = 1;
- return 0;
- }
- h->alloc_failed = 0;
+ (*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = chunk->contents;
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
+ h->alloc_failed = 0;
return 1;
}
@@ -174,14 +210,19 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
struct obstack *h;
int size;
int alignment;
+#if defined (__STDC__) && __STDC__
+ POINTER (*chunkfun) (POINTER, long);
+ void (*freefun) (POINTER, POINTER);
+#else
POINTER (*chunkfun) ();
void (*freefun) ();
+#endif
POINTER arg;
{
register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
- alignment = DEFAULT_ALIGNMENT;
+ alignment = (int) DEFAULT_ALIGNMENT;
if (size == 0)
/* Default size is what GNU malloc can fit in a 4096-byte block. */
{
@@ -199,8 +240,13 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
size = 4096 - extra;
}
+#if defined(__STDC__) && __STDC__
+ h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
+ h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
+#else
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
h->freefun = freefun;
+#endif
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->extra_arg = arg;
@@ -208,17 +254,14 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
- {
- h->alloc_failed = 1;
- return 0;
- }
- h->alloc_failed = 0;
+ (*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = chunk->contents;
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
+ h->alloc_failed = 0;
return 1;
}
@@ -236,9 +279,9 @@ _obstack_newchunk (h, length)
register struct _obstack_chunk *old_chunk = h->chunk;
register struct _obstack_chunk *new_chunk;
register long new_size;
- register int obj_size = h->next_free - h->object_base;
- register int i;
- int already;
+ register long obj_size = h->next_free - h->object_base;
+ register long i;
+ long already;
/* Compute size for new chunk. */
new_size = (obj_size + length) + (obj_size >> 3) + 100;
@@ -248,11 +291,7 @@ _obstack_newchunk (h, length)
/* Allocate and initialize the new chunk. */
new_chunk = CALL_CHUNKFUN (h, new_size);
if (!new_chunk)
- {
- h->alloc_failed = 1;
- return;
- }
- h->alloc_failed = 0;
+ (*obstack_alloc_failed_handler) ();
h->chunk = new_chunk;
new_chunk->prev = old_chunk;
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
@@ -396,6 +435,39 @@ obstack_free (h, obj)
abort ();
}
+int
+_obstack_memory_used (h)
+ struct obstack *h;
+{
+ register struct _obstack_chunk* lp;
+ register int nbytes = 0;
+
+ for (lp = h->chunk; lp != 0; lp = lp->prev)
+ {
+ nbytes += lp->limit - (char *) lp;
+ }
+ return nbytes;
+}
+
+/* Define the error handler. */
+#ifndef _
+# ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# ifndef _
+# define _(Str) gettext (Str)
+# endif
+# else
+# define _(Str) (Str)
+# endif
+#endif
+
+static void
+print_and_abort ()
+{
+ fputs (_("memory exhausted\n"), stderr);
+ exit (obstack_exit_failure);
+}
+
#if 0
/* These are now turned off because the applications do not use it
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
@@ -434,6 +506,13 @@ int (obstack_room) (obstack)
return obstack_room (obstack);
}
+int (obstack_make_room) (obstack, length)
+ struct obstack *obstack;
+ int length;
+{
+ return obstack_make_room (obstack, length);
+}
+
void (obstack_grow) (obstack, pointer, length)
struct obstack *obstack;
POINTER pointer;
diff --git a/contrib/binutils/libiberty/partition.c b/contrib/binutils/libiberty/partition.c
new file mode 100644
index 0000000..c1d5847
--- /dev/null
+++ b/contrib/binutils/libiberty/partition.c
@@ -0,0 +1,185 @@
+/* List implentation of a partition of consecutive integers.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ Contributed by CodeSourcery, LLC.
+
+ This file is part of GNU CC.
+
+ GNU CC 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.
+
+ GNU CC 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 GNU CC; see the file COPYING. If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "libiberty.h"
+#include "partition.h"
+
+/* Creates a partition of NUM_ELEMENTS elements. Initially each
+ element is in a class by itself. */
+
+partition
+partition_new (num_elements)
+ int num_elements;
+{
+ int e;
+
+ partition part = (partition)
+ xmalloc (sizeof (struct partition_def) +
+ (num_elements - 1) * sizeof (struct partition_elem));
+ part->num_elements = num_elements;
+ for (e = 0; e < num_elements; ++e)
+ {
+ part->elements[e].class_element = e;
+ part->elements[e].next = &(part->elements[e]);
+ part->elements[e].class_count = 1;
+ }
+
+ return part;
+}
+
+/* Freeds a partition. */
+
+void
+partition_delete (part)
+ partition part;
+{
+ free (part);
+}
+
+/* Unites the classes containing ELEM1 and ELEM2 into a single class
+ of partition PART. If ELEM1 and ELEM2 are already in the same
+ class, does nothing. Returns the canonical element of the
+ resulting union class. */
+
+int
+partition_union (part, elem1, elem2)
+ partition part;
+ int elem1;
+ int elem2;
+{
+ struct partition_elem *elements = part->elements;
+ struct partition_elem *e1;
+ struct partition_elem *e2;
+ struct partition_elem *p;
+ struct partition_elem *old_next;
+ /* The canonical element of the resulting union class. */
+ int class_element = elements[elem1].class_element;
+
+ /* If they're already in the same class, do nothing. */
+ if (class_element == elements[elem2].class_element)
+ return class_element;
+
+ /* Make sure ELEM1 is in the larger class of the two. If not, swap
+ them. This way we always scan the shorter list. */
+ if (elements[elem1].class_count < elements[elem2].class_count)
+ {
+ int temp = elem1;
+ elem1 = elem2;
+ elem2 = temp;
+ class_element = elements[elem1].class_element;
+ }
+
+ e1 = &(elements[elem1]);
+ e2 = &(elements[elem2]);
+
+ /* Keep a count of the number of elements in the list. */
+ elements[class_element].class_count
+ += elements[e2->class_element].class_count;
+
+ /* Update the class fields in elem2's class list. */
+ e2->class_element = class_element;
+ for (p = e2->next; p != e2; p = p->next)
+ p->class_element = class_element;
+
+ /* Splice ELEM2's class list into ELEM1's. These are circular
+ lists. */
+ old_next = e1->next;
+ e1->next = e2->next;
+ e2->next = old_next;
+
+ return class_element;
+}
+
+/* Compare elements ELEM1 and ELEM2 from array of integers, given a
+ pointer to each. Used to qsort such an array. */
+
+static int
+elem_compare (elem1, elem2)
+ const void *elem1;
+ const void *elem2;
+{
+ int e1 = * (int *) elem1;
+ int e2 = * (int *) elem2;
+ if (e1 < e2)
+ return -1;
+ else if (e1 > e2)
+ return 1;
+ else
+ return 0;
+}
+
+/* Prints PART to the file pointer FP. The elements of each
+ class are sorted. */
+
+void
+partition_print (part, fp)
+ partition part;
+ FILE *fp;
+{
+ char *done;
+ int num_elements = part->num_elements;
+ struct partition_elem *elements = part->elements;
+ int *class_elements;
+ int e;
+
+ /* Flag the elements we've already printed. */
+ done = (char *) xmalloc (num_elements);
+ memset (done, 0, num_elements);
+
+ /* A buffer used to sort elements in a class. */
+ class_elements = (int *) xmalloc (num_elements * sizeof (int));
+
+ fputc ('[', fp);
+ for (e = 0; e < num_elements; ++e)
+ /* If we haven't printed this element, print its entire class. */
+ if (! done[e])
+ {
+ int c = e;
+ int count = elements[elements[e].class_element].class_count;
+ int i;
+
+ /* Collect the elements in this class. */
+ for (i = 0; i < count; ++i) {
+ class_elements[i] = c;
+ done[c] = 1;
+ c = elements[c].next - elements;
+ }
+ /* Sort them. */
+ qsort ((void *) class_elements, count, sizeof (int), &elem_compare);
+ /* Print them. */
+ fputc ('(', fp);
+ for (i = 0; i < count; ++i)
+ fprintf (fp, i == 0 ? "%d" : " %d", class_elements[i]);
+ fputc (')', fp);
+ }
+ fputc (']', fp);
+
+ free (done);
+}
+
diff --git a/contrib/binutils/libiberty/pexecute.c b/contrib/binutils/libiberty/pexecute.c
index fbbea40..56ddec7 100644
--- a/contrib/binutils/libiberty/pexecute.c
+++ b/contrib/binutils/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 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
@@ -23,24 +23,37 @@ Boston, MA 02111-1307, USA. */
/* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */
-#ifdef IN_GCC
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <errno.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#define ISSPACE (x) isspace(x)
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
-#ifdef IN_GCC
-#include "gansidecl.h"
-/* ??? Need to find a suitable header file. */
-#define PEXECUTE_FIRST 1
-#define PEXECUTE_LAST 2
-#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
-#define PEXECUTE_SEARCH 4
-#define PEXECUTE_VERBOSE 8
+#ifdef vfork /* Autoconf may define this to fork for us. */
+# define VFORK_STRING "fork"
#else
-#include "libiberty.h"
+# define VFORK_STRING "vfork"
+#endif
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
#endif
+#ifdef VMS
+#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
+ lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
+#endif /* VMS */
+
+#include "libiberty.h"
/* stdin file number. */
#define STDIN_FILE_NO 0
@@ -146,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,
@@ -166,7 +181,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
char *cp;
for (cp = argv[i]; *cp; cp++)
{
- if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp))
+ if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp))
fputc ('\\', argfile);
fputc (*cp, argfile);
}
@@ -220,53 +235,18 @@ pwait (pid, status, flags)
#endif /* MSDOS */
-#if defined (_WIN32)
+#if defined (_WIN32) && ! defined (_UWIN)
#include <process.h>
-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
#define fix_argv(argvec) (argvec)
extern int _spawnv ();
extern int _spawnvp ();
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
- pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
- (_P_NOWAIT, program, fix_argv(argv));
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
- return pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- return cwait (status, pid, WAIT_CHILD);
-}
-
-#else /* ! __CYGWIN32__ */
+#else /* ! __CYGWIN__ */
/* This is a kludge to get around the Microsoft C spawn functions' propensity
to remove the outermost set of double quotes from all arguments. */
@@ -302,8 +282,48 @@ 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__ */
#include <io.h>
#include <fcntl.h>
@@ -420,6 +440,9 @@ pwait (pid, status, flags)
int *status;
int flags;
{
+#ifdef __CYGWIN__
+ return wait (status);
+#else
int termstat;
pid = _cwait (&termstat, pid, WAIT_CHILD);
@@ -437,11 +460,10 @@ pwait (pid, status, flags)
*status = (((termstat) & 0xff) << 8);
return pid;
+#endif /* __CYGWIN__ */
}
-#endif /* ! defined (__CYGWIN32__) */
-
-#endif /* _WIN32 */
+#endif /* _WIN32 && ! _UWIN */
#ifdef OS2
@@ -509,7 +531,7 @@ static int first_time = 1;
int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
const char *program;
- char **argv;
+ char * const *argv;
const char *this_pname;
const char *temp_base;
char **errmsg_fmt, **errmsg_arg;
@@ -538,14 +560,18 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
fputc (' ', stdout);
for (i=1; argv[i]; i++)
{
- /* We have to quote every arg, so that when the echo is
- executed, the quotes are stripped and the original arg
- is left. */
fputc ('\'', stdout);
+ /* See if we have an argument that needs fixing. */
+ if (strchr(argv[i], '/'))
+ {
+ tmpname = (char *) xmalloc (256);
+ mpwify_filename (argv[i], tmpname);
+ argv[i] = tmpname;
+ }
for (cp = argv[i]; *cp; cp++)
{
- /* Write an Option-d esc char in front of special chars. */
- if (strchr ("\"'+", *cp))
+ /* Write an Option-d escape char in front of special chars. */
+ if (strchr("'+", *cp))
fputc ('\266', stdout);
fputc (*cp, stdout);
}
@@ -560,15 +586,20 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
for (i=1; argv[i]; i++)
{
+ /* See if we have an argument that needs fixing. */
+ if (strchr(argv[i], '/'))
+ {
+ tmpname = (char *) xmalloc (256);
+ mpwify_filename (argv[i], tmpname);
+ argv[i] = tmpname;
+ }
if (strchr (argv[i], ' '))
fputc ('\'', stdout);
for (cp = argv[i]; *cp; cp++)
{
- /* Write an Option-d esc char in front of special chars. */
- if (strchr ("\"'+", *cp))
- {
- fputc ('\266', stdout);
- }
+ /* Write an Option-d escape char in front of special chars. */
+ if (strchr("'+", *cp))
+ fputc ('\266', stdout);
fputc (*cp, stdout);
}
if (strchr (argv[i], ' '))
@@ -615,16 +646,7 @@ pfinish ()
/* include for Unix-like environments but not for Dos-like environments */
#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
- && ! defined (_WIN32)
-
-#ifdef VMS
-#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
- lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
-#else
-#ifdef USG
-#define vfork fork
-#endif
-#endif
+ && ! (defined (_WIN32) && ! defined (_UWIN))
extern int execv ();
extern int execvp ();
@@ -634,7 +656,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
const char *program;
char * const *argv;
const char *this_pname;
- const char *temp_base;
+ const char *temp_base ATTRIBUTE_UNUSED;
char **errmsg_fmt, **errmsg_arg;
int flags;
{
@@ -689,11 +711,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
{
case -1:
{
-#ifdef vfork
- *errmsg_fmt = "fork";
-#else
- *errmsg_fmt = "vfork";
-#endif
+ *errmsg_fmt = VFORK_STRING;
*errmsg_arg = NULL;
return -1;
}
@@ -723,11 +741,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
/* Note: Calling fprintf and exit here doesn't seem right for vfork. */
fprintf (stderr, "%s: ", this_pname);
fprintf (stderr, install_error_msg, program);
-#ifdef IN_GCC
- fprintf (stderr, ": %s\n", my_strerror (errno));
-#else
fprintf (stderr, ": %s\n", xstrerror (errno));
-#endif
exit (-1);
/* NOTREACHED */
return 0;
@@ -749,7 +763,7 @@ int
pwait (pid, status, flags)
int pid;
int *status;
- int flags;
+ int flags ATTRIBUTE_UNUSED;
{
/* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */
@@ -761,4 +775,4 @@ pwait (pid, status, flags)
return pid;
}
-#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */
+#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */
diff --git a/contrib/binutils/libiberty/putenv.c b/contrib/binutils/libiberty/putenv.c
new file mode 100644
index 0000000..9d56922
--- /dev/null
+++ b/contrib/binutils/libiberty/putenv.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
+ This file based on putenv.c in the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if defined (_AIX) && !defined (__GNUC__)
+ #pragma alloca
+#endif
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ansidecl.h"
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#else
+# ifndef alloca
+# ifdef __GNUC__
+# define alloca __builtin_alloca
+# else
+extern char *alloca ();
+# endif /* __GNUC__ */
+# endif /* alloca */
+#endif /* HAVE_ALLOCA_H */
+
+/* Below this point, it's verbatim code from the glibc-2.0 implementation */
+
+
+/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
+int
+putenv (string)
+ const char *string;
+{
+ const char *const name_end = strchr (string, '=');
+
+ if (name_end)
+ {
+ char *name = (char *) alloca (name_end - string + 1);
+ memcpy (name, string, name_end - string);
+ name[name_end - string] = '\0';
+ return setenv (name, name_end + 1, 1);
+ }
+
+ unsetenv (string);
+ return 0;
+}
diff --git a/contrib/binutils/libiberty/random.c b/contrib/binutils/libiberty/random.c
index e205719..ef00da0 100644
--- a/contrib/binutils/libiberty/random.c
+++ b/contrib/binutils/libiberty/random.c
@@ -2,17 +2,30 @@
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. [rescinded 22 July 1999]
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
/*
@@ -37,10 +50,14 @@
#ifdef __STDC__
# define PTR void *
-# define NULL (void *) 0
+# ifndef NULL
+# define NULL (void *) 0
+# endif
#else
# define PTR char *
-# define NULL 0
+# ifndef NULL
+# define NULL (void *) 0
+# endif
#endif
#endif
diff --git a/contrib/binutils/libiberty/setenv.c b/contrib/binutils/libiberty/setenv.c
new file mode 100644
index 0000000..eec1300
--- /dev/null
+++ b/contrib/binutils/libiberty/setenv.c
@@ -0,0 +1,163 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file based on setenv.c in the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ansidecl.h"
+#include <sys/types.h> /* For `size_t' */
+#include <stdio.h> /* For `NULL' */
+
+#include <errno.h>
+#if !defined(errno) && !defined(HAVE_ERRNO_DECL)
+extern int errno;
+#endif
+#define __set_errno(ev) ((errno) = (ev))
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#define __environ environ
+#ifndef HAVE_ENVIRON_DECL
+extern char **environ;
+#endif
+
+/* LOCK and UNLOCK are defined as no-ops. This makes the libiberty
+ * implementation MT-Unsafe. */
+#define LOCK
+#define UNLOCK
+
+/* Below this point, it's verbatim code from the glibc-2.0 implementation */
+
+/* If this variable is not a null pointer we allocated the current
+ environment. */
+static char **last_environ;
+
+
+int
+setenv (name, value, replace)
+ const char *name;
+ const char *value;
+ int replace;
+{
+ register char **ep;
+ register size_t size;
+ const size_t namelen = strlen (name);
+ const size_t vallen = strlen (value) + 1;
+
+ LOCK;
+
+ size = 0;
+ if (__environ != NULL)
+ for (ep = __environ; *ep != NULL; ++ep)
+ if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
+ break;
+ else
+ ++size;
+
+ if (__environ == NULL || *ep == NULL)
+ {
+ char **new_environ;
+ if (__environ == last_environ && __environ != NULL)
+ /* We allocated this space; we can extend it. */
+ new_environ = (char **) realloc (last_environ,
+ (size + 2) * sizeof (char *));
+ else
+ new_environ = (char **) malloc ((size + 2) * sizeof (char *));
+
+ if (new_environ == NULL)
+ {
+ UNLOCK;
+ return -1;
+ }
+
+ new_environ[size] = malloc (namelen + 1 + vallen);
+ if (new_environ[size] == NULL)
+ {
+ free ((char *) new_environ);
+ __set_errno (ENOMEM);
+ UNLOCK;
+ return -1;
+ }
+
+ if (__environ != last_environ)
+ memcpy ((char *) new_environ, (char *) __environ,
+ size * sizeof (char *));
+
+ memcpy (new_environ[size], name, namelen);
+ new_environ[size][namelen] = '=';
+ memcpy (&new_environ[size][namelen + 1], value, vallen);
+
+ new_environ[size + 1] = NULL;
+
+ last_environ = __environ = new_environ;
+ }
+ else if (replace)
+ {
+ size_t len = strlen (*ep);
+ if (len + 1 < namelen + 1 + vallen)
+ {
+ /* The existing string is too short; malloc a new one. */
+ char *new = malloc (namelen + 1 + vallen);
+ if (new == NULL)
+ {
+ UNLOCK;
+ return -1;
+ }
+ *ep = new;
+ }
+ memcpy (*ep, name, namelen);
+ (*ep)[namelen] = '=';
+ memcpy (&(*ep)[namelen + 1], value, vallen);
+ }
+
+ UNLOCK;
+
+ return 0;
+}
+
+void
+unsetenv (name)
+ const char *name;
+{
+ const size_t len = strlen (name);
+ char **ep;
+
+ LOCK;
+
+ for (ep = __environ; *ep; ++ep)
+ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+ {
+ /* Found it. Remove this pointer by moving later ones back. */
+ char **dp = ep;
+ do
+ dp[0] = dp[1];
+ while (*dp++);
+ /* Continue the loop in case NAME appears again. */
+ }
+
+ UNLOCK;
+}
diff --git a/contrib/binutils/libiberty/splay-tree.c b/contrib/binutils/libiberty/splay-tree.c
new file mode 100644
index 0000000..22ea07d
--- /dev/null
+++ b/contrib/binutils/libiberty/splay-tree.c
@@ -0,0 +1,370 @@
+/* A splay-tree datatype.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Contributed by Mark Mitchell (mark@markmitchell.com).
+
+This file is part of GNU CC.
+
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* For an easily readable description of splay-trees, see:
+
+ Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
+ Algorithms. Harper-Collins, Inc. 1991. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "libiberty.h"
+#include "splay-tree.h"
+
+static void splay_tree_delete_helper PARAMS((splay_tree,
+ splay_tree_node));
+static void splay_tree_splay PARAMS((splay_tree,
+ splay_tree_key));
+static splay_tree_node splay_tree_splay_helper
+ PARAMS((splay_tree,
+ splay_tree_key,
+ splay_tree_node*,
+ splay_tree_node*,
+ splay_tree_node*));
+static int splay_tree_foreach_helper PARAMS((splay_tree,
+ splay_tree_node,
+ splay_tree_foreach_fn,
+ void*));
+
+/* Deallocate NODE (a member of SP), and all its sub-trees. */
+
+static void
+splay_tree_delete_helper (sp, node)
+ splay_tree sp;
+ splay_tree_node node;
+{
+ if (!node)
+ return;
+
+ splay_tree_delete_helper (sp, node->left);
+ splay_tree_delete_helper (sp, node->right);
+
+ if (sp->delete_key)
+ (*sp->delete_key)(node->key);
+ if (sp->delete_value)
+ (*sp->delete_value)(node->value);
+
+ free ((char*) node);
+}
+
+/* Help splay SP around KEY. PARENT and GRANDPARENT are the parent
+ and grandparent, respectively, of NODE. */
+
+static splay_tree_node
+splay_tree_splay_helper (sp, key, node, parent, grandparent)
+ splay_tree sp;
+ splay_tree_key key;
+ splay_tree_node *node;
+ splay_tree_node *parent;
+ splay_tree_node *grandparent;
+{
+ splay_tree_node *next;
+ splay_tree_node n;
+ int comparison;
+
+ n = *node;
+
+ if (!n)
+ return *parent;
+
+ comparison = (*sp->comp) (key, n->key);
+
+ if (comparison == 0)
+ /* We've found the target. */
+ next = 0;
+ else if (comparison < 0)
+ /* The target is to the left. */
+ next = &n->left;
+ else
+ /* The target is to the right. */
+ next = &n->right;
+
+ if (next)
+ {
+ /* Continue down the tree. */
+ n = splay_tree_splay_helper (sp, key, next, node, parent);
+
+ /* The recursive call will change the place to which NODE
+ points. */
+ if (*node != n)
+ return n;
+ }
+
+ if (!parent)
+ /* NODE is the root. We are done. */
+ return n;
+
+ /* First, handle the case where there is no grandparent (i.e.,
+ *PARENT is the root of the tree.) */
+ if (!grandparent)
+ {
+ if (n == (*parent)->left)
+ {
+ *node = n->right;
+ n->right = *parent;
+ }
+ else
+ {
+ *node = n->left;
+ n->left = *parent;
+ }
+ *parent = n;
+ return n;
+ }
+
+ /* Next handle the cases where both N and *PARENT are left children,
+ or where both are right children. */
+ if (n == (*parent)->left && *parent == (*grandparent)->left)
+ {
+ splay_tree_node p = *parent;
+
+ (*grandparent)->left = p->right;
+ p->right = *grandparent;
+ p->left = n->right;
+ n->right = p;
+ *grandparent = n;
+ return n;
+ }
+ else if (n == (*parent)->right && *parent == (*grandparent)->right)
+ {
+ splay_tree_node p = *parent;
+
+ (*grandparent)->right = p->left;
+ p->left = *grandparent;
+ p->right = n->left;
+ n->left = p;
+ *grandparent = n;
+ return n;
+ }
+
+ /* Finally, deal with the case where N is a left child, but *PARENT
+ is a right child, or vice versa. */
+ if (n == (*parent)->left)
+ {
+ (*parent)->left = n->right;
+ n->right = *parent;
+ (*grandparent)->right = n->left;
+ n->left = *grandparent;
+ *grandparent = n;
+ return n;
+ }
+ else
+ {
+ (*parent)->right = n->left;
+ n->left = *parent;
+ (*grandparent)->left = n->right;
+ n->right = *grandparent;
+ *grandparent = n;
+ return n;
+ }
+}
+
+/* Splay SP around KEY. */
+
+static void
+splay_tree_splay (sp, key)
+ splay_tree sp;
+ splay_tree_key key;
+{
+ if (sp->root == 0)
+ return;
+
+ splay_tree_splay_helper (sp, key, &sp->root,
+ /*grandparent=*/0, /*parent=*/0);
+}
+
+/* Call FN, passing it the DATA, for every node below NODE, all of
+ which are from SP, following an in-order traversal. If FN every
+ returns a non-zero value, the iteration ceases immediately, and the
+ value is returned. Otherwise, this function returns 0. */
+
+static int
+splay_tree_foreach_helper (sp, node, fn, data)
+ splay_tree sp;
+ splay_tree_node node;
+ splay_tree_foreach_fn fn;
+ void* data;
+{
+ int val;
+
+ if (!node)
+ return 0;
+
+ val = splay_tree_foreach_helper (sp, node->left, fn, data);
+ if (val)
+ return val;
+
+ val = (*fn)(node, data);
+ if (val)
+ return val;
+
+ return splay_tree_foreach_helper (sp, node->right, fn, data);
+}
+
+/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
+ DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
+ values. */
+
+splay_tree
+splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
+ splay_tree_compare_fn compare_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_s));
+ sp->root = 0;
+ sp->comp = compare_fn;
+ sp->delete_key = delete_key_fn;
+ sp->delete_value = delete_value_fn;
+
+ return sp;
+}
+
+/* Deallocate SP. */
+
+void
+splay_tree_delete (sp)
+ splay_tree sp;
+{
+ splay_tree_delete_helper (sp, sp->root);
+ free ((char*) 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. Returns the new node. */
+
+splay_tree_node
+splay_tree_insert (sp, key, value)
+ splay_tree sp;
+ splay_tree_key key;
+ splay_tree_value value;
+{
+ int comparison = 0;
+
+ splay_tree_splay (sp, key);
+
+ if (sp->root)
+ comparison = (*sp->comp)(sp->root->key, key);
+
+ if (sp->root && comparison == 0)
+ {
+ /* If the root of the tree already has the indicated KEY, just
+ replace the value with VALUE. */
+ if (sp->delete_value)
+ (*sp->delete_value)(sp->root->value);
+ sp->root->value = value;
+ }
+ else
+ {
+ /* Create a new node, and insert it at the root. */
+ splay_tree_node node;
+
+ node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node_s));
+ node->key = key;
+ node->value = value;
+
+ if (!sp->root)
+ node->left = node->right = 0;
+ else if (comparison < 0)
+ {
+ node->left = sp->root;
+ node->right = node->left->right;
+ node->left->right = 0;
+ }
+ else
+ {
+ node->right = sp->root;
+ node->left = node->right->left;
+ node->right->left = 0;
+ }
+
+ sp->root = node;
+ }
+
+ return sp->root;
+}
+
+/* Lookup KEY in SP, returning VALUE if present, and NULL
+ otherwise. */
+
+splay_tree_node
+splay_tree_lookup (sp, key)
+ splay_tree sp;
+ splay_tree_key key;
+{
+ splay_tree_splay (sp, key);
+
+ if (sp->root && (*sp->comp)(sp->root->key, key) == 0)
+ return sp->root;
+ else
+ return 0;
+}
+
+/* Call FN, passing it the DATA, for every node in SP, following an
+ in-order traversal. If FN every returns a non-zero value, the
+ iteration ceases immediately, and the value is returned.
+ Otherwise, this function returns 0. */
+
+int
+splay_tree_foreach (sp, fn, data)
+ splay_tree sp;
+ splay_tree_foreach_fn fn;
+ void *data;
+{
+ return splay_tree_foreach_helper (sp, sp->root, fn, data);
+}
+
+/* Splay-tree comparison function, treating the keys as ints. */
+
+int
+splay_tree_compare_ints (k1, k2)
+ splay_tree_key k1;
+ splay_tree_key k2;
+{
+ if ((int) k1 < (int) k2)
+ return -1;
+ else if ((int) k1 > (int) k2)
+ return 1;
+ else
+ return 0;
+}
+
+/* Splay-tree comparison function, treating the keys as pointers. */
+
+int
+splay_tree_compare_pointers (k1, k2)
+ splay_tree_key k1;
+ splay_tree_key k2;
+{
+ if ((char*) k1 < (char*) k2)
+ return -1;
+ else if ((char*) k1 > (char*) k2)
+ return 1;
+ else
+ return 0;
+}
diff --git a/contrib/binutils/libiberty/strchr.c b/contrib/binutils/libiberty/strchr.c
index 22976ce..550480f 100644
--- a/contrib/binutils/libiberty/strchr.c
+++ b/contrib/binutils/libiberty/strchr.c
@@ -21,7 +21,7 @@ BUGS
char *
strchr (s, c)
- register CONST char *s;
+ register const char *s;
int c;
{
do {
diff --git a/contrib/binutils/libiberty/strerror.c b/contrib/binutils/libiberty/strerror.c
index f5e2eeb..644cc75 100644
--- a/contrib/binutils/libiberty/strerror.c
+++ b/contrib/binutils/libiberty/strerror.c
@@ -7,7 +7,7 @@
#include "config.h"
-#ifndef NEED_sys_errlist
+#ifdef HAVE_SYS_ERRLIST
/* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
might declare sys_errlist in a way that the compiler might consider
incompatible with our later declaration, perhaps by using const
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <errno.h>
-#ifndef NEED_sys_errlist
+#ifdef HAVE_SYS_ERRLIST
#undef sys_errlist
#endif
@@ -55,12 +55,12 @@ struct error_info
{
int value; /* The numeric value from <errno.h> */
const char *name; /* The equivalent symbolic value */
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
const char *msg; /* Short message about this value */
#endif
};
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
# define ENTRY(value, name, msg) {value, name, msg}
#else
# define ENTRY(value, name, msg) {value, name}
@@ -455,7 +455,7 @@ static int num_error_names = 0;
same name, it differs from other implementations in that it is dynamically
initialized rather than statically initialized. */
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
static int sys_nerr;
static const char **sys_errlist;
@@ -532,7 +532,7 @@ init_error_tables ()
}
}
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
/* Now attempt to allocate the sys_errlist table, zero it out, and then
initialize it from the statically initialized error_table. */
@@ -595,7 +595,7 @@ errno_max ()
return (maxsize - 1);
}
-#ifdef NEED_strerror
+#ifndef HAVE_STRERROR
/*
@@ -634,7 +634,7 @@ strerror (errnoval)
char *msg;
static char buf[32];
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
if (error_names == NULL)
{
@@ -668,7 +668,7 @@ strerror (errnoval)
return (msg);
}
-#endif /* NEED_strerror */
+#endif /* ! HAVE_STRERROR */
/*
diff --git a/contrib/binutils/libiberty/strrchr.c b/contrib/binutils/libiberty/strrchr.c
index 30f9e8a..8c05bcb 100644
--- a/contrib/binutils/libiberty/strrchr.c
+++ b/contrib/binutils/libiberty/strrchr.c
@@ -21,7 +21,7 @@ BUGS
char *
strrchr (s, c)
- register CONST char *s;
+ register const char *s;
int c;
{
char *rtnval = 0;
diff --git a/contrib/binutils/libiberty/strsignal.c b/contrib/binutils/libiberty/strsignal.c
index d517eed..c7bb10c 100644
--- a/contrib/binutils/libiberty/strsignal.c
+++ b/contrib/binutils/libiberty/strsignal.c
@@ -64,12 +64,12 @@ struct signal_info
{
int value; /* The numeric value from <signal.h> */
const char *name; /* The equivalent symbolic value */
-#ifdef NEED_sys_siglist
+#ifndef HAVE_SYS_SIGLIST
const char *msg; /* Short message about this value */
#endif
};
-#ifdef NEED_sys_siglist
+#ifndef HAVE_SYS_SIGLIST
# define ENTRY(value, name, msg) {value, name, msg}
#else
# define ENTRY(value, name, msg) {value, name}
@@ -236,7 +236,7 @@ static int num_signal_names = 0;
same name, it differs from other implementations in that it is dynamically
initialized rather than statically initialized. */
-#ifdef NEED_sys_siglist
+#ifndef HAVE_SYS_SIGLIST
static int sys_nsig;
static const char **sys_siglist;
@@ -319,7 +319,7 @@ init_signal_tables ()
}
}
-#ifdef NEED_sys_siglist
+#ifndef HAVE_SYS_SIGLIST
/* Now attempt to allocate the sys_siglist table, zero it out, and then
initialize it from the statically initialized signal_table. */
@@ -414,7 +414,7 @@ DESCRIPTION
*/
-#ifdef NEED_strsignal
+#ifndef HAVE_STRSIGNAL
const char *
strsignal (signo)
@@ -423,7 +423,7 @@ strsignal (signo)
const char *msg;
static char buf[32];
-#ifdef NEED_sys_siglist
+#ifndef HAVE_SYS_SIGLIST
if (signal_names == NULL)
{
@@ -452,7 +452,7 @@ strsignal (signo)
return (msg);
}
-#endif /* NEED_strsignal */
+#endif /* ! HAVE_STRSIGNAL */
/*
@@ -580,7 +580,7 @@ DESCRIPTION
followed by a newline.
*/
-#ifdef NEED_psignal
+#ifndef HAVE_PSIGNAL
void
psignal (signo, message)
@@ -601,7 +601,7 @@ psignal (signo, message)
}
}
-#endif /* NEED_psignal */
+#endif /* ! HAVE_PSIGNAL */
/* A simple little main that does nothing but print all the signal translations
diff --git a/contrib/binutils/libiberty/strtol.c b/contrib/binutils/libiberty/strtol.c
index db27ee0..5467cc3 100644
--- a/contrib/binutils/libiberty/strtol.c
+++ b/contrib/binutils/libiberty/strtol.c
@@ -10,10 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
+ * 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -63,11 +60,11 @@
*/
long
strtol(nptr, endptr, base)
- CONST char *nptr;
+ const char *nptr;
char **endptr;
register int base;
{
- register CONST char *s = nptr;
+ register const char *s = nptr;
register unsigned long acc;
register int c;
register unsigned long cutoff;
diff --git a/contrib/binutils/libiberty/strtoul.c b/contrib/binutils/libiberty/strtoul.c
index 4090245..2ec3204 100644
--- a/contrib/binutils/libiberty/strtoul.c
+++ b/contrib/binutils/libiberty/strtoul.c
@@ -10,10 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
+ * 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -51,11 +48,11 @@
*/
unsigned long
strtoul(nptr, endptr, base)
- CONST char *nptr;
+ const char *nptr;
char **endptr;
register int base;
{
- register CONST char *s = nptr;
+ register const char *s = nptr;
register unsigned long acc;
register int c;
register unsigned long cutoff;
@@ -91,7 +88,7 @@ strtoul(nptr, endptr, base)
break;
if (c >= base)
break;
- if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
+ if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
diff --git a/contrib/binutils/libiberty/tmpnam.c b/contrib/binutils/libiberty/tmpnam.c
index c061467..8eb77e2 100644
--- a/contrib/binutils/libiberty/tmpnam.c
+++ b/contrib/binutils/libiberty/tmpnam.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#ifndef L_tmpnam
-#define L_tmpname 100
+#define L_tmpnam 100
#endif
#ifndef P_tmpdir
#define P_tmpdir "/usr/tmp"
diff --git a/contrib/binutils/libiberty/vasprintf.c b/contrib/binutils/libiberty/vasprintf.c
index da83db2..b959f5f 100644
--- a/contrib/binutils/libiberty/vasprintf.c
+++ b/contrib/binutils/libiberty/vasprintf.c
@@ -18,14 +18,14 @@ License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stdio.h>
-#include <string.h>
-#include <ansidecl.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
+#include <stdio.h>
+#include <string.h>
+#include <ansidecl.h>
#ifdef TEST
int global_total_width;
@@ -105,6 +105,7 @@ int_vasprintf (result, format, args)
(void) va_arg (ap, char *);
break;
}
+ p++;
}
}
#ifdef TEST
diff --git a/contrib/binutils/libiberty/vfprintf.c b/contrib/binutils/libiberty/vfprintf.c
index ce3fdf9..db7b2ff 100644
--- a/contrib/binutils/libiberty/vfprintf.c
+++ b/contrib/binutils/libiberty/vfprintf.c
@@ -1,13 +1,21 @@
-#include <stdio.h>
+/* Provide a version vfprintf in terms of _doprnt.
+ By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ */
+
+#ifdef __STDC__
+#include <stdarg.h>
+#else
#include <varargs.h>
-#include <ansidecl.h>
+#endif
+#include <stdio.h>
#undef vfprintf
int
-vfprintf (file, format, ap)
- FILE *file;
- const char *format;
- va_list ap;
+vfprintf (stream, format, ap)
+ FILE * stream;
+ const char * format;
+ va_list ap;
{
- return _doprnt (format, ap, file);
+ return _doprnt (format, ap, stream);
}
diff --git a/contrib/binutils/libiberty/vprintf.c b/contrib/binutils/libiberty/vprintf.c
index 89c289e..65b425a 100644
--- a/contrib/binutils/libiberty/vprintf.c
+++ b/contrib/binutils/libiberty/vprintf.c
@@ -1,9 +1,9 @@
-#include <stdio.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
+#include <stdio.h>
#include <ansidecl.h>
#undef vprintf
int
diff --git a/contrib/binutils/libiberty/xmalloc.c b/contrib/binutils/libiberty/xmalloc.c
index b88105a..621c6d2 100644
--- a/contrib/binutils/libiberty/xmalloc.c
+++ b/contrib/binutils/libiberty/xmalloc.c
@@ -36,28 +36,29 @@ Boston, MA 02111-1307, USA. */
/* For systems with larger pointers than ints, these must be declared. */
PTR malloc PARAMS ((size_t));
PTR realloc PARAMS ((PTR, size_t));
+PTR calloc PARAMS ((size_t, size_t));
PTR sbrk PARAMS ((ptrdiff_t));
#endif
/* The program name if set. */
static const char *name = "";
-#if ! defined (_WIN32) || defined (__CYGWIN32__)
+#ifdef HAVE_SBRK
/* The initial sbrk, set when the program name is set. Not used for win32
ports other than cygwin32. */
static char *first_break = NULL;
-#endif
+#endif /* HAVE_SBRK */
void
xmalloc_set_program_name (s)
const char *s;
{
name = s;
-#if ! defined (_WIN32) || defined (__CYGWIN32__)
+#ifdef HAVE_SBRK
/* Win32 ports other than cygwin32 don't have brk() */
if (first_break == NULL)
first_break = (char *) sbrk (0);
-#endif /* ! _WIN32 || __CYGWIN32 __ */
+#endif /* HAVE_SBRK */
}
PTR
@@ -71,7 +72,7 @@ xmalloc (size)
newmem = malloc (size);
if (!newmem)
{
-#if ! defined (_WIN32) || defined (__CYGWIN32__)
+#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
@@ -80,15 +81,50 @@ 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
+#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 /* ! _WIN32 || __CYGWIN32 __ */
+#endif /* HAVE_SBRK */
+ xexit (1);
+ }
+ return (newmem);
+}
+
+PTR
+xcalloc (nelem, elsize)
+ size_t nelem, elsize;
+{
+ PTR newmem;
+
+ if (nelem == 0 || elsize == 0)
+ nelem = elsize = 1;
+
+ newmem = calloc (nelem, elsize);
+ if (!newmem)
+ {
+#ifdef HAVE_SBRK
+ extern char **environ;
+ size_t allocated;
+
+ if (first_break != NULL)
+ allocated = (char *) sbrk (0) - first_break;
+ else
+ allocated = (char *) sbrk (0) - (char *) &environ;
+ fprintf (stderr,
+ "\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%sCannot allocate %lu bytes\n",
+ name, *name ? ": " : "",
+ (unsigned long) (nelem * elsize));
+#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
@@ -109,7 +145,7 @@ xrealloc (oldmem, size)
newmem = realloc (oldmem, size);
if (!newmem)
{
-#ifndef __MINGW32__
+#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
@@ -118,15 +154,15 @@ 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
+#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 /* __MINGW32__ */
+#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
diff --git a/contrib/binutils/libiberty/xmemdup.c b/contrib/binutils/libiberty/xmemdup.c
new file mode 100644
index 0000000..f780041
--- /dev/null
+++ b/contrib/binutils/libiberty/xmemdup.c
@@ -0,0 +1,22 @@
+/* xmemdup.c -- Duplicate a memory buffer, using xcalloc.
+ This trivial function is in the public domain.
+ Jeff Garzik, September 1999. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "ansidecl.h"
+#include "libiberty.h"
+
+#include <sys/types.h> /* For size_t. */
+
+PTR
+xmemdup (input, copy_size, alloc_size)
+ const PTR input;
+ size_t copy_size;
+ size_t alloc_size;
+{
+ PTR output = xcalloc (1, alloc_size);
+ memcpy (output, input, copy_size);
+ return output;
+}
diff --git a/contrib/binutils/libiberty/xstrdup.c b/contrib/binutils/libiberty/xstrdup.c
index 9d08bc7..6f846cf 100644
--- a/contrib/binutils/libiberty/xstrdup.c
+++ b/contrib/binutils/libiberty/xstrdup.c
@@ -2,16 +2,22 @@
This trivial function is in the public domain.
Ian Lance Taylor, Cygnus Support, December 1995. */
+#include <sys/types.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include "ansidecl.h"
#include "libiberty.h"
char *
xstrdup (s)
- const char *s;
+ const char *s;
{
- char *ret;
-
- ret = xmalloc (strlen (s) + 1);
- strcpy (ret, s);
+ register size_t len = strlen (s) + 1;
+ register char *ret = xmalloc (len);
+ memcpy (ret, s, len);
return ret;
}
OpenPOWER on IntegriCloud