diff options
45 files changed, 7591 insertions, 2712 deletions
diff --git a/gnu/lib/libiberty/config.guess b/gnu/lib/libiberty/config.guess index 4eded68f544..4fc21ecc3aa 100644 --- a/gnu/lib/libiberty/config.guess +++ b/gnu/lib/libiberty/config.guess @@ -1,7 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 1999 Free Software Foundation, Inc. -# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-01-30' + # This file 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 of the License, or @@ -21,134 +24,295 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Written by Per Bothner <bothner@cygnus.com>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) +# (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:MicroBSD:*:*) + echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <<EOF >dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f dummy.s dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than generic posix subsystem? - # Should we change UNAME_MACHINE based on the output of uname - # instead of the specific alpha model. + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? echo alpha-pc-interix - exit 0;; + exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} + *:OS/390:*:*) + echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 @@ -156,9 +320,13 @@ EOF echo pyramid-pyramid-bsd fi exit 0 ;; - NILE:*:*:dcosx) + NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -187,7 +355,7 @@ EOF echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) @@ -201,39 +369,32 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -246,12 +407,18 @@ EOF VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; - 2020:CLIX:*:*) + 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); @@ -266,12 +433,20 @@ EOF exit (-1); } EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -287,15 +462,18 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} - else + else echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 @@ -316,12 +494,21 @@ EOF ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) + i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #include <sys/systemcfg.h> main() @@ -332,8 +519,7 @@ EOF exit(0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -341,8 +527,9 @@ EOF echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) - if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -350,7 +537,7 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -360,7 +547,7 @@ EOF ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -375,33 +562,48 @@ EOF hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; - *9??*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9] ) + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c - sed 's/^ //' << EOF >dummy.c + #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> - + int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); - #endif + #endif long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) + + switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: + case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) - switch (bits) + switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; @@ -409,20 +611,36 @@ EOF } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; - #endif + #endif default: puts ("hppa1.0"); break; } exit (0); } EOF - (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` - rm -f dummy.c dummy + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #include <unistd.h> int main () @@ -447,8 +665,7 @@ EOF exit (0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -457,13 +674,16 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; - i?86:OSF1:*:*) + i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else @@ -473,9 +693,6 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; - hppa*:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -494,71 +711,82 @@ EOF C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; - *:FreeBSD:*:*) - if test -x /usr/bin/objformat -a "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf - else - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - fi + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin32 + echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i586-pc-interix3 + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than generic posix subsystem? + # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # change UNAME_MACHINE based on the output of uname instead of - # i386? - echo i386-pc-interix + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin32 + echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -566,175 +794,159 @@ EOF *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - armv*) UNAME_MACHINE=$UNAME_MACHINE ;; - arm* | sa110*) UNAME_MACHINE="arm" ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac - + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc | elf32ppclinux) - # Determine Lib Version - cat >dummy.c <<EOF -#include <features.h> -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - ${CC-cc} dummy.c -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f dummy.c dummy - echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;; + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <<EOF -main(argc, argv) - int argc; - char *argv[]; -{ -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >dummy.c <<EOF -#include <features.h> -main(argc, argv) - int argc; - char *argv[]; -{ -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) + i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, @@ -742,46 +954,59 @@ EOF # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i?86:*:5:7*) - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 -# 5.0.4c returns "Pent II". 5.0.5 returns PentII - (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} - exit 0 ;; - i?86:*:3.2:*) + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo ${UNAME_MACHINE}-pc-isc$UNAME_REL elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*PentII' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pent II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -803,9 +1028,15 @@ EOF # "miniframe" echo m68010-convergent-sysv exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -816,28 +1047,28 @@ EOF 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; - RM*:SINIX-*:*:*) + RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; - RM*:ReliantUNIX-*:*:*) + RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) @@ -848,8 +1079,8 @@ EOF echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) @@ -861,13 +1092,17 @@ EOF # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else @@ -883,12 +1118,87 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -cat >dummy.c <<EOF +eval $set_cc_for_build +cat >$dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> # include <sys/utsname.h> @@ -926,7 +1236,10 @@ main () #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -971,11 +1284,24 @@ main () #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -986,8 +1312,7 @@ main () } EOF -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. @@ -1019,6 +1344,48 @@ then esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/gnu/lib/libiberty/config.sub b/gnu/lib/libiberty/config.sub index 567459eb1f5..2ab7f25694c 100644 --- a/gnu/lib/libiberty/config.sub +++ b/gnu/lib/libiberty/config.sub @@ -1,6 +1,10 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-01-28' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,9 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -45,30 +52,73 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi +me=`echo "$0" | sed -e 's,.*/,,'` -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -94,20 +144,28 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; - -sim | -cisco | -oki | -wec | -winbond ) # EGCS LOCAL + -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; - -scout) # EGCS LOCAL + -scout) ;; - -wrs) # EGCS LOCAL + -wrs) os=-vxworks basic_machine=$1 ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; @@ -156,49 +214,72 @@ case $os in -psos*) os=-psos ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 \ - | tron | a29k | 580 | i960 | h8300 \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x) - basic_machine=$basic_machine-unknown - ;; - m88110 | m680[012346]0 | m683?2 | m68360 | m5200 | z8k | v70 \ - | h8500 | w65) # EGCS LOCAL - ;; - thumb) - basic_machine=$basic_machine-unknown - ;; - mips64vr4300 | mips64vr4300el) # EGCS LOCAL jsmith/vr4300 + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) basic_machine=$basic_machine-unknown ;; - mips64vr4100 | mips64vr4100el) # EGCS LOCAL jsmith/vr4100 + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. basic_machine=$basic_machine-unknown + os=-none ;; - mips64vr5000 | mips64vr5000el) # EGCS LOCAL ian/vr5000 - basic_machine=$basic_machine-unknown - ;; - mips16) - basic_machine=$basic_machine-unknown - ;; - d10v) - basic_machine=$basic_machine-unknown + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -207,44 +288,62 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* \ - | hppa-* | hppa1.0-* | hppa1.1-* \ - | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ - | alpha-* | alphaev5-* | alphaev56-* | alphapca56-* \ - | alphaev6-* | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \ - | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-* | arm*-*) - ;; - m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-* | d10v-*) # EGCS LOCAL - ;; - thumb-*) # EGCS LOCAL angela/thumb - ;; - v850-*) # EGCS LOCAL - ;; - d30v-*) # EGCS LOCAL - ;; - mips64vr4300-* | mips64vr4300el-*) # EGCS LOCAL jsmith/vr4300 - ;; - mips64vr4100-* | mips64vr4100el-*) # EGCS LOCAL jsmith/vr4100 - ;; - mips16-*) # EGCS LOCAL krk/mips16 - ;; - tic30-*) # EGCS LOCAL ian/tic30 - ;; - c30-*) # EGCS LOCAL ian/tic30 - basic_machine=tic30-unknown + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. - 386bsd) # EGCS LOCAL + 386bsd) basic_machine=i386-unknown os=-bsd ;; @@ -254,11 +353,11 @@ case $basic_machine in 3b*) basic_machine=we32k-att ;; - a29khif) # EGCS LOCAL + a29khif) basic_machine=a29k-amd os=-udi ;; - adobe68k) # EGCS LOCAL + adobe68k) basic_machine=m68010-adobe os=-scout ;; @@ -277,21 +376,21 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; - apollo68bsd) # EGCS LOCAL + apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; @@ -303,6 +402,10 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -323,27 +426,30 @@ case $basic_machine in basic_machine=c38-convex os=-bsd ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [ctj]90-cray) - basic_machine=c90-cray + cray | j90) + basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola @@ -371,7 +477,7 @@ case $basic_machine in encore | umax | mmax) basic_machine=ns32k-encore ;; - es1800 | OSE68k | ose68k | ose | OSE) # EGCS LOCAL + es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; @@ -385,6 +491,10 @@ case $basic_machine in basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -393,11 +503,11 @@ case $basic_machine in basic_machine=h8300-hitachi os=-hms ;; - h8300xray) # EGCS LOCAL + h8300xray) basic_machine=h8300-hitachi os=-xray ;; - h8500hms) # EGCS LOCAL + h8500hms) basic_machine=h8500-hitachi os=-hms ;; @@ -416,22 +526,6 @@ case $basic_machine in basic_machine=m68k-hp os=-hpux ;; - w89k-*) # EGCS LOCAL - basic_machine=hppa1.1-winbond - os=-proelf - ;; - op50n-*) # EGCS LOCAL - basic_machine=hppa1.1-oki - os=-proelf - ;; - op60c-*) # EGCS LOCAL - basic_machine=hppa1.1-oki - os=-proelf - ;; - hppro) # EGCS LOCAL - basic_machine=hppa1.1-hp - os=-proelf - ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; @@ -441,22 +535,21 @@ case $basic_machine in hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9] ) + hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9] ) + hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; - hp9k78[0-9] | hp78[0-9] ) + hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | \ - hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893 ) + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; - hp9k8[0-9][13679] | hp8[0-9][13679] ) + hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) @@ -465,47 +558,42 @@ case $basic_machine in hppa-next) os=-nextstep3 ;; - hppaosf) # EGCS LOCAL + hppaosf) basic_machine=hppa1.1-hp os=-osf ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; i370-ibm* | ibm*) basic_machine=i370-ibm - os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) + i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; - i[34567]86v4*) + i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; - i[34567]86v) + i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; - i[34567]86sol2) + i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; - i386mach) # EGCS LOCAL + i386mach) basic_machine=i386-mach os=-mach ;; - i386-vsta | vsta) # EGCS LOCAL + i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; - i386-go32 | go32) # EGCS LOCAL - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -531,16 +619,16 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` @@ -548,24 +636,36 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - monitor) # EGCS LOCAL + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) basic_machine=m68k-rom68k os=-coff ;; - msdos) # EGCS LOCAL - basic_machine=i386-unknown + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc os=-msdos ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) - basic_machine=i386-unknown # EGCS LOCAL + basic_machine=i386-unknown os=-netbsd ;; netwinder) - basic_machine=armv4l-corel + basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) @@ -580,7 +680,7 @@ case $basic_machine in basic_machine=mips-sony os=-newsos ;; - necv70) # EGCS LOCAL + necv70) basic_machine=v70-nec os=-sysv ;; @@ -609,18 +709,37 @@ case $basic_machine in basic_machine=i960-intel os=-nindy ;; - mon960) # EGCS LOCAL + mon960) basic_machine=i960-intel os=-mon960 ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; - OSE68000 | ose68000) # EGCS LOCAL + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; - os68k) # EGCS LOCAL + os68k) basic_machine=m68k-none os=-os68k ;; @@ -638,46 +757,60 @@ case $basic_machine in pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexen) + pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ps2) basic_machine=i386-ibm ;; - rom68k) # EGCS LOCAL + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) basic_machine=m68k-rom68k os=-coff ;; @@ -687,10 +820,22 @@ case $basic_machine in rtpc | rtpc-*) basic_machine=romp-ibm ;; - sa29200) # EGCS LOCAL + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; sequent) basic_machine=i386-sequent ;; @@ -698,7 +843,7 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; - sparclite-wrs) # EGCS LOCAL + sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -709,10 +854,10 @@ case $basic_machine in spur) basic_machine=spur-unknown ;; - st2000) # EGCS LOCAL + st2000) basic_machine=m68k-tandem ;; - stratus) # EGCS LOCAL + stratus) basic_machine=i860-stratus os=-sysv4 ;; @@ -756,16 +901,40 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; symmetry) basic_machine=i386-sequent os=-dynix ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; tower | tower-32) basic_machine=m68k-ncr ;; @@ -777,7 +946,7 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; - v810 | necv810) # EGCS LOCAL + v810 | necv810) basic_machine=v810-nec os=-none ;; @@ -790,8 +959,8 @@ case $basic_machine in os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -804,18 +973,22 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; - w65*) # EGCS LOCAL - basic_machine=w65-wdc - os=-none + w65*) + basic_machine=w65-wdc + os=-none ;; - xmp) - basic_machine=xmp-cray - os=-unicos + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; - z8k-*-coff) # EGCS LOCAL + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; @@ -826,22 +999,15 @@ case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. - w89k) # EGCS LOCAL + w89k) basic_machine=hppa1.1-winbond ;; - op50n) # EGCS LOCAL + op50n) basic_machine=hppa1.1-oki ;; - op60c) # EGCS LOCAL + op60c) basic_machine=hppa1.1-oki ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; romp) basic_machine=romp-ibm ;; @@ -851,16 +1017,26 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; - sparc | sparcv9) + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -869,16 +1045,15 @@ case $basic_machine in orion105) basic_machine=clipper-highlevel ;; - mac | mpw | mac-mpw) # EGCS LOCAL + mac | mpw | mac-mpw) basic_machine=m68k-apple ;; - pmac | pmac-mpw) # EGCS LOCAL + pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -935,20 +1110,38 @@ case $os in | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* ) + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -microbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; - # EGCS LOCAL + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mon960* | -lnews* ) + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; - # END EGCS LOCAL -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -958,6 +1151,12 @@ case $os in -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; -osfrose*) os=-osfrose ;; @@ -973,14 +1172,23 @@ case $os in -acis*) os=-aos ;; - -386bsd) # EGCS LOCAL + -atheos*) + os=-atheos + ;; + -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; + -nova*) + os=-rtmk-nova + ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 + ;; + -nsk*) + os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) @@ -1007,15 +1215,21 @@ case $os in # This must come after -sysvr4. -sysv*) ;; - -ose*) # EGCS LOCAL + -ose*) os=-ose ;; - -es1800*) # EGCS LOCAL + -es1800*) os=-ose ;; -xenix) os=-xenix ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; -none) ;; *) @@ -1041,13 +1255,17 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; - arm*-corel) + arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; - pdp11-*) + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1065,15 +1283,18 @@ case $basic_machine in # default. # os=-sunos4 ;; - m68*-cisco) # EGCS LOCAL + m68*-cisco) os=-aout ;; - mips*-cisco) # EGCS LOCAL + mips*-cisco) os=-elf ;; - mips*-*) # EGCS LOCAL - os=-elf - ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -1086,13 +1307,13 @@ case $basic_machine in *-ibm) os=-aix ;; - *-wec) # EGCS LOCAL + *-wec) os=-proelf ;; - *-winbond) # EGCS LOCAL + *-winbond) os=-proelf ;; - *-oki) # EGCS LOCAL + *-oki) os=-proelf ;; *-hp) @@ -1137,36 +1358,39 @@ case $basic_machine in *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; - *-rom68k) # EGCS LOCAL + *-rom68k) os=-coff ;; - *-*bug) # EGCS LOCAL + *-*bug) os=-coff ;; - *-apple) # EGCS LOCAL + *-apple) os=-macos ;; + *-atari*) + os=-mint + ;; *) os=-none ;; @@ -1212,27 +1436,41 @@ case $basic_machine in -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; - -vxsim* | -vxworks*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; - -hms*) # EGCS LOCAL + -hms*) vendor=hitachi ;; - -mpw* | -macos*) # EGCS LOCAL + -mpw* | -macos*) vendor=apple ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/gnu/lib/libiberty/include/demangle.h b/gnu/lib/libiberty/include/demangle.h index a6234119aff..bff266931c8 100644 --- a/gnu/lib/libiberty/include/demangle.h +++ b/gnu/lib/libiberty/include/demangle.h @@ -1,5 +1,6 @@ /* Defs for interface to demanglers. - Copyright 1992, 1995, 1996 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 + 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 @@ -20,25 +21,34 @@ #if !defined (DEMANGLE_H) #define DEMANGLE_H -#include <ansidecl.h> +#include "ansidecl.h" -/* Options passed to cplus_demangle (in 2nd parameter). */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ -#define DMGL_NO_OPTS 0 /* For readability... */ -#define DMGL_PARAMS (1 << 0) /* Include function args */ -#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ -#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */ +/* Options passed to cplus_demangle (in 2nd parameter). */ -#define DMGL_AUTO (1 << 8) -#define DMGL_GNU (1 << 9) -#define DMGL_LUCID (1 << 10) -#define DMGL_ARM (1 << 11) -#define DMGL_HP (1 << 12) /* For the HP aCC compiler; same as ARM - except for template arguments, etc. */ -#define DMGL_EDG (1 << 13) +#define DMGL_NO_OPTS 0 /* For readability... */ +#define DMGL_PARAMS (1 << 0) /* Include function args */ +#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ +#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */ +#define DMGL_VERBOSE (1 << 3) /* Include implementation details. */ +#define DMGL_TYPES (1 << 4) /* Also try to demangle type encodings. */ + +#define DMGL_AUTO (1 << 8) +#define DMGL_GNU (1 << 9) +#define DMGL_LUCID (1 << 10) +#define DMGL_ARM (1 << 11) +#define DMGL_HP (1 << 12) /* For the HP aCC compiler; + same as ARM except for + template arguments, etc. */ +#define DMGL_EDG (1 << 13) +#define DMGL_GNU_V3 (1 << 14) +#define DMGL_GNAT (1 << 15) /* If none of these are set, use 'current_demangling_style' as the default. */ -#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG) +#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT) /* Enumeration of possible demangling styles. @@ -50,23 +60,31 @@ extern enum demangling_styles { + no_demangling = -1, unknown_demangling = 0, auto_demangling = DMGL_AUTO, gnu_demangling = DMGL_GNU, lucid_demangling = DMGL_LUCID, arm_demangling = DMGL_ARM, hp_demangling = DMGL_HP, - edg_demangling = DMGL_EDG + edg_demangling = DMGL_EDG, + gnu_v3_demangling = DMGL_GNU_V3, + java_demangling = DMGL_JAVA, + gnat_demangling = DMGL_GNAT } current_demangling_style; /* Define string names for the various demangling styles. */ -#define AUTO_DEMANGLING_STYLE_STRING "auto" -#define GNU_DEMANGLING_STYLE_STRING "gnu" -#define LUCID_DEMANGLING_STYLE_STRING "lucid" -#define ARM_DEMANGLING_STYLE_STRING "arm" -#define HP_DEMANGLING_STYLE_STRING "hp" -#define EDG_DEMANGLING_STYLE_STRING "edg" +#define NO_DEMANGLING_STYLE_STRING "none" +#define AUTO_DEMANGLING_STYLE_STRING "auto" +#define GNU_DEMANGLING_STYLE_STRING "gnu" +#define LUCID_DEMANGLING_STYLE_STRING "lucid" +#define ARM_DEMANGLING_STYLE_STRING "arm" +#define HP_DEMANGLING_STYLE_STRING "hp" +#define EDG_DEMANGLING_STYLE_STRING "edg" +#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3" +#define JAVA_DEMANGLING_STYLE_STRING "java" +#define GNAT_DEMANGLING_STYLE_STRING "gnat" /* Some macros to test what demangling style is active. */ @@ -77,15 +95,18 @@ extern enum demangling_styles #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM) #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP) #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG) +#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) +#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) +#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) /* Provide information about the available demangle styles. This code is pulled from gdb into libiberty because it is useful to binutils also. */ - -extern struct demangler_engine + +extern const struct demangler_engine { - const char *demangling_style_name; - enum demangling_styles demangling_style; - const char *demangling_style_doc; + const char *const demangling_style_name; + const enum demangling_styles demangling_style; + const char *const demangling_style_doc; } libiberty_demanglers[]; extern char * @@ -102,10 +123,49 @@ cplus_mangle_opname PARAMS ((const char *opname, int options)); extern void set_cplus_marker_for_demangling PARAMS ((int ch)); -extern enum demangling_styles +extern enum demangling_styles cplus_demangle_set_style PARAMS ((enum demangling_styles style)); - -extern enum demangling_styles + +extern enum demangling_styles cplus_demangle_name_to_style PARAMS ((const char *name)); +/* V3 ABI demangling entry points, defined in cp-demangle.c. */ +extern char* +cplus_demangle_v3 PARAMS ((const char* mangled, int options)); + +extern char* +java_demangle_v3 PARAMS ((const char* mangled)); + + +enum gnu_v3_ctor_kinds { + gnu_v3_complete_object_ctor = 1, + gnu_v3_base_object_ctor, + gnu_v3_complete_object_allocating_ctor +}; + +/* Return non-zero iff NAME is the mangled form of a constructor name + in the G++ V3 ABI demangling style. Specifically, return an `enum + gnu_v3_ctor_kinds' value indicating what kind of constructor + it is. */ +extern enum gnu_v3_ctor_kinds + is_gnu_v3_mangled_ctor PARAMS ((const char *name)); + + +enum gnu_v3_dtor_kinds { + gnu_v3_deleting_dtor = 1, + gnu_v3_complete_object_dtor, + gnu_v3_base_object_dtor +}; + +/* Return non-zero iff NAME is the mangled form of a destructor name + in the G++ V3 ABI demangling style. Specifically, return an `enum + gnu_v3_dtor_kinds' value, indicating what kind of destructor + it is. */ +extern enum gnu_v3_dtor_kinds + is_gnu_v3_mangled_dtor PARAMS ((const char *name)); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* DEMANGLE_H */ diff --git a/gnu/lib/libiberty/include/dyn-string.h b/gnu/lib/libiberty/include/dyn-string.h index 67f7ab7d36e..2a771c7a5d1 100644 --- a/gnu/lib/libiberty/include/dyn-string.h +++ b/gnu/lib/libiberty/include/dyn-string.h @@ -1,21 +1,21 @@ /* An abstract string datatype. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +GCC 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, +GCC 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 +along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -45,7 +45,7 @@ typedef struct dyn_string names in user programs, the functions that are used in the demangler are given implementation-reserved names. */ -#ifdef IN_LIBGCC2 +#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3) #define dyn_string_init __cxa_dyn_string_init #define dyn_string_new __cxa_dyn_string_new @@ -66,7 +66,7 @@ typedef struct dyn_string #define dyn_string_substring __cxa_dyn_string_substring #define dyn_string_eq __cxa_dyn_string_eq -#endif /* IN_LIBGCC2 */ +#endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */ extern int dyn_string_init PARAMS ((struct dyn_string *, int)); diff --git a/gnu/lib/libiberty/include/hashtab.h b/gnu/lib/libiberty/include/hashtab.h index 67c37a284f7..be866b51ee6 100644 --- a/gnu/lib/libiberty/include/hashtab.h +++ b/gnu/lib/libiberty/include/hashtab.h @@ -1,5 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). This program is free software; you can redistribute it and/or modify @@ -36,65 +36,130 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ extern "C" { #endif /* __cplusplus */ -#include <ansidecl.h> +#include "ansidecl.h" -/* The hash table element is represented by the following type. */ +#ifndef GTY +#define GTY(X) +#endif -typedef const void *hash_table_entry_t; +/* The type for a hash code. */ +typedef unsigned int hashval_t; + +/* Callback function pointer types. */ + +/* Calculate hash of a table entry. */ +typedef hashval_t (*htab_hash) PARAMS ((const void *)); + +/* Compare a table entry with a possible entry. The entry already in + the table always comes first, so the second element can be of a + different type (but in this case htab_find and htab_find_slot + cannot be used; instead the variants that accept a hash value + must be used). */ +typedef int (*htab_eq) PARAMS ((const void *, const void *)); + +/* Cleanup function called whenever a live element is removed from + the hash table. */ +typedef void (*htab_del) PARAMS ((void *)); + +/* Function called by htab_traverse for each live element. The first + arg is the slot of the element (which can be passed to htab_clear_slot + if desired), the second arg is the auxiliary pointer handed to + htab_traverse. Return 1 to continue scan, 0 to stop. */ +typedef int (*htab_trav) PARAMS ((void **, void *)); + +/* Memory-allocation function, with the same functionality as calloc(). + Iff it returns NULL, the hash table implementation will pass an error + code back to the user, so if your code doesn't handle errors, + best if you use xcalloc instead. */ +typedef PTR (*htab_alloc) PARAMS ((size_t, size_t)); + +/* We also need a free() routine. */ +typedef void (*htab_free) PARAMS ((PTR)); /* Hash tables are of the following type. The structure (implementation) of this type is not needed for using the hash tables. All work with hash table should be executed only through functions mentioned below. */ -typedef struct +struct htab GTY(()) { + /* Pointer to hash function. */ + htab_hash hash_f; + + /* Pointer to comparison function. */ + htab_eq eq_f; + + /* Pointer to cleanup function. */ + htab_del del_f; + + /* Table itself. */ + PTR * GTY ((use_param (""), length ("%h.size"))) entries; + /* Current size (in entries) of the hash table */ size_t size; + /* Current number of elements including also deleted elements */ - size_t number_of_elements; + size_t n_elements; + /* Current number of deleted elements in the table */ - size_t number_of_deleted_elements; + size_t n_deleted; + /* The following member is used for debugging. Its value is number - of all calls of `find_hash_table_entry' for the hash table. */ - int searches; + of all calls of `htab_find_slot' for the hash table. */ + unsigned int searches; + /* The following member is used for debugging. Its value is number of collisions fixed for time of work with the hash table. */ - int collisions; - /* Pointer to function for evaluation of hash value (any unsigned value). - This function has one parameter of type hash_table_entry_t. */ - unsigned (*hash_function) PARAMS ((hash_table_entry_t)); - /* Pointer to function for test on equality of hash table elements (two - parameter of type hash_table_entry_t. */ - int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t)); - /* Table itself */ - hash_table_entry_t *entries; -} *hash_table_t; + unsigned int collisions; + + /* Pointers to allocate/free functions. */ + htab_alloc alloc_f; + htab_free free_f; +}; + +typedef struct htab *htab_t; +/* An enum saying whether we insert into the hash table or not. */ +enum insert_option {NO_INSERT, INSERT}; /* The prototypes of the package functions. */ -extern hash_table_t create_hash_table - PARAMS ((size_t, unsigned (*) (hash_table_entry_t), - int (*) (hash_table_entry_t, hash_table_entry_t))); +extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash, + htab_eq, htab_del, + htab_alloc, htab_free)); -extern void delete_hash_table PARAMS ((hash_table_t)); +/* Backward-compatibility functions. */ +extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); +extern htab_t htab_try_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); -extern void empty_hash_table PARAMS ((hash_table_t)); +extern void htab_delete PARAMS ((htab_t)); +extern void htab_empty PARAMS ((htab_t)); -extern hash_table_entry_t *find_hash_table_entry - PARAMS ((hash_table_t, hash_table_entry_t, int)); +extern PTR htab_find PARAMS ((htab_t, const void *)); +extern PTR *htab_find_slot PARAMS ((htab_t, const void *, + enum insert_option)); +extern PTR htab_find_with_hash PARAMS ((htab_t, const void *, + hashval_t)); +extern PTR *htab_find_slot_with_hash PARAMS ((htab_t, const void *, + hashval_t, + enum insert_option)); +extern void htab_clear_slot PARAMS ((htab_t, void **)); +extern void htab_remove_elt PARAMS ((htab_t, void *)); -extern void remove_element_from_hash_table_entry PARAMS ((hash_table_t, - hash_table_entry_t)); +extern void htab_traverse PARAMS ((htab_t, htab_trav, void *)); -extern size_t hash_table_size PARAMS ((hash_table_t)); +extern size_t htab_size PARAMS ((htab_t)); +extern size_t htab_elements PARAMS ((htab_t)); +extern double htab_collisions PARAMS ((htab_t)); -extern size_t hash_table_elements_number PARAMS ((hash_table_t)); +/* A hash function for pointers. */ +extern htab_hash htab_hash_pointer; -extern int hash_table_collisions PARAMS ((hash_table_t)); +/* An equality function for pointers. */ +extern htab_eq htab_eq_pointer; -extern int all_hash_table_collisions (); +/* A hash function for null-terminated strings. */ +extern hashval_t htab_hash_string PARAMS ((const PTR)); #ifdef __cplusplus } diff --git a/gnu/lib/libiberty/include/libiberty.h b/gnu/lib/libiberty/include/libiberty.h index 05114a27b6c..3f478b93106 100644 --- a/gnu/lib/libiberty/include/libiberty.h +++ b/gnu/lib/libiberty/include/libiberty.h @@ -1,4 +1,29 @@ /* Function declarations for libiberty. + + Copyright 2001, 2002 Free Software Foundation, Inc. + + Note - certain prototypes declared in this header file are for + functions whoes implementation copyright does not belong to the + FSF. Those prototypes are present in this file for reference + purposes only and their presence in this file should not construed + as an indication of ownership by the FSF of the implementation of + those functions in any way or form whatsoever. + + 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. + Written by Cygnus Support, 1994. The libiberty library provides a number of functions which are @@ -16,10 +41,17 @@ extern "C" { #include "ansidecl.h" +#ifdef ANSI_PROTOTYPES +/* Get a definition for size_t. */ +#include <stddef.h> +/* Get a definition for va_list. */ +#include <stdarg.h> +#endif + /* Build an argument vector from a string. Allocates memory using malloc. Use freeargv to free the vector. */ -extern char **buildargv PARAMS ((char *)); +extern char **buildargv PARAMS ((const char *)) ATTRIBUTE_MALLOC; /* Free a vector returned by buildargv. */ @@ -28,7 +60,7 @@ extern void freeargv PARAMS ((char **)); /* Duplicate an argument vector. Allocates memory using malloc. Use freeargv to free the vector. */ -extern char **dupargv PARAMS ((char **)); +extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC; /* Return the last component of a path name. Note that we can't use a @@ -36,16 +68,69 @@ extern char **dupargv PARAMS ((char **)); across different systems, sometimes as "char *" and sometimes as "const char *" */ -#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) +/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is + undefined, we haven't run the autoconf check so provide the + declaration without arguments. If it is 0, we checked and failed + to find the declaration so provide a fully prototyped one. If it + is 1, we found it so don't provide any declaration at all. */ +#if !HAVE_DECL_BASENAME +#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (HAVE_DECL_BASENAME) extern char *basename PARAMS ((const char *)); #else extern char *basename (); #endif +#endif + +/* A well-defined basename () that is always compiled in. */ + +extern const char *lbasename PARAMS ((const char *)); + +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using xmalloc. */ + +extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC; + +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using xmalloc. The first argument is + not one of the strings to be concatenated, but if not NULL is a + pointer to be freed after the new string is created, similar to the + way xrealloc works. */ + +extern char *reconcat PARAMS ((char *, const char *, ...)) ATTRIBUTE_MALLOC; + +/* Determine the length of concatenating an arbitrary number of + strings. You must pass NULL as the last argument of this function, + to terminate the list of strings. */ + +extern unsigned long concat_length PARAMS ((const char *, ...)); + +/* Concatenate an arbitrary number of strings into a SUPPLIED area of + memory. You must pass NULL as the last argument of this function, + to terminate the list of strings. The supplied memory is assumed + to be large enough. */ + +extern char *concat_copy PARAMS ((char *, const char *, ...)); + +/* Concatenate an arbitrary number of strings into a GLOBAL area of + memory. You must pass NULL as the last argument of this function, + to terminate the list of strings. The supplied memory is assumed + to be large enough. */ + +extern char *concat_copy2 PARAMS ((const char *, ...)); + +/* This is the global area used by concat_copy2. */ -/* Concatenate an arbitrary number of strings, up to (char *) NULL. - Allocates memory using xmalloc. */ +extern char *libiberty_concat_ptr; -extern char *concat PARAMS ((const char *, ...)); +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using alloca. The arguments are + evaluated twice! */ +#define ACONCAT(ACONCAT_PARAMS) \ + (libiberty_concat_ptr = alloca (concat_length ACONCAT_PARAMS + 1), \ + concat_copy2 ACONCAT_PARAMS) /* Check whether two file descriptors refer to the same file. */ @@ -60,9 +145,19 @@ extern char * getpwd PARAMS ((void)); extern long get_run_time PARAMS ((void)); +/* Generate a relocated path to some installation directory. Allocates + return value using malloc. */ + +extern char *make_relative_prefix PARAMS ((const char *, const char *, + const char *)); + /* Choose a temporary directory to use for scratch files, DEPRECATED */ -extern char *choose_temp_base PARAMS ((void)); +extern char *choose_temp_base PARAMS ((void)) ATTRIBUTE_MALLOC; + +/* Return a temporary file name or NULL if unable to create one. */ + +extern char *make_temp_file PARAMS ((const char *)) ATTRIBUTE_MALLOC; /* Return a temporary file name or NULL if unable to create one. */ @@ -117,23 +212,20 @@ extern int xatexit PARAMS ((void (*fn) (void))); /* Exit, calling all the functions registered with xatexit. */ -extern void xexit PARAMS ((int status)); +extern void xexit PARAMS ((int status)) ATTRIBUTE_NORETURN; /* Set the program name used by xmalloc. */ extern void xmalloc_set_program_name PARAMS ((const char *)); +/* Report an allocation failure. */ +extern void xmalloc_failed PARAMS ((size_t)) ATTRIBUTE_NORETURN; + /* Allocate memory without fail. If malloc fails, this will print a message to stderr (using the name set by xmalloc_set_program_name, if any) and then call xexit. */ -#ifdef ANSI_PROTOTYPES -/* Get a definition for size_t. */ -#include <stddef.h> -/* Get a definition for va_list. */ -#include <stdarg.h> -#endif -extern PTR xmalloc PARAMS ((size_t)); +extern PTR xmalloc PARAMS ((size_t)) ATTRIBUTE_MALLOC; /* Reallocate memory without fail. This works like xmalloc. Note, realloc type functions are not suitable for attribute malloc since @@ -144,11 +236,19 @@ extern PTR xrealloc PARAMS ((PTR, size_t)); /* Allocate memory without fail and set it to zero. This works like xmalloc. */ -extern PTR xcalloc PARAMS ((size_t, size_t)); +extern PTR xcalloc PARAMS ((size_t, size_t)) ATTRIBUTE_MALLOC; /* Copy a string into a memory buffer without fail. */ -extern char *xstrdup PARAMS ((const char *)); +extern char *xstrdup PARAMS ((const char *)) ATTRIBUTE_MALLOC; + +/* Copy an existing memory buffer to a new memory buffer without fail. */ + +extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)) ATTRIBUTE_MALLOC; + +/* Physical memory routines. Return values are in BYTES. */ +extern double physmem_total PARAMS ((void)); +extern double physmem_available PARAMS ((void)); /* Copy an existing memory buffer to a new memory buffer without fail. */ @@ -158,7 +258,7 @@ extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)); #define _hex_array_size 256 #define _hex_bad 99 -extern char _hex_value[_hex_array_size]; +extern const char _hex_value[_hex_array_size]; extern void hex_init PARAMS ((void)); #define hex_p(c) (hex_value (c) != _hex_bad) /* If you change this, note well: Some code relies on side effects in @@ -182,15 +282,54 @@ extern int pexecute PARAMS ((const char *, char * const *, const char *, extern int pwait PARAMS ((int, int *, int)); +#if !HAVE_DECL_ASPRINTF /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ -extern int asprintf PARAMS ((char **, const char *, ...)); +extern int asprintf PARAMS ((char **, const char *, ...)) ATTRIBUTE_PRINTF_2; +#endif +#if !HAVE_DECL_VASPRINTF /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ -extern int vasprintf PARAMS ((char **, const char *, va_list)); +extern int vasprintf PARAMS ((char **, const char *, va_list)) + ATTRIBUTE_PRINTF(2,0); +#endif + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +/* Drastically simplified alloca configurator. If we're using GCC, + we use __builtin_alloca; otherwise we use the C alloca. The C + alloca is always available. You can override GCC by defining + USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is + also set/unset as it is often used to indicate whether code needs + to call alloca(0). */ +extern PTR C_alloca PARAMS ((size_t)) ATTRIBUTE_MALLOC; +#undef alloca +#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA +# define alloca(x) __builtin_alloca(x) +# undef C_ALLOCA +# define ASTRDUP(X) \ + (__extension__ ({ const char *const libiberty_optr = (X); \ + const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \ + char *const libiberty_nptr = alloca (libiberty_len); \ + (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); })) +#else +# define alloca(x) C_alloca(x) +# undef USE_C_ALLOCA +# define USE_C_ALLOCA 1 +# undef C_ALLOCA +# define C_ALLOCA 1 +extern const char *libiberty_optr; +extern char *libiberty_nptr; +extern unsigned long libiberty_len; +# define ASTRDUP(X) \ + (libiberty_optr = (X), \ + libiberty_len = strlen (libiberty_optr) + 1, \ + libiberty_nptr = alloca (libiberty_len), \ + (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len)) +#endif #ifdef __cplusplus } diff --git a/gnu/lib/libiberty/include/obstack.h b/gnu/lib/libiberty/include/obstack.h index a20ab55967a..d86d9f2c426 100644 --- a/gnu/lib/libiberty/include/obstack.h +++ b/gnu/lib/libiberty/include/obstack.h @@ -1,5 +1,7 @@ /* obstack.h - object stack macros - Copyright (C) 1988,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. + Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, + 1999, 2000 + Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. diff --git a/gnu/lib/libiberty/include/partition.h b/gnu/lib/libiberty/include/partition.h index f49d67a8cad..5d3623f716e 100644 --- a/gnu/lib/libiberty/include/partition.h +++ b/gnu/lib/libiberty/include/partition.h @@ -1,21 +1,21 @@ -/* List implentation of a partition of consecutive integers. - Copyright (C) 2000 Free Software Foundation, Inc. +/* List implementation of a partition of consecutive integers. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. - This file is part of GNU CC. + This file is part of GCC. - GNU CC is free software; you can redistribute it and/or modify + GCC 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, + GCC 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 + along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -40,7 +40,7 @@ extern "C" { #endif /* __cplusplus */ -#include <ansidecl.h> +#include "ansidecl.h" #include <stdio.h> struct partition_elem @@ -78,4 +78,8 @@ extern void partition_print PARAMS((partition, #define partition_find(partition__, element__) \ ((partition__)->elements[(element__)].class_element) +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* _PARTITION_H */ diff --git a/gnu/lib/libiberty/include/splay-tree.h b/gnu/lib/libiberty/include/splay-tree.h index 6d70c8d9075..23f7ac69d42 100644 --- a/gnu/lib/libiberty/include/splay-tree.h +++ b/gnu/lib/libiberty/include/splay-tree.h @@ -1,21 +1,21 @@ /* A splay-tree datatype. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it +GCC 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 +GCC 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 +along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -34,7 +34,7 @@ Boston, MA 02111-1307, USA. */ extern "C" { #endif /* __cplusplus */ -#include <ansidecl.h> +#include "ansidecl.h" /* Use typedefs for the key and data types to facilitate changing these types, if necessary. These types should be sufficiently wide @@ -61,6 +61,18 @@ typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value)); /* The type of a function used to iterate over the tree. */ typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*)); +/* The type of a function used to allocate memory for tree root and + node structures. The first argument is the number of bytes needed; + the second is a data pointer the splay tree functions pass through + to the allocator. This function must never return zero. */ +typedef void *(*splay_tree_allocate_fn) PARAMS((int, void *)); + +/* The type of a function used to free memory allocated using the + corresponding splay_tree_allocate_fn. The first argument is the + memory to be freed; the latter is a data pointer the splay tree + functions pass through to the freer. */ +typedef void (*splay_tree_deallocate_fn) PARAMS((void *, void *)); + /* The nodes in the splay tree. */ struct splay_tree_node_s { @@ -89,19 +101,44 @@ typedef struct splay_tree_s /* The deallocate-value function. NULL if no cleanup is necessary. */ splay_tree_delete_value_fn delete_value; + + /* Allocate/free functions, and a data pointer to pass to them. */ + splay_tree_allocate_fn allocate; + splay_tree_deallocate_fn deallocate; + void *allocate_data; + } *splay_tree; extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn, splay_tree_delete_key_fn, splay_tree_delete_value_fn)); +extern splay_tree splay_tree_new_with_allocator + PARAMS((splay_tree_compare_fn, + splay_tree_delete_key_fn, + splay_tree_delete_value_fn, + splay_tree_allocate_fn, + splay_tree_deallocate_fn, + void *)); extern void splay_tree_delete PARAMS((splay_tree)); extern splay_tree_node splay_tree_insert PARAMS((splay_tree, splay_tree_key, splay_tree_value)); +extern void splay_tree_remove PARAMS((splay_tree, + splay_tree_key)); extern splay_tree_node splay_tree_lookup PARAMS((splay_tree, splay_tree_key)); +extern splay_tree_node splay_tree_predecessor + PARAMS((splay_tree, + splay_tree_key)); +extern splay_tree_node splay_tree_successor + PARAMS((splay_tree, + splay_tree_key)); +extern splay_tree_node splay_tree_max + PARAMS((splay_tree)); +extern splay_tree_node splay_tree_min + PARAMS((splay_tree)); extern int splay_tree_foreach PARAMS((splay_tree, splay_tree_foreach_fn, void*)); diff --git a/gnu/lib/libiberty/include/symcat.h b/gnu/lib/libiberty/include/symcat.h index 3e27162b264..61ce1e9b341 100644 --- a/gnu/lib/libiberty/include/symcat.h +++ b/gnu/lib/libiberty/include/symcat.h @@ -19,12 +19,16 @@ #ifndef SYM_CAT_H #define SYM_CAT_H -#if defined (__STDC__) || defined (ALMOST_STDC) +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define CONCAT2(a,b) a##b #define CONCAT3(a,b,c) a##b##c #define CONCAT4(a,b,c,d) a##b##c##d #define STRINGX(s) #s #else +/* Note one should never pass extra whitespace to the CONCATn macros, + e.g. CONCAT2(foo, bar) because traditonal C will keep the space between + the two labels instead of concatenating them. Instead, make sure to + write CONCAT2(foo,bar). */ #define CONCAT2(a,b) a/**/b #define CONCAT3(a,b,c) a/**/b/**/c #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d @@ -35,6 +39,11 @@ #define XCONCAT3(a,b,c) CONCAT3(a,b,c) #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) +/* Note the layer of indirection here is typically used to allow + stringification of the expansion of macros. I.e. "#define foo + bar", "XSTRING(foo)", to yield "bar". Be aware that this only + works for __STDC__, not for traditional C which will still resolve + to "foo". */ #define XSTRING(s) STRINGX(s) -#endif SYM_CAT_H +#endif /* SYM_CAT_H */ diff --git a/gnu/lib/libiberty/install-sh b/gnu/lib/libiberty/install-sh index e9de23842dc..59bcde425aa 100644 --- a/gnu/lib/libiberty/install-sh +++ b/gnu/lib/libiberty/install-sh @@ -221,7 +221,7 @@ else # Make a temp file name in the proper directory. - dsttmp=$dstdir/#inst.$$# + dsttmp=$dstdir/_inst.$$_ # Move or copy the file name to the temp name diff --git a/gnu/lib/libiberty/src/ChangeLog b/gnu/lib/libiberty/src/ChangeLog index c858409d301..513b48276ed 100644 --- a/gnu/lib/libiberty/src/ChangeLog +++ b/gnu/lib/libiberty/src/ChangeLog @@ -1,3 +1,1792 @@ +2003-10-16 Release Manager + + * GCC 3.3.2 Released. + +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-06-19 Dara Hazeghi <dhazeghi@yahoo.com> + + * configure.in: Add check for malloc.h needed by + m68k for function free(). + * configure: Regenerated. + * config.in: Add HAVE_MALLOC_H. + * hashtab.c: include malloc.h were available for + free(). + +2003-06-09 Albert Chin-A-Young <china@thewrittenword.com> + + PR bootstrap/10974 + * physmem.c: Update comment. + * configure.in: Modify test for _system_configuration for older + AIX systems. + + * config.in, configure: Regenerated. + +2003-06-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR other/10810 + * test-demangle.c (getline): Fix fence-post error. + +2003-05-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + Backport from mainline: + 2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * vsprintf.c: Include "ansidecl.h" earlier, rely on + ANSI_PROTOTYPES and possibly include <stdarg.h>. + +2003-05-14 Carlo Wood <carlo@alinoe.com> + + * cp-demangle.c: Fix typo in "char_traints" string-literal. + +2003-05-13 Release Manager + + * GCC 3.3 Released. + +2003-05-13 Release Manager + + * GCC 3.3 Released. + +2003-05-13 Release Manager + + * GCC 3.3 Released. + +2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + PR target/10338 + PR bootstrap/10198 + PR bootstrap/10140 + * getopt.c (exchange, _getopt_initialize): Use mempcpy not + __mempcpy. + * regex.c (regerror): Likewise. + +2003-04-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in (HAVE_UINTPTR_T): Always define. + * configure: Regenerated. + +2003-03-23 Alexandre Oliva <aoliva@redhat.com> + + * Makefile.in (MULTIOSDIR): New macro. Use $(CC) $(LIBCFLAGS) + instead of $$CC alone. + (install_to_tooldir): Use it. + +2003-03-03 Mark Mitchell <mark@codesourcery.com> + + * cplus-dem.c: Add license exception to copyright notice. + +2003-02-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * physmem.c: Formatting changes from upstream. + +2003-02-24 Danny Smith <dannysmith@users.source.forge.net> + + * physmem.c (physmem_total): Add _WIN32 support. + (physmem_available): Likewise. + +2003-02-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Test for + GSI_PHYSMEM. + (physmem_available) [HAVE_TABLE]: Test for TBL_VMSTATS. + +2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in: Check for sys/systemcfg.h and + _system_configuration. + * physmem.c: Add support for AIX. Tweek formatting as per + upstream coreutils beta. + +2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + Richard Earnshaw <rearnsha@arm.com> + Geoffrey Keating <geoffk@apple.com> + + * configure.in: Check for sys/sysctl.h and sysctl. + * physmem.c: Add support for *bsd and darwin. + * Makefile.in: Generate depedency for physmem.o. + +2003-02-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Use getsysinfo on + Tru64 UNIX. + (physmem_available) [HAVE_TABLE && HAVE_SYS_TABLE_H]: Use table on + Tru64 UNIX. + + * configure.in (AC_CHECK_HEADERS): Check for sys/sysinfo.h, + machine/hal_sysinfo.h, sys/table.h. + (checkfuncs, AC_CHECKFUNCS): Check for getsysinfo, table. + * configure, config.in: Regenerate. + +2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in: Check for sys/sysmp.h and sysmp. + * physmem.c: Pull upstream copy, add support for irix6. + + * config.in, configure: Regenerated. + +2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * physmem.c (physmem_total, physmem_available): De-ANSI-fy. + * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and + pstat_getdynamic. + +2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (CFILES): Add physmem.c. + (REQUIRED_OFILES): Add physmem.o. + * configure.in: Check for sys/pstat.h. + (checkfuncs): Add pstat_getstatic and pstat_getdynamic. + * physmem.c: New file, copied from textutils. + + * config.in, configure: Regenerated. + +2003-02-20 Alexandre Oliva <aoliva@redhat.com> + + * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to + config.status. + * configure: Rebuilt. + +2003-02-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * acconfig.h: New file. Add uintptr_t. + * config.in: Regenerated. + +2003-02-04 Joseph S. Myers <jsm@polyomino.org.uk> + + * libiberty.texi: Update to GFDL 1.2. + +2003-02-02 Christian Cornelssen <ccorn@cs.tu-berlin.de> + + * Makefile.in (libiberty_topdir): New subst. + (mkinstalldirs): Redefine in terms of the above. + * configure.in: AC_SUBST it. + * configure: Regenerate. + +2003-01-28 Christian Cornelssen <ccorn@cs.tu-berlin.de> + + * Makefile.in (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): + Pass $(FLAGS_TO_PASS). + +2003-01-27 Alexandre Oliva <aoliva@redhat.com> + + * Makefile.in (install_to_tooldir): Instead of $(MULTISUBDIR), use + /`$$CC -print-multi-os-directory`. + +2003-01-26 Christian Cornelssen <ccorn@cs.tu-berlin.de> + + * Makefile.in (FLAGS_TO_PASS): Also pass DESTDIR. + (install_to_libdir, install_to_tooldir): Add a mkinstalldirs + command. + +2003-01-20 Josef Zlomek <zlomekj@suse.cz> + + * hashtab.c (htab_expand): Fix allocation of new entries. + +2002-12-04 Danny Smith <dannysmith@users.sourceforge.net> + + * make-relative-prefix.c (HAVE_HOST_EXECUTABLE_SUFFIX): + Define for hosts with HOST_EXECUTABLE_SUFFIX. + +2002-11-24 Nick Clifton <nickc@redhat.com> + + * make-relative-prefix.c (make_relative_prefix): Ensure return + string is empty before using strcat to construct it. + +2002-11-22 Daniel Jacobowitz <drow@mvista.com> + + * Makefile.in: Add make-relative-prefix.c. + * make-relative-prefix.c: New file. + * functions.texi: Rebuilt. + +2002-11-16 Jakub Jelinek <jakub@redhat.com> + + * md5.c (md5_process_block): Avoid `function-like macro "F{G,H,I}" must be + used with arguments in traditional C' warnings. + +2002-10-16 Jakub Jelinek <jakub@redhat.com> + + * config.table: Use mh-s390pic for s390x too. + +2002-10-06 Andreas Jaeger <aj@suse.de> + + * libiberty/cplus-dem.c (ada_demangle): Get rid of unneeded + variable and of strict-aliasing warning. + (grow_vect): Use char as first parameter. + +2002-09-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (all): Fix multilib parallel build. + +2002-09-19 John David Anglin <dave@hiuly1.hia.nrc.ca> + + * cp-demangle.c (demangling_new): Cast 0 to enum. + (demangle_char): Cast return of strdup to char *. + (is_gnu_v3_mangled_ctor): Cast 0 to enum. + (is_gnu_v3_mangled_dtor): Likewise. + * cplus-dem.c (grow_vect): Cast return of xrealloc to void *. + (work_stuff_copy_to_from): Cast return of xmalloc to char **. + * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t. + * md5.c (md5_process_bytes): Cast results back to const void *. + (md5_process_block): Add cast to const md5_uint32 *. + * regex.c (re_compile_fastmap): Cast enum to UCHAR_T. + * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to + unsigned short. + * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc + to void *. + * vasprintf.c (int_vasprintf): Cast return of malloc to char *. + +2002-09-19 Nick Clifton <nickc@redhat.com> + + * README: Update email addresses for bugs and patches. + +2002-09-10 Mike Stump <mrs@apple.com> + + * splay-tree.c (splay_tree_successor): Fix comments. + +2002-09-11 Zack Weinberg <zack@codesourcery.com> + + * cplus-dem.c: Code under #ifdef MAIN moved to gcc/cp/cxxfilt.c. + * testsuite/Makefile.in: Adjust for test-demangle. + * testsuite/regress-demangle: Deleted. + * testsuite/test-demangle.c: New file. + * testsuite/demangle-expected: Change \$ to $ throughout, now that + this file is not being read by a shell script. + +2002-09-05 Roger Sayle <roger@eyesopen.com> + + * regex.c: Only use "#pragma alloca" on AIX when not using gcc. + +2002-08-07 DJ Delorie <dj@redhat.com> + + * regex.c (re_error_msgid): Just use a simple array of strings. + (re_compile_pattern): Compensate. + (re_comp): Likewise. + (re_comp): Likewise. + (regerror): Likewise. + +2002-07-29 Neil Booth <neil@daikokuya.co.uk> + + * cplus-dem.c (PREPEND_BLANK): Remove. + +2002-07-10 Jason Merrill <jason@redhat.com> + + * cp-demangle.c (demangle_identifier): Support extended Unicode + characters. + +2002-07-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cp-demangle.c (demangle_v3_with_details): Wrap in + !defined IN_GLIBCPP_V3. + +2002-07-01 Mark Mitchell <mark@codesourcery.com> + + * cp-demangle.c (demangle_operator_name): Add type_arg parameter. + Set it for the "st" operator. + (demangle_expression): Handle expressions with types as arguments. + +2002-06-30 Douglas Rupp <rupp@gnat.com> + + * configure.in (OUTPUT_OPTION,NO_MINUS_C_MINUS_O): Configure. + * Makefile.in (OUTPUT_OPTION): Use. + +2002-06-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Makefile.in (install_to_libdir): Add $(DESTDIR). + (install_to_tooldir): Likewise. + +2002-06-17 Douglas Rupp <rupp@gnat.com> + + * lbasename.c: Add 2002 to copyright. + (IS_DIR_SEPARATOR): Remove VMS junk. + +2002-06-05 Geoffrey Keating <geoffk@redhat.com> + + * hashtab.c (htab_create): New stub function for backward + compatibility. + (htab_try_create): Likewise. + +2002-06-03 Geoffrey Keating <geoffk@redhat.com> + + * hashtab.c (htab_create): Delete. + (htab_try_create): Delete. + (htab_create_alloc): New. + (htab_delete): Support user-specified memory allocation. + (htab_expand): Likewise. + +2002-05-22 Roman Lechtchinsky <rl@cs.tu-berlin.de> + + * configure.in: Fix typo in the code checking for sys_errlist. + * configure: Regenerated. + +2002-05-13 Andreas Schwab <schwab@suse.de> + + * config.table: Use mh-x86pic also for x86-64. + +2002-05-08 Alexandre Oliva <aoliva@redhat.com> + + * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at + script entry, and set LD to it when configuring multilibs. + * configure: Rebuilt. + +2002-05-07 Mark Mitchell <mark@codesourcery.com> + + * configure.in (AC_TYPE_PID_T): Use it. + * configure: Regenerated. + * getruntime.c: Include <sys/types.h>. + * waitpid.c: Likewise. Use pid_t, not int, as the type of "pid". + +2002-04-09 Richard Henderson <rth@redhat.com> + + * hashtab.c (higher_prime_number): Use 7 as minimum. + (find_empty_slot_for_expand): Don't compute hash2 unless needed. + (htab_find_slot_with_hash): Likewise. + +2002-04-01 Phil Edwards <pme@gcc.gnu.org> + + * cp-demangle.c (__cxa_demangle): Also protect with IN_GLIBCPP_V3. + (is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_ctor): Conditionally + not compile if IN_GLIBCPP_V3 defined. + * dyn-string.c: Also allow IN_GLIBCPP_V3 to change allocation scheme. + +2002-03-30 Bryce McKinlay <bryce@waitaki.otago.ac.nz> + + * cp-demangle.c (java_demangle_v3): Don't try to release "demangled" + if it is NULL. + +2002-03-27 DJ Delorie <dj@redhat.com> + + * hex.c: Add documentation. + (_hex_value): Provide non-ASCII empty table. + (hex_init): Initialize the non-ASCII table. + * functions.texi: Regenerate. + +2002-03-27 Mark Mitchell <mark@codesourcery.com> + + * dyn-string.c: Add libgcc exception to copyright notice. + +2002-03-26 H.J. Lu (hjl@gnu.org) + + * config.table: Support --with-build-subdir. + * configure.in: Likewise. + * configure: Rebuild. + +2002-03-18 Stuart Griffith <Stuart_Griffith@credence.com> + + * strtod.c (strtod): Increment 8 chars, not 7, when `infinity' + seen. + +2002-03-12 Mark Mitchell <mark@codesourcery.com> + + * cp-demangle.c: Add libgcc exception to cp-demangle.c copyright + notice. + +2002-03-11 Douglas B Rupp <rupp@gnat.com> + + * xatexit.c [VMS]: Include stdlib.h and unixlib.h. + +2002-03-06 Jim Blandy <jimb@redhat.com> + + * splay-tree.c (splay_tree_xmalloc_allocate, + splay_tree_xmalloc_deallocate): Use K&R-style definitions, not + prototyped definitions. Mark `data' arguments as unused. + +2002-03-06 Andrew Cagney <ac131313@redhat.com> + + * floatformat.c (floatformat_arm_ext_big): Delete definition. + +2002-03-04 Phil Edwards <pme@gcc.gnu.org> + + * configure.in: Add --enable-install-libiberty option. + * Makefile.in (INSTALLED_HEADERS): New variable. + (install_to_libdir): Possibly also copy headers. + * configure: Regenerated. + +2002-03-04 Neil Booth <neil@daikokuya.demon.co.uk> + + * xmalloc.c (xmalloc_fail): Clarify error message further. + +2002-03-03 Neil Booth <neil@daikokuya.demon.co.uk> + + * xmalloc.c (xmalloc_fail): Clarify error message. + +2002-02-22 Jim Blandy <jimb@redhat.com> + + * splay-tree.c (splay_tree_xmalloc_allocate, + splay_tree_xmalloc_deallocate): New functions. + (splay_tree_new): Call splay_tree_new_with_allocator, passing the + above functions and a dummy data pointer. + (splay_tree_new_with_allocator): New function. + (splay_tree_delete_helper, splay_tree_delete, splay_tree_insert, + splay_tree_remove): Use the splay tree's allocation and + deallocation functions. + +2002-02-19 Scott Snyder <snyder@fnal.gov> + + * testsuite/demangle-expected: Add test case for infinite loop in + demangler. + * cplus-dem.c (demangle_arm_hp_template): Stop trying to demangle + if do_type() doesn't make any progress --- prevents an infinite + loop. + +2002-02-18 Carlo Wood <carlo@gnu.org> + + PR c++/5390 + * cplus-dem.c (demangle_integral_value): Accept multi-digit + numbers that do not start with an underscore; This is needed + for integer template parameters. This doesn't break anything + because multi-digit numbers are never followed by a digit. + * testsuite/demangle-expected: Corrected all mangled test + cases with multi-digit template parameters: g++ 2.95.x does + not generate underscores around these parameters. + +2002-02-05 Jason Merrill <jason@redhat.com> + + * cplus-dem.c (flags): Add DMGL_VERBOSE + (cplus_demangle_v3_p): Remove. + (demangle_it): Add DMGL_TYPES to passed flags. + * cp-demangle.c (cplus_demangle_v3_all): Remove. + (cplus_demangle_v3_type): Remove. + (cplus_demangle_v3): Add options parm. + +2002-02-02 H.J. Lu (hjl@gnu.org) + + * cp-demangle.c (cp_demangle_type): Do not protect with + IN_LIBGCC2. + (cplus_demangle_v3_all): New. + (cplus_demangle_v3): Call cplus_demangle_v3_all. + (cplus_demangle_v3_type): Call cplus_demangle_v3_all. + + * cplus-dem.c (cplus_demangle_v3_p): New function pointer. + Initialized to cplus_demangle_v3. + (cplus_demangle_with_style): Call cplus_demangle_v3_p instead + of cplus_demangle_v3. + (main): Set cplus_demangle_v3_p to cplus_demangle_v3_type for + command line symbol. + + * testsuite/regress-demangle: Pass the mangled name at the + command line. + +2002-02-01 H.J. Lu <hjl@gnu.org> + + * cp-demangle.c (cp_demangle_type): Call demangling_new with + DMGL_GNU_V3. + +2002-01-31 Phil Edwards <pme@gcc.gnu.org> + + * cp-demangle.c: Revert yesterday's change. + +2002-01-31 Adam Megacz <adam@xwt.org> + + * gcc/libiberty/configure.in: Treat mingw the same as cywin + wrt HAVE_SYS_ERRLIST. + +2002-01-30 Phil Edwards <pme@gcc.gnu.org> + + * cp-demangle.c (cp_demangle_type): Do not protect with IN_LIBGCC2. + (cplus_demangle_v3): Mimic __cxa_demangle and fall back on + cp_demangle_type. + * testsuite/demangle-expected: New gnu-v3 test. + +2002-01-22 Momchil Velikov <velco@fadata.bg> + + * configure.in (variable detection): Use arrays of unspecified + size instead of plain integers. + +2002-01-18 DJ Delorie <dj@redhat.com> + + * Makefile.in (TESTLIB): New. This library is for future + testsuites. + (CFILES, REQUIRED_OFILES, CONFIGURED_OFILES): Re-alphabetize, + break down by letter. + (REQUIRED_OFILES): List long-to-compile files first. + (maint-deps): New, target for updating dependencies. + (dependencies): Update. + * maint-tool: Add dependency-generating option. + * configure.in: Check for _doprnt even if we're not providing it. + * configure: Regenerate. + + * _doprnt.c: Modifications to allow compiling on any platform. + * copysign.c: Likewise. + * putenv.c: Likewise. + * setenv.c: Likewise. + * vsprintf.c: Likewise. + +2002-01-15 Douglas B Rupp <rupp@gnat.com> + + * mkstemps.c (mkstemps): On VMS, open temp file with option + that causes it to be deleted when closed. + +2002-01-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cp-demangle.c (long_options): Const-ify. + * cplus-dem.c (long_options): Likewise. + + * cplus-dem.c (mystrstr): Delete. All callers changed to use + strstr instead. + +2001-12-31 Ira Ruben <ira@apple.com> + + * aclocal.m4 (libiberty_AC_FUNC_STRNCMP): Use anon mmap as 2nd try. + * configure: Regenerated. + +2001-12-24 Douglas B. Rupp <rupp@gnat.com> + + * configure.in (uintptr_t): Use AC_CHECK_TYPE. + * configure: Regenerated. + +2001-12-12 Craig Rodrigues <rodrigc@gcc.gnu.org> + + PR other/2719 + * cplus-dem.c (consume_count): Treat negative count as an error. + * testsuite/demangle-expected: Added testcase. + +Tue Dec 11 07:08:57 2001 Douglas B. Rupp <rupp@gnat.com> + + * configure.in: Hardcode that vfork works on VMS host. + * configure: Regenerated. + +2001-12-06 Richard Henderson <rth@redhat.com> + + * cplus-dem.c (libiberty_demanglers): Add no_demangling case. + (cplus_demangle): Support no_demangling. + +2001-11-27 Zack Weinberg <zack@codesourcery.com> + + * _doprnt.c: Moved here from gcc/doprint.c. Adjust to build + in libiberty context. Fix typo in leading comment. + * configure.in: Fix various AC_DEFINEs so autoheader works. + If any of vprintf, vsprintf, vfprintf is missing from libc, + then AC_REPLACE_FUNCS(_doprnt). + +2001-11-26 DJ Delorie <dj@redhat.com> + Daniel Jacobowitz <drow@mvista.com> + + * Makefile.in (stamp-h): Depend on Makefile for proper + serialization. + (*-subdir): Depend on config.h for proper serialization. + +2001-11-26 DJ Delorie <dj@redhat.com> + + * configure.in: Check for alloca.h (for regex.c and putenv.c). + * configure: Regenerate. + * config.h: Add HAVE_ALLOCA_H. + +2001-11-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * regex.c: Check defined(__STDC__) || defined(ALMOST_STDC) || + defined(HAVE_STRINGIZE) to determine whether ISO CPP token pasting + is available. + +Thu Nov 15 11:06:25 2001 Jeffrey A Law (law@cygnus.com) + + * config.in (HAVE_UINTPTR_T): Provide autoconf stub. + * configure.in (HAVE_UINTPTR_T): Test for system defining + uintptr_t and define HAVE_UINTPTR_T appropriately. + * regex.c (uintptr_t): Do not provide a definition if the + system provided one. + + * regex.c (PREFIX): Provide an alternate definition for + non-ANSI/ISO compilers. + (ARG_PREFIX): Likewise. + +2001-11-12 Jim Meyering <meyering@lucent.com> + + * obstack.c (_): Honor the setting of ENABLE_NLS. Otherwise, + this code would end up calling gettext even in packages built + with --disable-nls. + * getopt.c (_): Likewise. + * regex.c (_): Likewise. + +2001-11-03 Alan Modra <amodra@bigpond.net.au> + + * configure.in: Cope with missing makeinfo. + * configure: Regenerate. + +2001-10-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * hex.c (hex_init): Provide empty stub. + + * hex.c (hex_init): Delete. + (_hex_value): Const-ify and initialize at compile-time. + +2001-10-19 H.J. Lu <hjl@gnu.org> + + * Makefile.in ($(TARGETLIB)): Also generate pic/$(TARGETLIB) if + necessary. + +2001-10-17 DJ Delorie <dj@redhat.com> + + * argv.c, asprintf.c, choose-temp.c, concat.c, cplus-dem.c, + ffs.c, fnmatch.txh, getruntime.c, make-temp-file.c, + mkstemps.c, pexecute.c, random.c, strsignal.c, vasprintf.c: + Improve manual formatting. + * functions.texi: Regenerate. + +2001-10-15 DJ Delorie <dj@redhat.com> + + * Makefile.in (TEXIFILES): Add fnmatch.txh. + (maint-undoc): New. + maint-tool: Add "undoc" tool. + * alloca.c, argv.c, asprintf.c, choose-temp.c, concat.c, + fdmatch.c, ffs.c, getruntime.c, insque.c, lbasename.c, + make-temp-file.c, mkstemps.c, pexecute.c, random.c, spaces.c, + strerror.s, strsignal.c, strtol.c, vasprintf.c: Add or update + documentation. + * fnmatch.txh: New. + * functions.texi: Regenerate. + +2001-10-10 Joseph S. Myers <jsm28@cam.ac.uk> + + * bcmp.c, setenv.c: Use "nonzero" instead of "non-zero". + * strtod.c: Use "ISO C" instead of "ANSI C". + * functions.texi: Regenerate. + +2001-10-07 Joseph S. Myers <jsm28@cam.ac.uk> + + * alloca.c, clock.c, getcwd.c, getpagesize.c, getpwd.c, index.c, + libiberty.texi, memchr.c, putenv.c, rindex.c, strchr.c, strdup.c, + strerror.c, strrchr.c, strstr.c, strtod.c, tmpnam.c, vfork.c, + xatexit.c, xmalloc.c, xstrerror.c: Improve manual formatting. Fix + spelling. Give names to function arguments in documentation. Use + (void) prototypes in documentation. + * functions.texi: Regenerate. + +2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * argv.c (buildargv, tests, main): Const-ify. + * cp-demangle.c (operator_code): Likewise. + * cplus-dem.c (optable, libiberty_demanglers, + cplus_demangle_set_style, cplus_demangle_name_to_style, + print_demangler_list): Likewise. + * hashtab.c (higher_prime_number): Likewise. + * strcasecmp.c (charmap): Likewise. + * strerror.c (error_info, strerror, main): Likewise. + * strncasecmp.c (charmap): Likewise. + * strsignal.c (signal_info): Likewise. + +2001-09-29 DJ Delorie <dj@redhat.com> + + * configure: Regenerate. + +2001-09-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * concat.c: Include stdlib.h. + +2001-09-27 Eli Zaretskii <eliz@is.elta.co.il> + + * libiberty.texi: (Top level): Add syncodeindex pg. Add + @dircategory and @direntry directives. Add @finalout. + (many nodes): Lose the next,prev,up pointers on the @nide line. + (Using, Supplemental Functions, Replacement Functions): Fix + markup. + (Functions): Move around, to allow makeinfo to build the manual + without next,prev,up pointers in thye node lines. + (Licenses): Fix typos. + + * index.c, rindex.c, strchr.c, strerror.c, strrchr.c, strstr.c, + strtol.c, xatexit.c, xexit.c, xmalloc.c: Fix spelling and markup. + * functions.texi: Regenerate. + + * copying-lib.texi: Lose the next,prev,up pointers on the @node + line. + +2001-09-27 DJ Delorie <dj@redhat.com> + + * configure.in: Don't use in-tree texinfo, because libiberty must + be built before it. Check for makeinfo version 4 or higher. + * functions.texi: Regenerate. + +2001-09-20 DJ Delorie <dj@redhat.com> + Phil Edwards <pedwards@disaster.jaj.com> + + * configure.in (MAKEINFO, PERL): Detect these. + (--enable-maintainer-mode): Add. + * configure: Regenerate. + * Makefile.in (MAKEINFO, PERL): Define. + (libiberty.info, libiberty.dvi, libiberty.html): New. + (CFILES): Add bsearch.c. + (CONFIGURED_OFILES): New, list of objects configure might add. + (maint-missing, maint-buildall): New, for maintainers only. + (clean, mostlyclean): Add info/dvi/html files. + * libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New. + * gather-docs: New, for maintainers. + * maint-tool: New, for maintainers. + * alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c, + bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c, + getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c, + memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c, + sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c, + strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c, + tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c, + xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update + documentation. + +2001-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * concat.c (reconcat): Fix for traditional C. + +2001-09-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * concat.c (reconcat): New function. + +2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * concat.c (vconcat_length, vconcat_copy, concat_length, + concat_copy, concat_copy2): New functions. + (concat): Use vconcat_length/vconcat_copy. + + * alloca.c (libiberty_optr, libiberty_nptr, libiberty_len): + Define. + +2001-09-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * asprintf.c: Don't define USE_STDARG. Use VPARAMS, VA_OPEN, + VA_FIXEDARG & VA_CLOSE. + + * vasprintf.c: Check HAVE_STRING_H when including string.h. + (checkit): Delete redundant prototype. Add ATTRIBUTE_PRINTF_1. + Use VA_OPEN, VA_FIXEDARG & VA_CLOSE. Free allocated string. + +2001-08-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * concat.c (concat): Use VPARAMS, VA_OPEN, VA_FIXEDARG & VA_CLOSE. + +2001-08-23 Ulrich Drepper <drepper@redhat.com> + + * regex.c (truncate_wchar): Use wcrtomb not wctomb. + +2001-08-23 Ulrich Drepper <drepper@redhat.com> + + * posix/regex.c [_LIBC] (convert_mbs_to_wcs): Use __mbrtowc + instead of mbrtowc. + [_LIBC]: Use __iswctype instead of iswctype, __wcslen instead of + wcslen, and __wcscoll instead of wcscoll. + +2001-08-22 Matt Kraai <kraai@alumni.carnegiemellon.edu> + + * fibheap.c (fibheap_init, fibnode_init): Remove. + (fibheap_new, fibnode_new): Use xcalloc to allocate and + initialize memory. + (fibheap_insert): Remove check for node allocation failure. + +2001-08-21 Richard Henderson <rth@redhat.com> + + * Makefile.in (fibheap.o): Depend on config.h. + * fibheap.c: Tidy formatting. Use config.h.` Rearrange some + functions for inlining. + +Tue Aug 21 12:35:04 2001 Christopher Faylor <cgf@cygnus.com> + + * configure.in: Need to set HAVE_SYS_ERRLIST and HAVE_SYS_NERR whenever + hosting on cygwin. + * configure: Regenerate. + +2001-08-20 Andrew Cagney <ac131313@redhat.com> + + * floatformat.c (floatformat_m88110_ext): Remove #ifdef + HARRIS_FLOAT_FORMAT. + (floatformat_ia64_spill_little, floatformat_ia64_quad_little) + (floatformat_ia64_spill_big, floatformat_ia64_quad_big) + (floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword) + (floatformat_m88110_harris_ext): New float formats. + +2001-08-20 Daniel Berlin <dan@cgsoftware.com> + + * fibheap.c: New file. Fibonacci heap. + + * Makefile.in (CFILES): Add fibheap.c. + (REQUIRED_OFILES): Add fibheap.o. + (fibheap.o): Add dependencies for fibheap.o. + +2001-08-17 Christopher Faylor <cgf@cygnus.com> + + * configure.in: Always set HAVE_SYS_ERRLIST when targetting cygwin. + * configure: Regenerate. + +2001-08-16 Richard Henderson <rth@redhat.com> + + * hashtab.c (htab_hash_string): New. + +2001-08-13 Andrew Cagney <ac131313@redhat.com> + + * floatformat.c (floatformat_ieee_double_littlebyte_bigword): Fix + name. + +2001-08-12 Isamu Hasegawa <isamu@yamato.ibm.com> + + * regex.c (wcs_regex_compile): Use appropriate string + to compare with collating element. + Fix the padding for the alignment. + +2001-08-10 Andrew Cagney <ac131313@redhat.com> + + * lbasename.c (lbasename): Change function definition to return a + const char pointer. + +2001-08-07 Jason Merrill <jason_merrill@redhat.com> + + * cp-demangle.c (demangle_special_name): "GR" -> "reference temporary + for". + +2001-08-03 Richard Henderson <rth@redhat.com> + + * Makefile.in (concat.o): Depend on config.h. + +2001-07-30 Andreas Jaeger <aj@suse.de> + + * concat.c: Include "config.h". + +2001-07-30 Andreas Jaeger <aj@suse.de> + + * regex.c: Declare wcs functions only if compiling with + MBS_SUPPORT. + Don't use #elif for traditional C. + +2001-07-23 Ulrich Drepper <drepper@redhat.com> + + * regex.c: Revamp memory allocation for WCHAR functions to + not use too much stack. + +2001-07-30 Andreas Jaeger <aj@suse.de> + + * regex.c: Declare wcs functions only if compiling with + MBS_SUPPORT. + Don't use #elif for traditional C. + +2001-07-25 Daniel Jacobowitz <drow@mvista.com> + + * Makefile.in (regex.o): Add dependency on config.h. + +2001-07-18 Andreas Schwab <schwab@suse.de> + + * regex.c (WORDCHAR_P) [WCHAR]: Also return true for the + underscore character. + +2001-07-18 Ulrich Drepper <drepper@redhat.com> + + * regex.c: Limit string length printed in debug messages to 100 + chars. + +2001-07-18 Andreas Jaeger <aj@suse.de> + + * regex.c: Place under LGPL version 2.1. + +2001-07-10 Jeff Johnston <jjohnstn@redhat.com> + + * Makefile.in: Add support for regex code. + * regex.c: New file. + +2001-07-05 Mark Klein <mklein@dis.com> + + * Makefile.in: Add ffs.c dependency. + * configure.in: Add ffs.c. + * ffs.c: New file. + +2001-06-18 Richard Henderson <rth@redhat.com> + + * concat.c: Include <sys/types.h>. + +2001-06-11 Loren J. Rittle <ljrittle@acm.org> + + bootstrap/3106 + * strerror.c (sys_nerr): Hide the OS header version. + * strsignal.c (sys_nsig): Likewise. + +2001-06-10 Richard Henderson <rth@redhat.com> + + * concat.c: Include string.h. Fix int vs size_t usage. + Simplify the iteration loops. Use memcpy. + +2001-05-16 Matt Kraai <kraai@alumni.carnegiemellon.edu> + + * partition.c: Fix misspelling of `implementation'. + +2001-05-09 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> + + * md5.c (md5_init_ctx): Declare constants as unsigned. + (md5_process_block): Likewise. + +2001-05-07 Zack Weinberg <zackw@stanford.edu> + + * cp-demangle.c (demangle_v3_with_details, + is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor): Use K+R style + function definition. + * ternary.c: Use K+R style function definitions. Use PTR, not + void *. Make arguments constant where possible. + +2001-05-07 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.h (splay_tree_max): New function. + (splay_tree_min): Likewise. + +2001-04-15 Daniel Berlin <dan@cgsoftware.com> + + * ternary.c: New file - Ternary search tree implementation. + + * Makefile.in: Add ternary.o, and ternary.c dependencies. + +2001-04-03 Zack Weinberg <zackw@stanford.edu> + + * make-temp-file.c (try): Inline. + +2001-02-28 Richard Henderson <rth@redhat.com> + + * Makefile.in (make-temp-file.o): Depend on config.h. + +2001-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * memchr.c (memchr): Adjust condition to avoid infinite loop. + +2001-03-23 Jakub Jelinek <jakub@redhat.com> + + * cp-demangle.c (demangle_discriminator): `_0' is discriminator #1, + `_' not followed by a digit is invalid. + +2001-03-22 Jim Blandy <jimb@redhat.com> + + * cp-demangle.c (string_list_delete): Use dyn_string_delete + instead of free, to free the contents as well as the string + structure. + +2001-03-21 Zack Weinberg <zackw@stanford.edu> + + * make-temp-file.c: Always default DIR_SEPARATOR to '/'. + Don't default P_tmpdir to anything. Try /var/tmp before + /usr/tmp. + +2001-03-20 Zack Weinberg <zackw@stanford.edu> + + * choose-temp.c: Split off make_temp_file, and the code + duplicated between it and choose_temp_base, into... + * make-temp-file.c: ... here; new file. + + * Makefile.in (CFILES): Add make-temp-file.c. + (REQUIRED_OFILES): Add make-temp-file.o. + +2001-03-20 Jim Blandy <jimb@redhat.com> + + * cp-demangle.c (struct demangling_def): New fields: + is_constructor and is_destructor. + (demangling_new): Initialize them. + (demangle_ctor_dtor_name): Set them, if we detect a constructor + or destructor. + (demangle_v3_with_details, is_gnu_v3_mangled_ctor, + is_gnu_v3_mangled_dtor): New functions. + +2001-03-20 Jason Merrill <jason@redhat.com> + + * cplus-dem.c (main): Skip initial $. + +2001-03-15 Michael Meissner <meissner@redhat.com> + + * hashtab.c (higher_prime_number): Silence warning that 4294967291 + might be a signed integer under pre-ISO C systems. + +2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk> + John David Anglin <dave@hiauly1.hia.nrc.ca> + + * libiberty/lbasename.c: New file. + * libiberty/Makefile.in: Update for lbasename. + +2001-03-06 Zack Weinberg <zackw@stanford.edu> + + * aclocal.m4 (libiberty_AC_FUNC_C_ALLOCA): New. + * configure.in: Replace all alloca logic with a simple use of + the above new macro. + * config.table: Kill *-*-beos* entry. + * config/mh-beos: Delete. + * configure, config.in: Regenerate. + + * Makefile.in (ALLOCA, HFILES): Kill. + (REQUIRED_OFILES): Add alloca.o. + (alloca.o): Depend on libiberty.h. + (argv.o): Don't depend on alloca-conf.h. + * alloca-conf.h: Delete. + * alloca.c: Include libiberty.h. Kill all #ifdef emacs + blocks. Provide the C alloca unconditionally. Use PTR where + appropriate. Make i00afunc static. + * argv.c: Don't include alloca-conf.h. + +2001-03-04 John David Anglin <dave@hiauly1.hia.nrc.ca> + + * cplus-dem.c (main): Cast enum style to int. + +2001-02-16 Loren J. Rittle <ljrittle@acm.org> + + * cplus-dem.c (main): Initialize style. + +2001-02-02 Phil Edwards <pme@sources.redhat.com> + + * COPYING.LIB: Update to LGPL 2.1 from the FSF. + +2001-01-31 Bryce McKinlay <bryce@albatross.co.nz> + + Add support for Java demangling under the v3 ABI: + * cp-demangle.c (NAMESPACE_SEPARATOR): New define. + (struct demangling_def): Add `style' field. + (demangling_new): New parameter `style'. Set it in demangling_t. + (demangle_prefix): Use NAMESPACE_SEPARATOR. + (demangle_type_ptr): Don't emit pointer symbol if doing Java output. + (cp_demangle): New parameter `style'. Pass it to demangling_new(). + (main): Call cp_demangle with extra parameter. + (java_demangle_v3): New function. + (java_builtin_type_names): New. Table of primitive type names used + for Java demangling. + (demangle_builtin_type): Look up in java_builtin_type_names if doing + Java output. + * cplus-dem.c (cplus_demangle): Use java_demangle_v3 to do Java + demangling. + (long_options): Remove obsolete `java' option. + (main): Remove explicit handling of `java' option. Instead, pass style + parameter in cplus_demangle flags as gdb does. + * testsuite/demangle.expected: Add some Java test cases. + +2000-12-29 DJ Delorie <dj@redhat.com> + + * fnmatch.c: Make the note about the origins of this file more + accurate, at least until we can sync with glibc. + * getopt.c: Ditto. + * getopt1.c: Ditto. + * md5.c: Ditto. + * obstack.c: Ditto. + +2000-12-26 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * bsearch.c: New file. + * configure.in (funcs): Add bsearch. + (AC_CHECK_FUNCS): Likewise. + * configure, config.in: Regenerate. + +2000-12-13 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * safe-ctype.c: #include "ansidecl.h". + * strtod.c: Likewise. + +2000-12-13 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * strtoul.c: Include safe-ctype.h, not ctype.h. + +2000-12-07 Zack Weinberg <zack@wolery.stanford.edu> + + * safe-ctype.c: New file. + * Makefile.in (CFILES): Add safe-ctype.c. + (REQUIRED_OFILES): Add safe-ctype.o. + + * argv.c: Define ISBLANK and use it, not isspace. + * basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c, + strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use + uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c) + before calling TOLOWER(c)/TOUPPER(c). + +2000-12-07 Mike Stump <mrs@wrs.com> + + * Makefile.in (distclean): When cleaning, remove testsuite. + +2000-12-05 Jason Merrill <jason@redhat.com> + + * cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled + name before allocating the dyn_string. + +2000-12-04 Jason Merrill <jason@redhat.com> + + * cp-demangle.c: s/new_abi/v3/. + * cplus-dem.c: Likewise. + (current_demangling_style): Now auto_demangling. + (cplus_demangle): Try v3 demangling if AUTO_DEMANGLING. + (main): Use standard symbol chars for auto_demangling. + +2000-11-26 Mark Mitchell <mark@codesourcery.com> + + * hashtab.c (higher_prime_number): Use a table, rather than a + seive, to find the next prime. + +2000-11-22 H.J. Lu <hjl@gnu.org> + + * cplus-dem.c (main): Handle gnat_demangling. + +2000-11-22 Zack Weinberg <zack@wolery.stanford.edu> + + * aclocal.m4 (LIB_AC_PROG_CC): Moved here from configure.in. + (AC_DEFINE_NOAUTOHEADER): New - work around bug in autoheader. + * configure.in: Call AC_C_INLINE and AC_C_CONST. Use three + argument form of AC_DEFINE in dummy definitions block. Use + AC_DEFINE_NOAUTOHEADER for real definitions of things defined + in dummy block. Preload cache variables instead of bypassing + tests, where possible. + * acconfig.h: Removed. + + * xmalloc.c (xmalloc_failed): New function, does error + reporting on failed allocation. + (xmalloc, xcalloc, xrealloc): Use it. + +2000-11-21 Hans-Peter Nilsson <hp@bitrange.com> + + * cplus-dem.c (cplus_demangle): Fix formatting. + (grow_vect): Ditto. + (ada_demangle): Ditto. + (internal_cplus_demangle): Ditto. + (mop_up): Ditto. + +2000-11-21 H.J. Lu <hjl@gnu.org> + + * cplus-dem.c (main): Handle java_demangling. + +2000-11-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (grow_vect): Prototype. + (ada_demangle): Cast the arg of ctype macros to unsigned char. + +2000-11-15 Hans-Peter Nilsson <hp@bitrange.com> + + * cplus-dem.c (ada_demangle): Add back ATTRIBUTE_UNUSED for + parameter `option'. + +2000-11-15 Kenneth Block <kenneth.block@compaq.com> + + * cplus-dem.c: Eliminate use of DEFUN, it is obsolete and cannot + be used in GCC. + +2000-11-15 Kenneth Block <kenneth.block@compaq.com> + + * cplus-dem.c: Add gnat demangler. Add java to demangle style + list. + +2000-11-04 Hans-Peter Nilsson <hp@bitrange.com> + + * hashtab.c (htab_expand): Change to return int. Use calloc or + xcalloc depending on htab->return_allocation_failure. Return zero + if calloc fails. + (htab_create): Update comment to cover memory allocation. + (htab_try_create): New. + (htab_find_slot_with_hash): Return NULL if htab_expand fails. + Update comment to cover this. + +2000-11-03 Hans-Peter Nilsson <hp@bitrange.com> + + * hashtab.c: Change void * to PTR where necessary. + (htab_create, htab_expand): Correct formatting of comment before + function. + +2000-10-22 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (string_list_def): Add caret_position and comments. + (result_caret_pos): New macro. + (result_append_string): Rename to... + (result_add_string): ... this, and insert at caret position. + Rename throughout. + (result_append): Rename to... + (result_add): ... this, and insert at caret position. Rename + throughout. + (result_append_char): Rename to... + (result_add_char): ... this, and insert at caret position. Rename + throughout. + (result_append_space): Remove. + (string_list_new): Initialize caret position. + (result_add_separated_char): Use caret position. + (result_get_caret): New funtion. + (result_set_caret): Likewise. + (result_shift_caret): Likewise. + (result_previous_char_is_space): Likewise. + (substitution_start): Use caret position. + (substitution_add): Likewise. + (demangling_new): Initialize caret position. + (demangle_encoding): Use caret position. + (demanglin_nested_name): Put CV qualifiers after name. + (demangle_type_ptr): Use switch statement. Handle pointers to + arrays. Don't use result_append_space. Use caret position. + (demangle_type): Emit CV qualifiers after underlying type. Adjust + call to demangle_array_type. + (demangle_array_type): Add parameter to handle pointers to arrays. + +2000-10-01 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.c (splay_tree_insert): Fix formatting. + +2000-09-16 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.c (splay_tree_predecessor): Fix typo in comment. + +2000-09-14 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * splay-tree.c: #include <stdio.h>. + +2000-09-14 Hans-Peter Nilsson <hp@axis.com> + + * testsuite/demangle-expected: Add two tests for anonymous + namespaces. + * cplus-dem.c (gnu_special): Handle anonymous namespaces. + +2000-09-10 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.c (splay_tree_predecessor): New function. + (splay_tree_successor): Likewise. + +2000-09-10 Hans-Peter Nilsson <hp@axis.com> + + * testsuite/demangle-expected: Add four tests for type_info + mangling. + * cplus-dem.c (gnu_special): Use do_type, not demangle_fund_type, + for a non-template non-qualified type_info function or node. + +2000-09-08 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c: Fix copyright banner. + +2000-09-07 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * md5.c: #include "ansidecl.h". + +2000-09-06 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (status_allocation_failed): Rearrange whitespace. + (demangle_type): Handle substitution candidates correctly in the + face of special substitutions. + +2000-09-05 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_encoding): Rename variable. + (demangle_name): Rename parameter. Handle return type + suppression. + (demangle_nested_name): Rename parameter. + (demangle_prefix): Likewise. Change return type suppression. + (demangle_unqualified_name): Add parameter. Flag constructors and + conversion operators. + (demangle_special_name): Fix comment. + (demangle_type): Rename variable. + (demangle_bare_function_type): Check for missing return type and + parameter. + (demangle_class_enum_type): Rename parameter. + (demangle_discriminator): Fix misspelling in comment. + +2000-08-31 DJ Delorie <dj@redhat.com> + + * configure.in (Cygwin): special case cygwin only when we're + building cygwin, not when we're hosting cygwin. + +2000-09-04 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_template_arg): Eat an `E' after an + <expression>. + +2000-09-04 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_type_ptr): Increment position past + pointer and reference characters. + +2000-09-04 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_nv_offset): New function. + (demangle_v_offset): Likewise. + (demangle_call_offset): Likewise. + (demangle_special_name): Update thunk demangling to comply with + ABI changes. + +2000-09-03 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (ANONYMOUS_NAMESPACE_PREFIX): New macro. + (substitution_def): Remove template_parm_number. + (NOT_TEMPLATE_PARM): Remove. + (result_insert_string): New macro. + (result_insert): Likewise. + (result_insert_char): Likewise. + (substitution_add): Remove last parameter. Don't store template + parm number. + (BFT_NO_RETURN_TYPE): Define as NULL. + (demangle_encoding): Adjust call to demangle_bare_function_type. + (demangle_name): Adjust substitution. Adjust call to + substitution_add. + (demangle_prefix): Adjust call to substitution_add. + (demangle_identifier): Handle anonymous namespaces. + (demangle_operator_name): Change demangling of vendor-extended + operator to match ABI changes. + (demangle_type_ptr): Change parameters. Make recursive. Handle + substitutions here. + (demangle_type): Adjust calls to demangle_template_param, + substitution_add, and demangle_type_ptr. Fix substitution of + templated types. + (demangle_function_type): Change parameter to a pointer. + (demangle_bare_function_type): Likewise. Adjust insertion point. + (demangle_template_param): Remove last parameter. + (demangle_expr_primary): Remove unused variable. Adjust call to + demangle_template_param. + (is_mangled_char): Accept `$' and `.'. + * cplus-dem.c (gnu_new_abi_symbol_characters): Add '$' and '.'. + * dyn-string.c (dyn_string_insert_char): New function. + +2000-08-31 Hans-Peter Nilsson <hp@axis.com> + + * testsuite/demangle-expected: Add nine tests for + underscore-after-number followed by five tests for name-signature + delimiter. + +2000-08-28 Richard Henderson <rth@cygnus.com> + + * Makefile.in (md5.o): Depend on config.h. + +2000-08-28 Jason Merrill <jason@redhat.com> + + * Makefile.in (REQUIRED_OFILES): Add md5.o. + (CFILES): Add md5.c. + * md5.c: New file. + +2000-08-27 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_name): Initialize template_p in local + name case. Don't re-add substitutions as candidates. + (demangle_nested_name): Use <unqualified-name>. + (demangle_prefix): Likewise. Don't add template names as + substitution candidates twice, or re-add a substitution or the + last prefix component. + (demangle_local_name): Adjust output format. + +2000-08-25 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (result_add_separated_char): Change parameter to + int. + (substitution_add): Don't check for duplicates. Check if + previously allocated size is zero. + (demangle_name): Remove duplicate check for std substitution. + Clear template flag appropriately. + (demangle_prefix): Remove argument to demangle_substitution. + Don't check that template flag is already set. + (demangle_operator_name): Add pt operator. + (demangle_type): Don't treat r as built-in type. Remove argument + to demangle_substitution. Fix substitution candidate mechanics. + Handle <template-template-parm>s. Improve comments. + (demangle_template_param): Don't handle template arg lists here. + (demangle_substitution): Remove parameter. + (print_usage): Remove extra fprintf option. + +2000-08-24 Greg McGary <greg@mcgary.org> + + * libiberty/random.c (end_ptr): Revert previous change. + +2000-08-24 Greg McGary <greg@mcgary.org> + + * libiberty/cplus-dem.c (cplus_demangle_opname, cplus_mangle_opname, + demangle_expression, demangle_function_name): Use ARRAY_SIZE. + * libiberty/random.c (end_ptr): Likewise. + +2000-08-23 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (result_close_template_list): Remove function. + (result_add_separated_char): New function. + (result_open_template_list): New macro. + (result_close_template_list): Likewise. + (demangle_prefix): Don't set template_p if the + prefix ends with a ctor name. + (demangle_type_ptr): Remove duplicate RETURN_IF_ERROR. + (demangle_type): Check for template args after substitution. + (demangle_template_args): Use result_open_template_list. + +2000-08-02 Zack Weinberg <zack@wolery.cumb.org> + + * pexecute.c: Don't use vfork. Initialize 'pid' before retry loop. + +2000-07-26 Dave Pitts <dpitts@cozx.com> + + * config/mh-openedition.h: Added -DLE370 definition. + +2000-07-26 Mark Elbrecht <snowball3@bigfoot.com> + + * pexecute.c (pexecute) [__MSDOS__]: Change __GO32__ to + __DJGPP__. Use P_WAIT instead of constant in the spawnv* call. + Cast program to 'char *' in errmsg_arg assignment. + (PWAIT_ERROR): Define. + (pwait): Use PWAIT_ERROR. Adjust DJGPP's status code to conform + to DJGPP's WIF* macros. + +2000-07-27 RodneyBrown <RodneyBrown@pmsc.com> + Jeff Law <law@cygnus.com> + + * getcwd.c: Include string.h, stdlib.h for prototypes + + * Makefile.in (rename.o, waitpid.o): Depend on config.h + * rename.c: Include config.h, unistd.h + * waitpid.c: Include config.h, sys/wait.h + +2000-07-24 Hans-Peter Nilsson <hp@axis.com> + + * cplus-dem.c (work_stuff_copy_to_from): New. + (delete_non_B_K_work_stuff): New. + (delete_work_stuff): New. + (mop_up): Break out work_stuff partly destruction to + delete_non_B_K_work_stuff. + (iterate_demangle_function): New. + (demangle_prefix): Call iterate_demangle_function instead of + demangle_function_name. Leave handling of name-signature + __-delimiters to iterate_demangle_function. + (demangle_integral_value): Strip an optional + following underscore cautiously. Handle negative numbers. + +2000-07-24 Daniel Berlin <dberlin@redhat.com> + + * cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to + if (AUTO_DEMANGLING || GNU_DEMANGLING) + +2000-07-21 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_ctor_dtor_name): Remove not-in-charge + allocating ctor mangling. + (demangle_array_type): Handle empty and non-constant array length. + +2000-07-23 Michael Sokolov <msokolov@ivan.Harhan.ORG> + Jeff Law <law@cygnus.com> + + * configure.in (AC_CHECK_HEADERS): Add time.h. + (AC_HEADER_TIME): Add check. + * configure, config.in: Regenerate. + * getruntime.c: Portably #include <sys/time.h> and/or <time.h>. + + * configure.in (AC_CHECK_HEADERS): Add limits.h. + * configure, config.in: Regenerate. + * sort.c: Portably #include <limits.h> and/or <sys/param.h>. + * strtol.c, strtoul.c: #include "config.h". Portably #include + <limits.h> and/or <sys/param.h>. + * Makefile.in (strtol.o, strtoul.o): Update dependencies. + + * aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro. + * configure.in (libiberty_AC_DECLARE_ERRNO): Add check. + * configure, config.in: Regenerate. + * pexecute.c, strtol.c, strtoul.c: Declare errno if necessary. + + * cp-demangle.c, mkstemps.c: #include <sys/types.h>. + +2000-07-21 Mike Stump <mrs@wrs.com> + + * Makefile.in (xexit.o): Add dependency for config.h in xexit.c. + * (vasprintf.o): Add dependency for config.h in vasprintf.c. + +2000-07-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cp-demangle.c (cp_demangle_type): Wrap in IN_LIBGCC2. + + * setenv.c (setenv): Initialize variable `ep'. + + * sigsetmask.c (abort): Prototype. + + * vasprintf.c: Include config.h. Check ANSI_PROTOTYPES, not + __STDC__ for stdarg.h include. + (int_vasprintf): Prototype. + (checkit): Prototype. Use VPARAMS/ANSI_PROTOTYPES/VA_START in + definition. Cast `global_total_width' in comparison. + (main): Prototype. Return a value. + + * vfork.c (fork): Prototype. + + * xexit.c: Include config.h. + +2000-07-20 Joseph S. Myers <jsm28@cam.ac.uk> + + * cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int, + and print it with %u. + +2000-07-17 Hans-Peter Nilsson <hp@axis.com> + + * testsuite/regress-demangle (failed test): Show result and + expected output. + +2000-07-07 Andrew Haley <aph@cygnus.com> + + * cplus-dem.c (main): fflush() after emitting last char before + waiting for input. + +2000-06-28 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_encoding): Accept no substitutions. + (demangle_name): Handle <substitution> followed by + <unqualified-template-name>. + (demangle_type): Follow special substitutions with + <class-enum-type> + (demangle_subtitution): Set template_p for special substitutions. + (main): Fix typos. + +2000-06-27 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_special_name): Swap base and derived + class when demangling construction vtables. + +2000-06-21 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c: Don't include ctype.h. + (IS_DIGIT): New macro. + (IS_ALPHA): Likewise. Use IS_DIGIT and IS_ALPHA throughout + instead of isdigit and isalpanum. + (demangling_def): Make name and next const pointers. + (STATUS_ALLOCATION_FAILED): New status code. + (dyn_string_append_space): Handle failure in + dyn_string_append_char. + (int_to_dyn_string): Likewise. Change return value to status_t. + (string_list_new): Handle failure of dyn_string_init. + (result_close_template_list): Change return type to status_t. + Handle failure in dyn_string_append. + (result_push): Change return value to status_t. Handle failure in + string_list_new. Handle failure of result_push throughout. + (substitution_add): Change return value to status_t. Handle + dyn_string failures. Handle failure of substitution_add + throughout. + (template_arg_list_new): Return NULL on allocation failure. + (result_append_string): Return STATUS_ALLOCATION_FAILED on error. + Handle error result throughout. + (result_append): Likewise. + (result_append_char): Likewise. + (result_append_space): Likewise. + (demangling_new): Make argument a const pointer. Handle + allocation failures. + (demangle_template_args): Handle failure in template_arg_list_new + and result_close_template_list. + (demangle_discriminator): Return if int_to_dyn_string fails. + (cp_demangle): Likewise. + (cp_demangle_type): New function. + (cplus_demangle_new_abi): Don't call dyn_string_delete. Abort on + memory allocation failure. + (main): Likewise. + * dyn-string.c (RETURN_ON_ALLOCATION_FAILURE): Define if + IN_LIBGCC2. + (dyn_string_init): Change return value to int. Handle + RETURN_ON_ALLOCATION_FAILURE case. + (dyn_string_new): Handle RETURN_ON_ALLOCATION_FAILURE case. + (dyn_string_release): Delete the dyn_string. + (dyn_string_resize): Handle RETURN_ON_ALLOCATION_FAILURE case. + (dyn_string_copy): Change return type to int. + (dyn_string_copy_cstr): Likewise. + (dyn_string_prepend): Likewise. + (dyn_string_prepend_cstr): Likewise. + (dyn_string_insert): Likewise. + (dyn_string_insert_cstr): Likewise. + (dyn_string_append): Likewise. + (dyn_string_append_cstr): Likewise. + (dyn_string_append_char): Likewise. + (dyn_string_substring): Likewise. + +2000-06-09 Zack Weinberg <zack@wolery.cumb.org> + + * cp-demangle.c (demangle_operator_name): Add spaces before + names beginning with a letter: delete, delete[], new, new[], + sizeof. + (demangle_special_name): Handle TF <type> and TJ <type>. + +Thu Jun 8 18:52:24 2000 Philippe De Muyter <phdm@macqel.be> + + * cp-demangle.c (template_arg_list_new): Revert previous PARAMS patch. + +Thu Jun 8 09:25:54 2000 Philippe De Muyter <phdm@macqel.be> + + * cp-demangle.c (stdio.h): File included unconditionaly. + (template_arg_list_new): Parameter list is PARAMS ((void)), not (). + * dyn-string.c (stdio.h): File included. + * partition.c (partition_print): No `&' needed to take the address of + a function. + +2000-06-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in (ac_libiberty_warn_cflags): Add -pedantic. + + * choose-temp.c (try, choose_temp_base, make_temp_file): Constify. + + * cp-demangle.c (demangle_char): Change parameter from char to int. + (demangle_expression, demangle_expr_primary): Remove extra + semi-colon in prototype. + + * dyn-string.c (dyn_string_append_char): Change parameter from + char to int. + + * memcmp.c (memcmp): Constify. + + * mkstemps.c (gcc_uint64_t): Mark GNUC `long long' case with + __extension__. + + * partition.c (elem_compare): Prototype. Don't cast away + const-ness. + + * setenv.c (setenv): Use braces to avoid ambiguous `else'. + +2000-06-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (cp-demangle.o): Depend on $(INCDIR)/demangle.h. + + * cp-demangle.c: Include demangle.h. + (template_arg_list_new): DeANSIfy. + (cp_demangle): Make static and add prototype. + (operator_code, operators): Constify. + (demangle_operator_name): Likewise for variables `p1', `p2' and `p'. + +2000-06-05 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c (demangle_prefix): Cast argument to isdigit to + unsigned char. + (demangle_unqualified_name): Likewise. + (demangle_number_literally): Likewise. + (demangle_type): Likewise. + (demangle_substitution): Likewise. + (is_mangled_char): Likewise, for isalnum. + +2000-06-04 Alex Samuel <samuel@codesourcery.com> + + * Makefile.in (CFILES): Add cp-demangle.c and dyn-string.c. + (REQUIRED_OFILES): Add cp-demangle.o and dyn-string.o. + (cp-demangle.o): New dependency. + (dyn-string.o): Likewise. + + * dyn-string.c: Move here from gcc/dyn-string.c. Add new functions. + + * cplus-dem.c (libiberty_demanglers): Add initializer for new-ABI + demangler. + (cplus_demangle): Call cplus_demangle_new_abi if in new-ABI + demangling mode. + (gnu_new_abi_symbol_characters): New function. + (main): Use gnu_new_abi_symbol_characters. * cp-demangle.c: New + file. + * cp-demangle.c: New file. + +Tue May 30 16:45:25 2000 Andrew Cagney <cagney@b1.cygnus.com> + + * floatformat.c: Add name to each floatformat field. + +Tue May 30 15:07:52 2000 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (objalloc.o): Depend on config.h + +2000-05-29 Zack Weinberg <zack@wolery.cumb.org> + + * hashtab.c, partition.c, sort.c, xmemdup.c: Include string.h + if HAVE_STRING_H. + * pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H. + * objalloc.c: Include config.h. Include stdlib.h and don't + declare malloc or free if HAVE_STDLIB_H. + * strerror.c, strsignal.c: Include stdlib.h if HAVE_STDLIB_H, + else declare malloc without prototype. Include string.h if + HAVE_STRING_H, else declare memset without prototype. Don't + include stddef.h. + +2000-05-23 Mike Stump <mrs@wrs.com> + + * Makefile.in (xmalloc.o): Add dependency for config.h, fixes make + -j3. + +2000-05-18 J. David Anglin <dave@hiauly1.hia.nrc.ca> + + * xmalloc.c: Include config.h for HAVE_SBRK definition. + +2000-05-16 Horst von Brand <vonbrand@sleipnir.valparaiso.cl> + + * hashtab.c (hash_pointer): Delete low-order bits which are + probably zero, also eliminate a warning on alpha. + +2000-05-15 David Edelsohn <edelsohn@gnu.org> + + * Makefile.in: Change "pic" to depend on $(PICFLAG), not + on $(enable_shared). + +2000-05-10 Jakub Jelinek <jakub@redhat.com> + + * config.table: Use mh-sparcpic for sparc*-*-*. + +2000-05-08 Nick Clifton <nickc@cygnus.com> + + * Makefile.in (CFILES): Add strncmp.c. + (NEEDED): Add strncmp. + +2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (cplus_demangle_opname, demangle_function_name): + Cast the arguments to `islower' to `unsigned char'. + (print_demangler_list): Prototype. + +Thu May 4 17:14:41 2000 Philippe De Muyter <phdm@macqel.be> + + * sort.c (UCHAR_MAX): Provide fallback definition. + +2000-04-29 Alexandre Oliva <aoliva@cygnus.com> + + * Makefile.in (maintainer-clean-subdir): Fix handling of empty + SUBDIRS. + +2000-04-28 Kenneth Block <block@zk3.dec.com> + Jason Merrill <jason@casey.cygnus.com> + + * cplus-dem.c (libiberty_demanglers): New table for demangle styles. + (cplus_demangle_set_style): New function for setting style. + (cplus_demangle_name_to_style): New function to translate name. + +2000-04-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * aclocal.m4: New file with new test libiberty_AC_FUNC_STRNCMP. + + * configure.in (AC_CHECK_HEADERS): Add sys/mman.h fcntl.h. + (libiberty_AC_FUNC_STRNCMP): Invoke. + + * strncmp.c: New file. + +Thu Apr 27 16:58:43 MET DST 2000 Jan Hubicka <jh@suse.cz> + + * hashtab.c (htab_expand): Add prototype. + (find_empty_slot_for_expand): Likewise. + +2000-04-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * hashtab.c (hash_pointer, eq_pointer): Make definition static to + match prototype. + (htab_expand): Cast the return value of xcalloc. + +2000-04-24 Mark Mitchell <mark@codesourcery.com> + + * hashtab.c (hash_pointer): New function. + (eq_pointer): Likewise. + (htab_hash_pointer): New variable. + (htab_eq_pointer): Likewise. + +2000-04-23 Mark Mitchell <mark@codesourcery.com> + + * sort.c (sort_pointers): Fix endianness bugs. + + * sort.c: New file. + * Makefile.in (CFILES): Add sort.c + (REQUIRED_OFILES): Add sort.o. + (sort.o): New target. + +2000-04-21 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * Makefile.in (*-subdir): Revamp slightly to avoid losing on + 4.3BSD systems. + +Tue Apr 18 16:23:31 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * hashtab.c: Various minor cleanups. + (htab_find_slot_with_hash): INSERT is now enum insert_option. + (htab_find_slot): Likewise. + +2000-04-16 Dave Pitts <dpitts@cozx.com> + + * cplus-dem.c (cplus_demangle_opname): Changed to use islower. + +2000-04-05 Richard Henderson <rth@cygnus.com> + + * splay-tree.c (splay_tree_remove): New. + +2000-03-30 Mark Mitchell <mark@codesourcery.com> + + * hashtab.c (find_empty_slot_for_expand): Use hashval_t for hash + codes. + (htab_find_with_hash): Likewise. + (htab_find_slot_with_hash): Likewise. + +2000-03-29 Zack Weinberg <zack@wolery.cumb.org> + + * hashtab.c (htab_find_with_hash): Avoid calculating hash2 + unless it will be used. Rearrange loop for better + optimization. + (higher_prime_number): Add static prototype. + Thu Mar 16 01:33:58 2000 Jeffrey A Law (law@cygnus.com) * Makefile.in (partition.o): Depend on config.h @@ -515,9 +2304,9 @@ Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * 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. + (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. @@ -530,11 +2319,11 @@ Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Cast the argument of a ctype function to unsigned char. * floatformat.c (floatformat_to_double): Add explicit braces to - avoid ambiguous `else'. + 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. + `cstart' and `cend' to unsigned char. Cast the argument of macro + `FOLD', which uses ctype functions, to unsigned char. * objalloc.c (free): Add prototype. @@ -545,7 +2334,7 @@ Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson <hp@axis.se> 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. + doesn't exist. (do_hpacc_template_literal): remove unused variable `i'. Fri Dec 18 16:11:43 EST 1998 Andrew MacLeod <amacleod@cygnus.com> @@ -589,48 +2378,48 @@ Fri Dec 4 13:51:04 1998 David Taylor <taylor@texas.cygnus.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. + 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. + function. (arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP - style for this case is the same as ARM. + 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_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. + 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. + 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. + 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. + 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. + value param for HP/aCC. (do_hpacc_template_literal): new function. Handle a template's - literal parameter for HP aCC. + 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. + to message. Sat Nov 28 17:25:22 1998 Christopher Faylor <cgf@cygnus.com> @@ -712,13 +2501,13 @@ Mon Nov 2 15:05:33 1998 Geoffrey Noer <noer@cygnus.com> 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. + 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> @@ -824,8 +2613,8 @@ Thu Oct 8 23:42:08 1998 Jeffrey A Law (law@cygnus.com) 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. + inclusions inside HAVE_*_H macros. Include ansidecl.h when not + IN_GCC. * vasprintf.c: Include stdarg.h/varargs.h first. @@ -1139,7 +2928,7 @@ Mon May 4 13:00:28 1998 Ian Lance Taylor <ian@cygnus.com> * 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. + (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@. @@ -1356,7 +3145,7 @@ Wed Sep 24 00:31:59 1997 Felix Lee <flee@yin.cygnus.com> * asprintf.c: stdarg.h when ALMOST_STDC * config/mh-windows (EXTRA_OFILES): add asprintf.o and - strncasecmp.o. + strncasecmp.o. Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com> @@ -3398,7 +5187,7 @@ Thu Jan 30 22:48:41 1992 Stu Grossman (grossman at cygnus.com) Mon Jan 20 18:53:23 1992 Stu Grossman (grossman at cygnus.com) - * getopt.c, getopt1.c, ../include/getopt.h: Get latest versions. + * getopt.c, getopt1.c, ../include/getopt.h: Get latest versions. Sat Jan 18 16:53:01 1992 Fred Fish (fnf at cygnus.com) diff --git a/gnu/lib/libiberty/src/Makefile.in b/gnu/lib/libiberty/src/Makefile.in index 9aa57f06d4b..cafb3f7916d 100644 --- a/gnu/lib/libiberty/src/Makefile.in +++ b/gnu/lib/libiberty/src/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1990, 91 - 99, 2000 +# Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003 # Free Software Foundation # # This file is part of the libiberty library. @@ -26,6 +26,7 @@ # Makefile for libiberty directory # +libiberty_topdir = @libiberty_topdir@ srcdir = @srcdir@ VPATH = @srcdir@ @@ -34,6 +35,8 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ +includedir = @includedir@ +target_header_dir = @target_header_dir@ SHELL = @SHELL@ @@ -48,6 +51,10 @@ MULTICLEAN = true INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs + +# Some compilers can't handle cc -c blah.c -o foo/blah.o. +OUTPUT_OPTION = @OUTPUT_OPTION@ AR = @AR@ AR_FLAGS = rc @@ -56,15 +63,17 @@ CC = @CC@ CFLAGS = @CFLAGS@ LIBCFLAGS = $(CFLAGS) RANLIB = @RANLIB@ +MAKEINFO = @MAKEINFO@ +PERL = @PERL@ PICFLAG = MAKEOVERRIDES = TARGETLIB = libiberty.a +TESTLIB = testlib.a 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.) @@ -76,6 +85,7 @@ FLAGS_TO_PASS = \ "AR_FLAGS=$(AR_FLAGS)" \ "CC=$(CC)" \ "CFLAGS=$(CFLAGS)" \ + "DESTDIR=$(DESTDIR)" \ "LIBCFLAGS=$(LIBCFLAGS)" \ "EXTRA_OFILES=$(EXTRA_OFILES)" \ "HDEFINES=$(HDEFINES)" \ @@ -95,8 +105,9 @@ FLAGS_TO_PASS = \ # Subdirectories to recurse into. We need to override this during cleaning SUBDIRS = testsuite +# FIXME: add @BUILD_INFO@ once we're sure it works for everyone. all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir - @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all + @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all .PHONY: check installcheck check: check-subdir @@ -108,66 +119,183 @@ INCDIR=$(srcdir)/$(MULTISRCTOP)../include COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ .c.o: - test x"$(enable_shared)" != xyes || \ - $(COMPILE.c) $(PICFLAG) $< -o pic/$@ - $(COMPILE.c) $< + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \ + else true; fi + $(COMPILE.c) $< $(OUTPUT_OPTION) -info: info-subdir +# NOTE: If you add new files to the library, add them to this list +# (alphabetical), and add them to REQUIRED_OFILES, or +# CONFIGURED_OFILES and funcs in configure.in. +CFILES = alloca.c argv.c asprintf.c atexit.c \ + basename.c bcmp.c bcopy.c bsearch.c bzero.c \ + calloc.c choose-temp.c clock.c concat.c cp-demangle.c \ + cplus-dem.c \ + dyn-string.c \ + fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \ + getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ + hashtab.c hex.c \ + index.c insque.c \ + lbasename.c \ + make-relative-prefix.c \ + make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \ + memset.c mkstemps.c \ + objalloc.c obstack.c \ + partition.c pexecute.c physmem.c putenv.c \ + random.c regex.c rename.c rindex.c \ + safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \ + splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \ + strncasecmp.c strncmp.c strrchr.c strsignal.c strstr.c \ + strtod.c strtol.c strtoul.c \ + ternary.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 + +# These are always included in the library. The first four are listed +# first and by compile time to optimize parallel builds. +REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \ + alloca.o argv.o \ + choose-temp.o concat.o \ + dyn-string.o \ + fdmatch.o fibheap.o floatformat.o fnmatch.o \ + getopt.o getopt1.o getpwd.o getruntime.o \ + hashtab.o hex.o \ + lbasename.o \ + make-relative-prefix.o \ + make-temp-file.o \ + objalloc.o obstack.o \ + partition.o physmem.o pexecute.o \ + safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \ + strsignal.o \ + ternary.o \ + xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o + +# These are all the objects that configure may add to the library via +# $funcs or EXTRA_OFILES. This list exists here only for "make +# maint-missing" and "make check". +CONFIGURED_OFILES = asprintf.o atexit.o \ + basename.o bcmp.o bcopy.o bsearch.o bzero.o \ + calloc.o clock.o copysign.o \ + _doprnt.o \ + ffs.o \ + getcwd.o getpagesize.o \ + index.o insque.o \ + memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \ + putenv.o \ + random.o rename.o rindex.o \ + setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \ + strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \ + strtoul.o \ + tmpnam.o \ + vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \ + waitpid.o + +# These files are installed if the library has been configured to do so. +INSTALLED_HEADERS = \ + $(INCDIR)/ansidecl.h \ + $(INCDIR)/demangle.h \ + $(INCDIR)/dyn-string.h \ + $(INCDIR)/fibheap.h \ + $(INCDIR)/floatformat.h \ + $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h \ + $(INCDIR)/objalloc.h \ + $(INCDIR)/partition.h \ + $(INCDIR)/safe-ctype.h \ + $(INCDIR)/sort.h \ + $(INCDIR)/splay-tree.h \ + $(INCDIR)/ternary.h + +$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) + -rm -f $(TARGETLIB) pic/$(TARGETLIB) + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) + $(RANLIB) $(TARGETLIB) + if [ x"$(PICFLAG)" != x ]; then \ + cd pic; \ + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ + $(RANLIB) $(TARGETLIB); \ + cd ..; \ + else true; fi + +$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES) + -rm -f $(TESTLIB) + $(AR) $(AR_FLAGS) $(TESTLIB) \ + $(REQUIRED_OFILES) $(CONFIGURED_OFILES) + $(RANLIB) $(TESTLIB) + +info: libiberty.info info-subdir install-info: install-info-subdir clean-info: clean-info-subdir -dvi: dvi-subdir +dvi: libiberty.dvi dvi-subdir +html: libiberty.html -# Include files that are in this directory. -HFILES = alloca-conf.h +TEXISRC = \ + $(srcdir)/libiberty.texi \ + $(srcdir)/copying-lib.texi \ + $(srcdir)/obstacks.texi \ + $(srcdir)/functions.texi -# NOTE: If you add new files to the library, add them to this list -# (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 +# Additional files that have texi snippets that need to be collected +# and sorted. Some are here because the sources are imported from +# elsewhere. Others represent headers in ../include. +TEXIFILES = fnmatch.txh -# 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 +libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC) + $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi -$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA) - rm -f $(TARGETLIB) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA) - $(RANLIB) $(TARGETLIB) +libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC) + texi2dvi $(srcdir)/libiberty.texi + +libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC) + $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi + +@MAINT@$(srcdir)/functions.texi : stamp-functions +@MAINT@ @true + +@MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile +@MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES) +@MAINT@ echo stamp > stamp-functions 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) + ${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR) + $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n + ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n ) + mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB) + if test -n "${target_header_dir}"; then \ + case "${target_header_dir}" in \ + /*) thd=${target_header_dir};; \ + *) thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \ + esac; \ + ${mkinstalldirs} $(DESTDIR)$${thd}; \ + for h in ${INSTALLED_HEADERS}; do \ + ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \ + done; \ + fi @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install +# This is tricky. Even though CC in the Makefile contains +# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the +# default multilib, so we have to take LIBCFLAGS into account as well, +# since it will be passed the multilib flags. +MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory` 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) + ${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) + $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n + ( cd $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) ; $(RANLIB) $(TARGETLIB)n ) + mv -f $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB) @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install # 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 \ + strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \ vfork waitpid bcmp bcopy bzero needed-list: Makefile rm -f needed-list; touch needed-list; \ @@ -185,7 +313,7 @@ required-list: Makefile echo $(REQUIRED_OFILES) > required-list stamp-picdir: - if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \ + if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \ mkdir pic; \ else true; fi touch stamp-picdir @@ -194,8 +322,8 @@ stamp-picdir: etags tags: TAGS etags-subdir -TAGS: $(CFILES) $(HFILES) - etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done` +TAGS: $(CFILES) + etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done` # The standalone demangler (c++filt) has been moved to binutils. demangle: @@ -204,26 +332,46 @@ demangle: @false ls: - @echo Makefile $(HFILES) $(CFILES) + @echo Makefile $(CFILES) + +# Various targets for maintainers. + +maint-missing : + @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES) + +maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES) + @true + +maint-undoc : $(srcdir)/functions.texi + @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc + +maint-deps : + @$(PERL) $(srcdir)/maint-tool -s $(srcdir) deps $(INCDIR) # Need to deal with profiled libraries, too. # 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 + -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 + -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky + -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg + -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr + -rm -f libtexi.stamp @$(MULTICLEAN) multi-clean DO=mostlyclean clean: clean-subdir $(MAKE) SUBDIRS="" mostlyclean - rm -f *.a required-list tmpmulti.out + -rm -f *.a required-list tmpmulti.out + -rm -f libiberty.dvi libiberty.info* libiberty.html @$(MULTICLEAN) multi-clean DO=clean distclean: distclean-subdir $(MAKE) SUBDIRS="" clean @$(MULTICLEAN) multi-clean DO=distclean - rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out - rm -f config.log + -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out + -rm -f config.log + -rmdir testsuite 2>/dev/null maintainer-clean realclean: maintainer-clean-subdir $(MAKE) SUBDIRS="" distclean @@ -232,57 +380,117 @@ force: Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status +# Depending on Makefile makes sure that config.status has been re-run +# if needed. This prevents problems with parallel builds. config.h: stamp-h ; @true -stamp-h: config.in config.status +stamp-h: config.in config.status Makefile CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status config.status: $(srcdir)/configure $(srcdir)/config.table $(SHELL) ./config.status --recheck - +# Depending on config.h makes sure that config.status has been re-run +# if needed. This prevents problems with parallel builds, in case +# subdirectories need to run config.status also. 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; \ +maintainer-clean-subdir: config.h + @subdirs='$(SUBDIRS)'; \ + target=`echo $@ | sed -e 's/-subdir//'`; \ + for dir in $$subdirs ; do \ + cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $$target; \ done -$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir +$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir +$(CONFIGURED_OFILES): stamp-picdir + +# The dependencies in the remainder of this file are automatically +# generated by "make maint-deps". Manual edits will be lost. -alloca.o: config.h +_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h +alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.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 +basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h +bsearch.o: config.h $(INCDIR)/ansidecl.h +calloc.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h clock.o: config.h -concat.o: $(INCDIR)/libiberty.h -cplus-dem.o: config.h $(INCDIR)/demangle.h -fdmatch.o: $(INCDIR)/libiberty.h -fnmatch.o: config.h $(INCDIR)/fnmatch.h +concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +copysign.o: $(INCDIR)/ansidecl.h +cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ + $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h +cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ + $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \ + $(INCDIR)/libiberty.h +fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \ + $(INCDIR)/libiberty.h +floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h +fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.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 +getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h +make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h +memchr.o: $(INCDIR)/ansidecl.h +memcmp.o: $(INCDIR)/ansidecl.h +memcpy.o: $(INCDIR)/ansidecl.h +memmove.o: $(INCDIR)/ansidecl.h +memset.o: $(INCDIR)/ansidecl.h +mkstemps.o: config.h $(INCDIR)/ansidecl.h +objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.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 -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 -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 +partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/partition.h +pexecute.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h +physmem.o: config.h $(INCDIR)/libiberty.h +putenv.o: config.h $(INCDIR)/ansidecl.h +random.o: $(INCDIR)/ansidecl.h +regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h +rename.o: config.h +safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h +setenv.o: config.h $(INCDIR)/ansidecl.h +sigsetmask.o: $(INCDIR)/ansidecl.h +sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/sort.h +spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/splay-tree.h +strcasecmp.o: $(INCDIR)/ansidecl.h +strchr.o: $(INCDIR)/ansidecl.h +strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +strncasecmp.o: $(INCDIR)/ansidecl.h +strncmp.o: $(INCDIR)/ansidecl.h +strrchr.o: $(INCDIR)/ansidecl.h +strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h +strtol.o: config.h $(INCDIR)/safe-ctype.h +strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h +ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/ternary.h +vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +vfork.o: $(INCDIR)/ansidecl.h +vprintf.o: $(INCDIR)/ansidecl.h +vsprintf.o: $(INCDIR)/ansidecl.h +waitpid.o: config.h +xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h diff --git a/gnu/lib/libiberty/src/argv.c b/gnu/lib/libiberty/src/argv.c index f596ffd0110..649b51e6731 100644 --- a/gnu/lib/libiberty/src/argv.c +++ b/gnu/lib/libiberty/src/argv.c @@ -1,5 +1,5 @@ /* Create and destroy argument vectors (argv's) - Copyright (C) 1992 Free Software Foundation, Inc. + Copyright (C) 1992, 2001 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support This file is part of the libiberty library. @@ -51,7 +51,6 @@ extern char *strdup (); /* Duplicate a string */ #endif /* __STDC__ */ -#include "alloca-conf.h" #ifndef NULL #define NULL 0 @@ -66,26 +65,15 @@ extern char *strdup (); /* Duplicate a string */ /* -NAME +@deftypefn Extension char** dupargv (char **@var{vector}) - dupargv -- duplicate an argument vector +Duplicate an argument vector. Simply scans through @var{vector}, +duplicating each argument until the terminating @code{NULL} is found. +Returns a pointer to the argument vector if successful. Returns +@code{NULL} if there is insufficient memory to complete building the +argument vector. -SYNOPSIS - - char **dupargv (vector) - char **vector; - -DESCRIPTION - - Duplicate an argument vector. Simply scans through the - vector, duplicating each argument until the - terminating NULL is found. - -RETURNS - - Returns a pointer to the argument vector if - successful. Returns NULL if there is insufficient memory to - complete building the argument vector. +@end deftypefn */ @@ -123,24 +111,14 @@ dupargv (argv) /* -NAME - - freeargv -- free an argument vector - -SYNOPSIS +@deftypefn Extension void freeargv (char **@var{vector}) - void freeargv (vector) - char **vector; +Free an argument vector that was built using @code{buildargv}. Simply +scans through @var{vector}, freeing the memory for each argument until +the terminating @code{NULL} is found, and then frees @var{vector} +itself. -DESCRIPTION - - Free an argument vector that was built using buildargv. Simply scans - through the vector, freeing the memory for each argument until the - terminating NULL is found, and then frees the vector itself. - -RETURNS - - No value. +@end deftypefn */ @@ -161,53 +139,46 @@ char **vector; /* -NAME - - buildargv -- build an argument vector from a string - -SYNOPSIS - - char **buildargv (sp) - char *sp; - -DESCRIPTION +@deftypefn Extension char** buildargv (char *@var{sp}) - Given a pointer to a string, parse the string extracting fields - separated by whitespace and optionally enclosed within either single - or double quotes (which are stripped off), and build a vector of - pointers to copies of the string for each field. The input string - remains unchanged. +Given a pointer to a string, parse the string extracting fields +separated by whitespace and optionally enclosed within either single +or double quotes (which are stripped off), and build a vector of +pointers to copies of the string for each field. The input string +remains unchanged. The last element of the vector is followed by a +@code{NULL} element. - All of the memory for the pointer array and copies of the string - is obtained from malloc. All of the memory can be returned to the - system with the single function call freeargv, which takes the - returned result of buildargv, as it's argument. +All of the memory for the pointer array and copies of the string +is obtained from @code{malloc}. All of the memory can be returned to the +system with the single function call @code{freeargv}, which takes the +returned result of @code{buildargv}, as it's argument. - The memory for the argv array is dynamically expanded as necessary. +Returns a pointer to the argument vector if successful. Returns +@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient +memory to complete building the argument vector. -RETURNS +If the input is a null string (as opposed to a @code{NULL} pointer), +then buildarg returns an argument vector that has one arg, a null +string. - Returns a pointer to the argument vector if successful. Returns NULL - if the input string pointer is NULL or if there is insufficient - memory to complete building the argument vector. +@end deftypefn -NOTES +The memory for the argv array is dynamically expanded as necessary. - In order to provide a working buffer for extracting arguments into, - with appropriate stripping of quotes and translation of backslash - sequences, we allocate a working buffer at least as long as the input - string. This ensures that we always have enough space in which to - work, since the extracted arg is never larger than the input string. +In order to provide a working buffer for extracting arguments into, +with appropriate stripping of quotes and translation of backslash +sequences, we allocate a working buffer at least as long as the input +string. This ensures that we always have enough space in which to +work, since the extracted arg is never larger than the input string. - If the input is a null string (as opposed to a NULL pointer), then - buildarg returns an argv that has one arg, a null string. +The argument vector is always kept terminated with a @code{NULL} arg +pointer, so it can be passed to @code{freeargv} at any time, or +returned, as appropriate. - Argv is always kept terminated with a NULL arg pointer, so it can - be passed to freeargv at any time, or returned, as appropriate. */ char **buildargv (input) -char *input; + const char *input; { char *arg; char *copybuf; @@ -340,7 +311,7 @@ char *input; /* Simple little test driver. */ -static char *tests[] = +static const char *const tests[] = { "a simple command line", "arg 'foo' is single quoted", @@ -357,10 +328,10 @@ static char *tests[] = NULL }; -main () +int main () { char **argv; - char **test; + const char *const *test; char **targs; for (test = tests; *test != NULL; test++) @@ -381,6 +352,7 @@ main () freeargv (argv); } + return 0; } #endif /* MAIN */ diff --git a/gnu/lib/libiberty/src/basename.c b/gnu/lib/libiberty/src/basename.c index 7698f06f8ae..704e9c89b08 100644 --- a/gnu/lib/libiberty/src/basename.c +++ b/gnu/lib/libiberty/src/basename.c @@ -2,20 +2,14 @@ This file is in the public domain. */ /* -NAME - basename -- return pointer to last component of a pathname -SYNOPSIS - char *basename (const char *name) +@deftypefn Supplemental char* basename (const char *@var{name}) -DESCRIPTION - Given a pointer to a string containing a typical pathname - (/usr/src/cmd/ls/ls.c for example), returns a pointer to the - last component of the pathname ("ls.c" in this case). +Returns a pointer to the last component of pathname @var{name}. +Behavior is undefined if the pathname ends in a directory separator. + +@end deftypefn -BUGS - Presumes a UNIX or DOS/Windows style path with UNIX or DOS/Windows - style separators. */ #include "ansidecl.h" diff --git a/gnu/lib/libiberty/src/choose-temp.c b/gnu/lib/libiberty/src/choose-temp.c index 3babdcda511..cb48d35897d 100644 --- a/gnu/lib/libiberty/src/choose-temp.c +++ b/gnu/lib/libiberty/src/choose-temp.c @@ -17,123 +17,53 @@ 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 two functions: choose_temp_base and make_temp_file. */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif #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 - -#ifndef R_OK -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#endif #include "libiberty.h" -extern int mkstemps (); - -#ifndef IN_GCC -#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) -#define DIR_SEPARATOR '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -/* On MSDOS, write temp files in current dir - because there's no place else we can expect to use. */ -/* ??? Although the current directory is tried as a last resort, - this is left in so that on MSDOS it is preferred to /tmp on the - off chance that someone requires this, since that was the previous - behaviour. */ -#ifdef __MSDOS__ -#ifndef P_tmpdir -#define P_tmpdir "." -#endif -#endif +extern char *choose_tmpdir PARAMS ((void)); /* Name of temporary file. mktemp requires 6 trailing X's. */ #define TEMP_FILE "ccXXXXXX" +#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1) -/* Subroutine of choose_temp_base. - If BASE is non-NULL, return it. - Otherwise it checks if DIR is a usable directory. - If success, DIR is returned. - Otherwise NULL is returned. */ +/* -static char * -try (dir, base) - char *dir, *base; -{ - if (base != 0) - return base; - if (dir != 0 - && access (dir, R_OK | W_OK | X_OK) == 0) - return dir; - return 0; -} +@deftypefn Extension char* choose_temp_base (void) -#if defined(__MSDOS__) && !defined(__GO32__) -/* 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. +Return a prefix for temporary file names or @code{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 (@code{mktemp} +fails). The buffer for the result is obtained with @code{xmalloc}. + +This function is provided for backwards compatability only. Its use is +not recommended. - This function is provided for backwards compatability only. It use - is not recommended. */ +@end deftypefn +*/ + +#if defined(__MSDOS__) && !defined(__GO32__) char * choose_temp_base () { - char *base = 0; + const char *base = choose_tmpdir (); char *temp_filename; int len; - 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 = "."; len = strlen (base); - temp_filename = xmalloc (len + 1 /*DIR_SEPARATOR*/ - + strlen (TEMP_FILE) + 1); + temp_filename = xmalloc (len + TEMP_FILE_LEN + 1); strcpy (temp_filename, base); - - if (len != 0 - && temp_filename[len-1] != '/' - && temp_filename[len-1] != DIR_SEPARATOR) - temp_filename[len++] = DIR_SEPARATOR; strcpy (temp_filename + len, TEMP_FILE); mktemp (temp_filename); @@ -142,65 +72,3 @@ choose_temp_base () return temp_filename; } #endif - -/* 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/gnu/lib/libiberty/src/config.in b/gnu/lib/libiberty/src/config.in index 6e64208da92..7b5cae9ebcd 100644 --- a/gnu/lib/libiberty/src/config.in +++ b/gnu/lib/libiberty/src/config.in @@ -1,17 +1,10 @@ /* config.in. Generated automatically from configure.in by autoheader. */ -/* Define if using alloca.c. */ -#undef C_ALLOCA +/* Define to empty if the keyword does not work. */ +#undef const -/* 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 a working `mmap' system call. */ +#undef HAVE_MMAP /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H @@ -19,38 +12,32 @@ /* Define if you have <vfork.h>. */ #undef HAVE_VFORK_H +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + /* 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 if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + /* 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 to `unsigned long' if <sys/types.h> doesn't define. */ +#undef uintptr_t -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR +/* Define if you have the _doprnt function. */ +#undef HAVE__DOPRNT /* Define if you have the asprintf function. */ #undef HAVE_ASPRINTF @@ -67,6 +54,9 @@ /* Define if you have the bcopy function. */ #undef HAVE_BCOPY +/* Define if you have the bsearch function. */ +#undef HAVE_BSEARCH + /* Define if you have the bzero function. */ #undef HAVE_BZERO @@ -76,6 +66,9 @@ /* Define if you have the clock function. */ #undef HAVE_CLOCK +/* Define if you have the ffs function. */ +#undef HAVE_FFS + /* Define if you have the getcwd function. */ #undef HAVE_GETCWD @@ -85,6 +78,9 @@ /* Define if you have the getrusage function. */ #undef HAVE_GETRUSAGE +/* Define if you have the getsysinfo function. */ +#undef HAVE_GETSYSINFO + /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY @@ -118,6 +114,12 @@ /* Define if you have the psignal function. */ #undef HAVE_PSIGNAL +/* Define if you have the pstat_getdynamic function. */ +#undef HAVE_PSTAT_GETDYNAMIC + +/* Define if you have the pstat_getstatic function. */ +#undef HAVE_PSTAT_GETSTATIC + /* Define if you have the putenv function. */ #undef HAVE_PUTENV @@ -175,6 +177,15 @@ /* Define if you have the sysconf function. */ #undef HAVE_SYSCONF +/* Define if you have the sysctl function. */ +#undef HAVE_SYSCTL + +/* Define if you have the sysmp function. */ +#undef HAVE_SYSMP + +/* Define if you have the table function. */ +#undef HAVE_TABLE + /* Define if you have the times function. */ #undef HAVE_TIMES @@ -196,6 +207,18 @@ /* Define if you have the waitpid function. */ #undef HAVE_WAITPID +/* Define if you have the <alloca.h> header file. */ +#undef HAVE_ALLOCA_H + +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the <machine/hal_sysinfo.h> header file. */ +#undef HAVE_MACHINE_HAL_SYSINFO_H + /* Define if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -208,17 +231,75 @@ /* Define if you have the <sys/file.h> header file. */ #undef HAVE_SYS_FILE_H +/* Define if you have the <sys/mman.h> header file. */ +#undef HAVE_SYS_MMAN_H + /* Define if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H +/* Define if you have the <sys/pstat.h> header file. */ +#undef HAVE_SYS_PSTAT_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/sysctl.h> header file. */ +#undef HAVE_SYS_SYSCTL_H + +/* Define if you have the <sys/sysinfo.h> header file. */ +#undef HAVE_SYS_SYSINFO_H + +/* Define if you have the <sys/sysmp.h> header file. */ +#undef HAVE_SYS_SYSMP_H + +/* Define if you have the <sys/systemcfg.h> header file. */ +#undef HAVE_SYS_SYSTEMCFG_H + +/* Define if you have the <sys/table.h> header file. */ +#undef HAVE_SYS_TABLE_H + /* Define if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H +/* Define if you have the <time.h> header file. */ +#undef HAVE_TIME_H + /* Define if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H + +/* Define if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define if errno must be declared even when <errno.h> is included. */ +#undef NEED_DECLARATION_ERRNO + +/* Define if you have the `uintptr_t' type. */ +#undef HAVE_UINTPTR_T + +/* 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 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 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 _system_configuration variable. */ +#undef HAVE__SYSTEM_CONFIGURATION + diff --git a/gnu/lib/libiberty/src/config.table b/gnu/lib/libiberty/src/config.table index 4e33746164c..df48ce99525 100644 --- a/gnu/lib/libiberty/src/config.table +++ b/gnu/lib/libiberty/src/config.table @@ -1,3 +1,9 @@ +# Don't build the shared library for build. +if [ -n "${with_build_subdir}" ]; then + enable_shared=no +fi + +frag= case "${host}" in rs6000-ibm-aix3.1 | rs6000-ibm-aix) frag=mh-aix ;; @@ -6,10 +12,13 @@ case "${host}" in *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;; i370-*-opened*) frag=mh-openedition ;; i[345]86-*-windows*) frag=mh-windows ;; - *-*-beos*) frag=mh-beos ;; esac -frags=$frag +if [ -n "${frag}" ]; then + frags=${libiberty_topdir}/libiberty/config/$frag +else + frags= +fi # If they didn't specify --enable-shared, don't generate shared libs. case "${enable_shared}" in @@ -19,30 +28,28 @@ case "${enable_shared}" in *) shared=yes ;; esac if [ "${shared}" = "yes" ]; then + frag= case "${host}" in *-*-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" ;; + alpha*-*-linux*) frag=mh-elfalphapic ;; + arm*-*-*) frag=mh-armpic ;; + hppa*-*-*) frag=mh-papic ;; + i[3456]86-*-* | x86_64-*-*) + frag=mh-x86pic ;; powerpc*-*-aix*) ;; - powerpc*-*-*) frags="${frags} ../../config/mh-ppcpic" ;; - *-*-*) frags="${frags} ../../config/mh-${host_cpu}pic" ;; + powerpc*-*-*) frag=mh-ppcpic ;; + sparc*-*-*) frag=mh-sparcpic ;; + s390*-*-*) frag=mh-s390pic ;; + *) frag=mh-${host_cpu}pic ;; esac + if [ -n "${frag}" ]; then + frags="${frags} ${libiberty_topdir}/config/${frag}" + fi 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" echo "# Following fragment copied from ${frag}" >> temp-frag diff --git a/gnu/lib/libiberty/src/configure b/gnu/lib/libiberty/src/configure index e387788250f..a3022505b10 100644 --- a/gnu/lib/libiberty/src/configure +++ b/gnu/lib/libiberty/src/configure @@ -12,11 +12,19 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --with-target-subdir=SUBDIR Configuring in a subdirectory" + --with-target-subdir=SUBDIR Configuring in a subdirectory for target" +ac_help="$ac_help + --with-build-subdir=SUBDIR Configuring in a subdirectory for build" ac_help="$ac_help --with-cross-host=HOST Configuring with a cross compiler" ac_help="$ac_help --with-newlib Configuring with newlib" +ac_help="$ac_help + --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-install-libiberty Install headers for end users" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -528,12 +536,24 @@ fi +# This works around the fact that libtool configuration may change LD +# for this particular configuration, but some shells, instead of +# keeping the changes in LD private, export them just because LD is +# exported. We don't use libtool yet, but some day we might, so... +ORIGINAL_LD_FOR_MULTILIBS=$LD + # 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-build-subdir or --without-build-subdir was given. +if test "${with_build_subdir+set}" = set; then + withval="$with_build_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" @@ -548,7 +568,10 @@ fi if test "${srcdir}" = "."; then - if test -z "${with_target_subdir}"; then + if test -n "${with_build_subdir}"; then + libiberty_topdir="${srcdir}/../.." + with_target_subdir= + elif test -z "${with_target_subdir}"; then libiberty_topdir="${srcdir}/.." else if test "${with_target_subdir}" != "."; then @@ -560,6 +583,7 @@ if test "${srcdir}" = "."; then else libiberty_topdir="${srcdir}/.." fi + ac_aux_dir= for ac_dir in ${GNUSYSTEM_AUX_DIR} $libiberty_topdir $srcdir/$libiberty_topdir; do if test -f $ac_dir/install-sh; then @@ -581,13 +605,119 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:610: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + maintainer_mode=$enableval +else + maintainer_mode=no +fi + + +echo "$ac_t""$maintainer_mode" 1>&6 + +if test "$maintainer_mode" = "yes"; then + MAINT='' + NOTMAINT='#' +else + MAINT='#' + NOTMAINT='' +fi + +# Do we have a single-tree copy of texinfo? Even if we do, we can't +# rely on it - libiberty is built before texinfo. +# Extract the first word of "makeinfo", so it can be a program name with args. +set dummy makeinfo; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:635: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$MAKEINFO"; then + ac_cv_prog_MAKEINFO="$MAKEINFO" # 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_MAKEINFO="makeinfo" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +MAKEINFO="$ac_cv_prog_MAKEINFO" +if test -n "$MAKEINFO"; then + echo "$ac_t""$MAKEINFO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "x$MAKEINFO" = "x"; then + MAKEINFO="@echo makeinfo missing; true" + BUILD_INFO= +else + BUILD_INFO=info + case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in + x*\ [1-3].* ) + MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" + BUILD_INFO= + echo "configure: warning: +*** Makeinfo is too old. Info documentation will not be built." 1>&2 + ;; + esac +fi + + + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:681: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # 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_PERL="perl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +PERL="$ac_cv_prog_PERL" +if test -n "$PERL"; then + echo "$ac_t""$PERL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test x"$PERL" = x""; then + HAVE_PERL='#' +else + HAVE_PERL='' +fi + + + # 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 +echo "configure:721: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -610,7 +740,7 @@ 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 +echo "configure:744: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -636,7 +766,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:640: checking for $ac_word" >&5 +echo "configure:770: 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 @@ -668,7 +798,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:672: checking for $ac_word" >&5 +echo "configure:802: 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 @@ -700,7 +830,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:704: checking for $ac_word" >&5 +echo "configure:834: 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 @@ -733,20 +863,11 @@ 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 +echo "configure:871: 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 @@ -776,7 +897,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:780: checking for $ac_word" >&5 +echo "configure:901: 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 @@ -825,7 +946,7 @@ fi 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 +echo "configure:950: 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 @@ -834,7 +955,7 @@ else 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 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:959: \"$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 @@ -845,12 +966,12 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_libiberty_warn_cflags='-W -Wall -Wtraditional' + ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' 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 +echo "configure:975: 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 @@ -879,8 +1000,70 @@ else fi + +if test "x$CC" != xcc; then + echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6 +echo "configure:1007: checking whether $CC and cc understand -c and -o together" >&5 +else + echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6 +echo "configure:1010: checking whether cc understands -c and -o together" >&5 +fi +set dummy $CC; ac_cc="`echo $2 | + sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'foo(){}' > conftest.c +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5' +if { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + ac_try='cc -c conftest.c -o conftest.o 1>&5' + if { (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 + cat >> confdefs.h <<\EOF +#define NO_MINUS_C_MINUS_O 1 +EOF + +fi + +# autoconf is lame and doesn't give us any substitution variable for this. +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then + NO_MINUS_C_MINUS_O=yes +else + OUTPUT_OPTION='-o $@' +fi + + + echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:884: checking for POSIXized ISC" >&5 +echo "configure:1067: 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 @@ -900,6 +1083,121 @@ else ISC= fi +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1088: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1093 "configure" +#include "confdefs.h" + +int main() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1163: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <<EOF +#line 1170 "configure" +#include "confdefs.h" + +int main() { +} $ac_kw foo() { +; return 0; } +EOF +if { (eval echo configure:1177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <<EOF +#define inline $ac_cv_c_inline +EOF + ;; +esac + @@ -918,7 +1216,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:922: checking for a BSD compatible install" >&5 +echo "configure:1220: 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 @@ -979,7 +1277,7 @@ host_makefile_frag=${frag} # able to link anything, it had better be able to at least compile # something. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:983: checking how to run the C preprocessor" >&5 +echo "configure:1281: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -994,13 +1292,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 998 "configure" +#line 1296 "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; } +{ (eval echo configure:1302: \"$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 : @@ -1011,13 +1309,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1015 "configure" +#line 1313 "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; } +{ (eval echo configure:1319: \"$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 : @@ -1028,13 +1326,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1032 "configure" +#line 1330 "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; } +{ (eval echo configure:1336: \"$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 : @@ -1058,21 +1356,21 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h +for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.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 +echo "configure:1364: 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" +#line 1369 "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; } +{ (eval echo configure:1374: \"$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* @@ -1099,12 +1397,12 @@ 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 +echo "configure:1401: 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" +#line 1406 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -1120,7 +1418,7 @@ 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 +if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1140,6 +1438,254 @@ EOF fi +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1443: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1448 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + + +echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6 +echo "configure:1479: checking whether errno must be declared" >&5 +if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1484 "configure" +#include "confdefs.h" +#include <errno.h> +int main() { +int x = errno; +; return 0; } +EOF +if { (eval echo configure:1491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + libiberty_cv_declare_errno=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + libiberty_cv_declare_errno=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$libiberty_cv_declare_errno" 1>&6 +if test $libiberty_cv_declare_errno = yes +then cat >> confdefs.h <<\EOF +#define NEED_DECLARATION_ERRNO 1 +EOF + +fi + + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1513: 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 1518 "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:1526: \"$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 1543 "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 1561 "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 1582 "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:1593: \"$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 uintptr_t""... $ac_c" 1>&6 +echo "configure:1617: checking for uintptr_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1622 "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])uintptr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uintptr_t=yes +else + rm -rf conftest* + ac_cv_type_uintptr_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_uintptr_t" 1>&6 +if test $ac_cv_type_uintptr_t = no; then + cat >> confdefs.h <<\EOF +#define uintptr_t unsigned long +EOF + +fi + +# Given the above check, we always have uintptr_t or a fallback +# definition. So define HAVE_UINTPTR_T in case any imported code +# relies on it. +cat >> confdefs.h <<\EOF +#define HAVE_UINTPTR_T 1 +EOF + + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1658: 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 1663 "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 + # This is the list of functions which libiberty will provide if they # are not available on the host. @@ -1149,9 +1695,11 @@ funcs="$funcs atexit" funcs="$funcs basename" funcs="$funcs bcmp" funcs="$funcs bcopy" +funcs="$funcs bsearch" funcs="$funcs bzero" funcs="$funcs calloc" funcs="$funcs clock" +funcs="$funcs ffs" funcs="$funcs getcwd" funcs="$funcs getpagesize" funcs="$funcs index" @@ -1189,19 +1737,20 @@ funcs="$funcs waitpid" vars="sys_errlist sys_nerr sys_siglist" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" +checkfuncs="$checkfuncs pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl" # 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 + for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1200: checking for $ac_func" >&5 +echo "configure:1749: 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" +#line 1754 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1224,7 +1773,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1777: \"$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 @@ -1248,15 +1797,15 @@ else fi done - for ac_func in getpagesize index insque mkstemps memchr memcmp memcpy memmove + for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1255: checking for $ac_func" >&5 +echo "configure:1804: 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" +#line 1809 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1279,7 +1828,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1832: \"$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 @@ -1303,15 +1852,15 @@ else fi done - for ac_func in memset putenv random rename rindex sigsetmask strcasecmp + for ac_func in memmove memset putenv random rename rindex sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1310: checking for $ac_func" >&5 +echo "configure:1859: 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" +#line 1864 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1334,7 +1883,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1887: \"$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 @@ -1358,15 +1907,15 @@ else fi done - for ac_func in setenv strchr strdup strncasecmp strrchr strstr strtod strtol + for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1365: checking for $ac_func" >&5 +echo "configure:1914: 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" +#line 1919 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1389,7 +1938,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1413,15 +1962,15 @@ else fi done - for ac_func in strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid + for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1420: checking for $ac_func" >&5 +echo "configure:1969: 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" +#line 1974 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1444,7 +1993,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1997: \"$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 @@ -1468,27 +2017,70 @@ else fi done - cat >> confdefs.h <<\EOF -#define HAVE_SYS_ERRLIST 1 -EOF + for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2024: 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 2029 "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(); - cat >> confdefs.h <<\EOF -#define HAVE_SYS_NERR 1 +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:2052: \"$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 - cat >> confdefs.h <<\EOF -#define HAVE_SYS_SIGLIST 1 +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 getrusage on_exit psignal strerror strsignal sysconf times + for ac_func in sysconf times sbrk gettimeofday ffs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1487: checking for $ac_func" >&5 +echo "configure:2079: 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" +#line 2084 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1511,7 +2103,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2107: \"$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 @@ -1535,15 +2127,15 @@ else fi done - for ac_func in sbrk gettimeofday + for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1542: checking for $ac_func" >&5 +echo "configure:2134: 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" +#line 2139 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1566,7 +2158,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2162: \"$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 @@ -1590,15 +2182,27 @@ else 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 + 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 +# provide the function, we want to define HAVE_FN in config.h. setobjs= CHECK= +target_header_dir= if test -n "${with_target_subdir}"; then # We are being configured as a target library. AC_REPLACE_FUNCS @@ -1610,7 +2214,6 @@ if test -n "${with_target_subdir}"; then # 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 @@ -1640,6 +2243,30 @@ EOF fi + # We may wish to install the target headers somewhere. + # Check whether --enable-install-libiberty or --disable-install-libiberty was given. +if test "${enable_install_libiberty+set}" = set; then + enableval="$enable_install_libiberty" + enable_install_libiberty=$enableval +else + enable_install_libiberty=no +fi + + # Option parsed, now set things appropriately. + case x"$enable_install_libiberty" in + xyes|x) + target_header_dir=libiberty + ;; + xno) + target_header_dir= + ;; + *) + # This could be sanity-checked in various ways... + target_header_dir="${enable_install_libiberty}" + ;; + esac + + else # Not a target library, so we set things up to run the test suite. @@ -1649,6 +2276,20 @@ fi + +case "${host}" in + *-*-cygwin* | *-*-mingw*) + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 +EOF + + ;; +esac + if test -z "${setobjs}"; then case "${host}" in @@ -1705,24 +2346,22 @@ if test -z "${setobjs}"; then # 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//'`" + # DJ - only if we're *building* cygwin, not just building *with* cygwin + + if test -n "${with_target_subdir}" + then + 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//'`" + fi ;; *-*-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 - + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes ;; *-*-uwin*) @@ -1733,14 +2372,15 @@ EOF # 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 + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes + ;; + *-*-*vms*) + # Under VMS, vfork works very different than on Unix. The standard test + # won't work, and it isn't easily adaptable. It makes more sense to + # just force it. + ac_cv_func_vfork_works=yes ;; esac @@ -1748,7 +2388,7 @@ EOF # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2392: 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. @@ -1759,12 +2399,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1763 "configure" +#line 2403 "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 +if { (eval echo configure:2408: \"$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 @@ -1790,19 +2430,19 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2434: 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 +echo "configure:2441: 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" +#line 2446 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1825,7 +2465,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2469: \"$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 @@ -1851,131 +2491,13 @@ 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 + echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:2496: 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" +#line 2501 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1998,14 +2520,14 @@ 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 + for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2526: 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" +#line 2531 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2028,7 +2550,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2554: \"$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 @@ -2045,17 +2567,16 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then cat >> confdefs.h <<EOF #define CRAY_STACKSEG_END $ac_func EOF - break else echo "$ac_t""no" 1>&6 fi -done + 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 +echo "configure:2580: 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 @@ -2063,7 +2584,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2067 "configure" +#line 2588 "configure" #include "confdefs.h" find_stack_direction () { @@ -2082,7 +2603,7 @@ 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 +if { (eval echo configure:2607: \"$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 @@ -2101,161 +2622,20 @@ 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_%'` + 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 +echo "configure:2629: 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" +#line 2634 "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; } +{ (eval echo configure:2639: \"$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* @@ -2280,18 +2660,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2284: checking for working vfork" >&5 +echo "configure:2664: 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 +echo "configure:2670: 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" +#line 2675 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2314,7 +2694,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2698: \"$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 @@ -2336,7 +2716,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 2340 "configure" +#line 2720 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2431,7 +2811,7 @@ main() { } } 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 +if { (eval echo configure:2815: \"$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 @@ -2456,21 +2836,140 @@ fi if test $ac_cv_func_vfork_works = no; then LIBOBJS="$LIBOBJS vfork.o" fi + # We only need _doprnt if we might use it to implement v*printf. + if test $ac_cv_func_vprintf != yes \ + || test $ac_cv_func_vfprintf != yes \ + || test $ac_cv_func_vsprintf != yes; then + for ac_func in _doprnt +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2847: 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 2852 "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:2875: \"$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 + + + else + for ac_func in _doprnt +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2905: 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 2910 "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:2933: \"$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 v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:2462: checking for $v" >&5 +echo "configure:2961: 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" +#line 2966 "configure" #include "confdefs.h" int *p; int main() { -extern int $v; p = &$v; +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 +if { (eval echo configure:2973: \"$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 @@ -2493,15 +2992,140 @@ EOF echo "$ac_t""no" 1>&6 fi done + + # special check for _system_configuration because AIX <4.3.2 do not + # contain the `physmem' member. + echo $ac_n "checking for external symbol _system_configuration""... $ac_c" 1>&6 +echo "configure:3000: checking for external symbol _system_configuration" >&5 + cat > conftest.$ac_ext <<EOF +#line 3002 "configure" +#include "confdefs.h" +#include <sys/systemcfg.h> +int main() { +double x = _system_configuration.physmem; +; return 0; } +EOF +if { (eval echo configure:3009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE__SYSTEM_CONFIGURATION 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + 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 +echo "configure:3027: 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 3032 "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:3055: \"$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 ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3085: 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 3090 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3095: \"$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 + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3124: 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" +#line 3129 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2524,7 +3148,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3152: \"$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 @@ -2548,8 +3172,272 @@ else fi done +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:3177: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext <<EOF +#line 3185 "configure" +#include "confdefs.h" + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include <sys/types.h> +#include <fcntl.h> +#include <sys/mman.h> + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:3325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + + +echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 +echo "configure:3349: checking for working strncmp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_strncmp_works=no +else + cat > conftest.$ac_ext <<EOF +#line 3357 "configure" +#include "confdefs.h" + +/* Test by Jim Wilson and Kaveh Ghazi. + Check whether strncmp reads past the end of its string parameters. */ +#include <sys/types.h> + +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#ifndef MAP_ANON +#ifdef MAP_ANONYMOUS +#define MAP_ANON MAP_ANONYMOUS +#else +#define MAP_ANON MAP_FILE +#endif +#endif + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif +#ifndef O_RDONLY +#define O_RDONLY 0 +#endif + +#define MAP_LEN 0x10000 + +main () +{ +#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) + char *p; + int dev_zero; + + dev_zero = open ("/dev/zero", O_RDONLY); + if (dev_zero < 0) + exit (1); + + p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, dev_zero, 0); + if (p == (char *)-1) + p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0); + if (p == (char *)-1) + exit (2); + else + { + char *string = "__si_type_info"; + char *q = (char *) p + MAP_LEN - strlen (string) - 2; + char *r = (char *) p + 0xe; + + strcpy (q, string); + strcpy (r, string); + strncmp (r, q, 14); + } +#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */ + exit (0); +} + +EOF +if { (eval echo configure:3421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_strncmp_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_strncmp_works=no +fi +rm -fr conftest* fi +rm -f core core.* *.core +fi + +echo "$ac_t""$ac_cv_func_strncmp_works" 1>&6 +if test $ac_cv_func_strncmp_works = no ; then + LIBOBJS="$LIBOBJS strncmp.o" +fi + + # Install a library built with a cross compiler in $(tooldir) rather # than $(libdir). if test -z "${with_cross_host}"; then @@ -2693,6 +3581,13 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g +s%@libiberty_topdir@%$libiberty_topdir%g +s%@MAINT@%$MAINT%g +s%@NOTMAINT@%$NOTMAINT%g +s%@MAKEINFO@%$MAKEINFO%g +s%@BUILD_INFO@%$BUILD_INFO%g +s%@PERL@%$PERL%g +s%@HAVE_PERL@%$HAVE_PERL%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g @@ -2705,8 +3600,10 @@ 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%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g +s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g +s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g @@ -2714,8 +3611,8 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g s%@host_makefile_frag@%%g s%@CPP@%$CPP%g s%@CHECK@%$CHECK%g +s%@target_header_dir@%$target_header_dir%g s%@LIBOBJS@%$LIBOBJS%g -s%@ALLOCA@%$ALLOCA%g s%@INSTALL_DEST@%$INSTALL_DEST%g CEOF @@ -2930,18 +3827,21 @@ srcdir=${srcdir} host=${host} target=${target} with_target_subdir=${with_target_subdir} +with_build_subdir=${with_build_subdir} with_multisubdir=${with_multisubdir} ac_configure_args="--enable-multilib ${ac_configure_args}" CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" 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 + if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then # FIXME: We shouldn't need to set ac_file ac_file=Makefile + LD="${ORIGINAL_LD_FOR_MULTILIBS}" . ${libiberty_topdir}/config-ml.in fi fi diff --git a/gnu/lib/libiberty/src/configure.in b/gnu/lib/libiberty/src/configure.in index cc1b2c2082b..8039b9310bb 100644 --- a/gnu/lib/libiberty/src/configure.in +++ b/gnu/lib/libiberty/src/configure.in @@ -3,16 +3,27 @@ dnl Process this file with autoconf to produce a configure script AC_PREREQ(2.13) AC_INIT(pexecute.c) +# This works around the fact that libtool configuration may change LD +# for this particular configuration, but some shells, instead of +# keeping the changes in LD private, export them just because LD is +# exported. We don't use libtool yet, but some day we might, so... +ORIGINAL_LD_FOR_MULTILIBS=$LD + dnl We use these options to decide which functions to include. AC_ARG_WITH(target-subdir, -[ --with-target-subdir=SUBDIR Configuring in a subdirectory]) +[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) +AC_ARG_WITH(build-subdir, +[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build]) AC_ARG_WITH(cross-host, [ --with-cross-host=HOST Configuring with a cross compiler]) AC_ARG_WITH(newlib, [ --with-newlib Configuring with newlib]) if test "${srcdir}" = "."; then - if test -z "${with_target_subdir}"; then + if test -n "${with_build_subdir}"; then + libiberty_topdir="${srcdir}/../.." + with_target_subdir= + elif test -z "${with_target_subdir}"; then libiberty_topdir="${srcdir}/.." else if test "${with_target_subdir}" != "."; then @@ -24,8 +35,60 @@ if test "${srcdir}" = "."; then else libiberty_topdir="${srcdir}/.." fi +AC_SUBST(libiberty_topdir) AC_CONFIG_AUX_DIR($libiberty_topdir) +dnl Very limited version of automake's enable-maintainer-mode + +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + maintainer_mode=$enableval, + maintainer_mode=no) + +AC_MSG_RESULT($maintainer_mode) + +if test "$maintainer_mode" = "yes"; then + MAINT='' + NOTMAINT='#' +else + MAINT='#' + NOTMAINT='' +fi +AC_SUBST(MAINT)dnl +AC_SUBST(NOTMAINT)dnl + +# Do we have a single-tree copy of texinfo? Even if we do, we can't +# rely on it - libiberty is built before texinfo. +AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ) +if test "x$MAKEINFO" = "x"; then + MAKEINFO="@echo makeinfo missing; true" + BUILD_INFO= +else + BUILD_INFO=info + case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in + x*\ [[1-3]].* ) + MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" + BUILD_INFO= + AC_MSG_WARN([ +*** Makeinfo is too old. Info documentation will not be built.]) + ;; + esac +fi +AC_SUBST(MAKEINFO) +AC_SUBST(BUILD_INFO) + +AC_CHECK_PROG(PERL, perl, perl, ) +if test x"$PERL" = x""; then + HAVE_PERL='#' +else + HAVE_PERL='' +fi +AC_SUBST(HAVE_PERL) + AC_CANONICAL_HOST dnl When we start using automake: @@ -36,51 +99,21 @@ 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 +LIB_AC_PROG_CC -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 +AC_PROG_CC_C_O +# autoconf is lame and doesn't give us any substitution variable for this. +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then + NO_MINUS_C_MINUS_O=yes else - GCC= - ac_libiberty_warn_cflags= - test "${CFLAGS+set}" = set || CFLAGS="-g" + OUTPUT_OPTION='-o $@' fi -]) -AC_SUBST(ac_libiberty_warn_cflags) - -LIB_AC_PROG_CC +AC_SUBST(NO_MINUS_C_MINUS_O) +AC_SUBST(OUTPUT_OPTION) AC_ISC_POSIX +AC_C_CONST +AC_C_INLINE dnl When we start using libtool: dnl Default to a non shared library. This may be overridden by the @@ -109,8 +142,19 @@ 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_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h) AC_HEADER_SYS_WAIT +AC_HEADER_TIME + +libiberty_AC_DECLARE_ERRNO + +AC_CHECK_TYPE(uintptr_t, unsigned long) +# Given the above check, we always have uintptr_t or a fallback +# definition. So define HAVE_UINTPTR_T in case any imported code +# relies on it. +AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) + +AC_TYPE_PID_T # This is the list of functions which libiberty will provide if they # are not available on the host. @@ -120,9 +164,11 @@ funcs="$funcs atexit" funcs="$funcs basename" funcs="$funcs bcmp" funcs="$funcs bcopy" +funcs="$funcs bsearch" funcs="$funcs bzero" funcs="$funcs calloc" funcs="$funcs clock" +funcs="$funcs ffs" funcs="$funcs getcwd" funcs="$funcs getpagesize" funcs="$funcs index" @@ -160,29 +206,31 @@ funcs="$funcs waitpid" vars="sys_errlist sys_nerr sys_siglist" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" +checkfuncs="$checkfuncs pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl" # 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) + AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock) + AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy) + AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask) + AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr) + AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf) + AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal) + AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs) + AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl) + AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) + AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) + AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) 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 +# provide the function, we want to define HAVE_FN in config.h. setobjs= CHECK= +target_header_dir= if test -n "${with_target_subdir}"; then # We are being configured as a target library. AC_REPLACE_FUNCS @@ -194,7 +242,6 @@ if test -n "${with_target_subdir}"; then # 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 @@ -212,12 +259,33 @@ if test -n "${with_target_subdir}"; then # dont have to check them here. # Of the functions in $checkfuncs, newlib only has strerror. - AC_DEFINE(HAVE_STRERROR) + AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) setobjs=yes fi + # We may wish to install the target headers somewhere. + AC_ARG_ENABLE(install-libiberty, + [ --enable-install-libiberty Install headers for end users], + enable_install_libiberty=$enableval, + enable_install_libiberty=no)dnl + + # Option parsed, now set things appropriately. + case x"$enable_install_libiberty" in + xyes|x) + target_header_dir=libiberty + ;; + xno) + target_header_dir= + ;; + *) + # This could be sanity-checked in various ways... + target_header_dir="${enable_install_libiberty}" + ;; + esac + + else # Not a target library, so we set things up to run the test suite. @@ -226,6 +294,14 @@ else fi AC_SUBST(CHECK) +AC_SUBST(target_header_dir) + +case "${host}" in + *-*-cygwin* | *-*-mingw*) + AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST) + AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR) + ;; +esac if test -z "${setobjs}"; then case "${host}" in @@ -253,7 +329,7 @@ if test -z "${setobjs}"; then # don't have to check them here. # Of the functions in $checkfuncs, VxWorks only has strerror. - AC_DEFINE(HAVE_STRERROR) + AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) setobjs=yes ;; @@ -277,18 +353,22 @@ if test -z "${setobjs}"; then # 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//'`" + # DJ - only if we're *building* cygwin, not just building *with* cygwin + + if test -n "${with_target_subdir}" + then + 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//'`" + fi ;; *-*-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) + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes ;; *-*-uwin*) @@ -299,8 +379,15 @@ if test -z "${setobjs}"; then # 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) + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes + ;; + + *-*-*vms*) + # Under VMS, vfork works very different than on Unix. The standard test + # won't work, and it isn't easily adaptable. It makes more sense to + # just force it. + ac_cv_func_vfork_works=yes ;; esac @@ -309,36 +396,24 @@ if test -z "${setobjs}"; then # 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 - + libiberty_AC_FUNC_C_ALLOCA AC_FUNC_VFORK if test $ac_cv_func_vfork_works = no; then LIBOBJS="$LIBOBJS vfork.o" fi + # We only need _doprnt if we might use it to implement v*printf. + if test $ac_cv_func_vprintf != yes \ + || test $ac_cv_func_vfprintf != yes \ + || test $ac_cv_func_vsprintf != yes; then + AC_REPLACE_FUNCS(_doprnt) + else + AC_CHECK_FUNCS(_doprnt) + 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;], + [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 @@ -349,9 +424,22 @@ EOF AC_MSG_RESULT(no) fi done + + # special check for _system_configuration because AIX <4.3.2 do not + # contain the `physmem' member. + AC_MSG_CHECKING([for external symbol _system_configuration]) + AC_TRY_COMPILE([#include <sys/systemcfg.h>], + [double x = _system_configuration.physmem;], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, + [Define if you have the _system_configuration variable.])], + [AC_MSG_RESULT([no])]) + AC_CHECK_FUNCS($checkfuncs) fi +libiberty_AC_FUNC_STRNCMP + # Install a library built with a cross compiler in $(tooldir) rather # than $(libdir). if test -z "${with_cross_host}"; then @@ -365,9 +453,10 @@ AC_SUBST(INSTALL_DEST) 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 + if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then # FIXME: We shouldn't need to set ac_file ac_file=Makefile + LD="${ORIGINAL_LD_FOR_MULTILIBS}" . ${libiberty_topdir}/config-ml.in fi fi], @@ -375,8 +464,10 @@ srcdir=${srcdir} host=${host} target=${target} with_target_subdir=${with_target_subdir} +with_build_subdir=${with_build_subdir} with_multisubdir=${with_multisubdir} ac_configure_args="--enable-multilib ${ac_configure_args}" CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" libiberty_topdir=${libiberty_topdir} ) diff --git a/gnu/lib/libiberty/src/cplus-dem.c b/gnu/lib/libiberty/src/cplus-dem.c index ff6625244df..199f767736d 100644 --- a/gnu/lib/libiberty/src/cplus-dem.c +++ b/gnu/lib/libiberty/src/cplus-dem.c @@ -1,5 +1,6 @@ /* Demangler for GNU C++ - Copyright 1989, 91, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. + Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001 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 @@ -10,6 +11,15 @@ 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. +In addition to the permissions in the GNU Library General Public +License, the Free Software Foundation gives you unlimited permission +to link the compiled version of this file into combinations with other +programs, and to distribute those combinations without any restriction +coming from the use of this file. (The Library Public License +restrictions do apply in other respects; for example, they cover +modification of the file, and distribution when not linked into a +combined executable.) + 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 @@ -33,7 +43,8 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #endif -#include <ctype.h> +#include "safe-ctype.h" + #include <sys/types.h> #include <string.h> #include <stdio.h> @@ -51,26 +62,15 @@ char * realloc (); #include "libiberty.h" +static char *ada_demangle PARAMS ((const char *, int)); + #define min(X,Y) (((X) < (Y)) ? (X) : (Y)) -static const char *mystrstr PARAMS ((const char *, const char *)); +/* 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 -static const char * -mystrstr (s1, s2) - const char *s1, *s2; -{ - register const char *p = s1; - register int len = strlen (s2); - - for (; (p = strchr (p, *s2)) != 0; p++) - { - if (strncmp (p, s2, len) == 0) - { - return (p); - } - } - return (0); -} +extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN; /* In order to allow a single demangler executable to demangle strings using various common values of CPLUS_MARKER, as well as any specific @@ -92,7 +92,7 @@ mystrstr (s1, s2) #define CPLUS_MARKER '$' #endif -enum demangling_styles current_demangling_style = gnu_demangling; +enum demangling_styles current_demangling_style = auto_demangling; static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' }; @@ -147,9 +147,9 @@ struct work_stuff static const struct optable { - const char *in; - const char *out; - int flags; + const char *const in; + const char *const out; + const int flags; } optable[] = { {"nw", " new", DMGL_ANSI}, /* new (1.92, ansi) */ {"dl", " delete", DMGL_ANSI}, /* new (1.92, ansi) */ @@ -246,9 +246,15 @@ typedef enum type_kind_t tk_real } type_kind_t; -struct demangler_engine libiberty_demanglers[] = +const struct demangler_engine libiberty_demanglers[] = { { + NO_DEMANGLING_STYLE_STRING, + no_demangling, + "Demangling disabled" + } + , + { AUTO_DEMANGLING_STYLE_STRING, auto_demangling, "Automatic selection based on executable" @@ -285,13 +291,29 @@ struct demangler_engine libiberty_demanglers[] = } , { + GNU_V3_DEMANGLING_STYLE_STRING, + gnu_v3_demangling, + "GNU (g++) V3 ABI-style demangling" + } + , + { + JAVA_DEMANGLING_STYLE_STRING, + java_demangling, + "Java style demangling" + } + , + { + GNAT_DEMANGLING_STYLE_STRING, + gnat_demangling, + "GNAT style demangling" + } + , + { NULL, unknown_demangling, NULL } }; #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)) @@ -305,12 +327,21 @@ struct demangler_engine libiberty_demanglers[] = /* Prototypes for local functions */ +static void +delete_work_stuff PARAMS ((struct work_stuff *)); + +static void +delete_non_B_K_work_stuff PARAMS ((struct work_stuff *)); + static char * mop_up PARAMS ((struct work_stuff *, string *, int)); static void squangle_mop_up PARAMS ((struct work_stuff *)); +static void +work_stuff_copy_to_from PARAMS ((struct work_stuff *, struct work_stuff *)); + #if 0 static int demangle_method_args PARAMS ((struct work_stuff *, const char **, string *)); @@ -388,6 +419,9 @@ string_prepend PARAMS ((string *, const char *)); static void string_prependn PARAMS ((string *, const char *, int)); +static void +string_append_template_idx PARAMS ((string *, int)); + static int get_count PARAMS ((const char **, int *)); @@ -413,6 +447,10 @@ static void demangle_function_name PARAMS ((struct work_stuff *, const char **, string *, const char *)); +static int +iterate_demangle_function PARAMS ((struct work_stuff *, + const char **, string *, const char *)); + static void remember_type PARAMS ((struct work_stuff *, const char *, int)); @@ -465,6 +503,28 @@ 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)); + +static void +grow_vect PARAMS ((char **, size_t *, size_t, int)); + /* Translate count to integer, consuming tokens in the process. Conversion terminates on the first non-digit character. @@ -479,10 +539,10 @@ consume_count (type) { int count = 0; - if (! isdigit ((unsigned char)**type)) + if (! ISDIGIT ((unsigned char)**type)) return -1; - while (isdigit ((unsigned char)**type)) + while (ISDIGIT ((unsigned char)**type)) { count *= 10; @@ -493,7 +553,7 @@ consume_count (type) ten. */ if ((count % 10) != 0) { - while (isdigit ((unsigned char) **type)) + while (ISDIGIT ((unsigned char) **type)) (*type)++; return -1; } @@ -502,6 +562,9 @@ consume_count (type) (*type)++; } + if (count < 0) + count = -1; + return (count); } @@ -519,7 +582,7 @@ consume_count_with_underscores (mangled) if (**mangled == '_') { (*mangled)++; - if (!isdigit ((unsigned char)**mangled)) + if (!ISDIGIT ((unsigned char)**mangled)) return -1; idx = consume_count (mangled); @@ -651,14 +714,14 @@ cplus_demangle_opname (opname, result, options) } } else if (opname[0] == '_' && opname[1] == '_' - && opname[2] >= 'a' && opname[2] <= 'z' - && opname[3] >= 'a' && opname[3] <= 'z') + && ISLOWER((unsigned char)opname[2]) + && ISLOWER((unsigned char)opname[3])) { if (opname[4] == '\0') { /* Operator. */ size_t i; - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { if (strlen (optable[i].in) == 2 && memcmp (optable[i].in, opname + 2, 2) == 0) @@ -676,7 +739,7 @@ cplus_demangle_opname (opname, result, options) { /* Assignment. */ size_t i; - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { if (strlen (optable[i].in) == 3 && memcmp (optable[i].in, opname + 2, 3) == 0) @@ -700,7 +763,7 @@ cplus_demangle_opname (opname, result, options) && memcmp (opname + 3, "assign_", 7) == 0) { size_t i; - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { len1 = len - 10; if ((int) strlen (optable[i].in) == len1 @@ -717,7 +780,7 @@ cplus_demangle_opname (opname, result, options) else { size_t i; - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { len1 = len - 3; if ((int) strlen (optable[i].in) == len1 @@ -748,6 +811,7 @@ cplus_demangle_opname (opname, result, options) return ret; } + /* Takes operator name as e.g. "++" and returns mangled operator name (e.g. "postincrement_expr"), or NULL if not found. @@ -763,7 +827,7 @@ cplus_mangle_opname (opname, options) int len; len = strlen (opname); - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { if ((int) strlen (optable[i].out) == len && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI) @@ -780,7 +844,7 @@ enum demangling_styles cplus_demangle_set_style (style) enum demangling_styles style; { - struct demangler_engine *demangler = libiberty_demanglers; + const struct demangler_engine *demangler = libiberty_demanglers; for (; demangler->demangling_style != unknown_demangling; ++demangler) if (style == demangler->demangling_style) @@ -798,7 +862,7 @@ enum demangling_styles cplus_demangle_name_to_style (name) const char *name; { - struct demangler_engine *demangler = libiberty_demanglers; + const struct demangler_engine *demangler = libiberty_demanglers; for (; demangler->demangling_style != unknown_demangling; ++demangler) if (strcmp (name, demangler->demangling_style_name) == 0) @@ -810,7 +874,7 @@ cplus_demangle_name_to_style (name) /* char *cplus_demangle (const char *mangled, int options) If MANGLED is a mangled function name produced by GNU C++, then - a pointer to a malloced string giving a C++ representation + a pointer to a @code{malloc}ed string giving a C++ representation of the name will be returned; otherwise NULL will be returned. It is the caller's responsibility to free the string which is returned. @@ -842,10 +906,32 @@ cplus_demangle (mangled, options) { char *ret; struct work_stuff work[1]; + + if (current_demangling_style == no_demangling) + return xstrdup (mangled); + 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; + work->options = options; + if ((work->options & DMGL_STYLE_MASK) == 0) + work->options |= (int) current_demangling_style & DMGL_STYLE_MASK; + + /* The V3 ABI demangling is implemented elsewhere. */ + if (GNU_V3_DEMANGLING || AUTO_DEMANGLING) + { + ret = cplus_demangle_v3 (mangled, work->options); + if (ret || GNU_V3_DEMANGLING) + return ret; + } + + if (JAVA_DEMANGLING) + { + ret = java_demangle_v3 (mangled); + if (ret) + return ret; + } + + if (GNAT_DEMANGLING) + return ada_demangle(mangled,options); ret = internal_cplus_demangle (work, mangled); squangle_mop_up (work); @@ -853,6 +939,137 @@ cplus_demangle (mangled, options) } +/* Assuming *OLD_VECT points to an array of *SIZE objects of size + ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects, + updating *OLD_VECT and *SIZE as necessary. */ + +static void +grow_vect (old_vect, size, min_size, element_size) + char **old_vect; + size_t *size; + size_t min_size; + int element_size; +{ + if (*size < min_size) + { + *size *= 2; + if (*size < min_size) + *size = min_size; + *old_vect = (void *) xrealloc (*old_vect, *size * element_size); + } +} + +/* Demangle ada names: + 1. Discard final __{DIGIT}+ or ${DIGIT}+ + 2. Convert other instances of embedded "__" to `.'. + 3. Discard leading _ada_. + 4. Remove everything after first ___ if it is followed by 'X'. + 5. Put symbols that should be suppressed in <...> brackets. + The resulting string is valid until the next call of ada_demangle. */ + +static char * +ada_demangle (mangled, option) + const char *mangled; + int option ATTRIBUTE_UNUSED; +{ + int i, j; + int len0; + const char* p; + char *demangled = NULL; + int at_start_name; + int changed; + size_t demangled_size = 0; + + changed = 0; + + if (strncmp (mangled, "_ada_", 5) == 0) + { + mangled += 5; + changed = 1; + } + + if (mangled[0] == '_' || mangled[0] == '<') + goto Suppress; + + p = strstr (mangled, "___"); + if (p == NULL) + len0 = strlen (mangled); + else + { + if (p[3] == 'X') + { + len0 = p - mangled; + changed = 1; + } + else + goto Suppress; + } + + /* Make demangled big enough for possible expansion by operator name. */ + grow_vect (&demangled, + &demangled_size, 2 * len0 + 1, + sizeof (char)); + + if (ISDIGIT ((unsigned char) mangled[len0 - 1])) { + for (i = len0 - 2; i >= 0 && ISDIGIT ((unsigned char) mangled[i]); i -= 1) + ; + if (i > 1 && mangled[i] == '_' && mangled[i - 1] == '_') + { + len0 = i - 1; + changed = 1; + } + else if (mangled[i] == '$') + { + len0 = i; + changed = 1; + } + } + + for (i = 0, j = 0; i < len0 && ! ISALPHA ((unsigned char)mangled[i]); + i += 1, j += 1) + demangled[j] = mangled[i]; + + at_start_name = 1; + while (i < len0) + { + at_start_name = 0; + + if (i < len0 - 2 && mangled[i] == '_' && mangled[i + 1] == '_') + { + demangled[j] = '.'; + changed = at_start_name = 1; + i += 2; j += 1; + } + else + { + demangled[j] = mangled[i]; + i += 1; j += 1; + } + } + demangled[j] = '\000'; + + for (i = 0; demangled[i] != '\0'; i += 1) + if (ISUPPER ((unsigned char)demangled[i]) || demangled[i] == ' ') + goto Suppress; + + if (! changed) + return NULL; + else + return demangled; + + Suppress: + grow_vect (&demangled, + &demangled_size, strlen (mangled) + 3, + sizeof (char)); + + if (mangled[0] == '<') + strcpy (demangled, mangled); + else + sprintf (demangled, "<%s>", mangled); + + return demangled; +} + /* 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 @@ -868,7 +1085,7 @@ internal_cplus_demangle (work, mangled) string decl; int success = 0; char *demangled = NULL; - int s1,s2,s3,s4; + int s1, s2, s3, s4; s1 = work->constructor; s2 = work->destructor; s3 = work->static_type; @@ -921,7 +1138,7 @@ internal_cplus_demangle (work, mangled) work->destructor = s2; work->static_type = s3; work->type_quals = s4; - return (demangled); + return demangled; } @@ -942,16 +1159,85 @@ squangle_mop_up (work) } } -/* Clear out any mangled storage */ -static char * -mop_up (work, declp, success) - struct work_stuff *work; - string *declp; - int success; +/* Copy the work state and storage. */ + +static void +work_stuff_copy_to_from (to, from) + struct work_stuff *to; + struct work_stuff *from; { - char *demangled = NULL; + int i; + + delete_work_stuff (to); + + /* Shallow-copy scalars. */ + memcpy (to, from, sizeof (*to)); + + /* Deep-copy dynamic storage. */ + if (from->typevec_size) + to->typevec + = (char **) xmalloc (from->typevec_size * sizeof (to->typevec[0])); + + for (i = 0; i < from->ntypes; i++) + { + int len = strlen (from->typevec[i]) + 1; + + to->typevec[i] = xmalloc (len); + memcpy (to->typevec[i], from->typevec[i], len); + } + + if (from->ksize) + to->ktypevec + = (char **) xmalloc (from->ksize * sizeof (to->ktypevec[0])); + + for (i = 0; i < from->numk; i++) + { + int len = strlen (from->ktypevec[i]) + 1; + + to->ktypevec[i] = xmalloc (len); + memcpy (to->ktypevec[i], from->ktypevec[i], len); + } + if (from->bsize) + to->btypevec + = (char **) xmalloc (from->bsize * sizeof (to->btypevec[0])); + + for (i = 0; i < from->numb; i++) + { + int len = strlen (from->btypevec[i]) + 1; + + to->btypevec[i] = xmalloc (len); + memcpy (to->btypevec[i], from->btypevec[i], len); + } + + if (from->ntmpl_args) + to->tmpl_argvec + = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); + + for (i = 0; i < from->ntmpl_args; i++) + { + int len = strlen (from->tmpl_argvec[i]) + 1; + + to->tmpl_argvec[i] = xmalloc (len); + memcpy (to->tmpl_argvec[i], from->tmpl_argvec[i], len); + } + + if (from->previous_argument) + { + to->previous_argument = (string*) xmalloc (sizeof (string)); + string_init (to->previous_argument); + string_appends (to->previous_argument, from->previous_argument); + } +} + + +/* Delete dynamic stuff in work_stuff that is not to be re-used. */ + +static void +delete_non_B_K_work_stuff (work) + struct work_stuff *work; +{ /* Discard the remembered types, if any. */ forget_types (work); @@ -978,6 +1264,30 @@ mop_up (work, declp, success) free ((char*) work->previous_argument); work->previous_argument = NULL; } +} + + +/* Delete all dynamic storage in work_stuff. */ +static void +delete_work_stuff (work) + struct work_stuff *work; +{ + delete_non_B_K_work_stuff (work); + squangle_mop_up (work); +} + + +/* Clear out any mangled storage */ + +static char * +mop_up (work, declp, success) + struct work_stuff *work; + string *declp; + int success; +{ + char *demangled = NULL; + + delete_non_B_K_work_stuff (work); /* If demangling was successful, ensure that the demangled string is null terminated and return it. Otherwise, free the demangling decl. */ @@ -989,7 +1299,7 @@ mop_up (work, declp, success) else { string_appendn (declp, "", 1); - demangled = declp -> b; + demangled = declp->b; } return (demangled); } @@ -1203,7 +1513,7 @@ demangle_signature (work, mangled, declp) break; case '_': - if (GNU_DEMANGLING && expect_return_type) + if ((AUTO_DEMANGLING || GNU_DEMANGLING) && expect_return_type) { /* Read the return type. */ string return_type; @@ -1229,7 +1539,7 @@ demangle_signature (work, mangled, declp) if (HP_DEMANGLING) { (*mangled)++; - while (**mangled && isdigit ((unsigned char)**mangled)) + while (**mangled && ISDIGIT ((unsigned char)**mangled)) (*mangled)++; } else @@ -1237,7 +1547,7 @@ demangle_signature (work, mangled, declp) break; case 'H': - if (GNU_DEMANGLING) + if (AUTO_DEMANGLING || GNU_DEMANGLING) { /* A G++ template function. Read the template arguments. */ success = demangle_template (work, mangled, declp, 0, 0, @@ -1405,82 +1715,151 @@ demangle_template_template_parm (work, mangled, tname) } static int -demangle_integral_value (work, mangled, s) +demangle_expression (work, mangled, s, tk) struct work_stuff *work; const char** mangled; string* s; + type_kind_t tk; { + int need_operator = 0; int success; - if (**mangled == 'E') + success = 1; + string_appendn (s, "(", 1); + (*mangled)++; + while (success && **mangled != 'W' && **mangled != '\0') { - int need_operator = 0; - - success = 1; - string_appendn (s, "(", 1); - (*mangled)++; - while (success && **mangled != 'W' && **mangled != '\0') + if (need_operator) { - if (need_operator) - { - size_t i; - size_t len; + size_t i; + size_t len; - success = 0; + success = 0; - len = strlen (*mangled); + len = strlen (*mangled); - for (i = 0; - i < sizeof (optable) / sizeof (optable [0]); - ++i) - { - size_t l = strlen (optable[i].in); + for (i = 0; i < ARRAY_SIZE (optable); ++i) + { + size_t l = strlen (optable[i].in); - if (l <= len - && memcmp (optable[i].in, *mangled, l) == 0) - { - string_appendn (s, " ", 1); - string_append (s, optable[i].out); - string_appendn (s, " ", 1); - success = 1; - (*mangled) += l; - break; - } + if (l <= len + && memcmp (optable[i].in, *mangled, l) == 0) + { + string_appendn (s, " ", 1); + string_append (s, optable[i].out); + string_appendn (s, " ", 1); + success = 1; + (*mangled) += l; + break; } - - if (!success) - break; } - else - need_operator = 1; - success = demangle_template_value_parm (work, mangled, s, - tk_integral); + if (!success) + break; } - - if (**mangled != 'W') - success = 0; else - { - string_appendn (s, ")", 1); - (*mangled)++; - } + need_operator = 1; + + success = demangle_template_value_parm (work, mangled, s, tk); + } + + if (**mangled != 'W') + success = 0; + else + { + string_appendn (s, ")", 1); + (*mangled)++; } + + return success; +} + +static int +demangle_integral_value (work, mangled, s) + struct work_stuff *work; + const char** mangled; + string* s; +{ + int success; + + if (**mangled == 'E') + success = demangle_expression (work, mangled, s, tk_integral); else if (**mangled == 'Q' || **mangled == 'K') success = demangle_qualified (work, mangled, s, 0, 1); else { + int value; + + /* By default, we let the number decide whether we shall consume an + underscore. */ + int multidigit_without_leading_underscore = 0; + int leave_following_underscore = 0; + success = 0; + /* Negative numbers are indicated with a leading `m'. */ if (**mangled == 'm') { string_appendn (s, "-", 1); (*mangled)++; } - while (isdigit ((unsigned char)**mangled)) + else if (mangled[0][0] == '_' && mangled[0][1] == 'm') { - string_appendn (s, *mangled, 1); - (*mangled)++; + /* Since consume_count_with_underscores does not handle the + `m'-prefix we must do it here, using consume_count and + adjusting underscores: we have to consume the underscore + matching the prepended one. */ + multidigit_without_leading_underscore = 1; + string_appendn (s, "-", 1); + (*mangled) += 2; + } + else if (**mangled == '_') + { + /* Do not consume a following underscore; + multidigit_without_leading_underscore will consume what should be + consumed. */ + leave_following_underscore = 1; + } + else + { + /* Since consume_count_with_underscores does not handle + multi-digit numbers that do not start with an underscore, + and this number can be an integer template parameter, + we have to call consume_count. */ + multidigit_without_leading_underscore = 1; + /* These multi-digit numbers never end on an underscore, + so if there is one then don't eat it. */ + leave_following_underscore = 1; + } + + /* We must call consume_count if we expect to remove a trailing + underscore, since consume_count_with_underscores expects + the leading underscore (that we consumed) if it is to handle + multi-digit numbers. */ + if (multidigit_without_leading_underscore) + value = consume_count (mangled); + else + value = consume_count_with_underscores (mangled); + + if (value != -1) + { + char buf[INTBUF_SIZE]; + sprintf (buf, "%d", value); + string_append (s, buf); + + /* Numbers not otherwise delimited, might have an underscore + appended as a delimeter, which we should skip. + + ??? This used to always remove a following underscore, which + is wrong. If other (arbitrary) cases are followed by an + underscore, we need to do something more radical. */ + + if ((value > 9 || multidigit_without_leading_underscore) + && ! leave_following_underscore + && **mangled == '_') + (*mangled)++; + + /* All is well. */ success = 1; } } @@ -1488,6 +1867,51 @@ demangle_integral_value (work, mangled, s) 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; @@ -1511,11 +1935,7 @@ demangle_template_value_parm (work, mangled, s, tk) if (work->tmpl_argvec) string_append (s, work->tmpl_argvec[idx]); else - { - char buf[10]; - sprintf(buf, "T%d", idx); - string_append (s, buf); - } + string_append_template_idx (s, idx); } else if (tk == tk_integral) success = demangle_integral_value (work, mangled, s); @@ -1551,38 +1971,7 @@ demangle_template_value_parm (work, mangled, s, tk) success = 0; } else if (tk == tk_real) - { - if (**mangled == 'm') - { - string_appendn (s, "-", 1); - (*mangled)++; - } - while (isdigit ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - if (**mangled == '.') /* fraction */ - { - string_appendn (s, ".", 1); - (*mangled)++; - while (isdigit ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - } - if (**mangled == 'e') /* exponent */ - { - string_appendn (s, "e", 1); - (*mangled)++; - while (isdigit ((unsigned char)**mangled)) - { - string_appendn (s, *mangled, 1); - (*mangled)++; - } - } - } + success = demangle_real_value (work, mangled, s); else if (tk == tk_pointer || tk == tk_reference) { if (**mangled == 'Q') @@ -1632,7 +2021,7 @@ demangle_template_value_parm (work, mangled, s, tk) 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 + the template is remembered in the list of back-referenceable types. */ static int @@ -1680,11 +2069,9 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) } else { - char buf[10]; - sprintf(buf, "T%d", idx); - string_append (tname, buf); + string_append_template_idx (tname, idx); if (trawname) - string_append (trawname, buf); + string_append_template_idx (trawname, idx); } } else @@ -1863,7 +2250,7 @@ arm_pt (work, mangled, n, anchor, args) { /* 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__"))) + if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = strstr (mangled, "__pt__"))) { int len; *args = *anchor + 6; @@ -1878,9 +2265,9 @@ arm_pt (work, mangled, n, anchor, args) } if (AUTO_DEMANGLING || EDG_DEMANGLING) { - if ((*anchor = mystrstr (mangled, "__tm__")) - || (*anchor = mystrstr (mangled, "__ps__")) - || (*anchor = mystrstr (mangled, "__pt__"))) + if ((*anchor = strstr (mangled, "__tm__")) + || (*anchor = strstr (mangled, "__ps__")) + || (*anchor = strstr (mangled, "__pt__"))) { int len; *args = *anchor + 6; @@ -1893,7 +2280,7 @@ arm_pt (work, mangled, n, anchor, args) return 1; } } - else if ((*anchor = mystrstr (mangled, "__S"))) + else if ((*anchor = strstr (mangled, "__S"))) { int len; *args = *anchor + 3; @@ -2032,8 +2419,15 @@ demangle_arm_hp_template (work, mangled, n, declp) break; default: /* Not handling other HP cfront stuff */ - if (!do_type (work, &args, &arg)) - goto cfront_template_args_done; + { + const char* old_args = args; + if (!do_type (work, &args, &arg)) + goto cfront_template_args_done; + + /* Fail if we didn't make any progress: prevent infinite loop. */ + if (args == old_args) + return; + } } string_appends (declp, &arg); string_append (declp, ","); @@ -2166,6 +2560,86 @@ demangle_class (work, mangled, declp) return (success); } + +/* Called when there's a "__" in the mangled name, with `scan' pointing to + the rightmost guess. + + Find the correct "__"-sequence where the function name ends and the + signature starts, which is ambiguous with GNU mangling. + Call demangle_signature here, so we can make sure we found the right + one; *mangled will be consumed so caller will not make further calls to + demangle_signature. */ + +static int +iterate_demangle_function (work, mangled, declp, scan) + struct work_stuff *work; + const char **mangled; + string *declp; + const char *scan; +{ + const char *mangle_init = *mangled; + int success = 0; + string decl_init; + struct work_stuff work_init; + + if (*(scan + 2) == '\0') + return 0; + + /* Do not iterate for some demangling modes, or if there's only one + "__"-sequence. This is the normal case. */ + if (ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING + || strstr (scan + 2, "__") == NULL) + { + demangle_function_name (work, mangled, declp, scan); + return 1; + } + + /* Save state so we can restart if the guess at the correct "__" was + wrong. */ + string_init (&decl_init); + string_appends (&decl_init, declp); + memset (&work_init, 0, sizeof work_init); + work_stuff_copy_to_from (&work_init, work); + + /* Iterate over occurrences of __, allowing names and types to have a + "__" sequence in them. We must start with the first (not the last) + occurrence, since "__" most often occur between independent mangled + parts, hence starting at the last occurence inside a signature + might get us a "successful" demangling of the signature. */ + + while (scan[2]) + { + demangle_function_name (work, mangled, declp, scan); + success = demangle_signature (work, mangled, declp); + if (success) + break; + + /* Reset demangle state for the next round. */ + *mangled = mangle_init; + string_clear (declp); + string_appends (declp, &decl_init); + work_stuff_copy_to_from (work, &work_init); + + /* Leave this underscore-sequence. */ + scan += 2; + + /* Scan for the next "__" sequence. */ + while (*scan && (scan[0] != '_' || scan[1] != '_')) + scan++; + + /* Move to last "__" in this sequence. */ + while (*scan && *scan == '_') + scan++; + scan -= 2; + } + + /* Delete saved state. */ + delete_work_stuff (&work_init); + string_delete (&decl_init); + + return success; +} + /* LOCAL FUNCTION @@ -2181,6 +2655,8 @@ SYNOPSIS DESCRIPTION Consume and demangle the prefix of the mangled name. + While processing the function name root, arrange to call + demangle_signature if the root is ambiguous. DECLP points to the string buffer into which demangled output is placed. On entry, the buffer is empty. On exit it contains @@ -2255,7 +2731,7 @@ demangle_prefix (work, mangled, declp) /* This block of code is a reduction in strength time optimization of: - scan = mystrstr (*mangled, "__"); */ + scan = strstr (*mangled, "__"); */ { scan = *mangled; @@ -2284,20 +2760,20 @@ demangle_prefix (work, mangled, declp) } else if (work -> static_type) { - if (!isdigit ((unsigned char)scan[0]) && (scan[0] != 't')) + if (!ISDIGIT ((unsigned char)scan[0]) && (scan[0] != 't')) { success = 0; } } else if ((scan == *mangled) - && (isdigit ((unsigned char)scan[2]) || (scan[2] == 'Q') + && (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 || HP_DEMANGLING) - && isdigit ((unsigned char)scan[2])) + && ISDIGIT ((unsigned char)scan[2])) { *mangled = scan + 2; consume_count (mangled); @@ -2334,7 +2810,7 @@ demangle_prefix (work, mangled, declp) /* EDG template? */ demangle_arm_hp_template (work, mangled, strlen (*mangled), declp); } - else if ((scan == *mangled) && !isdigit ((unsigned char)scan[2]) + else if ((scan == *mangled) && !ISDIGIT ((unsigned char)scan[2]) && (scan[2] != 't')) { /* Mangled name starts with "__". Skip over any leading '_' characters, @@ -2347,36 +2823,23 @@ demangle_prefix (work, mangled, declp) { scan++; } - if ((scan = mystrstr (scan, "__")) == NULL || (*(scan + 2) == '\0')) + if ((scan = strstr (scan, "__")) == NULL || (*(scan + 2) == '\0')) { /* No separator (I.E. "__not_mangled"), or empty signature (I.E. "__not_mangled_either__") */ success = 0; } else - { - 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); - } + return iterate_demangle_function (work, mangled, declp, scan); } } else if (*(scan + 2) != '\0') { /* Mangled name does not start with "__" but does have one somewhere in there with non empty stuff after it. Looks like a global - function name. */ - demangle_function_name (work, mangled, declp, scan); + function name. Iterate over all "__":s until the right + one is found. */ + return iterate_demangle_function (work, mangled, declp, scan); } else { @@ -2469,7 +2932,7 @@ gnu_special (work, mangled, declp) 1); break; default: - if (isdigit((unsigned char)*mangled[0])) + if (ISDIGIT((unsigned char)*mangled[0])) { n = consume_count(mangled); /* We may be seeing a too-large size, or else a @@ -2525,11 +2988,30 @@ gnu_special (work, mangled, declp) break; default: n = consume_count (mangled); - if (n < 0 || n > strlen (*mangled)) + if (n < 0 || n > (long) strlen (*mangled)) { success = 0; break; } + + 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. There's information + about what identifier or filename it was keyed to, but + it's just there to make the mangled name unique; we just + step over it. */ + string_append (declp, "{anonymous}"); + (*mangled) += n; + + /* Now p points to the marker before the N, so we need to + update it to the first marker after what we consumed. */ + p = strpbrk (*mangled, cplus_markers); + break; + } + string_appendn (declp, *mangled, n); (*mangled) += n; } @@ -2591,7 +3073,7 @@ gnu_special (work, mangled, declp) success = demangle_template (work, mangled, declp, 0, 1, 1); break; default: - success = demangle_fund_type (work, mangled, declp); + success = do_type (work, mangled, declp); break; } if (success && **mangled != '\0') @@ -2692,7 +3174,7 @@ arm_special (mangled, declp) { n = consume_count (mangled); if (n == -1 - || n > strlen (*mangled)) + || n > (long) strlen (*mangled)) return 0; string_prependn (declp, *mangled, n); (*mangled) += n; @@ -2753,7 +3235,6 @@ demangle_qualified (work, mangled, result, isfuncname, append) { int qualifiers = 0; int success = 1; - const char *p; char num[2]; string temp; string last_name; @@ -2785,19 +3266,10 @@ demangle_qualified (work, mangled, result, isfuncname, append) /* GNU mangled name with more than 9 classes. The count is preceded by an underscore (to distinguish it from the <= 9 case) and followed by an underscore. */ - p = *mangled + 2; - qualifiers = atoi (p); - if (!isdigit ((unsigned char)*p) || *p == '0') - success = 0; - - /* Skip the digits. */ - while (isdigit ((unsigned char)*p)) - ++p; - - if (*p != '_') + (*mangled)++; + qualifiers = consume_count_with_underscores (mangled); + if (qualifiers == -1) success = 0; - - *mangled = p + 1; break; case '1': @@ -2987,15 +3459,13 @@ get_count (type, count) const char *p; int n; - if (!isdigit ((unsigned char)**type)) - { - return (0); - } + if (!ISDIGIT ((unsigned char)**type)) + return (0); else { *count = **type - '0'; (*type)++; - if (isdigit ((unsigned char)**type)) + if (ISDIGIT ((unsigned char)**type)) { p = *type; n = *count; @@ -3005,7 +3475,7 @@ get_count (type, count) n += *p - '0'; p++; } - while (isdigit ((unsigned char)*p)); + while (ISDIGIT ((unsigned char)*p)); if (*p == '_') { *type = p + 1; @@ -3129,8 +3599,13 @@ do_type (work, mangled, result) (*mangled)++; string_append (&decl, ")"); - string_prepend (&decl, SCOPE_STRING (work)); - if (isdigit ((unsigned char)**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 (n == -1 @@ -3162,6 +3637,14 @@ 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; @@ -3274,11 +3757,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; } @@ -3332,7 +3811,7 @@ demangle_fund_type (work, mangled, result) int done = 0; int success = 1; char buf[10]; - int dec = 0; + unsigned int dec = 0; string btype; type_kind_t tk = tk_integral; @@ -3446,7 +3925,7 @@ demangle_fund_type (work, mangled, result) break; case 'G': (*mangled)++; - if (!isdigit ((unsigned char)**mangled)) + if (!ISDIGIT ((unsigned char)**mangled)) { success = 0; break; @@ -3458,7 +3937,7 @@ demangle_fund_type (work, mangled, result) int i; (*mangled)++; for (i = 0; - i < sizeof (buf) - 1 && **mangled && **mangled != '_'; + i < (long) sizeof (buf) - 1 && **mangled && **mangled != '_'; (*mangled)++, i++) buf[i] = **mangled; if (**mangled != '_') @@ -3476,7 +3955,7 @@ demangle_fund_type (work, mangled, result) *mangled += min (strlen (*mangled), 2); } sscanf (buf, "%x", &dec); - sprintf (buf, "int%i_t", dec); + sprintf (buf, "int%u_t", dec); APPEND_BLANK (result); string_append (result, buf); break; @@ -3527,7 +4006,7 @@ demangle_fund_type (work, mangled, result) static int do_hpacc_template_const_value (work, mangled, result) - struct work_stuff *work; + struct work_stuff *work ATTRIBUTE_UNUSED; const char **mangled; string *result; { @@ -3558,12 +4037,12 @@ do_hpacc_template_const_value (work, mangled, result) } /* We have to be looking at an integer now */ - if (!(isdigit ((unsigned char)**mangled))) + 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)) + while (ISDIGIT ((unsigned char)**mangled)) { char_str[0] = **mangled; string_append (result, char_str); @@ -3642,10 +4121,10 @@ snarf_numeric_literal (args, arg) else if (**args == '+') (*args)++; - if (!isdigit ((unsigned char)**args)) + if (!ISDIGIT ((unsigned char)**args)) return 0; - while (isdigit ((unsigned char)**args)) + while (ISDIGIT ((unsigned char)**args)) { char_str[0] = **args; string_append (arg, char_str); @@ -4151,7 +4630,7 @@ demangle_function_name (work, mangled, declp, scan) if (declp->p - declp->b >= 10 /* op$assign_ */ && memcmp (declp->b + 3, "assign_", 7) == 0) { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { int len = declp->p - declp->b - 10; if ((int) strlen (optable[i].in) == len @@ -4167,7 +4646,7 @@ demangle_function_name (work, mangled, declp, scan) } else { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { int len = declp->p - declp->b - 3; if ((int) strlen (optable[i].in) == len @@ -4209,13 +4688,13 @@ demangle_function_name (work, mangled, declp, scan) } } else if (declp->b[0] == '_' && declp->b[1] == '_' - && declp->b[2] >= 'a' && declp->b[2] <= 'z' - && declp->b[3] >= 'a' && declp->b[3] <= 'z') + && ISLOWER((unsigned char)declp->b[2]) + && ISLOWER((unsigned char)declp->b[3])) { if (declp->b[4] == '\0') { /* Operator. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { if (strlen (optable[i].in) == 2 && memcmp (optable[i].in, declp->b + 2, 2) == 0) @@ -4232,7 +4711,7 @@ demangle_function_name (work, mangled, declp, scan) if (declp->b[2] == 'a' && declp->b[5] == '\0') { /* Assignment. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) + for (i = 0; i < ARRAY_SIZE (optable); i++) { if (strlen (optable[i].in) == 3 && memcmp (optable[i].in, declp->b + 2, 3) == 0) @@ -4397,296 +4876,12 @@ string_prependn (p, s, n) } } -/* 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 - prints the result on stdout. */ - -#ifdef MAIN - -#include "getopt.h" - -static char *program_name; -static 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 -demangle_it (mangled_name) - char *mangled_name; -{ - char *result; - - result = cplus_demangle (mangled_name, flags); - if (result == NULL) - { - printf ("%s\n", mangled_name); - } - else - { - printf ("%s\n", result); - free (result); - } -} - static void -usage (stream, status) - FILE *stream; - int status; -{ - fprintf (stream, "\ -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 32767 -char mbuffer[MBUF_SIZE]; - -/* Defined in the automatically-generated underscore.c. */ -extern int prepends_underscore; - -int strip_underscore = 0; - -static struct option long_options[] = { - {"strip-underscores", no_argument, 0, '_'}, - {"format", required_argument, 0, 's'}, - {"help", no_argument, 0, 'h'}, - {"java", no_argument, 0, 'j'}, - {"no-strip-underscores", no_argument, 0, 'n'}, - {"version", no_argument, 0, 'v'}, - {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."); -} - - -/* 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 "_$.<>#,*&[]:(){}"; -} - - -int -main (argc, argv) - int argc; - char **argv; -{ - char *result; - int c; - char *valid_symbols; - - program_name = argv[0]; - - strip_underscore = prepends_underscore; - - while ((c = getopt_long (argc, argv, "_ns:j", long_options, (int *) 0)) != EOF) - { - switch (c) - { - case '?': - usage (stderr, 1); - break; - case 'h': - usage (stdout, 0); - case 'n': - strip_underscore = 0; - break; - case 'v': - printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version); - exit (0); - case '_': - strip_underscore = 1; - break; - case 'j': - flags |= DMGL_JAVA; - break; - case 's': - if (strcmp (optarg, "gnu") == 0) - { - current_demangling_style = gnu_demangling; - } - else if (strcmp (optarg, "lucid") == 0) - { - current_demangling_style = lucid_demangling; - } - else if (strcmp (optarg, "arm") == 0) - { - 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); - } - break; - } - } - - if (optind < argc) - { - for ( ; optind < argc; optind++) - { - demangle_it (argv[optind]); - } - } - 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) || strchr (valid_symbols, c))) - { - if (i >= MBUF_SIZE-1) - break; - mbuffer[i++] = c; - c = getchar (); - } - if (i > 0) - { - int skip_first = 0; - - if (mbuffer[0] == '.') - ++skip_first; - if (strip_underscore && mbuffer[skip_first] == '_') - ++skip_first; - - if (skip_first > i) - skip_first = i; - - mbuffer[i] = 0; - - result = cplus_demangle (mbuffer + skip_first, flags); - if (result) - { - if (mbuffer[0] == '.') - putc ('.', stdout); - fputs (result, stdout); - free (result); - } - else - fputs (mbuffer, stdout); - - fflush (stdout); - } - if (c == EOF) - break; - putchar (c); - } - } - - exit (0); -} - -static void -fatal (str) - char *str; -{ - fprintf (stderr, "%s: %s\n", program_name, str); - exit (1); -} - -PTR -xmalloc (size) - size_t size; -{ - register PTR value = (PTR) malloc (size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; -} - -PTR -xrealloc (ptr, size) - PTR ptr; - size_t size; +string_append_template_idx (s, idx) + string *s; + int idx; { - register PTR value = (PTR) realloc (ptr, size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; + char buf[INTBUF_SIZE + 1 /* 'T' */]; + sprintf(buf, "T%d", idx); + string_append (s, buf); } -#endif /* main */ diff --git a/gnu/lib/libiberty/src/dyn-string.c b/gnu/lib/libiberty/src/dyn-string.c index 69897f84c5e..fd6e6b55b52 100644 --- a/gnu/lib/libiberty/src/dyn-string.c +++ b/gnu/lib/libiberty/src/dyn-string.c @@ -1,5 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. @@ -9,6 +9,15 @@ 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. +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combined +executable.) + 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 @@ -41,7 +50,7 @@ Boston, MA 02111-1307, USA. */ abort if an allocation fails. Instead, percolate an error code up through the call chain. */ -#ifdef IN_LIBGCC2 +#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3) #define RETURN_ON_ALLOCATION_FAILURE #endif diff --git a/gnu/lib/libiberty/src/floatformat.c b/gnu/lib/libiberty/src/floatformat.c index 1d8f16df353..d9e9fad816d 100644 --- a/gnu/lib/libiberty/src/floatformat.c +++ b/gnu/lib/libiberty/src/floatformat.c @@ -1,5 +1,5 @@ /* IEEE floating point support routines, for GDB, the GNU Debugger. - Copyright (C) 1991, 1994, 1999 Free Software Foundation, Inc. + Copyright (C) 1991, 1994, 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -36,19 +36,27 @@ extern char *memset (); /* floatformats for IEEE single and double, big and little endian. */ const struct floatformat floatformat_ieee_single_big = { - floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no + floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23, + floatformat_intbit_no, + "floatformat_ieee_single_big" }; const struct floatformat floatformat_ieee_single_little = { - floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no + floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23, + floatformat_intbit_no, + "floatformat_ieee_single_little" }; const struct floatformat floatformat_ieee_double_big = { - floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no + floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52, + floatformat_intbit_no, + "floatformat_ieee_double_big" }; const struct floatformat floatformat_ieee_double_little = { - floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no + floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, + floatformat_intbit_no, + "floatformat_ieee_double_little" }; /* floatformat for IEEE double, little endian byte order, with big endian word @@ -56,42 +64,82 @@ const struct floatformat floatformat_ieee_double_little = const struct floatformat floatformat_ieee_double_littlebyte_bigword = { - floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no + floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52, + floatformat_intbit_no, + "floatformat_ieee_double_littlebyte_bigword" }; const struct floatformat floatformat_i387_ext = { floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, - floatformat_intbit_yes + floatformat_intbit_yes, + "floatformat_i387_ext" }; const struct floatformat floatformat_m68881_ext = { /* Note that the bits from 16 to 31 are unused. */ - floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64, floatformat_intbit_yes + floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64, + floatformat_intbit_yes, + "floatformat_m68881_ext" }; const struct floatformat floatformat_i960_ext = { /* Note that the bits from 0 to 15 are unused. */ floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64, - floatformat_intbit_yes + floatformat_intbit_yes, + "floatformat_i960_ext" }; const struct floatformat floatformat_m88110_ext = { -#ifdef HARRIS_FLOAT_FORMAT + floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, + floatformat_intbit_yes, + "floatformat_m88110_ext" +}; +const struct floatformat floatformat_m88110_harris_ext = +{ /* Harris uses raw format 128 bytes long, but the number is just an ieee double, and the last 64 bits are wasted. */ floatformat_big,128, 0, 1, 11, 0x3ff, 0x7ff, 12, 52, - floatformat_intbit_no -#else - floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, - floatformat_intbit_yes -#endif /* HARRIS_FLOAT_FORMAT */ + floatformat_intbit_no, + "floatformat_m88110_ext_harris" }; -const struct floatformat floatformat_arm_ext = +const struct floatformat floatformat_arm_ext_big = { /* Bits 1 to 16 are unused. */ floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, - floatformat_intbit_yes + floatformat_intbit_yes, + "floatformat_arm_ext_big" +}; +const struct floatformat floatformat_arm_ext_littlebyte_bigword = +{ + /* Bits 1 to 16 are unused. */ + floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, + floatformat_intbit_yes, + "floatformat_arm_ext_littlebyte_bigword" +}; +const struct floatformat floatformat_ia64_spill_big = +{ + floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64, + floatformat_intbit_yes, + "floatformat_ia64_spill_big" +}; +const struct floatformat floatformat_ia64_spill_little = +{ + floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64, + floatformat_intbit_yes, + "floatformat_ia64_spill_little" +}; +const struct floatformat floatformat_ia64_quad_big = +{ + floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112, + floatformat_intbit_no, + "floatformat_ia64_quad_big" +}; +const struct floatformat floatformat_ia64_quad_little = +{ + floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112, + floatformat_intbit_no, + "floatformat_ia64_quad_little" }; static unsigned long get_field PARAMS ((unsigned char *, diff --git a/gnu/lib/libiberty/src/getcwd.c b/gnu/lib/libiberty/src/getcwd.c index 47b1c1eec31..9ffa8009e4e 100644 --- a/gnu/lib/libiberty/src/getcwd.c +++ b/gnu/lib/libiberty/src/getcwd.c @@ -2,24 +2,18 @@ This function is in the public domain. */ /* -NAME - getcwd -- get absolute pathname for current working directory -SYNOPSIS - char *getcwd (char pathname[len], len) +@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len}) -DESCRIPTION - Copy the absolute pathname for the current working directory into - the supplied buffer and return a pointer to the buffer. If the - current directory's path doesn't fit in LEN characters, the result - is NULL and errno is set. +Copy the absolute pathname for the current working directory into +@var{pathname}, which is assumed to point to a buffer of at least +@var{len} bytes, and return a pointer to the buffer. If the current +directory's path doesn't fit in @var{len} characters, the result is +@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer, +@code{getcwd} will obtain @var{len} bytes of space using +@code{malloc}. - 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(). +@end deftypefn */ diff --git a/gnu/lib/libiberty/src/getruntime.c b/gnu/lib/libiberty/src/getruntime.c index b855ea6e82f..ff836e9fce4 100644 --- a/gnu/lib/libiberty/src/getruntime.c +++ b/gnu/lib/libiberty/src/getruntime.c @@ -1,5 +1,5 @@ /* Return time used so far, in microseconds. - Copyright (C) 1994, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -22,6 +22,10 @@ Boston, MA 02111-1307, USA. */ #include "ansidecl.h" #include "libiberty.h" +/* On some systems (such as WindISS), you must include <sys/types.h> + to get the definition of "time_t" before you include <time.h>. */ +#include <sys/types.h> + /* There are several ways to get elapsed execution time; unfortunately no single way is available for all host systems, nor are there reliable ways to find out which way is correct for a given host. */ @@ -63,6 +67,18 @@ Boston, MA 02111-1307, USA. */ #endif #endif +/* + +@deftypefn Replacement long get_run_time (void) + +Returns the time used so far, in microseconds. If possible, this is +the time used by this process, else it is the elapsed time since the +process started. + +@end deftypefn + +*/ + long get_run_time () { diff --git a/gnu/lib/libiberty/src/hashtab.c b/gnu/lib/libiberty/src/hashtab.c index c59e3159520..9426a185178 100644 --- a/gnu/lib/libiberty/src/hashtab.c +++ b/gnu/lib/libiberty/src/hashtab.c @@ -1,5 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). This file is part of the libiberty library. @@ -35,271 +35,588 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #endif +#include <sys/types.h> + #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif -#include "libiberty.h" -#include "hashtab.h" - -#ifdef HASHTAB_STATS -/* The following variable is used for debugging. Its value is number - of all calls of `find_hash_table_entry' for all hash tables. */ - -static int all_searches = 0; - -/* The following variable is used for debugging. Its value is number - of collisions fixed for time of work with all hash tables. */ +#ifdef HAVE_STRING_H +#include <string.h> +#endif -static int all_collisions = 0; +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif -/* The following variable is used for debugging. Its value is number - of all table expansions fixed for time of work with all hash - tables. */ +#include <stdio.h> -static int all_expansions = 0; -#endif +#include "libiberty.h" +#include "hashtab.h" /* This macro defines reserved value for empty table entry. */ -#define EMPTY_ENTRY NULL +#define EMPTY_ENTRY ((PTR) 0) /* This macro defines reserved value for table entry which contained a deleted element. */ -#define DELETED_ENTRY ((void *) 1) +#define DELETED_ENTRY ((PTR) 1) + +static unsigned long higher_prime_number PARAMS ((unsigned long)); +static hashval_t hash_pointer PARAMS ((const void *)); +static int eq_pointer PARAMS ((const void *, const void *)); +static int htab_expand PARAMS ((htab_t)); +static PTR *find_empty_slot_for_expand PARAMS ((htab_t, hashval_t)); -/* The following function returns the nearest prime number which is - greater than given source number. */ +/* At some point, we could make these be NULL, and modify the + hash-table routines to handle NULL specially; that would avoid + function-call overhead for the common case of hashing pointers. */ +htab_hash htab_hash_pointer = hash_pointer; +htab_eq htab_eq_pointer = eq_pointer; + +/* The following function returns a nearest prime number which is + greater than N, and near a power of two. */ static unsigned long -higher_prime_number (number) - unsigned long number; +higher_prime_number (n) + unsigned long n; { - unsigned long i; + /* These are primes that are near, but slightly smaller than, a + power of two. */ + static const unsigned long primes[] = { + (unsigned long) 7, + (unsigned long) 13, + (unsigned long) 31, + (unsigned long) 61, + (unsigned long) 127, + (unsigned long) 251, + (unsigned long) 509, + (unsigned long) 1021, + (unsigned long) 2039, + (unsigned long) 4093, + (unsigned long) 8191, + (unsigned long) 16381, + (unsigned long) 32749, + (unsigned long) 65521, + (unsigned long) 131071, + (unsigned long) 262139, + (unsigned long) 524287, + (unsigned long) 1048573, + (unsigned long) 2097143, + (unsigned long) 4194301, + (unsigned long) 8388593, + (unsigned long) 16777213, + (unsigned long) 33554393, + (unsigned long) 67108859, + (unsigned long) 134217689, + (unsigned long) 268435399, + (unsigned long) 536870909, + (unsigned long) 1073741789, + (unsigned long) 2147483647, + /* 4294967291L */ + ((unsigned long) 2147483647) + ((unsigned long) 2147483644), + }; + + const unsigned long *low = &primes[0]; + const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])]; + + while (low != high) + { + const unsigned long *mid = low + (high - low) / 2; + if (n > *mid) + low = mid + 1; + else + high = mid; + } - for (number = (number / 2) * 2 + 3;; number += 2) + /* If we've run out of primes, abort. */ + if (n > *low) { - for (i = 3; i * i <= number; i += 2) - if (number % i == 0) - break; - if (i * i > number) - return number; + fprintf (stderr, "Cannot find prime bigger than %lu\n", n); + abort (); } + + return *low; +} + +/* Returns a hash code for P. */ + +static hashval_t +hash_pointer (p) + const PTR p; +{ + return (hashval_t) ((long)p >> 3); +} + +/* Returns non-zero if P1 and P2 are equal. */ + +static int +eq_pointer (p1, p2) + const PTR p1; + const PTR p2; +{ + return p1 == p2; } /* 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. */ + created hash table, or NULL if memory allocation fails. */ -hash_table_t -create_hash_table (size, hash_function, eq_function) +htab_t +htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f) size_t size; - unsigned (*hash_function) PARAMS ((hash_table_entry_t)); - int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t)); + htab_hash hash_f; + htab_eq eq_f; + htab_del del_f; + htab_alloc alloc_f; + htab_free free_f; { - hash_table_t result; + htab_t result; size = higher_prime_number (size); - result = (hash_table_t) xmalloc (sizeof (*result)); - result->entries - = (hash_table_entry_t *) xmalloc (size * sizeof (hash_table_entry_t)); + result = (htab_t) (*alloc_f) (1, sizeof (struct htab)); + if (result == NULL) + return NULL; + result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR)); + if (result->entries == NULL) + { + if (free_f != NULL) + (*free_f) (result); + return NULL; + } result->size = size; - result->hash_function = hash_function; - result->eq_function = eq_function; -#ifdef HASHTAB_STATS - result->searches = 0; - result->collisions = 0; -#endif - empty_hash_table (result); + result->hash_f = hash_f; + result->eq_f = eq_f; + result->del_f = del_f; + result->alloc_f = alloc_f; + result->free_f = free_f; return result; } +/* These functions exist solely for backward compatibility. */ + +#undef htab_create +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; +{ + return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free); +} + +htab_t +htab_try_create (size, hash_f, eq_f, del_f) + size_t size; + htab_hash hash_f; + htab_eq eq_f; + htab_del del_f; +{ + return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free); +} + /* This function frees all memory allocated for given hash table. Naturally the hash table must already exist. */ void -delete_hash_table (htab) - hash_table_t htab; +htab_delete (htab) + htab_t htab; { - free (htab->entries); - free (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]); + + if (htab->free_f != NULL) + { + (*htab->free_f) (htab->entries); + (*htab->free_f) (htab); + } } /* This function clears all entries in the given hash table. */ void -empty_hash_table (htab) - hash_table_t htab; +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 (PTR)); +} + +/* 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 PTR * +find_empty_slot_for_expand (htab, hash) + htab_t htab; + hashval_t hash; { - memset (htab->entries, 0, htab->size * sizeof (hash_table_entry_t)); - htab->number_of_elements = 0; - htab->number_of_deleted_elements = 0; + size_t size = htab->size; + unsigned int index = hash % size; + PTR *slot = htab->entries + index; + hashval_t hash2; + + if (*slot == EMPTY_ENTRY) + return slot; + else if (*slot == DELETED_ENTRY) + abort (); + + hash2 = 1 + hash % (size - 2); + for (;;) + { + index += hash2; + if (index >= size) + index -= size; + + slot = htab->entries + index; + if (*slot == EMPTY_ENTRY) + return slot; + else if (*slot == DELETED_ENTRY) + abort (); + } } /* 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. */ + table entries is changed. If memory allocation failures are allowed, + this function will return zero, indicating that the table could not be + expanded. If all goes well, it will return a non-zero value. */ -static void -expand_hash_table (htab) - hash_table_t htab; +static int +htab_expand (htab) + htab_t htab; { - hash_table_t new_htab; - hash_table_entry_t *entry_ptr; - hash_table_entry_t *new_entry_ptr; - - new_htab = create_hash_table (htab->number_of_elements * 2, - htab->hash_function, htab->eq_function); - for (entry_ptr = htab->entries; entry_ptr < htab->entries + htab->size; - entry_ptr++) - if (*entry_ptr != EMPTY_ENTRY && *entry_ptr != DELETED_ENTRY) - { - new_entry_ptr = find_hash_table_entry (new_htab, *entry_ptr, 1); - *new_entry_ptr = (*entry_ptr); - } - free (htab->entries); - *htab = (*new_htab); - free (new_htab); + PTR *oentries; + PTR *olimit; + PTR *p; + PTR *nentries; + size_t nsize; + + oentries = htab->entries; + olimit = oentries + htab->size; + + nsize = higher_prime_number (htab->size * 2); + + nentries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR)); + if (nentries == NULL) + return 0; + htab->entries = nentries; + htab->size = nsize; + + htab->n_elements -= htab->n_deleted; + htab->n_deleted = 0; + + p = oentries; + do + { + PTR x = *p; + + if (x != EMPTY_ENTRY && x != DELETED_ENTRY) + { + PTR *q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x)); + + *q = x; + } + + p++; + } + while (p < olimit); + + if (htab->free_f != NULL) + (*htab->free_f) (oentries); + return 1; } -/* This function searches for hash table entry which contains element - equal to given value or empty entry in which given value can be - placed (if the element with given value does not exist in the - table). The function works in two regimes. The first regime is - used only for search. The second is used for search and - reservation empty entry for given value. The table is expanded if - occupancy (taking into accout also deleted elements) is more than - 75%. Naturally the hash table must already exist. If reservation - flag is TRUE then the element with given value should be inserted - into the table entry before another call of - `find_hash_table_entry'. */ - -hash_table_entry_t * -find_hash_table_entry (htab, element, reserve) - hash_table_t htab; - hash_table_entry_t element; - int reserve; +/* This function searches for a hash table entry equal to the given + element. It cannot be used to insert or delete an element. */ + +PTR +htab_find_with_hash (htab, element, hash) + htab_t htab; + const PTR element; + hashval_t hash; { - hash_table_entry_t *entry_ptr; - hash_table_entry_t *first_deleted_entry_ptr; - unsigned index, hash_value, secondary_hash_value; + unsigned int index; + hashval_t hash2; + size_t size; + PTR entry; + + htab->searches++; + size = htab->size; + index = hash % size; - if (htab->size * 3 <= htab->number_of_elements * 4) + entry = htab->entries[index]; + if (entry == EMPTY_ENTRY + || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element))) + return entry; + + hash2 = 1 + hash % (size - 2); + + for (;;) { -#ifdef HASHTAB_STATS - all_expansions++; -#endif - expand_hash_table (htab); + htab->collisions++; + index += hash2; + if (index >= size) + index -= size; + + entry = htab->entries[index]; + if (entry == EMPTY_ENTRY + || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element))) + return entry; } - hash_value = (*htab->hash_function) (element); - secondary_hash_value = 1 + hash_value % (htab->size - 2); - index = hash_value % htab->size; -#ifdef HASHTAB_STATS +} + +/* Like htab_find_slot_with_hash, but compute the hash value from the + element. */ + +PTR +htab_find (htab, element) + htab_t htab; + const PTR 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. + When inserting an entry, NULL may be returned if memory allocation + fails. */ + +PTR * +htab_find_slot_with_hash (htab, element, hash, insert) + htab_t htab; + const PTR element; + hashval_t hash; + enum insert_option insert; +{ + PTR *first_deleted_slot; + unsigned int index; + hashval_t hash2; + size_t size; + PTR entry; + + if (insert == INSERT && htab->size * 3 <= htab->n_elements * 4 + && htab_expand (htab) == 0) + return NULL; + + size = htab->size; + index = hash % size; + htab->searches++; - all_searches++; -#endif - first_deleted_entry_ptr = NULL; -#ifdef HASHTAB_STATS - for (;;htab->collisions++, all_collisions++) -#else + first_deleted_slot = NULL; + + entry = htab->entries[index]; + if (entry == EMPTY_ENTRY) + goto empty_entry; + else if (entry == DELETED_ENTRY) + first_deleted_slot = &htab->entries[index]; + else if ((*htab->eq_f) (entry, element)) + return &htab->entries[index]; + + hash2 = 1 + hash % (size - 2); for (;;) -#endif { - entry_ptr = htab->entries + index; - if (*entry_ptr == EMPTY_ENTRY) - { - if (reserve) - { - htab->number_of_elements++; - if (first_deleted_entry_ptr != NULL) - { - entry_ptr = first_deleted_entry_ptr; - *entry_ptr = DELETED_ENTRY; - } - } - break; - } - else if (*entry_ptr != DELETED_ENTRY) - { - if ((*htab->eq_function) (*entry_ptr, element)) - break; - } - else if (first_deleted_entry_ptr == NULL) - first_deleted_entry_ptr = entry_ptr; - index += secondary_hash_value; - if (index >= htab->size) - index -= htab->size; + htab->collisions++; + index += hash2; + if (index >= size) + index -= size; + + entry = htab->entries[index]; + if (entry == EMPTY_ENTRY) + goto empty_entry; + else 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]; + } + + empty_entry: + if (insert == NO_INSERT) + return NULL; + + htab->n_elements++; + + if (first_deleted_slot) + { + *first_deleted_slot = EMPTY_ENTRY; + return first_deleted_slot; } - return entry_ptr; + + return &htab->entries[index]; +} + +/* Like htab_find_slot_with_hash, but compute the hash value from the + element. */ + +PTR * +htab_find_slot (htab, element, insert) + htab_t htab; + const PTR element; + enum insert_option 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; + PTR element; +{ + PTR *slot; + + slot = htab_find_slot (htab, element, NO_INSERT); + 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; + PTR *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 deletes element with given value from hash table. - The hash table entry value will be `DELETED_ENTRY' after the - function call. Naturally the hash table must already exist. Hash - table entry for given value should be not empty (or 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 -remove_element_from_hash_table_entry (htab, element) - hash_table_t htab; - hash_table_entry_t element; +htab_traverse (htab, callback, info) + htab_t htab; + htab_trav callback; + PTR info; { - hash_table_entry_t *entry_ptr; + PTR *slot = htab->entries; + PTR *limit = slot + htab->size; + + do + { + PTR x = *slot; - entry_ptr = find_hash_table_entry (htab, element, 0); - *entry_ptr = DELETED_ENTRY; - htab->number_of_deleted_elements++; + 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. */ +/* Return the current size of given hash table. */ size_t -hash_table_size (htab) - hash_table_t htab; +htab_size (htab) + htab_t htab; { return htab->size; } -/* The following function returns current number of elements in given - hash table. */ +/* Return the current number of elements in given hash table. */ size_t -hash_table_elements_number (htab) - hash_table_t htab; +htab_elements (htab) + htab_t htab; { - return htab->number_of_elements - htab->number_of_deleted_elements; + return htab->n_elements - htab->n_deleted; } -#ifdef HASHTAB_STATS -/* The following function returns number of percents of fixed - collisions during all work with given hash table. */ +/* Return the fraction of fixed collisions during all work with given + hash table. */ -int -hash_table_collisions (htab) - hash_table_t htab; +double +htab_collisions (htab) + htab_t htab; { - int searches; + if (htab->searches == 0) + return 0.0; - searches = htab->searches; - if (searches == 0) - searches++; - return htab->collisions * 100 / searches; + return (double) htab->collisions / (double) htab->searches; } -/* The following function returns number of percents of fixed - collisions during all work with all hash tables. */ - -int -all_hash_table_collisions () +/* Hash P as a null-terminated string. + + Copied from gcc/hashtable.c. Zack had the following to say with respect + to applicability, though note that unlike hashtable.c, this hash table + implementation re-hashes rather than chain buckets. + + http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01021.html + From: Zack Weinberg <zackw@panix.com> + Date: Fri, 17 Aug 2001 02:15:56 -0400 + + I got it by extracting all the identifiers from all the source code + I had lying around in mid-1999, and testing many recurrences of + the form "H_n = H_{n-1} * K + c_n * L + M" where K, L, M were either + prime numbers or the appropriate identity. This was the best one. + I don't remember exactly what constituted "best", except I was + looking at bucket-length distributions mostly. + + So it should be very good at hashing identifiers, but might not be + as good at arbitrary strings. + + I'll add that it thoroughly trounces the hash functions recommended + for this use at http://burtleburtle.net/bob/hash/index.html, both + on speed and bucket distribution. I haven't tried it against the + function they just started using for Perl's hashes. */ + +hashval_t +htab_hash_string (p) + const PTR p; { - int searches; + const unsigned char *str = (const unsigned char *) p; + hashval_t r = 0; + unsigned char c; + + while ((c = *str++) != 0) + r = r * 67 + c - 113; - searches = all_searches; - if (searches == 0) - searches++; - return all_collisions * 100 / searches; + return r; } -#endif diff --git a/gnu/lib/libiberty/src/memcmp.c b/gnu/lib/libiberty/src/memcmp.c index 127ae0c8019..011f36c8619 100644 --- a/gnu/lib/libiberty/src/memcmp.c +++ b/gnu/lib/libiberty/src/memcmp.c @@ -2,16 +2,17 @@ This function is in the public domain. */ /* -NAME - memcmp -- compare two memory regions -SYNOPSIS - int memcmp (const void *from, const void *to, size_t count) +@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count}) + +Compares the first @var{count} bytes of two areas of memory. Returns +zero if they are the same, a value less than zero if @var{x} is +lexically less than @var{y}, or a value greater than zero if @var{x} +is lexically greater than @var{y}. Note that lexical order is determined +as if comparing unsigned char arrays. + +@end deftypefn -DESCRIPTION - Compare two memory regions and return less than, - equal to, or greater than zero, according to lexicographical - ordering of the compared regions. */ #include <ansidecl.h> diff --git a/gnu/lib/libiberty/src/mkstemps.c b/gnu/lib/libiberty/src/mkstemps.c index 16c16a23263..d3cb58058aa 100644 --- a/gnu/lib/libiberty/src/mkstemps.c +++ b/gnu/lib/libiberty/src/mkstemps.c @@ -48,18 +48,27 @@ typedef unsigned long gcc_uint64_t; #define TMP_MAX 16384 #endif -/* Generate a unique temporary file name from TEMPLATE. +/* - TEMPLATE has the form: +@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len}) - <path>/ccXXXXXX<suffix> +Generate a unique temporary file name from @var{template}. +@var{template} has the form: - SUFFIX_LEN tells us how long <suffix> is (it can be zero length). +@example + @var{path}/ccXXXXXX@var{suffix} +@end example - The last six characters of TEMPLATE before <suffix> must be "XXXXXX"; - they are replaced with a string that makes the filename unique. +@var{suffix_len} tells us how long @var{suffix} is (it can be zero +length). The last six characters of @var{template} before @var{suffix} +must be @samp{XXXXXX}; they are replaced with a string that makes the +filename unique. Returns a file descriptor open on the file for +reading and writing. + +@end deftypefn + +*/ - Returns a file descriptor open on the file for reading and writing. */ int mkstemps (template, suffix_len) char *template; @@ -111,7 +120,11 @@ mkstemps (template, suffix_len) v /= 62; XXXXXX[5] = letters[v % 62]; +#ifdef VMS + fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd"); +#else fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600); +#endif if (fd >= 0) /* The file does not exist. */ return fd; diff --git a/gnu/lib/libiberty/src/partition.c b/gnu/lib/libiberty/src/partition.c index c1d584774bf..0934047dde5 100644 --- a/gnu/lib/libiberty/src/partition.c +++ b/gnu/lib/libiberty/src/partition.c @@ -1,5 +1,5 @@ -/* List implentation of a partition of consecutive integers. - Copyright (C) 2000 Free Software Foundation, Inc. +/* List implementation of a partition of consecutive integers. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. This file is part of GNU CC. diff --git a/gnu/lib/libiberty/src/pexecute.c b/gnu/lib/libiberty/src/pexecute.c index 5003f1fe4d5..b3a58171657 100644 --- a/gnu/lib/libiberty/src/pexecute.c +++ b/gnu/lib/libiberty/src/pexecute.c @@ -71,53 +71,66 @@ static char *install_error_msg = "installation problem, cannot exec `%s'"; /* pexecute: execute a program. - PROGRAM and ARGV are the arguments to execv/execvp. +@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags) - THIS_PNAME is name of the calling program (i.e. argv[0]). +Executes a program. - TEMP_BASE is the path name, sans suffix, of a temporary file to use - if needed. This is currently only needed for MSDOS ports that don't use - GO32 (do any still exist?). Ports that don't need it can pass NULL. +@var{program} and @var{argv} are the arguments to +@code{execv}/@code{execvp}. - (FLAGS & PEXECUTE_SEARCH) is non-zero if $PATH should be searched - (??? It's not clear that GCC passes this flag correctly). - (FLAGS & PEXECUTE_FIRST) is nonzero for the first process in chain. - (FLAGS & PEXECUTE_FIRST) is nonzero for the last process in chain. - FIRST_LAST could be simplified to only mark the last of a chain of processes - but that requires the caller to always mark the last one (and not give up - early if some error occurs). It's more robust to require the caller to - mark both ends of the chain. +@var{this_pname} is name of the calling program (i.e., @code{argv[0]}). - The result is the pid on systems like Unix where we fork/exec and on systems - like WIN32 and OS2 where we use spawn. It is up to the caller to wait for - the child. +@var{temp_base} is the path name, sans suffix, of a temporary file to +use if needed. This is currently only needed for MS-DOS ports that +don't use @code{go32} (do any still exist?). Ports that don't need it +can pass @code{NULL}. - The result is the WEXITSTATUS on systems like MSDOS where we spawn and wait - for the child here. +(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched +(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} & +PEXECUTE_FIRST}) is nonzero for the first process in chain. +(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process +in chain. The first/last flags could be simplified to only mark the +last of a chain of processes but that requires the caller to always +mark the last one (and not give up early if some error occurs). +It's more robust to require the caller to mark both ends of the chain. - Upon failure, ERRMSG_FMT and ERRMSG_ARG are set to the text of the error - message with an optional argument (if not needed, ERRMSG_ARG is set to - NULL), and -1 is returned. `errno' is available to the caller to use. +The result is the pid on systems like Unix where we +@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we +use @code{spawn}. It is up to the caller to wait for the child. - pwait: cover function for wait. +The result is the @code{WEXITSTATUS} on systems like MS-DOS where we +@code{spawn} and wait for the child here. - PID is the process id of the task to wait for. - STATUS is the `status' argument to wait. - FLAGS is currently unused (allows future enhancement without breaking - upward compatibility). Pass 0 for now. +Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the +text of the error message with an optional argument (if not needed, +@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned. +@code{errno} is available to the caller to use. - The result is the pid of the child reaped, - or -1 for failure (errno says why). +@end deftypefn - On systems that don't support waiting for a particular child, PID is - ignored. On systems like MSDOS that don't really multitask pwait - is just a mechanism to provide a consistent interface for the caller. +@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags}) + +Waits for a program started by @code{pexecute} to finish. + +@var{pid} is the process id of the task to wait for. @var{status} is +the `status' argument to wait. @var{flags} is currently unused (allows +future enhancement without breaking upward compatibility). Pass 0 for now. + +The result is the pid of the child reaped, or -1 for failure +(@code{errno} says why). + +On systems that don't support waiting for a particular child, @var{pid} is +ignored. On systems like MS-DOS that don't really multitask @code{pwait} +is just a mechanism to provide a consistent interface for the caller. + +@end deftypefn + +@undocumented pfinish pfinish: finish generation of script pfinish is necessary for systems like MPW where a script is generated that - runs the requested programs. -*/ + runs the requested programs. */ #ifdef __MSDOS__ @@ -251,7 +264,7 @@ extern int _spawnvp (); /* This is a kludge to get around the Microsoft C spawn functions' propensity to remove the outermost set of double quotes from all arguments. */ -const char * const * +static const char * const * fix_argv (argvec) char **argvec; { diff --git a/gnu/lib/libiberty/src/rename.c b/gnu/lib/libiberty/src/rename.c index ae26e2d0040..9957994410b 100644 --- a/gnu/lib/libiberty/src/rename.c +++ b/gnu/lib/libiberty/src/rename.c @@ -1,7 +1,16 @@ /* rename -- rename a file This function is in the public domain. */ -/* Rename a file. */ +/* + +@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new}) + +Renames a file from @var{old} to @var{new}. If @var{new} already +exists, it is removed. + +@end deftypefn + +*/ #include <errno.h> diff --git a/gnu/lib/libiberty/src/setenv.c b/gnu/lib/libiberty/src/setenv.c index eec13006c22..0ed7ab6f1c9 100644 --- a/gnu/lib/libiberty/src/setenv.c +++ b/gnu/lib/libiberty/src/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 2002 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 @@ -16,10 +16,29 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* + +@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite}) +@deftypefnx Supplemental void unsetenv (const char *@var{name}) + +@code{setenv} adds @var{name} to the environment with value +@var{value}. If the name was already present in the environment, +the new value will be stored only if @var{overwrite} is nonzero. +The companion @code{unsetenv} function removes @var{name} from the +environment. This implementation is not safe for multithreaded code. + +@end deftypefn + +*/ + #if HAVE_CONFIG_H # include <config.h> #endif +#define setenv libiberty_setenv +#define unsetenv libiberty_unsetenv + #include "ansidecl.h" #include <sys/types.h> /* For `size_t' */ #include <stdio.h> /* For `NULL' */ @@ -45,6 +64,9 @@ extern int errno; extern char **environ; #endif +#undef setenv +#undef unsetenv + /* LOCK and UNLOCK are defined as no-ops. This makes the libiberty * implementation MT-Unsafe. */ #define LOCK diff --git a/gnu/lib/libiberty/src/sigsetmask.c b/gnu/lib/libiberty/src/sigsetmask.c index 2a09e6a6c5a..0d6eaf478dd 100644 --- a/gnu/lib/libiberty/src/sigsetmask.c +++ b/gnu/lib/libiberty/src/sigsetmask.c @@ -3,8 +3,17 @@ Contributed by Cygnus Support. This file is in the public doamin. */ -/* Set the current signal mask to the set provided, and return the - previous value */ +/* + +@deftypefn Supplemental int sigsetmask (int @var{set}) + +Sets the signal mask to the one provided in @var{set} and returns +the old mask (which, for libiberty's implementation, will always +be the value @code{1}). + +@end deftypefn + +*/ #define _POSIX_SOURCE #include <ansidecl.h> diff --git a/gnu/lib/libiberty/src/splay-tree.c b/gnu/lib/libiberty/src/splay-tree.c index 22ea07d84ad..6f90fde05fb 100644 --- a/gnu/lib/libiberty/src/splay-tree.c +++ b/gnu/lib/libiberty/src/splay-tree.c @@ -1,5 +1,5 @@ /* A splay-tree datatype. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. @@ -32,6 +32,8 @@ Boston, MA 02111-1307, USA. */ #include <stdlib.h> #endif +#include <stdio.h> + #include "libiberty.h" #include "splay-tree.h" @@ -68,7 +70,7 @@ splay_tree_delete_helper (sp, node) if (sp->delete_value) (*sp->delete_value)(node->value); - free ((char*) node); + (*sp->deallocate) ((char*) node, sp->allocate_data); } /* Help splay SP around KEY. PARENT and GRANDPARENT are the parent @@ -225,9 +227,29 @@ splay_tree_foreach_helper (sp, node, fn, data) return splay_tree_foreach_helper (sp, node->right, fn, data); } + +/* An allocator and deallocator based on xmalloc. */ +static void * +splay_tree_xmalloc_allocate (size, data) + int size; + void *data ATTRIBUTE_UNUSED; +{ + return (void *) xmalloc (size); +} + +static void +splay_tree_xmalloc_deallocate (object, data) + void *object; + void *data ATTRIBUTE_UNUSED; +{ + free (object); +} + + /* Allocate a new splay tree, using COMPARE_FN to compare nodes, DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate - values. */ + values. Use xmalloc to allocate the splay tree structure, and any + nodes added. */ splay_tree splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) @@ -235,11 +257,35 @@ splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) splay_tree_delete_key_fn delete_key_fn; splay_tree_delete_value_fn delete_value_fn; { - splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree_s)); + return (splay_tree_new_with_allocator + (compare_fn, delete_key_fn, delete_value_fn, + splay_tree_xmalloc_allocate, splay_tree_xmalloc_deallocate, 0)); +} + + +/* 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_with_allocator (compare_fn, delete_key_fn, delete_value_fn, + allocate_fn, deallocate_fn, allocate_data) + splay_tree_compare_fn compare_fn; + splay_tree_delete_key_fn delete_key_fn; + splay_tree_delete_value_fn delete_value_fn; + splay_tree_allocate_fn allocate_fn; + splay_tree_deallocate_fn deallocate_fn; + void *allocate_data; +{ + splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s), + allocate_data); sp->root = 0; sp->comp = compare_fn; sp->delete_key = delete_key_fn; sp->delete_value = delete_value_fn; + sp->allocate = allocate_fn; + sp->deallocate = deallocate_fn; + sp->allocate_data = allocate_data; return sp; } @@ -251,7 +297,7 @@ splay_tree_delete (sp) splay_tree sp; { splay_tree_delete_helper (sp, sp->root); - free ((char*) sp); + (*sp->deallocate) ((char*) sp, sp->allocate_data); } /* Insert a new node (associating KEY with DATA) into SP. If a @@ -284,7 +330,9 @@ splay_tree_insert (sp, key, value) /* Create a new node, and insert it at the root. */ splay_tree_node node; - node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node_s)); + node = ((splay_tree_node) + (*sp->allocate) (sizeof (struct splay_tree_node_s), + sp->allocate_data)); node->key = key; node->value = value; @@ -303,12 +351,53 @@ splay_tree_insert (sp, key, value) node->right->left = 0; } - sp->root = node; - } + sp->root = node; + } return sp->root; } +/* Remove KEY from SP. It is not an error if it did not exist. */ + +void +splay_tree_remove (sp, key) + splay_tree sp; + splay_tree_key key; +{ + splay_tree_splay (sp, key); + + if (sp->root && (*sp->comp) (sp->root->key, key) == 0) + { + splay_tree_node left, right; + + left = sp->root->left; + right = sp->root->right; + + /* Delete the root node itself. */ + if (sp->delete_value) + (*sp->delete_value) (sp->root->value); + (*sp->deallocate) (sp->root, sp->allocate_data); + + /* One of the children is now the root. Doesn't matter much + which, so long as we preserve the properties of the tree. */ + if (left) + { + sp->root = left; + + /* If there was a right child as well, hang it off the + right-most leaf of the left child. */ + if (right) + { + while (left->right) + left = left->right; + left->right = right; + } + } + else + sp->root = right; + } +} + /* Lookup KEY in SP, returning VALUE if present, and NULL otherwise. */ @@ -325,6 +414,106 @@ splay_tree_lookup (sp, key) return 0; } +/* Return the node in SP with the greatest key. */ + +splay_tree_node +splay_tree_max (sp) + splay_tree sp; +{ + splay_tree_node n = sp->root; + + if (!n) + return NULL; + + while (n->right) + n = n->right; + + return n; +} + +/* Return the node in SP with the smallest key. */ + +splay_tree_node +splay_tree_min (sp) + splay_tree sp; +{ + splay_tree_node n = sp->root; + + if (!n) + return NULL; + + while (n->left) + n = n->left; + + return n; +} + +/* Return the immediate predecessor KEY, or NULL if there is no + predecessor. KEY need not be present in the tree. */ + +splay_tree_node +splay_tree_predecessor (sp, key) + splay_tree sp; + splay_tree_key key; +{ + int comparison; + splay_tree_node node; + + /* If the tree is empty, there is certainly no predecessor. */ + if (!sp->root) + return NULL; + + /* Splay the tree around KEY. That will leave either the KEY + itself, its predecessor, or its successor at the root. */ + splay_tree_splay (sp, key); + comparison = (*sp->comp)(sp->root->key, key); + + /* If the predecessor is at the root, just return it. */ + if (comparison < 0) + return sp->root; + + /* Otherwise, find the leftmost element of the right subtree. */ + node = sp->root->left; + if (node) + while (node->right) + node = node->right; + + return node; +} + +/* Return the immediate successor KEY, or NULL if there is no + successor. KEY need not be present in the tree. */ + +splay_tree_node +splay_tree_successor (sp, key) + splay_tree sp; + splay_tree_key key; +{ + int comparison; + splay_tree_node node; + + /* If the tree is empty, there is certainly no successor. */ + if (!sp->root) + return NULL; + + /* Splay the tree around KEY. That will leave either the KEY + itself, its predecessor, or its successor at the root. */ + splay_tree_splay (sp, key); + comparison = (*sp->comp)(sp->root->key, key); + + /* If the successor is at the root, just return it. */ + if (comparison > 0) + return sp->root; + + /* Otherwise, find the rightmost element of the left subtree. */ + node = sp->root->right; + if (node) + while (node->left) + node = node->left; + + return node; +} + /* 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. diff --git a/gnu/lib/libiberty/src/strerror.c b/gnu/lib/libiberty/src/strerror.c index ae7e29bfa89..7e1be0787bd 100644 --- a/gnu/lib/libiberty/src/strerror.c +++ b/gnu/lib/libiberty/src/strerror.c @@ -13,6 +13,7 @@ incompatible with our later declaration, perhaps by using const attributes. So we hide the declaration in errno.h (if any) using a macro. */ +#define sys_nerr sys_nerr__ #define sys_errlist sys_errlist__ #endif @@ -20,6 +21,7 @@ #include <errno.h> #ifdef HAVE_SYS_ERRLIST +#undef sys_nerr #undef sys_errlist #endif @@ -53,10 +55,10 @@ static void init_error_tables PARAMS ((void)); struct error_info { - int value; /* The numeric value from <errno.h> */ - const char *name; /* The equivalent symbolic value */ + const int value; /* The numeric value from <errno.h> */ + const char *const name; /* The equivalent symbolic value */ #ifndef HAVE_SYS_ERRLIST - const char *msg; /* Short message about this value */ + const char *const msg; /* Short message about this value */ #endif }; @@ -557,28 +559,23 @@ init_error_tables () /* -NAME - - errno_max -- return the max errno value -SYNOPSIS +@deftypefn Extension int errno_max (void) - int errno_max (); +Returns the maximum @code{errno} value for which a corresponding +symbolic name or message is available. Note that in the case where we +use the @code{sys_errlist} supplied by the system, it is possible for +there to be more symbolic names than messages, or vice versa. In +fact, the manual page for @code{perror(3C)} explicitly warns that one +should check the size of the table (@code{sys_nerr}) before indexing +it, since new error codes may be added to the system before they are +added to the table. Thus @code{sys_nerr} might be smaller than value +implied by the largest @code{errno} value defined in @code{<errno.h>}. -DESCRIPTION +We return the maximum value that can be used to obtain a meaningful +symbolic name or message. - Returns the maximum errno value for which a corresponding symbolic - name or message is available. Note that in the case where - we use the sys_errlist supplied by the system, it is possible for - there to be more symbolic names than messages, or vice versa. - In fact, the manual page for perror(3C) explicitly warns that one - should check the size of the table (sys_nerr) before indexing it, - since new error codes may be added to the system before they are - added to the table. Thus sys_nerr might be smaller than value - implied by the largest errno value defined in <errno.h>. - - We return the maximum value that can be used to obtain a meaningful - symbolic name or message. +@end deftypefn */ @@ -599,31 +596,25 @@ errno_max () /* -NAME +@deftypefn Supplemental char* strerror (int @var{errnoval}) - strerror -- map an error number to an error message string +Maps an @code{errno} number to an error message string, the contents +of which are implementation defined. On systems which have the +external variables @code{sys_nerr} and @code{sys_errlist}, these +strings will be the same as the ones used by @code{perror}. -SYNOPSIS +If the supplied error number is within the valid range of indices for +the @code{sys_errlist}, but no message is available for the particular +error number, then returns the string @samp{Error @var{num}}, where +@var{num} is the error number. - char *strerror (int errnoval) +If the supplied error number is not a valid index into +@code{sys_errlist}, returns @code{NULL}. -DESCRIPTION - - Maps an errno number to an error message string, the contents of - which are implementation defined. On systems which have the external - variables sys_nerr and sys_errlist, these strings will be the same - as the ones used by perror(). - - If the supplied error number is within the valid range of indices - for the sys_errlist, but no message is available for the particular - error number, then returns the string "Error NUM", where NUM is the - error number. +The returned string is only guaranteed to be valid only until the +next call to @code{strerror}. - If the supplied error number is not a valid index into sys_errlist, - returns NULL. - - The returned string is only guaranteed to be valid only until the - next call to strerror. +@end deftypefn */ @@ -631,7 +622,7 @@ char * strerror (errnoval) int errnoval; { - char *msg; + const char *msg; static char buf[32]; #ifndef HAVE_SYS_ERRLIST @@ -673,32 +664,24 @@ strerror (errnoval) /* -NAME +@deftypefn Replacement {const char*} strerrno (int @var{errnum}) - strerrno -- map an error number to a symbolic name string +Given an error number returned from a system call (typically returned +in @code{errno}), returns a pointer to a string containing the +symbolic name of that error number, as found in @code{<errno.h>}. -SYNOPSIS +If the supplied error number is within the valid range of indices for +symbolic names, but no name is available for the particular error +number, then returns the string @samp{Error @var{num}}, where @var{num} +is the error number. - const char *strerrno (int errnoval) +If the supplied error number is not within the range of valid +indices, then returns @code{NULL}. -DESCRIPTION - - Given an error number returned from a system call (typically - returned in errno), returns a pointer to a string containing the - symbolic name of that error number, as found in <errno.h>. - - If the supplied error number is within the valid range of indices - for symbolic names, but no name is available for the particular - error number, then returns the string "Error NUM", where NUM is - the error number. - - If the supplied error number is not within the range of valid - indices, then returns NULL. - -BUGS +The contents of the location pointed to are only guaranteed to be +valid until the next call to @code{strerrno}. - The contents of the location pointed to are only guaranteed to be - valid until the next call to strerrno. +@end deftypefn */ @@ -741,18 +724,12 @@ strerrno (errnoval) /* -NAME - - strtoerrno -- map a symbolic errno name to a numeric value - -SYNOPSIS - - int strtoerrno (char *name) +@deftypefn Extension int strtoerrno (const char *@var{name}) -DESCRIPTION +Given the symbolic name of a error number (e.g., @code{EACCES}), map it +to an errno value. If no translation is found, returns 0. - Given the symbolic name of a error number, map it to an errno value. - If no translation is found, returns 0. +@end deftypefn */ @@ -803,7 +780,7 @@ main () int errn; int errnmax; const char *name; - char *msg; + const char *msg; char *strerror (); errnmax = errno_max (); diff --git a/gnu/lib/libiberty/src/strsignal.c b/gnu/lib/libiberty/src/strsignal.c index c7bb10c441c..27edb960df0 100644 --- a/gnu/lib/libiberty/src/strsignal.c +++ b/gnu/lib/libiberty/src/strsignal.c @@ -17,6 +17,7 @@ ignore any declaration in the system header files, and always declare it ourselves. With luck, this will always work. */ #define sys_siglist no_such_symbol +#define sys_nsig sys_nsig__no_such_symbol #include <stdio.h> #include <signal.h> @@ -35,6 +36,7 @@ extern char *memset (); /* Undefine the macro we used to hide the definition of sys_siglist found in the system header files. */ #undef sys_siglist +#undef sys_nsig #ifndef NULL # ifdef __STDC__ @@ -62,10 +64,10 @@ static void init_signal_tables PARAMS ((void)); struct signal_info { - int value; /* The numeric value from <signal.h> */ - const char *name; /* The equivalent symbolic value */ + const int value; /* The numeric value from <signal.h> */ + const char *const name; /* The equivalent symbolic value */ #ifndef HAVE_SYS_SIGLIST - const char *msg; /* Short message about this value */ + const char *const msg; /* Short message about this value */ #endif }; @@ -345,28 +347,22 @@ init_signal_tables () /* -NAME - - signo_max -- return the max signo value - -SYNOPSIS +@deftypefn Extension int signo_max (void) - int signo_max (); +Returns the maximum signal value for which a corresponding symbolic +name or message is available. Note that in the case where we use the +@code{sys_siglist} supplied by the system, it is possible for there to +be more symbolic names than messages, or vice versa. In fact, the +manual page for @code{psignal(3b)} explicitly warns that one should +check the size of the table (@code{NSIG}) before indexing it, since +new signal codes may be added to the system before they are added to +the table. Thus @code{NSIG} might be smaller than value implied by +the largest signo value defined in @code{<signal.h>}. -DESCRIPTION - - Returns the maximum signo value for which a corresponding symbolic - name or message is available. Note that in the case where - we use the sys_siglist supplied by the system, it is possible for - there to be more symbolic names than messages, or vice versa. - In fact, the manual page for psignal(3b) explicitly warns that one - should check the size of the table (NSIG) before indexing it, - since new signal codes may be added to the system before they are - added to the table. Thus NSIG might be smaller than value - implied by the largest signo value defined in <signal.h>. +We return the maximum value that can be used to obtain a meaningful +symbolic name or message. - We return the maximum value that can be used to obtain a meaningful - symbolic name or message. +@end deftypefn */ @@ -386,31 +382,25 @@ signo_max () /* -NAME - - strsignal -- map a signal number to a signal message string +@deftypefn Supplemental {const char *} strsignal (int @var{signo}) -SYNOPSIS - - const char *strsignal (int signo) - -DESCRIPTION +Maps an signal number to an signal message string, the contents of +which are implementation defined. On systems which have the external +variable @code{sys_siglist}, these strings will be the same as the +ones used by @code{psignal()}. - Maps an signal number to an signal message string, the contents of - which are implementation defined. On systems which have the external - variable sys_siglist, these strings will be the same as the ones used - by psignal(). +If the supplied signal number is within the valid range of indices for +the @code{sys_siglist}, but no message is available for the particular +signal number, then returns the string @samp{Signal @var{num}}, where +@var{num} is the signal number. - If the supplied signal number is within the valid range of indices - for the sys_siglist, but no message is available for the particular - signal number, then returns the string "Signal NUM", where NUM is the - signal number. +If the supplied signal number is not a valid index into +@code{sys_siglist}, returns @code{NULL}. - If the supplied signal number is not a valid index into sys_siglist, - returns NULL. +The returned string is only guaranteed to be valid only until the next +call to @code{strsignal}. - The returned string is only guaranteed to be valid only until the - next call to strsignal. +@end deftypefn */ @@ -456,31 +446,23 @@ strsignal (signo) /* -NAME - - strsigno -- map an signal number to a symbolic name string +@deftypefn Extension {const char*} strsigno (int @var{signo}) -SYNOPSIS +Given an signal number, returns a pointer to a string containing the +symbolic name of that signal number, as found in @code{<signal.h>}. - const char *strsigno (int signo) +If the supplied signal number is within the valid range of indices for +symbolic names, but no name is available for the particular signal +number, then returns the string @samp{Signal @var{num}}, where +@var{num} is the signal number. -DESCRIPTION +If the supplied signal number is not within the range of valid +indices, then returns @code{NULL}. - Given an signal number, returns a pointer to a string containing - the symbolic name of that signal number, as found in <signal.h>. +The contents of the location pointed to are only guaranteed to be +valid until the next call to @code{strsigno}. - If the supplied signal number is within the valid range of indices - for symbolic names, but no name is available for the particular - signal number, then returns the string "Signal NUM", where NUM is - the signal number. - - If the supplied signal number is not within the range of valid - indices, then returns NULL. - -BUGS - - The contents of the location pointed to are only guaranteed to be - valid until the next call to strsigno. +@end deftypefn */ @@ -519,18 +501,12 @@ strsigno (signo) /* -NAME - - strtosigno -- map a symbolic signal name to a numeric value +@deftypefn Extension int strtosigno (const char *@var{name}) -SYNOPSIS +Given the symbolic name of a signal, map it to a signal number. If no +translation is found, returns 0. - int strtosigno (char *name) - -DESCRIPTION - - Given the symbolic name of a signal, map it to a signal number. - If no translation is found, returns 0. +@end deftypefn */ @@ -565,19 +541,14 @@ strtosigno (name) /* -NAME +@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) - psignal -- print message about signal to stderr +Print @var{message} to the standard error, followed by a colon, +followed by the description of the signal specified by @var{signo}, +followed by a newline. -SYNOPSIS - - void psignal (unsigned signo, char *message); - -DESCRIPTION +@end deftypefn - Print to the standard error the message, followed by a colon, - followed by the description of the signal specified by signo, - followed by a newline. */ #ifndef HAVE_PSIGNAL diff --git a/gnu/lib/libiberty/src/strtod.c b/gnu/lib/libiberty/src/strtod.c index c86c73de9b3..97fc9339344 100644 --- a/gnu/lib/libiberty/src/strtod.c +++ b/gnu/lib/libiberty/src/strtod.c @@ -1,5 +1,5 @@ /* Implementation of strtod for systems with atof. - Copyright (C) 1991, 1995 Free Software Foundation, Inc. + Copyright (C) 1991, 1995, 2002 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,7 +22,23 @@ 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 <ctype.h> +/* + +@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr}) + +This ISO C function converts the initial portion of @var{string} to a +@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the +character after the last character used in the conversion is stored in +the location referenced by @var{endptr}. If no conversion is +performed, zero is returned and the value of @var{string} is stored in +the location referenced by @var{endptr}. + +@end deftypefn + +*/ + +#include "ansidecl.h" +#include "safe-ctype.h" extern double atof (); @@ -42,7 +58,7 @@ strtod (str, ptr) p = str; - while (isspace (*p)) + while (ISSPACE (*p)) ++p; if (*p == '+' || *p == '-') @@ -59,7 +75,7 @@ strtod (str, ptr) && (p[6] == 't' || p[6] == 'T') && (p[7] == 'y' || p[7] == 'Y')) { - *ptr = p + 7; + *ptr = p + 8; return atof (str); } else @@ -88,10 +104,10 @@ strtod (str, ptr) } /* digits, with 0 or 1 periods in it. */ - if (isdigit (*p) || *p == '.') + if (ISDIGIT (*p) || *p == '.') { int got_dot = 0; - while (isdigit (*p) || (!got_dot && *p == '.')) + while (ISDIGIT (*p) || (!got_dot && *p == '.')) { if (*p == '.') got_dot = 1; @@ -105,9 +121,9 @@ strtod (str, ptr) i = 1; if (p[i] == '+' || p[i] == '-') ++i; - if (isdigit (p[i])) + if (ISDIGIT (p[i])) { - while (isdigit (p[i])) + while (ISDIGIT (p[i])) ++i; *ptr = p + i; return atof (str); diff --git a/gnu/lib/libiberty/src/strtol.c b/gnu/lib/libiberty/src/strtol.c index 5467cc3e2e9..d9f54cc8f7a 100644 --- a/gnu/lib/libiberty/src/strtol.c +++ b/gnu/lib/libiberty/src/strtol.c @@ -28,13 +28,39 @@ * SUCH DAMAGE. */ +/* + +@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base}) +@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base}) + +The @code{strtol} function converts the string in @var{string} to a +long integer value according to the given @var{base}, which must be +between 2 and 36 inclusive, or be the special value 0. If @var{base} +is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x} +to indicate bases 8 and 16, respectively, else default to base 10. +When the base is 16 (either explicitly or implicitly), a prefix of +@code{0x} is allowed. The handling of @var{endptr} is as that of +@code{strtod} above. The @code{strtoul} function is the same, except +that the converted value is unsigned. + +@end deftypefn + +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#ifdef HAVE_LIMITS_H #include <limits.h> -#include <ctype.h> +#endif +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif #include <errno.h> -#if 0 -#include <stdlib.h> +#ifdef NEED_DECLARATION_ERRNO +extern int errno; #endif -#include "ansidecl.h" +#include "safe-ctype.h" /* FIXME: It'd be nice to configure around these, but the include files are too painful. These macros should at least be more portable than hardwired hex @@ -77,7 +103,7 @@ strtol(nptr, endptr, base) */ do { c = *s++; - } while (isspace(c)); + } while (ISSPACE(c)); if (c == '-') { neg = 1; c = *s++; @@ -113,10 +139,10 @@ strtol(nptr, endptr, base) cutlim = cutoff % (unsigned long)base; cutoff /= (unsigned long)base; for (acc = 0, any = 0;; c = *s++) { - if (isdigit(c)) + if (ISDIGIT(c)) c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else if (ISALPHA(c)) + c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10; else break; if (c >= base) diff --git a/gnu/lib/libiberty/src/testsuite/demangle-expected b/gnu/lib/libiberty/src/testsuite/demangle-expected index d3a1fe43890..c0483188239 100644 --- a/gnu/lib/libiberty/src/testsuite/demangle-expected +++ b/gnu/lib/libiberty/src/testsuite/demangle-expected @@ -127,31 +127,31 @@ VOrder__9ivTSolverUiRP12ivInteractorT2 ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&) # --format=gnu -_10PageButton\$__both +_10PageButton$__both PageButton::__both # --format=gnu -_3RNG\$singleMantissa +_3RNG$singleMantissa RNG::singleMantissa # --format=gnu -_5IComp\$_release +_5IComp$_release IComp::_release # --format=gnu -_\$_10BitmapComp +_$_10BitmapComp BitmapComp::~BitmapComp(void) # --format=gnu -_\$_9__io_defs +_$_9__io_defs __io_defs::~__io_defs(void) # --format=gnu -_\$_Q23foo3bar +_$_Q23foo3bar foo::bar::~bar(void) # --format=gnu -_\$_Q33foo3bar4bell +_$_Q33foo3bar4bell foo::bar::bell::~bell(void) # --format=gnu @@ -435,11 +435,11 @@ _vt.foo.bar foo::bar virtual table # --format=gnu -_vt\$foo +_vt$foo foo virtual table # --format=gnu -_vt\$foo\$bar +_vt$foo$bar foo::bar virtual table # --format=gnu @@ -647,11 +647,11 @@ zero__8osMemoryPvUi osMemory::zero(void *, unsigned int) # --format=gnu -_2T4\$N +_2T4$N T4::N # --format=gnu -_Q22T42t1\$N +_Q22T42t1$N T4::t1::N # --format=gnu @@ -727,11 +727,11 @@ __t6vector1Zii vector<int>::vector(int) # --format=gnu -_\$_t6vector1Zdi +_$_t6vector1Zdi vector<double>::~vector(int) # --format=gnu -_\$_t6vector1Zii +_$_t6vector1Zii vector<int>::~vector(int) # --format=gnu @@ -827,11 +827,11 @@ next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix List<VHDLEntity>::next(List<VHDLEntity>::Pix &) const # --format=gnu -_GLOBAL_\$D\$set +_GLOBAL_$D$set global destructors keyed to set # --format=gnu -_GLOBAL_\$I\$set +_GLOBAL_$I$set global constructors keyed to set # --format=gnu @@ -875,7 +875,7 @@ __t8BDDHookV1ZPcRCPc BDDHookV<char *>::BDDHookV(char *const &) # --format=gnu -_vt\$t8BDDHookV1ZPc +_vt$t8BDDHookV1ZPc BDDHookV<char *> virtual table # --format=gnu @@ -2476,13 +2476,131 @@ fn__FPQ21n1cPMQ21n1cFPQ21n1c_i fn(n::c *, int (n::c::*)(n::c *)) # --format=gnu -f__FGt3Bar1i21i +f__FGt3Bar1i2G1i f(Bar<2>, i) # --format=gnu -f__FGt3Bar1i_21_i +f__FGt3Bar1i21i f(Bar<21>, int) # --format=gnu -f__FGt3Bar1i24XY_t +f__FGt3Bar1i2G4XY_t f(Bar<2>, XY_t) +# +--format=gnu +foo__H1Zt2TA2ZRCiZt2NA1Ui9_X01_i +int foo<TA<int const &, NA<9> > >(TA<int const &, NA<9> >) +# +--format=gnu +foo__H1Zt2TA2ZcZt2NA1Ui20_X01_i +int foo<TA<char, NA<20> > >(TA<char, NA<20> >) +# +--format=gnu +foo__H1Zt2TA2ZiZt8N___A___1Ui99_X01_i +int foo<TA<int, N___A___<99> > >(TA<int, N___A___<99> >) +# +--format=gnu +foo__H1Zt2TA2ZRCiZt2NA1im1_X01_i +int foo<TA<int const &, NA<-1> > >(TA<int const &, NA<-1> >) +# +--format=gnu +foo__H1Zt2TA2ZRCiZt2NA1im9_X01_i +int foo<TA<int const &, NA<-9> > >(TA<int const &, NA<-9> >) +# +--format=gnu +foo__H1Zt2TA2ZcZt2NA1i_m20__X01_i +int foo<TA<char, NA<-20> > >(TA<char, NA<-20> >) +# +--format=gnu +foo__H1Zt2TA2ZcZt2NA1im1_X01_i +int foo<TA<char, NA<-1> > >(TA<char, NA<-1> >) +# +--format=gnu +foo__H1Zt2TA2ZiZt4N__A1im9_X01_i +int foo<TA<int, N__A<-9> > >(TA<int, N__A<-9> >) +# +--format=gnu +foo__H1Zt2TA2ZiZt4N__A1i_m99__X01_i +int foo<TA<int, N__A<-99> > >(TA<int, N__A<-99> >) +# +--format=gnu +__opi__t2TA2ZiZt4N__A1i9 +TA<int, N__A<9> >::operator int(void) +# +--format=gnu +__opi__t2TA2ZiZt8N___A___1i_m99_ +TA<int, N___A___<-99> >::operator int(void) +# +--format=gnu +foo___bar__baz_____H1Zt2TA2ZiZt8N___A___1i99_X01_i +int foo___bar__baz___<TA<int, N___A___<99> > >(TA<int, N___A___<99> >) +# +--format=gnu +foo__bar___foobar_____t2TA2ZiZt8N___A___1i_m99_ +TA<int, N___A___<-99> >::foo__bar___foobar___(void) +# +--format=gnu +foo__bar___foobar_____t2TA2ZiZt4N__A1i9 +TA<int, N__A<9> >::foo__bar___foobar___(void) +# +--format=gnu +__tfP8sockaddr +sockaddr * type_info function +# +--format=gnu +__tfPQ25libcwt16option_event_tct1Z12burst_app_ct +libcw::option_event_tct<burst_app_ct> * type_info function +# +--format=gnu +__tiP8sockaddr +sockaddr * type_info node +# +--format=gnu +__tiPQ25libcwt16option_event_tct1Z12burst_app_ct +libcw::option_event_tct<burst_app_ct> * type_info node +# +--format=gnu +_27_GLOBAL_.N.__12burst_app_ct.app_instance +{anonymous}::app_instance +# +--format=gnu +_26_GLOBAL_$N$_tmp_n.iilg4Gya$app_instance +{anonymous}::app_instance +# +--format=java +_ZN4java3awt10ScrollPane7addImplEPNS0_9ComponentEPNS_4lang6ObjectEi +java.awt.ScrollPane.addImpl(java.awt.Component, java.lang.Object, int) +# +--format=java +_ZN4java3awt4geom15AffineTransform9getMatrixEP6JArrayIdE +java.awt.geom.AffineTransform.getMatrix(double[]) +# +--format=java +_ZN23Mangle$Inner$InnerInner3fooEP6JArrayIPS0_IiEEdPS0_IPS0_IPS0_IPS0_IPN4java4lang6StringEEEEEPS0_IPS0_IPN6MangleEEE +Mangle$Inner$InnerInner.foo(int[][], double, java.lang.String[][][][], Mangle[][]) +# +--format=java +_ZN6JArray1tEP6JArrayIPS_E +JArray.t(JArray[]) +# +--format=java +_ZN4Prim1iEibcdfwPN4java4lang6StringEsx +Prim.i(int, boolean, byte, double, float, char, java.lang.String, short, long) +# +--format=java +_ZN4java4util14Map__U24_Entry11class__U24_E +java.util.Map$Entry.class$ +# +--format=hp +_Utf58_0_1__1_2147483647__2147483648 +_Utf58_0_1__1_2147483647__2147483648 +# +--format=gnu-v3 +St9bad_alloc +std::bad_alloc +# +# This caused an infinite loop. +# We still don't demangle this correctly, but at least we don't hang. +--format=auto +__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator +_Z1ZZ2Z::__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm(iterator) diff --git a/gnu/lib/libiberty/src/vasprintf.c b/gnu/lib/libiberty/src/vasprintf.c index b959f5f9ca5..aa20e5bff00 100644 --- a/gnu/lib/libiberty/src/vasprintf.c +++ b/gnu/lib/libiberty/src/vasprintf.c @@ -18,21 +18,48 @@ 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. */ -#ifdef __STDC__ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <ansidecl.h> +#ifdef ANSI_PROTOTYPES #include <stdarg.h> #else #include <varargs.h> #endif #include <stdio.h> +#ifdef HAVE_STRING_H #include <string.h> -#include <ansidecl.h> +#endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#else +extern unsigned long strtoul (); +extern PTR malloc (); +#endif +#include "libiberty.h" #ifdef TEST int global_total_width; #endif -unsigned long strtoul (); -char *malloc (); +/* + +@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args}) + +Like @code{vsprintf}, but instead of passing a pointer to a buffer, +you pass a pointer to a pointer. This function will compute the size +of the buffer needed, allocate memory with @code{malloc}, and store a +pointer to the allocated memory in @code{*@var{resptr}}. The value +returned is the same as @code{vsprintf} would return. If memory could +not be allocated, zero is returned and @code{NULL} is stored in +@code{*@var{resptr}}. + +@end deftypefn + +*/ + +static int int_vasprintf PARAMS ((char **, const char *, va_list *)); static int int_vasprintf (result, format, args) @@ -60,7 +87,7 @@ int_vasprintf (result, format, args) total_width += abs (va_arg (ap, int)); } else - total_width += strtoul (p, &p, 10); + total_width += strtoul (p, (char **) &p, 10); if (*p == '.') { ++p; @@ -70,7 +97,7 @@ int_vasprintf (result, format, args) total_width += abs (va_arg (ap, int)); } else - total_width += strtoul (p, &p, 10); + total_width += strtoul (p, (char **) &p, 10); } while (strchr ("hlL", *p)) ++p; @@ -111,7 +138,7 @@ int_vasprintf (result, format, args) #ifdef TEST global_total_width = total_width; #endif - *result = malloc (total_width); + *result = (char *) malloc (total_width); if (*result != NULL) return vsprintf (*result, format, *args); else @@ -132,33 +159,26 @@ vasprintf (result, format, args) } #ifdef TEST -void -checkit -#ifdef __STDC__ - (const char* format, ...) -#else - (va_alist) - va_dcl -#endif +static void ATTRIBUTE_PRINTF_1 +checkit VPARAMS ((const char *format, ...)) { - va_list args; char *result; - -#ifdef __STDC__ - va_start (args, format); -#else - char *format; - va_start (args); - format = va_arg (args, char *); -#endif + VA_OPEN (args, format); + VA_FIXEDARG (args, const char *, format); vasprintf (&result, format, args); - if (strlen (result) < global_total_width) + VA_CLOSE (args); + + if (strlen (result) < (size_t) global_total_width) printf ("PASS: "); else printf ("FAIL: "); printf ("%d %s\n", global_total_width, result); + + free (result); } +extern int main PARAMS ((void)); + int main () { @@ -169,5 +189,7 @@ main () checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ 777777777777777777333333333333366666666666622222222222777777777777733333"); checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); + + return 0; } #endif /* TEST */ diff --git a/gnu/lib/libiberty/src/vfork.c b/gnu/lib/libiberty/src/vfork.c index 86c45919f66..4aa5c21d427 100644 --- a/gnu/lib/libiberty/src/vfork.c +++ b/gnu/lib/libiberty/src/vfork.c @@ -1,6 +1,20 @@ /* Emulate vfork using just plain fork, for systems without a real vfork. This function is in the public domain. */ +/* + +@deftypefn Supplemental int vfork (void) + +Emulates @code{vfork} by calling @code{fork} and returning its value. + +@end deftypefn + +*/ + +#include "ansidecl.h" + +extern int fork PARAMS ((void)); + int vfork () { diff --git a/gnu/lib/libiberty/src/waitpid.c b/gnu/lib/libiberty/src/waitpid.c index 23db0b932d2..6e31f25e305 100644 --- a/gnu/lib/libiberty/src/waitpid.c +++ b/gnu/lib/libiberty/src/waitpid.c @@ -1,6 +1,31 @@ -int +/* + +@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int) + +This is a wrapper around the @code{wait} function. Any ``special'' +values of @var{pid} depend on your implementation of @code{wait}, as +does the return value. The third argument is unused in @libib{}. + +@end deftypefn + +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* On some systems (such as WindISS), you must include <sys/types.h> + to get the definition of "pid_t" before you include <sys/wait.h>. */ +#include <sys/types.h> + +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif + +pid_t waitpid (pid, stat_loc, options) - int pid, *stat_loc, options; + pid_t pid; + int *stat_loc, options; { for (;;) { diff --git a/gnu/lib/libiberty/src/xexit.c b/gnu/lib/libiberty/src/xexit.c index 431bbe02991..a65690f09c3 100644 --- a/gnu/lib/libiberty/src/xexit.c +++ b/gnu/lib/libiberty/src/xexit.c @@ -17,10 +17,27 @@ 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 "ansidecl.h" -#include "libiberty.h" +/* + +@deftypefn Replacement void xexit (int @var{code}) + +Terminates the program. If any functions have been registered with +the @code{xatexit} replacement function, they will be called first. +Termination is handled via the system's normal @code{exit} call. + +@end deftypefn +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <stdio.h> +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#include "libiberty.h" + /* This variable is set by xatexit if it is called. This way, xmalloc doesn't drag xatexit into the link. */ diff --git a/gnu/lib/libiberty/src/xmalloc.c b/gnu/lib/libiberty/src/xmalloc.c index 621c6d216c7..4c8249ae70b 100644 --- a/gnu/lib/libiberty/src/xmalloc.c +++ b/gnu/lib/libiberty/src/xmalloc.c @@ -17,6 +17,52 @@ 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. */ +/* + +@deftypefn Replacement void* xmalloc (size_t) + +Allocate memory without fail. If @code{malloc} fails, this will print +a message to @code{stderr} (using the name set by +@code{xmalloc_set_program_name}, +if any) and then call @code{xexit}. Note that it is therefore safe for +a program to contain @code{#define malloc xmalloc} in its source. + +@end deftypefn + +@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size}) +Reallocate memory without fail. This routine functions like @code{realloc}, +but will behave the same as @code{xmalloc} if memory cannot be found. + +@end deftypefn + +@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize}) + +Allocate memory without fail, and set it to zero. This routine functions +like @code{calloc}, but will behave the same as @code{xmalloc} if memory +cannot be found. + +@end deftypefn + +@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name}) + +You can use this to set the name of the program used by +@code{xmalloc_failed} when printing a failure message. + +@end deftypefn + +@deftypefn Replacement void xmalloc_failed (size_t) + +This function is not meant to be called by client code, and is listed +here for completeness only. If any of the allocation routines fail, this +function will be called to print an error message and terminate execution. + +@end deftypefn + +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" @@ -61,6 +107,31 @@ xmalloc_set_program_name (s) #endif /* HAVE_SBRK */ } +void +xmalloc_failed (size) + size_t size; +{ +#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%sout of memory allocating %lu bytes after a total of %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size, (unsigned long) allocated); +#else /* HAVE_SBRK */ + fprintf (stderr, + "\n%s%sout of memory allocating %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* HAVE_SBRK */ + xexit (1); +} + PTR xmalloc (size) size_t size; @@ -71,27 +142,8 @@ xmalloc (size) size = 1; newmem = malloc (size); 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) size, (unsigned long) allocated); -#else /* HAVE_SBRK */ - fprintf (stderr, - "\n%s%sCannot allocate %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size); -#endif /* HAVE_SBRK */ - xexit (1); - } + xmalloc_failed (size); + return (newmem); } @@ -106,27 +158,8 @@ xcalloc (nelem, elsize) 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); - } + xmalloc_failed (nelem * elsize); + return (newmem); } @@ -144,26 +177,7 @@ xrealloc (oldmem, size) else newmem = realloc (oldmem, size); 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 reallocate %lu bytes after allocating %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size, (unsigned long) allocated); -#else /* HAVE_SBRK */ - fprintf (stderr, - "\n%s%sCannot reallocate %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size); -#endif /* HAVE_SBRK */ - xexit (1); - } + xmalloc_failed (size); + return (newmem); } diff --git a/gnu/lib/libiberty/src/xmemdup.c b/gnu/lib/libiberty/src/xmemdup.c index f780041aa13..e19a72f1718 100644 --- a/gnu/lib/libiberty/src/xmemdup.c +++ b/gnu/lib/libiberty/src/xmemdup.c @@ -2,6 +2,19 @@ This trivial function is in the public domain. Jeff Garzik, September 1999. */ +/* + +@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size}) + +Duplicates a region of memory without fail. First, @var{alloc_size} bytes +are allocated, then @var{copy_size} bytes from @var{input} are copied into +it, and the new memory is returned. If fewer bytes are copied than were +allocated, the remaining memory is zeroed. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include "config.h" #endif |