diff options
author | camthesaxman <camthesaxman@users.noreply.github.com> | 2020-01-29 18:32:13 -0600 |
---|---|---|
committer | camthesaxman <camthesaxman@users.noreply.github.com> | 2020-01-29 18:32:13 -0600 |
commit | 9821a6af983f07bf146b19ca9993e37b88339bf2 (patch) | |
tree | 9ea2b3e93aa2695e5c0793a4e2643077d3a2c6c2 | |
parent | cdc6e2c50f96119bdc4c1205ff5901ca82ec8357 (diff) |
add some more files
114 files changed, 25180 insertions, 5288 deletions
@@ -2,6 +2,11 @@ set -e CCOPT= CXXOPT= + +[ ! -e gcc_arm/Makefile ] || make -C gcc_arm clean +CC="gcc -m32" cd gcc_arm && ./configure --target=arm-elf --host=i686-linux-gnu && make cc1 && cd .. +exit 0 + if [ ! -z "$CC" ]; then CCOPT=CC=$CC; fi if [ ! -z "$CXX" ]; then CXXOPT=CXX=$CXX; fi make -C gcc clean diff --git a/config.if b/config.if new file mode 100755 index 0000000..bcc0269 --- /dev/null +++ b/config.if @@ -0,0 +1,87 @@ +#! /dev/null +# Don't call it directly. This shell script fragment is called to +# determine: +# +# 1. libstcxx_interface: the interface name for libstdc++. +# 2. cxx_interface: the interface name for c++. +# 3. libc_interface: the interface name for libc. +# + +# Get the top level src dir. +if [ -z "${topsrcdir}" -a -z "${top_srcdir}" ] +then + echo "Undefined top level src dir: topsrcdir and top_srcdir are empty" >&2 + exit 1 +fi + +if [ -n "${topsrcdir}" ] +then + if_topsrcdir=${topsrcdir} +else + if_topsrcdir=${top_srcdir} +fi + +if [ -f ${if_topsrcdir}/libstdc++/Makefile.in ]; then +# We check libstdc++ for libstdcxx_interface. +libstdcxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/libstdc++/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'` +else +libstdcxx_interface= +fi + +if [ -f ${if_topsrcdir}/gcc/cp/Makefile.in ]; then +# We check gcc/cp for cxx_interface. +cxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/gcc/cp/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'` +else +cxx_interface= +fi + +# The trickiest part is libc_interface. +if [ -z "${libc_interface}" ] +then + case ${target_os} in + *linux*libc1*|*linux*libc5*) + case ${target_alias} in + *alpha*|*powerpc*) + libc_interface=-libc5.9- + ;; + *) + libc_interface=-libc5- + ;; + esac + ;; + *linux*gnu*) + # We have to work harder to figure it out. + if [ ${target_alias} = ${build_alias} ] + then + dummy=if$$ + cat >$dummy.c <<EOF +#include <features.h> +main(argc, argv) + int argc; + char *argv[]; +{ + printf("%d\n", __GLIBC_MINOR__); + return 0; +} +EOF + ${CC-cc} $dummy.c -o $dummy 2>/dev/null + if [ "$?" = 0 ] + then + libc_interface=-libc6.`./$dummy`- + rm -f $dummy.c $dummy + else + # It should never happen. + echo "Cannot find the GNU C library minor version number." >&2 + rm -f $dummy.c $dummy + exit 1 + fi + else + # Cross compiling. Assume glibc 2.1. + libc_interface=-libc6.1- + fi + ;; + *) + libc_interface=- + ;; + esac +fi diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..4dc4b6b --- /dev/null +++ b/config.sub @@ -0,0 +1,1274 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# 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. +# +# 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 +# (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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# 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. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# 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 + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# CYGNUS LOCAL marketing-names +# Here we handle any "marketing" names - translating them to +# standard triplets +case $1 in + mips-tx39-elf) + set mipstx39-unknown-elf + ;; + mips64vr5xxx-elf) + set mips64vr5000-elf + ;; + mips64vr5xxxel-elf) + set mips64vr5000el-elf + ;; + *) + ;; +esac +# END CYGNUS LOCAL marketing-names + +# 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*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond ) # CYGNUS LOCAL + os= + basic_machine=$1 + ;; + -scout) # CYGNUS LOCAL + ;; + -wrs) # CYGNUS LOCAL + os=vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +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 | sparc86x | v850 \ + | c4x) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[012346]0 | m683?2 | m68360 | m5200 | z8k | v70 \ + | h8500 | w65 | fr30) # CYGNUS LOCAL + basic_machine=$basic_machine-unknown + ;; + thumb) + basic_machine=$basic_machine-unknown + ;; + mips64vr4300 | mips64vr4300el) # CYGNUS LOCAL jsmith/vr4300 + basic_machine=$basic_machine-unknown + ;; + mips64vr4100 | mips64vr4100el) # CYGNUS LOCAL jsmith/vr4100 + basic_machine=$basic_machine-unknown + ;; + mips64vr5000 | mips64vr5000el) # CYGNUS LOCAL ian/vr5000 + basic_machine=$basic_machine-unknown + ;; + mips64vr5400) # CYGNUS LOCAL cagney/vr5400 + basic_machine=$basic_machine-unknown + ;; + mips16) + basic_machine=$basic_machine-unknown + ;; + tic30) # CYGNUS LOCAL ian/tic30 + basic_machine=$basic_machine-unknown + ;; + c30) # CYGNUS LOCAL ian/tic30 + basic_machine=tic30-unknown + ;; + + v850e) # CYGNUS LOCAL jtc/v850 + basic_machine=$basic_machine-unknown + ;; + v850ea) # CYGNUS LOCAL jtc/v850 + basic_machine=$basic_machine-unknown + ;; + d10v) + basic_machine=$basic_machine-unknown + ;; + d30v) # CYGNUS LOCAL hunt/d30v + basic_machine=$basic_machine-unknown + ;; + # 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) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + 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-* \ + | fr30-*) # CYGNUS LOCAL + ;; + m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-* | d10v-*) # CYGNUS LOCAL + ;; + thumb-*) # CYGNUS LOCAL angela/thumb + ;; + v850-*) # CYGNUS LOCAL + ;; + v850e-*) # CYGNUS LOCAL + ;; + v850ea-*) # CYGNUS LOCAL + ;; + d30v-*) # CYGNUS LOCAL + ;; + mips64vr4300-* | mips64vr4300el-*) # CYGNUS LOCAL jsmith/vr4300 + ;; + mips64vr4100-* | mips64vr4100el-*) # CYGNUS LOCAL jsmith/vr4100 + ;; + mips16-*) # CYGNUS LOCAL krk/mips16 + ;; + tic30-*) # CYGNUS LOCAL ian/tic30 + ;; + c30-*) # CYGNUS LOCAL ian/tic30 + basic_machine=tic30-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) # CYGNUS LOCAL + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) # CYGNUS LOCAL + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) # CYGNUS LOCAL + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) # CYGNUS LOCAL + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + 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 + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) # CYGNUS LOCAL + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) # CYGNUS LOCAL + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) # CYGNUS LOCAL + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + w89k-*) # CYGNUS LOCAL + basic_machine=hppa1.1-winbond + os=-proelf + ;; + op50n-*) # CYGNUS LOCAL + basic_machine=hppa1.1-oki + os=-proelf + ;; + op60c-*) # CYGNUS LOCAL + basic_machine=hppa1.1-oki + os=-proelf + ;; + hppro) # CYGNUS LOCAL + basic_machine=hppa1.1-hp + os=-proelf + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + 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] ) + basic_machine=hppa1.1-hp + ;; + 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 ) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679] ) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) # CYGNUS LOCAL + basic_machine=hppa1.1-hp + os=-osf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) # CYGNUS LOCAL + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) # CYGNUS LOCAL + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) # CYGNUS 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 + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) # CYGNUS LOCAL + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) # CYGNUS LOCAL + basic_machine=i386-unknown + os=-msdos + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown # CYGNUS LOCAL + os=-netbsd + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) # CYGNUS LOCAL + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) # CYGNUS LOCAL + basic_machine=i960-intel + os=-mon960 + ;; + np1) + basic_machine=np1-gould + ;; + OSE68000 | ose68000) # CYGNUS LOCAL + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) # CYGNUS LOCAL + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | k6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | k6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-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/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rom68k) # CYGNUS LOCAL + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) # CYGNUS LOCAL + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) # CYGNUS LOCAL + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) # CYGNUS LOCAL + basic_machine=m68k-tandem + ;; + stratus) # CYGNUS LOCAL + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) # CYGNUS LOCAL + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) # CYGNUS LOCAL + basic_machine=w65-wdc + os=-none + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) # CYGNUS LOCAL + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# 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) # CYGNUS LOCAL + basic_machine=hppa1.1-winbond + ;; + op50n) # CYGNUS LOCAL + basic_machine=hppa1.1-oki + ;; + op60c) # CYGNUS LOCAL + 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 + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) # CYGNUS LOCAL + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) # CYGNUS LOCAL + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + # CYGNUS LOCAL + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mon960* | -lnews* ) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + # END CYGNUS LOCAL + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) # CYGNUS LOCAL + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) # CYGNUS LOCAL + os=-ose + ;; + -es1800*) # CYGNUS LOCAL + os=-ose + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) # CYGNUS LOCAL + os=-aout + ;; + mips*-cisco) # CYGNUS LOCAL + os=-elf + ;; + mips*-*) # CYGNUS LOCAL + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) # CYGNUS LOCAL + os=-proelf + ;; + *-winbond) # CYGNUS LOCAL + os=-proelf + ;; + *-oki) # CYGNUS LOCAL + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *-rom68k) # CYGNUS LOCAL + os=-coff + ;; + *-*bug) # CYGNUS LOCAL + os=-coff + ;; + *-apple) # CYGNUS LOCAL + os=-macos + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) # CYGNUS LOCAL + vendor=hitachi + ;; + -mpw* | -macos*) # CYGNUS LOCAL + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/gcc_arm/Make-hooks b/gcc_arm/Make-hooks new file mode 100644 index 0000000..1fa9bbd --- /dev/null +++ b/gcc_arm/Make-hooks @@ -0,0 +1,21 @@ +lang.all.build: +lang.all.cross: +lang.start.encap: +lang.rest.encap: +lang.info: +lang.dvi: +lang.install-normal: +lang.install-common: +lang.install-info: +lang.install-man: +lang.uninstall: +lang.distdir: +lang.mostlyclean: +lang.clean: +lang.distclean: +lang.extraclean: +lang.maintainer-clean: +lang.stage1: +lang.stage2: +lang.stage3: +lang.stage4: diff --git a/gcc_arm/Make-host b/gcc_arm/Make-host new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc_arm/Make-host diff --git a/gcc_arm/Make-lang b/gcc_arm/Make-lang new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc_arm/Make-lang diff --git a/gcc_arm/Make-target b/gcc_arm/Make-target new file mode 100644 index 0000000..b57eeca --- /dev/null +++ b/gcc_arm/Make-target @@ -0,0 +1,35 @@ +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = arm/lib1funcs.asm +# CYGNUS LOCAL interworking +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX +# END CYGNUS LOCAL interworking + +# These are really part of libgcc1, but this will cause them to be +# built correctly, so... + +LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c + +fp-bit.c: $(srcdir)/config/fp-bit.c + echo '#define FLOAT' > fp-bit.c + echo '#ifndef __ARMEB__' >> fp-bit.c + echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c + echo '#endif' >> fp-bit.c + cat $(srcdir)/config/fp-bit.c >> fp-bit.c + +dp-bit.c: $(srcdir)/config/fp-bit.c + echo '#ifndef __ARMEB__' > dp-bit.c + echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c + echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c + echo '#endif' >> dp-bit.c + cat $(srcdir)/config/fp-bit.c >> dp-bit.c + +# CYGNUS LOCAL +MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float mapcs-32/mapcs-26 mno-thumb-interwork/mthumb-interwork fno-leading-underscore/fleading-underscore mcpu=arm7 +MULTILIB_DIRNAMES = le be fpu soft 32bit 26bit normal interwork elf under nofmult +MULTILIB_EXCEPTIONS = *mapcs-26/*mthumb-interwork* *mthumb-interwork*/*mcpu=arm7* +MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle mcpu?arm7=mcpu?arm7d mcpu?arm7=mcpu?arm7di mcpu?arm7=mcpu?arm70 mcpu?arm7=mcpu?arm700 mcpu?arm7=mcpu?arm700i mcpu?arm7=mcpu?arm710 mcpu?arm7=mcpu?arm710c mcpu?arm7=mcpu?arm7100 mcpu?arm7=mcpu?arm7500 mcpu?arm7=mcpu?arm7500fe mcpu?arm7=mcpu?arm6 mcpu?arm7=mcpu?arm60 mcpu?arm7=mcpu?arm600 mcpu?arm7=mcpu?arm610 mcpu?arm7=mcpu?arm620 +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib +# END CYGNUS LOCAL + +TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc diff --git a/gcc_arm/Makefile b/gcc_arm/Makefile new file mode 100644 index 0000000..05dbe09 --- /dev/null +++ b/gcc_arm/Makefile @@ -0,0 +1,2881 @@ +# Generated automatically from Makefile.in by configure. +# Makefile for GNU C compiler. +# Copyright (C) 1987, 88, 90-98, 1999 Free Software Foundation, Inc. + +#This file is part of GNU CC. + +#GNU CC is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 2, or (at your option) +#any later version. + +#GNU CC is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with GNU CC; see the file COPYING. If not, write to +#the Free Software Foundation, 59 Temple Place - Suite 330, +#Boston MA 02111-1307, USA. + +# The targets for external use include: +# all, doc, install, install-cross, install-cross-rest, +# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean, +# stage1, stage2, stage3, stage4. + +# Suppress smart makes who think they know how to automake Yacc files +.y.c: + +# Directory where sources are, from where we are. +srcdir = . + +# Variables that exist for you to override. +# See below for how to change them for certain systems. + +# List of language subdirectories. +# This is overridden by configure. +SUBDIRS = + +# Selection of languages to be made. +# This is overridden by configure. +CONFIG_LANGUAGES = +LANGUAGES = c $(CONFIG_LANGUAGES) + +# Selection of languages to be made during stage1 build. +# This is overridden by configure. +BOOT_LANGUAGES = c + +ALLOCA = +ALLOCA_FLAGS = +ALLOCA_FINISH = true + +# Various ways of specifying flags for compilations: +# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2. +# BOOT_CFLAGS is the value of CFLAGS to pass +# to the stage2 and stage3 compilations +# WARN_CFLAGS are the warning flags to pass to stage2 and stage3. +# (And for stage 1 if the native compiler is GCC.) It is +# separate from BOOT_CFLAGS because people tend to override optimization +# flags and we'd like them to still have warnings turned on. They are free +# to explicitly turn warnings off if they wish. +# XCFLAGS is used for most compilations but not when using the GCC just built. +# TCFLAGS is used for compilations with the GCC just built. +XCFLAGS = +TCFLAGS = +# CYGNUS LOCAL nowarnings/law +CFLAGS = -g +BOOT_CFLAGS = -O2 $(CFLAGS) +WARN_CFLAGS = +# END CYGNUS LOCAL +# These exists to be overridden by the x-* and t-* files, respectively. +X_CFLAGS = +T_CFLAGS = + +X_CPPFLAGS = +T_CPPFLAGS = + +CC = gcc +# srcdir might be a relative pathname which won't be valid in a subdirectory, +# so we must use objdir/srcdir instead to make it safe. objdir is always +# a full pathname. +BISON = `if [ -f $(objdir)/../bison/bison ] ; then case $(srcdir) in \ + /*) echo $(objdir)/../bison/bison -L $(srcdir)/../bison/ ;; \ + *) echo $(objdir)/../bison/bison -L $(objdir)/$(srcdir)/../bison/ ;; \ + esac; else echo bison ; fi` +BISONFLAGS = +LEX = `if [ -f $(objdir)/../flex/flex ] ; then echo $(objdir)/../flex/flex ; else echo flex ; fi` +LEXFLAGS = +AR = ar +AR_FLAGS = rc +LN = ln -s +DLLTOOL = dlltool +SHELL = /bin/sh +# on sysV, define this as cp. +INSTALL = /usr/bin/install -c +# Some systems may be missing symbolic links, regular links, or both. +# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate. +LN=ln +LN_S=ln -s +# These permit overriding just for certain files. +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +MAKEINFO = makeinfo +MAKEINFOFLAGS = +TEXI2DVI = texi2dvi +# For GNUmake: let us decide what gets passed to recursive makes. +MAKEOVERRIDES = + + +# Define this as & to perform parallel make on a Sequent. +# Note that this has some bugs, and it seems currently necessary +# to compile all the gen* files first by hand to avoid erroneous results. +P = + +# How to invoke ranlib. +RANLIB = ranlib +# Test to use to see whether ranlib exists on the system. +RANLIB_TEST = \ + [ -f $(RANLIB) ] \ + || ( [ "$(host_canonical)" = "$(target)" ] \ + && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ) + +# Compiler to use for compiling libgcc1.a. +# OLDCC should not be the GNU C compiler, +# since that would compile typical libgcc1.a functions such as mulsi3 +# into infinite recursions. +OLDCC = cc + +# CFLAGS for use with OLDCC, for compiling libgcc1.a. +# NOTE: -O does not work on some Unix systems! +CCLIBFLAGS = -O + +# Version of ar to use when compiling libgcc1.a. +OLDAR = ar +OLDAR_FLAGS = qc + +# Target to use when installing include directory. Either +# install-headers-tar or install-headers-cpio. +INSTALL_HEADERS_DIR = install-headers-tar + +# Header files that are made available under the same name +# to programs compiled with GCC. +USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \ + $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \ + $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \ + $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \ + $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10200.h \ + $(srcdir)/ginclude/va-mn10300.h $(srcdir)/ginclude/va-pa.h \ + $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \ + $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \ + $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \ + $(srcdir)/ginclude/va-v850.h $(srcdir)/ginclude/va-arc.h \ + $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \ + $(CYGNUS-LOCAL-d10v) $(srcdir)/ginclude/va-d10v.h \ + $(CYGNUS-LOCAL-fr30) $(srcdir)/ginclude/va-fr30.h \ + $(CYGNUS-LOCAL-d30v) $(srcdir)/ginclude/va-d30v.h \ + $(srcdir)/ginclude/va-c4x.h $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) \ + $(srcdir)/ginclude/proto.h $(srcdir)/ginclude/stdbool.h + +# Target to use whe installing assert.h. Some systems may +# want to set this empty. +INSTALL_ASSERT_H = install-assert-h + +# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test. +# Usually the one we just built. +# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS). +GCC_FOR_TARGET = ./xgcc -B./ -B$(build_tooldir)/bin/ + +# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. +# It omits XCFLAGS, and specifies -B./. +# It also specifies -I./include to find, e.g., stddef.h. +GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS) + +# Sed command to transform gcc to installed name. Overwritten by configure. +program_transform_name = s,x,x, +program_transform_cross_name = s,^,$(target_alias)-, + +build_canonical = i686-pc-linux-gnu +host_canonical = i686-pc-linux-gnu + +# Tools to use when building a cross-compiler. +# These are used because `configure' appends `cross-make' +# to the makefile when making a cross-compiler. + +# Use the tools from the build tree, if they are available. + +# objdir is set by configure. +objdir = /home/cameron/programming/agbcc2/gcc_arm + +AR_FOR_TARGET = ` \ + if [ -f $(objdir)/../binutils/ar ] ; then \ + echo $(objdir)/../binutils/ar ; \ + else \ + if [ "$(host_canonical)" = "$(target)" ] ; then \ + echo ar; \ + else \ + t='$(program_transform_name)'; echo ar | sed -e $$t ; \ + fi; \ + fi` +AR_FLAGS_FOR_TARGET = rc +RANLIB_FOR_TARGET = ` \ + if [ -f $(objdir)/../binutils/ranlib ] ; then \ + echo $(objdir)/../binutils/ranlib ; \ + else \ + if [ "$(host_canonical)" = "$(target)" ] ; then \ + echo ranlib; \ + else \ + t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \ + fi; \ + fi` +RANLIB_TEST_FOR_TARGET = \ + [ -f $(RANLIB_FOR_TARGET) ] \ + || ( [ "$(host_canonical)" = "$(target)" ] \ + && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ) + +# Dir to search for system headers. Overridden by cross-make. +SYSTEM_HEADER_DIR = /usr/include + +# Test to see whether <limits.h> exists in the system header files. +LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] + +# There may be a premade insn-attrtab.c for this machine. +# (You could rebuild it with genattrtab as usual, but it takes a long time.) +# PREMADE_ATTRTAB is the file name of the file to use. +# PREMADE_ATTRTAB_MD is the md file it corresponds to. +PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md. +PREMADE_ATTRTAB = + +target=arm-unknown-elf +target_alias=arm-elf +xmake_file= +tmake_file= ./config/arm/t-arm-elf +out_file=$(srcdir)/config/arm/arm.c +out_object_file=arm.o +md_file=$(srcdir)/config/arm/arm.md +tm_file= gansidecl.h $(srcdir)/config/arm/unknown-elf.h +build_xm_file= auto-host.h gansidecl.h $(srcdir)/config/i386/xm-i386.h +host_xm_file= auto-host.h gansidecl.h $(srcdir)/config/i386/xm-i386.h +lang_specs_files= +lang_options_files= +lang_tree_files= +GCC_THREAD_FILE=single +OBJC_BOEHM_GC= +JAVAGC=boehm +GTHREAD_FLAGS= +# Be prepared for gcc2 merges. +gcc_version=2.9-arm-000512 +gcc_version_trigger=./version.c +version=$(gcc_version) +mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` + +# Common prefix for installation directories. +# NOTE: This directory must exist when you start installation. +prefix = /usr/local +# Directory in which to put localized header files. On the systems with +# gcc as the native cc, `local_prefix' may not be `prefix' which is +# `/usr'. +# NOTE: local_prefix *should not* default from prefix. +local_prefix = $(prefix) +# Directory in which to put host dependent programs and libraries +exec_prefix = ${prefix} +# Directory in which to put the executable for the command `gcc' +bindir = ${exec_prefix}/bin +# Directory in which to put the directories used by the compiler. +libdir = ${exec_prefix}/lib +# Directory in which the compiler finds executables, libraries, etc. +libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version) +# Used to produce a relative $(gcc_tooldir) in gcc.o +unlibsubdir = ../../.. +# Directory in which to find other cross-compilation tools and headers. +dollar = +# Used in install-cross. +gcc_tooldir = $(libsubdir)/$(unlibsubdir)/../$(target_alias) +# Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/ +build_tooldir = $(exec_prefix)/$(target_alias) +# Directory in which the compiler finds g++ includes. +gcc_gxx_include_dir= $(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include/g++- +# Directory to search for site-specific includes. +includedir = $(local_prefix)/include +# assertdir is overridden in cross-make. +# (But this currently agrees with what is in cross-make.) +assertdir = $(gcc_tooldir)/include +# where the info files go +infodir = ${prefix}/info +# Extension (if any) to put in installed man-page filename. +manext = .1 +objext = .o +exeext = +build_exeext = + +# Directory in which to put man pages. +mandir = ${prefix}/man +man1dir = $(mandir)/man1 +# Dir for temp files. +tmpdir = /tmp + +# CYGNUS LOCAL texinfo +# Directory where texinfo.tex lives +texidir = $(srcdir)/../texinfo +# END CYGNUS LOCAL + +# Additional system libraries to link with. +CLIB= + +# Change this to a null string if obstacks are installed in the +# system library. +OBSTACK=obstack.o + +# Configure will set these if you need vfprintf and possibly _doprnt support. +VFPRINTF= +DOPRINT= + +# Specify the rule for actually making libgcc.a, +LIBGCC = libgcc.a +# and the rule for installing it. +INSTALL_LIBGCC = install-libgcc + +# Specify the rule for actually making libgcc1.a. +# The value may be empty; that means to do absolutely nothing +# with or for libgcc1.a. +LIBGCC1 = libgcc1.a + +# Specify the rule for making libgcc1.a for a cross-compiler. +# The default rule assumes that libgcc1.a is supplied by the user. +CROSS_LIBGCC1 = libgcc1.cross + +# Specify the rule for actually making libgcc2.a. +LIBGCC2 = libgcc2.a + +# Options to use when compiling libgcc2.a. +# -g1 causes output of debug info only for file-scope entities. +# we use this here because that should be enough, and also +# so that -g1 will be tested. +# +LIBGCC2_DEBUG_CFLAGS = -g1 +LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED + +# Additional options to use when compiling libgcc2.a. +# Some targets override this to -Iinclude +LIBGCC2_INCLUDES = + +# Additional target-dependent options for compiling libgcc2.a. +TARGET_LIBGCC2_CFLAGS = + +# Things which must be built before building libgcc2.a. +# Some targets override this to stmp-int-hdrs +LIBGCC2_DEPS = + +# libgcc1-test target (must also be overridable for a target) +LIBGCC1_TEST = libgcc1-test + +# List of extra executables that should be compiled for this target machine +# that are used for compiling from source code to object code. +# The rules for compiling them should be in the t-* file for the machine. +EXTRA_PASSES = + +# Like EXTRA_PASSES, but these are used when linking. +EXTRA_PROGRAMS = + +# List of extra object files that should be compiled and linked with +# compiler proper (cc1, cc1obj, cc1plus). +EXTRA_OBJS = + +# List of extra object files that should be compiled and linked with +# the gcc driver. +EXTRA_GCC_OBJS = + +# List of additional header files to install. +# Often this is edited directly by `configure'. +EXTRA_HEADERS = + +# List of extra C and assembler files to add to libgcc1.a. +# Assembler files should have names ending in `.asm'. +LIB1FUNCS_EXTRA = + +# List of extra C and assembler files to add to libgcc2.a. +# Assembler files should have names ending in `.asm'. +LIB2FUNCS_EXTRA = + +# We do not try to build float.h anymore. Let configure select the +# appropriate pre-built float.h file for the target. +FLOAT_H=float-i64.h + +# Program to convert libraries. +LIBCONVERT = + +# Control whether header files are installed. +INSTALL_HEADERS=install-headers + +# Options for tar when copying trees. So HPUX can override it. +TAROUTOPTS = xpBf + +# A list of all the language-specific executables. +# This is overridden by configure. +COMPILERS = cc1$(exeext) + +# List of things which should already be built whenever we try to use xgcc +# to compile anything (without linking). +GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) + +# List of things which should already be built whenever we try to use xgcc +# to link anything. +GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) + +# Directory to link to, when using the target `maketest'. +DIR = ../gcc + +# Guaranteed to not exist when not passing md through cpp. +# This value is overridden directly by configure. +MD_FILE = md-cpp-not-used + +# Flags to use when cross-building GCC. +# Prefix to apply to names of object files when using them +# to run on the machine we are compiling on. +HOST_PREFIX= +# Prefix to apply to names of object files when compiling them +# to run on the machine we are compiling on. +# The default for this variable is chosen to keep these rules +# out of the way of the other rules for compiling the same source files. +HOST_PREFIX_1=loser- +HOST_CC=$(CC) +HOST_CFLAGS=$(ALL_CFLAGS) +HOST_CLIB=$(CLIB) +HOST_LDFLAGS=$(LDFLAGS) +HOST_CPPFLAGS=$(ALL_CPPFLAGS) +HOST_ALLOCA=$(ALLOCA) +HOST_MALLOC=$(MALLOC) +HOST_OBSTACK=$(OBSTACK) +HOST_VFPRINTF=$(VFPRINTF) +HOST_DOPRINT=$(DOPRINT) + +# Actual name to use when installing a native compiler. +GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t` + +# Actual name to use when installing a cross-compiler. +GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t` + +# Choose the real default target. +ALL=all.internal + +# Choose the real install target. +INSTALL_TARGET=install-normal + +# Setup the testing framework, if you have one +EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \ + echo $${rootme}/../expect/expect ; \ + else echo expect ; fi` + +RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \ + echo $${srcdir}/../dejagnu/runtest ; \ + else echo runtest; fi` +RUNTESTFLAGS = + +# End of variables for you to override. + +# Definition of `all' is here so that new rules inserted by sed +# do not specify the default target. +# The real definition is under `all.internal' (for native compilers) +# or `all.cross' (for cross compilers). +all: all.indirect + +# This tells GNU Make version 3 not to put all variables in the environment. +.NOEXPORT: + +# sed inserts variable overrides after the following line. +####target overrides + +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = arm/lib1funcs.asm +# CYGNUS LOCAL interworking +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX +# END CYGNUS LOCAL interworking + +# These are really part of libgcc1, but this will cause them to be +# built correctly, so... + +LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c + +fp-bit.c: $(srcdir)/config/fp-bit.c + echo '#define FLOAT' > fp-bit.c + echo '#ifndef __ARMEB__' >> fp-bit.c + echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c + echo '#endif' >> fp-bit.c + cat $(srcdir)/config/fp-bit.c >> fp-bit.c + +dp-bit.c: $(srcdir)/config/fp-bit.c + echo '#ifndef __ARMEB__' > dp-bit.c + echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c + echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c + echo '#endif' >> dp-bit.c + cat $(srcdir)/config/fp-bit.c >> dp-bit.c + +# CYGNUS LOCAL +MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float mapcs-32/mapcs-26 mno-thumb-interwork/mthumb-interwork fno-leading-underscore/fleading-underscore mcpu=arm7 +MULTILIB_DIRNAMES = le be fpu soft 32bit 26bit normal interwork elf under nofmult +MULTILIB_EXCEPTIONS = *mapcs-26/*mthumb-interwork* *mthumb-interwork*/*mcpu=arm7* +MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle mcpu?arm7=mcpu?arm7d mcpu?arm7=mcpu?arm7di mcpu?arm7=mcpu?arm70 mcpu?arm7=mcpu?arm700 mcpu?arm7=mcpu?arm700i mcpu?arm7=mcpu?arm710 mcpu?arm7=mcpu?arm710c mcpu?arm7=mcpu?arm7100 mcpu?arm7=mcpu?arm7500 mcpu?arm7=mcpu?arm7500fe mcpu?arm7=mcpu?arm6 mcpu?arm7=mcpu?arm60 mcpu?arm7=mcpu?arm600 mcpu?arm7=mcpu?arm610 mcpu?arm7=mcpu?arm620 +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib +# END CYGNUS LOCAL + +TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc + +####host overrides + + +####cross overrides +CROSS=-DCROSS_COMPILE + +# Build libgcc1.a for a cross-compiler. +# By default this expects the user to provide libgcc1.a, +# and gives up immediately if the user has not done so. +LIBGCC1 = $(CROSS_LIBGCC1) + +# Dir to search for system headers. Normally /usr/include. +# Use CROSS_INCLUDE_DIR not TOOL_INCLUDE_DIR for other vendor's headers. +SYSTEM_HEADER_DIR = $(tooldir)/sys-include + +# Don't try to compile the things we can't compile. +ALL = all.cross + +# Don't install assert.h in /usr/local/include. +assertdir = $(tooldir)/include + +####build overrides + + +# CYGNUS LOCAL --site +####site overrides +# END CYGNUS LOCAL +# +# Now figure out from those variables how to compile and link. + +all.indirect: $(ALL) + +# IN_GCC tells various files that system.h, toplev.c, etc are available. +INTERNAL_CFLAGS = $(CROSS) -DIN_GCC $(SCHED_CFLAGS) -DMULTIBYTE_CHARS=1 + +# This is the variable actually used when we compile. +# If you change this line, you probably also need to change the definition +# of HOST_CFLAGS in build-make to match. +ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \ + -DHAVE_CONFIG_H + +# Likewise. +ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) + +# Even if ALLOCA is set, don't use it if compiling with GCC. +USE_ALLOCA= ${ALLOCA} +USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac ` +USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac ` +USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac ` +USE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac ` +USE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac ` + +# Dependency on obstack, alloca, malloc or whatever library facilities +# are not installed in the system libraries. +# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. +LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) + +# Likewise, for use in the tools that must run on this machine +# even if we are cross-building GCC. +# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. +HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT) + +# How to link with both our special library facilities +# and the system's installed libraries. +LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) $(CLIB) \ + ../libiberty/libiberty.a + +# Likewise, for use in the tools that must run on this machine +# even if we are cross-building GCC. +HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \ + $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) $(HOST_CLIB) + +HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o +HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o +HOST_PRINT = $(HOST_PREFIX)print-rtl.o + +# Specify the directories to be searched for header files. +# Both . and srcdir are used, in that order, +# so that tm.h and config.h will be found in the compilation +# subdirectory rather than in the source directory. +INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include + +# Always use -I$(srcdir)/config when compiling. +.c.o: + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + +# This tells GNU make version 3 not to export all the variables +# defined in this file into the environment. +.NOEXPORT: +# +# Support for additional languages (other than c and objc). +# ??? objc can be supported this way too (leave for later). + +# These next lines are overridden by configure. +LANG_MAKEFILES = +LANG_STAGESTUFF = +LANG_DIFF_EXCLUDES = +LANG_LIB2FUNCS = +LANG_EXTRA_HEADERS = + +# Flags to pass to recursive makes. +# CC is set by configure. Hosts without symlinks need special handling +# because we need CC="stage1/xgcc -Bstage1/" to work in the language +# subdirectories. +# ??? The choices here will need some experimenting with. +FLAGS_TO_PASS = \ + "AR_FLAGS_FOR_TARGET=$(AR_FLAGS_FOR_TARGET)" \ + "AR_FOR_TARGET=$(AR_FOR_TARGET)" \ + "BISON=$(BISON)" \ + "BISONFLAGS=$(BISONFLAGS)" \ + "CC=$(CC)" \ + "CFLAGS=$(CFLAGS)" \ + "CLIB=$(CLIB)" \ + "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LEX=$(LEX)" \ + "LEXFLAGS=$(LEXFLAGS)" \ + "LN=$(LN)" \ + "LN_S=$(LN_S)" \ + "MAKEINFO=$(MAKEINFO)" \ + "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \ + "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \ + "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \ + "SHELL=$(SHELL)" \ + "STAGE_PREFIX=$(STAGE_PREFIX)" \ + "exeext=$(exeext)" \ + "build_exeext=$(build_exeext)" \ + "objext=$(objext)" \ + "exec_prefix=$(exec_prefix)" \ + "prefix=$(prefix)" \ + "local_prefix=$(local_prefix)" \ + "gxx_include_dir=$(gcc_gxx_include_dir)" \ + "tooldir=$(tooldir)" \ + "gcc_tooldir=$(gcc_tooldir)" \ + "bindir=$(bindir)" \ + "libsubdir=$(libsubdir)" +# +# Lists of files for various purposes. + +# Language-specific object files for C and Objective C. +C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \ + c-aux-info.o c-common.o c-iterate.o + +# Language-specific object files for C. +C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS) + +SCHED_PREFIX = +SCHED_CFLAGS = + +# Language-independent object files. +OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \ + function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \ + varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o regmove.o \ + dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o \ + integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \ + regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o gcse.o \ + insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \ + insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \ + $(CYGNUS-LOCAL-lcm) lcm.o \ + $(CYGNUS-LOCAL-range) range.o \ + insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \ + mbchar.o dyn-string.o splay-tree.o graph.o sbitmap.o resource.o + +# GEN files are listed separately, so they can be built before doing parallel +# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load +# them before rtl.o is compiled. +GEN= genemit genoutput genrecog genextract genflags gencodes genconfig \ + genpeep gengenrtl gencheck + +CCCP=cccp + +# Files to be copied away after each stage in building. +STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \ + insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \ + insn-attr.h insn-attrtab.c insn-opinit.c genrtl.c genrtl.h tree-check.h \ + s-flags s-config s-codes s-mlib s-under\ + s-output s-recog s-emit s-extract s-peep s-check \ + s-attr s-attrtab s-opinit \ + genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \ + genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \ + genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \ + genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \ + gencheck$(build_exeext) \ + xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \ + $(EXTRA_PROGRAMS) gcc-cross$(exeext) \ + $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \ + specs underscore.c \ + $(CYGNUS-LOCAL-range) *.range \ + *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \ + *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse \ + *.[si] libcpp.a \ + $(LANG_STAGESTUFF) + + +# Members of libgcc1.a. +LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ + _lshrsi3 _ashrsi3 _ashlsi3 \ + _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \ + _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \ + _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \ + _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \ + _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2 + +# Library members defined in libgcc2.c. +LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \ + _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \ + _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \ + _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \ + _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \ + _fixtfdi _fixunstfdi _floatditf \ + __gcc_bcmp _varargs __dummy _eprintf \ + _bb _shtab _clear_cache _trampoline __main _exit \ + _ctors _pure + +LIB2FUNCS_EH = _eh + +FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ + _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ + _lt_sf _le_sf _si_to_sf _sf_to_si _negate_sf _make_sf \ + _sf_to_df + +DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \ + _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \ + _lt_df _le_df _si_to_df _df_to_si _negate_df _make_df \ + _df_to_sf + +# The files that "belong" in CONFIG_H are deliberately omitted +# because having them there would not be useful in actual practice. +# All they would do is cause complete recompilation every time +# one of the machine description files is edited. +# That may or may not be what one wants to do. +# If it is, rm *.o is an easy way to do it. +# CONFIG_H = $(host_xm_file) $(tm_file) +CONFIG_H = +RTL_BASE_H = rtl.h rtl.def machmode.h machmode.def +RTL_H = $(RTL_BASE_H) genrtl.h +TREE_H = tree.h real.h tree.def machmode.h machmode.def tree-check.h +BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h +RECOG_H = recog.h +EXPR_H = expr.h insn-codes.h +REGS_H = regs.h varray.h machmode.h machmode.def +# +# Language makefile fragments. + +# The following targets define the interface between us and the languages. +# +# all.build, all.cross, start.encap, rest.encap, +# info, dvi, +# install-normal, install-common, install-info, install-man, +# uninstall, distdir, +# mostlyclean, clean, distclean, extraclean, maintainer-clean, +# stage1, stage2, stage3, stage4 +# +# Each language is linked in with a series of hooks (since we can't use `::' +# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info). +# Configure computes and adds these here. + +####language hooks + +lang.all.build: +lang.all.cross: +lang.start.encap: +lang.rest.encap: +lang.info: +lang.dvi: +lang.install-normal: +lang.install-common: +lang.install-info: +lang.install-man: +lang.uninstall: +lang.distdir: +lang.mostlyclean: +lang.clean: +lang.distclean: +lang.extraclean: +lang.maintainer-clean: +lang.stage1: +lang.stage2: +lang.stage3: +lang.stage4: + +# sed inserts language fragments after the following line. +####language fragments + + +# End of language makefile fragments. +# +# The only suffixes we want for implicit rules are .c and .o, so clear +# the list and add them. This speeds up GNU Make, and allows -r to work. +.SUFFIXES: +.SUFFIXES: .c .o + +Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \ + $(xmake_file) $(tmake_file) $(LANG_MAKEFILES) + $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \ + "$(xmake_file)" "$(tmake_file)" + cp config.status config.run + LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run + rm -f config.run + +# CYGNUS LOCAL: autoconf/wilson +# Don't automatically run autoconf, since configure.in might be accidentally +# newer than configure. Also, this writes into the source directory which +# might be on a read-only file system. +#$(srcdir)/configure: $(srcdir)/configure.in +# cd $(srcdir); autoconf + +# cstamp-h.in controls rebuilding of config.in. +# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't +# delete it. A stamp file is needed as autoheader won't update the file if +# nothing has changed. +# It remains in the source directory and is part of the distribution. +# This follows what is done in shellutils, fileutils, etc. +# "echo timestamp" is used instead of touch to be consistent with other +# packages that use autoconf (??? perhaps also to avoid problems with patch?). +# ??? Newer versions have a maintainer mode that may be useful here. +# CYGNUS LOCAL: autoheader/jason +# Don't run autoheader automatically either. +#$(srcdir)/config.in: $(srcdir)/cstamp-h.in +#$(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h +# cd $(srcdir) && autoheader +# @rm -f $(srcdir)/cstamp-h.in +# echo timestamp > $(srcdir)/cstamp-h.in +auto-host.h: cstamp-h ; @true +cstamp-h: config.in config.status + CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status + +# Really, really stupid make features, such as SUN's KEEP_STATE, may force +# a target to build even if it is up-to-date. So we must verify that +# config.status does not exist before failing. +config.status: configure version.c + @if [ ! -f config.status ] ; then \ + echo You must configure gcc. Look at the INSTALL file for details.; \ + false; \ + else \ + LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \ + fi + +all.internal: start.encap rest.encap +# This is what to compile if making a cross-compiler. +# Note that we can compile enquire using the cross-compiler just built, +# although we can't run it on this machine. +all.cross: native gcc-cross specs stmp-headers $(LIBGCC) \ + $(LIBGCC1_TEST) lang.all.cross +# This is what to compile if making gcc with a cross-compiler. +all.build: native xgcc$(exeext) lang.all.build +# This is what must be made before installing GCC and converting libraries. +start.encap: native xgcc$(exeext) specs $(LIBGCC1) xlimits.h lang.start.encap +# These can't be made until after GCC can run. +rest.encap: stmp-headers $(LIBGCC) lang.rest.encap +# This is what is made with the host's compiler +# whether making a cross compiler or not. +native: config.status auto-host.h cpp$(exeext) $(LANGUAGES) \ + $(EXTRA_PASSES) $(EXTRA_PROGRAMS) + +# Define the names for selecting languages in LANGUAGES. +C c: cc1$(exeext) + +# Tell GNU make these are phony targets. +.PHONY: C c + +# On the target machine, finish building a cross compiler. +# This does the things that can't be done on the host machine. +rest.cross: $(LIBGCC) specs + +# Verify that it works to compile and link libgcc1-test. +# If it does, then there are sufficient replacements for libgcc1.a. +libgcc1-test: libgcc1-test.o native $(GCC_PARTS) + @echo "Testing libgcc1. Ignore linker warning messages." + $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \ + -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name` +libgcc1-test.o: libgcc1-test.c native xgcc$(exeext) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c + +# Recompile all the language-independent object files. +# This is used only if the user explicitly asks for it. +compilations: ${OBJS} + +# Create a list of the language-independent object files so the language +# subdirectories needn't mention their names explicitly. +stamp-objlist: $(OBJS) + echo " $(OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist + +# We call this executable `xgcc' rather than `gcc' +# to avoid confusion if the current directory is in the path +# and CC is `gcc'. It is renamed to `gcc' when it is installed. +xgcc$(exeext): gcc.o version.o choose-temp.o pexecute.o prefix.o version.o \ + mkstemp.o $(LIBDEPS) $(EXTRA_GCC_OBJS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o prefix.o version.o \ + choose-temp.o pexecute.o mkstemp.o $(EXTRA_GCC_OBJS) $(LIBS) + +# Dump a specs file to make -B./ read these specs over installed ones. +specs: xgcc$(exeext) + $(GCC_FOR_TARGET) -dumpspecs > tmp-specs + mv tmp-specs specs + +# We do want to create an executable named `xgcc', so we can use it to +# compile libgcc2.a. +# Also create gcc-cross, so that install-common will install properly. +gcc-cross: xgcc$(exeext) + cp xgcc$(exeext) gcc-cross$(exeext) + +cc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS) + +# Build the version of limits.h that we will install. +xlimits.h: glimits.h limitx.h limity.h + if $(LIMITS_H_TEST) ; then \ + cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \ + else \ + cat $(srcdir)/glimits.h > tmp-xlimits.h; \ + fi + mv tmp-xlimits.h xlimits.h +# +# Build libgcc.a. +# This is done in two parts because some functions, in libgcc1.c, +# must be compiled with something other than GCC, +# while the rest, in libgcc2.c, must be compiled with xgcc. +# That means we can't do libgcc2.c until after xgcc, cc1, etc. + +# Use this as value of LIBGCC1 to cause conversion to GNU library format. +# LIBCONVERT should put its output in libgcc1.conv. +libgcc1.conv: libgcc1.a + $(LIBCONVERT) libgcc1.a libgcc1.conv + +# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely. +# Make an empty file instead. +libgcc1.null: $(GCC_PASSES) + echo "void __foo () {}" > dummy.c + $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) libgcc1.null dummy$(objext) + rm -f dummy$(objext) dummy.c + +# This is $(LIBGCC1) for a cross-compiler. +# We have no automatic way of building libgcc1.a, +# so it's up to the installer to find a way to do that. +# This rule deliberately does not depend on libgcc1.a +# so that it will fail if the installer hasn't provided it. +libgcc1.cross: + mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false) + +# Compile the library of arithmetic subroutines with the native compiler. +# Don't compile it with GCC! +# (That would cause most arithmetic functions to call themselves.) +# +# NOTE: If you modify these rules substantially, please be sure to +# check at least config/i386/t-sco5 and possibly other makefile +# fragments. +libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status + -rm -f tmplibgcc1.a +# Actually build it in tmplibgcc1.a, then rename at end, +# so that libgcc1.a itself remains nonexistent if compilation is aborted. +# -e causes any failing command to make this rule fail. +# -e doesn't work in certain shells, so we test $$? as well. +# lynx has a broken ar, it always complains when the initial library is +# empty, thus this command works only if we don't do -e +# There is a trailing backslash (\) deleted from the following line. +# set -e; + for name in $(LIB1FUNCS); \ + do \ + echo $${name}; \ + rm -f $${name}$(objext); \ + $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + mv libgcc1$(objext) $${name}$(objext); \ + $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \ + rm -f $${name}$(objext); \ + done +# Some shells crash when a loop has no items. +# So make sure there is always at least one--`..'. +# Then ignore it. +# We don't use -e here because there are if statements +# that should not make the command give up when the if condition is false. +# Instead, we test for failure after each command where it matters. + for file in .. $(LIB1FUNCS_EXTRA); \ + do \ + if [ x$${file} != x.. ]; then \ + name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \ + echo $${name}; \ + if [ $${name}.asm = $${file} ]; then \ + cp $${file} $${name}.s || exit 1; file=$${name}.s; \ + else true; fi; \ + $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + rm -f $${name}.s $${name}$(objext); \ + else true; \ + fi; \ + done + -if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) tmplibgcc1.a; \ + else true; fi + mv tmplibgcc1.a libgcc1.a + +# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of +# functions. LIB1ASMSRC is the name of the source file in the config +# subdirectory. +libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC) + -rm -f tmplibgcc1.a libgcc1.S + cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S +# Actually build it in tmplibgcc1.a, then rename at end, +# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted. +# -e causes any failing command to make this rule fail. +# -e doesn't work in certain shells, so we test $$? as well. +# lynx has a broken ar, it always complains when the initial library is +# empty, thus this command works only if we don't do -e +# There is a trailing backslash (\) deleted from the following line. +# set -e; + for name in $(LIB1ASMFUNCS); \ + do \ + echo $${name}; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + mv libgcc1$(objext) $${name}$(objext); \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \ + rm -f $${name}$(objext); \ + done + -rm -f libgcc1.S + mv tmplibgcc1.a libgcc1-asm.a + +# Generate assembly versions of the functions required for libgcc1. +# You'll still need to massage the code by hand (possibly hacking +# underscores and local labels) but this will get you started. +libgcc1.S: libgcc1.c $(CONFIG_H) config.status + -rm -f libgcc1.S + touch libgcc1.S + for name in $(LIB1FUNCS); \ + do \ + echo $${name}; \ + $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + echo '#ifdef ' L$${name} >> libgcc1.S; \ + cat libgcc1.s >> libgcc1.S; \ + echo '#endif /*' L$${name} '*/' >> libgcc1.S; \ + echo "" >> libgcc1.S; \ + done + +# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled. +# But recompiling cc1 should not force recompilation of libgcc2.a. +# If you want to force recompilation, delete libgcc2.a. +libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs + -if [ -f libgcc2.ready ] ; then \ + true; \ + else \ + touch libgcc2.ready; \ + fi + +LIB2ADD = $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS) +libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \ + machmode.h longlong.h config.status +# Actually build it in tmplibgcc2.a, then rename at end, +# so that libgcc2.a itself remains nonexistent if compilation is aborted. + -rm -f tmplibgcc2.a +# -e causes any failing command to make this rule fail. +# -e doesn't work in certain shells, so we test $$? as well. +# lynx has a broken ar, it always complains when the initial library is +# empty, thus this command works only if we don't do -e +# There is a trailing backslash (\) deleted from the following line. +# set -e; + for name in $(LIB2FUNCS); \ + do \ + echo $${name}; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ + $(srcdir)/libgcc2.c -o $${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ + rm -f $${name}$(objext); \ + done + for name in $(LIB2FUNCS_EH); \ + do \ + echo $${name}; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -fexceptions $(INCLUDES) -c \ + -DL$${name} $(srcdir)/libgcc2.c -o $${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ + rm -f $${name}$(objext); \ + done + if [ x$(FPBIT) != x ]; then \ + for name in $(FPBIT_FUNCS); \ + do \ + echo $${name}; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ + -DFINE_GRAINED_LIBRARIES $(FPBIT) -o $${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ + rm -f $${name}$(objext); \ + done; \ + else true; fi; + if [ x$(DPBIT) != x ]; then \ + for name in $(DPBIT_FUNCS); \ + do \ + echo $${name}; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ + -DFINE_GRAINED_LIBRARIES $(DPBIT) -o $${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ + rm -f $${name}$(objext); \ + done; \ + else true; fi; +# Some shells crash when a loop has no items. +# So make sure there is always at least one--`..'. +# Then ignore it. +# We don't use -e here because there are if statements +# that should not make the command give up when the if condition is false. +# Instead, we test for failure after each command where it matters. + for file in $(LIB2ADD); do \ + name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \ + oname=` echo $${name} | sed -e 's,.*/,,'`; \ + if [ $${name}.txt = $${file} ]; then \ + for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \ + $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ + AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" CC="$(CC)" \ + CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \ + HOST_PREFIX_1="$(HOST_PREFIX_1)" \ + LANGUAGES="$(LANGUAGES)" \ + LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${f}; \ + rm -f $${f}; \ + else true; \ + fi; done; \ + else \ + echo $${name}; \ + if [ $${name}.asm = $${file} ]; then \ + cp $${file} $${name}.s || exit 1; file=$${name}.s; \ + else true; fi; \ + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \ + rm -f $${name}.s $${oname}$(objext); \ + fi; \ + done + mv tmplibgcc2.a libgcc2.a +# These lines were deleted from above the mv command +# because ranlibing libgcc.a itself should suffice. +# -if [ x${HPUX_GAS} = x ] ; then \ +# if $(RANLIB_TEST_FOR_TARGET) ; then \ +# $(RANLIB_FOR_TARGET) tmplibgcc2.a; +# else true; fi; \ +# else true; fi + +# Combine the various libraries into a single library, libgcc.a. +libgcc.a: $(LIBGCC1) $(LIBGCC2) + -rm -rf tmplibgcc.a libgcc.a tmpcopy + mkdir tmpcopy + -if [ x$(LIBGCC1) != x ]; \ + then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \ + else true; \ + fi +# Some versions of ar (specifically the one in RISC/os 5.x), create an +# unwritable table of contents file, and then print an error message when +# the second ar command tries to overwrite this file. To avoid the error +# message from ar, we make sure all files are writable. + -(cd tmpcopy; chmod +w * > /dev/null 2>&1) + (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2)) + (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext)) + rm -rf tmpcopy + -if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) tmplibgcc.a; \ + else true; fi +# Actually build it in tmplibgcc.a, then rename at end, +# so that libgcc.a itself remains nonexistent if compilation is aborted. + mv tmplibgcc.a libgcc.a + +# Use the genmultilib shell script to generate the information the gcc +# driver program needs to select the library directory based on the +# switches. +multilib.h: s-mlib; @true +s-mlib: $(srcdir)/genmultilib Makefile + $(SHELL) $(srcdir)/genmultilib \ + "$(MULTILIB_OPTIONS)" \ + "$(MULTILIB_DIRNAMES)" \ + "$(MULTILIB_MATCHES)" \ + "$(MULTILIB_EXCEPTIONS)" \ + "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h + $(srcdir)/move-if-change tmp-mlib.h multilib.h + touch s-mlib + +# Build multiple copies of libgcc.a, one for each target switch. +stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \ + $(LIB2ADD) machmode.h longlong.h config.status + for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \ + dir=`echo $$i | sed -e 's/;.*$$//'`; \ + flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ + $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ + AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + CC="$(CC)" CFLAGS="$(CFLAGS)" \ + RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ + RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ + LANGUAGES="$(LANGUAGES)" \ + HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ + LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \ + MULTILIB_CFLAGS="$${flags}" \ + LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \ + dir="$${dir}" stmp-multilib-sub; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + done + touch stmp-multilib + +# Subroutine of stmp-multilib so make -n works. +stmp-multilib-sub: + rm -f $(LIBGCC2) + if [ -d $(dir) ]; then \ + cd $(dir); \ + rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \ + else true; \ + fi + $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ + AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + CC="$(CC)" CFLAGS="$(CFLAGS)" \ + HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ + LANGUAGES="$(LANGUAGES)" \ + LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2) + if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \ + then true; \ + else rm -f $(LIBGCC1); \ + fi + if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \ + then true; \ + else \ + $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ + AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + CC="$(CC)" CFLAGS="$(CFLAGS)" \ + HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ + LANGUAGES="$(LANGUAGES)" \ + LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \ + fi + rm -rf tmplibgcc.a tmpcopy + mkdir tmpcopy + if [ x$(LIBGCC1) != x ]; \ + then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \ + else true; \ + fi + (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2)) + (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext)) + rm -rf libgcc2.a tmpcopy + if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) tmplibgcc.a; \ + else true; fi + if [ -d $(dir) ]; then true; else mkdir $(dir); fi + mv tmplibgcc.a $(dir)/libgcc.a + for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ + AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ + CC="$(CC)" CFLAGS="$(CFLAGS)" \ + HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ + LANGUAGES="$(LANGUAGES)" \ + MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \ + mv t$${f} $(dir)/$${f}; \ + else true; \ + fi; done + +# Compiling object files from source files. + +# Note that dependencies on obstack.h are not written +# because that file is not part of GCC. + +# C language specific files. + +# CYGNUS LOCAL: built in build directory +c-parse.o : c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \ + c-tree.h input.h flags.h system.h toplev.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c c-parse.c +c-parse.h : c-parse.c +c-parse.c : c-parse.y + @echo expect 46 shift/reduce conflicts. + $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c +c-parse.y : $(srcdir)/c-parse.in + echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y + sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ + -e "/^ifc$$/d" -e "/^end ifc$$/d" \ + $(srcdir)/c-parse.in >>tmp-c-parse.y + $(srcdir)/move-if-change tmp-c-parse.y c-parse.y + +# CYGNUS LOCAL: c-gperf.h really depends on c-parse.gperf. +$(srcdir)/c-gperf.h: + gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \ + -k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h + $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h + +c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \ + output.h toplev.h +c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \ + output.h $(EXPR_H) $(RTL_H) toplev.h +c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \ + output.h +# CYGNUS LOCAL: built in build directory +c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \ + c-parse.h input.h flags.h c-gperf.h c-pragma.h \ + toplev.h output.h mbchar.h +c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h +c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h +c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \ + function.h defaults.h c-pragma.h toplev.h +c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \ + flags.h toplev.h $(EXPR_H) +mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h +graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \ + hard-reg-set.h $(BASIC_BLOCK_H) +sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) + +hash.o: hash.c hash.h system.h toplev.h + +pexecute.o: $(srcdir)/../libiberty/pexecute.c $(CONFIG_H) system.h + rm -f pexecute.c + $(LN_S) $(srcdir)/../libiberty/pexecute.c pexecute.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) pexecute.c + +vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h + rm -f vfprintf.c + $(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) vfprintf.c + +splay-tree.o: $(srcdir)/../libiberty/splay-tree.c \ + $(srcdir)/../include/splay-tree.h $(srcdir)/../include/libiberty.h + rm -f splay-tree.c + $(LN_S) $(srcdir)/../libiberty/splay-tree.c splay-tree.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) splay-tree.c + +underscore.c: s-under ; @true + +s-under: $(GCC_PASSES) + echo "int xxy_us_dummy;" >tmp-dum.c + $(GCC_FOR_TARGET) -S tmp-dum.c + echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c + if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \ + echo "int prepends_underscore = 1;" >>tmp-under.c; \ + else \ + echo "int prepends_underscore = 0;" >>tmp-under.c; \ + fi + $(srcdir)/move-if-change tmp-under.c underscore.c + -rm -f tmp-dum.c tmp-dum.s + touch s-under + +# A file used by all variants of C. + +c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \ + flags.h toplev.h output.h c-pragma.h $(RTL_H) + +# Language-independent files. + +# CYGNUS LOCAL -- meissner/relative pathnames +DRIVER_DEFINES = \ + -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \ + -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \ + -DDEFAULT_TARGET_VERSION=\"$(version)\" \ + -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \ + -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \ + -DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" +gcc.o: gcc.c $(CONFIG_H) system.h multilib.h Makefile prefix.h \ + $(lang_specs_files) + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(DRIVER_DEFINES) \ + -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'` +# END CYGNUS LOCAL -- meissner/relative pathnames + +tree-check.h: s-check ; @true +s-check : gencheck $(srcdir)/move-if-change + ./gencheck > tmp-check.h + $(srcdir)/move-if-change tmp-check.h tree-check.h + touch s-check + +gencheck : gencheck.o tree.def $(lang_tree_files) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + gencheck.o $(HOST_LIBS) + +gencheck.o : gencheck.c hconfig.h system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencheck.c + +dumpvers: dumpvers.c + +version.o: version.c +obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H) + rm -f obstack.c + $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c + +choose-temp.o: $(srcdir)/../libiberty/choose-temp.c $(CONFIG_H) system.h + rm -f choose-temp.c + $(LN_S) $(srcdir)/../libiberty/choose-temp.c choose-temp.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) choose-temp.c + +mkstemp.o: $(srcdir)/../libiberty/mkstemp.c $(CONFIG_H) system.h + rm -f mkstemp.c + $(LN_S) $(srcdir)/../libiberty/mkstemp.c mkstemp.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) mkstemp.c + +prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DPREFIX=\"$(prefix)\" \ + -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'` + +convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h + +tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h +print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H) +stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \ + function.h $(EXPR_H) $(RTL_H) toplev.h except.h +fold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \ + $(RTL_H) +# CYGNUS LOCAL live range +toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \ + flags.h input.h insn-attr.h xcoffout.h defaults.h output.h range.h \ + insn-codes.h insn-config.h $(RECOG_H) Makefile toplev.h dwarfout.h \ + dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \ + $(lang_options_files) + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DTARGET_NAME=\"$(target_alias)\" \ + -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'` +# END CYGNUS LOCAL + +rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h + +print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h +rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H) + +varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \ + function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \ + xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h +function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \ + insn-config.h $(RECOG_H) output.h toplev.h except.h +stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \ + insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \ + loop.h $(RECOG_H) toplev.h output.h varray.h +except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \ + insn-config.h $(RECOG_H) output.h except.h toplev.h +expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \ + $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \ + typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h +calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \ + insn-flags.h $(REGS_H) toplev.h output.h +expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h +explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h insn-codes.h +optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h +# CYGNUS LOCAL live range +dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \ + insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \ + toplev.h range.h +# END CYGNUS LOCAL +sdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \ + function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \ + insn-config.h $(srcdir)/../include/obstack.h xcoffout.h c-pragma.h \ + sdbout.h toplev.h +dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \ + flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h +dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \ + flags.h insn-config.h reload.h output.h defaults.h \ + hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h +xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \ + flags.h toplev.h output.h dbxout.h +emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \ + $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h +real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h +getpwd.o : getpwd.c $(CONFIG_H) system.h + +integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ + integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \ + function.h output.h $(RECOG_H) except.h toplev.h + +jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \ + insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \ + toplev.h +stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \ + $(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h + +cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ + real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h +gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ + real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h +resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \ + $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h +# CYGNUS LOCAL lcm +lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ + real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) +loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \ + insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \ + toplev.h varray.h +unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \ + integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h varray.h +flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \ + $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h +combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \ + insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \ + $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h +regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \ + $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \ + output.h +local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \ + $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \ + insn-attr.h toplev.h +bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \ + $(REGS_H) +# CYGNUS LOCAL live range +range.o : range.c $(CONFIG_H) $(RTL_H) $(TREE_H) $(BASIC_BLOCK_H) flags.h \ + $(REGS_H) hard-reg-set.h insn-config.h recog.h output.h expr.h insn-codes.h \ + range.h function.h except.h system.h toplev.h +global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \ + $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h \ + range.h +#END CYGNUS LOCAL +varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h + +reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \ + reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \ + real.h toplev.h +reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \ + reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \ + $(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h +caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \ + $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \ + $(RECOG_H) reload.h $(EXPR_H) toplev.h +reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \ + $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h \ + insn-flags.h $(RECOG_H) flags.h output.h $(EXPR_H) +alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \ + $(REGS_H) toplev.h output.h $(EXPR_H) +regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \ + $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \ + $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h +$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \ + $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h \ + insn-attr.h toplev.h recog.h +# CYGNUS LOCAL live range +final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(REGS_H) \ + $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \ + hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h \ + toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h range.h +# END CYGNUS LOCAL +recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \ + $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \ + insn-flags.h insn-codes.h real.h toplev.h +reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \ + $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h +dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h + +$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \ + $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \ + insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file) + +# Build auxiliary files that support ecoff format. +mips-tfile: mips-tfile.o version.o $(LIBDEPS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS) + +mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) system.h machmode.h + +mips-tdump: mips-tdump.o version.o $(LIBDEPS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS) + +mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) system.h + +# Build file to support OSF/rose half-pic format. +halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H) system.h + +# Normally this target is not used; but it is used if you +# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c +# from the GNU Emacs distribution. +alloca.o: $(srcdir)/../libiberty/alloca.c + rm -f alloca.c + $(LN_S) $(srcdir)/../libiberty/alloca.c alloca.c + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \ + -c `echo alloca.c | sed 's,^\./,,'` + $(ALLOCA_FINISH) +# +# Generate header and source files from the machine description, +# and compile them. + +.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \ + insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \ + insn-attr.h insn-attrtab.c + +# The following pair of rules has this effect: +# genconfig is run only if the md has changed since genconfig was last run; +# but the file insn-config.h is touched only when its contents actually change. + +# Each of the other insn-* files is handled by a similar pair of rules. + +# This causes an anomaly in the results of make -n +# because insn-* is older than s-* +# and thus make -n thinks that insn-* will be updated +# and force recompilation of things that depend on it. +# We use move-if-change precisely to avoid such recompilation. +# But there is no way to teach make -n that it will be avoided. + +# Each of the insn-*.[ch] rules has a semicolon at the end, +# for otherwise the system Make on SunOS 4.1 never tries +# to recompile insn-*.o. To avoid problems and extra noise from +# versions of make which don't like empty commands (nothing after the +# trailing `;'), we call true for each. + +insn-config.h: s-config ; @true +s-config : $(md_file) genconfig $(srcdir)/move-if-change + ./genconfig $(md_file) > tmp-config.h + $(srcdir)/move-if-change tmp-config.h insn-config.h + touch s-config + +insn-flags.h: s-flags ; @true +s-flags : $(md_file) genflags $(srcdir)/move-if-change + ./genflags $(md_file) > tmp-flags.h + $(srcdir)/move-if-change tmp-flags.h insn-flags.h + touch s-flags + +insn-codes.h: s-codes ; @true +s-codes : $(md_file) gencodes $(srcdir)/move-if-change + ./gencodes $(md_file) > tmp-codes.h + $(srcdir)/move-if-change tmp-codes.h insn-codes.h + touch s-codes + +insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \ + insn-config.h insn-flags.h insn-codes.h system.h reload.h recog.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c + +insn-emit.c: s-emit ; @true +s-emit : $(md_file) genemit $(srcdir)/move-if-change + ./genemit $(md_file) > tmp-emit.c + $(srcdir)/move-if-change tmp-emit.c insn-emit.c + touch s-emit + +insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \ + real.h output.h flags.h system.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c + +insn-recog.c: s-recog ; @true +s-recog : $(md_file) genrecog $(srcdir)/move-if-change + ./genrecog $(md_file) > tmp-recog.c + $(srcdir)/move-if-change tmp-recog.c insn-recog.c + touch s-recog + +insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \ + insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c + +insn-opinit.c: s-opinit ; @true +s-opinit : $(md_file) genopinit $(srcdir)/move-if-change + ./genopinit $(md_file) > tmp-opinit.c + $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c + touch s-opinit + +insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \ + insn-config.h recog.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c + +insn-extract.c: s-extract ; @true +s-extract : $(md_file) genextract $(srcdir)/move-if-change + ./genextract $(md_file) > tmp-extract.c + $(srcdir)/move-if-change tmp-extract.c insn-extract.c + touch s-extract + +insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \ + system.h insn-config.h recog.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c + +insn-peep.c: s-peep ; @true +s-peep : $(md_file) genpeep $(srcdir)/move-if-change + ./genpeep $(md_file) > tmp-peep.c + $(srcdir)/move-if-change tmp-peep.c insn-peep.c + touch s-peep + +insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \ + output.h insn-attr.h insn-config.h system.h toplev.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c + +insn-attr.h: s-attr ; @true +s-attr : $(md_file) genattr $(srcdir)/move-if-change + ./genattr $(md_file) > tmp-attr.h + $(srcdir)/move-if-change tmp-attr.h insn-attr.h + touch s-attr + +insn-attrtab.c: s-attrtab ; @true +s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change + if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \ + then \ + echo Using $(PREMADE_ATTRTAB); \ + cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \ + else \ + ./genattrtab $(md_file) > tmp-attrtab.c; \ + fi + $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c + touch s-attrtab + +insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \ + hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \ + insn-codes.h system.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c + +insn-output.c: s-output ; @true +s-output : $(md_file) genoutput $(srcdir)/move-if-change + ./genoutput $(md_file) > tmp-output.c + $(srcdir)/move-if-change tmp-output.c insn-output.c + touch s-output + +genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h +genrtl.c genrtl.h : s-genrtl + @true # force gnu make to recheck modification times. + +s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H) + ./gengenrtl tmp-genrtl.h tmp-genrtl.c + $(srcdir)/move-if-change tmp-genrtl.h genrtl.h + $(srcdir)/move-if-change tmp-genrtl.c genrtl.c + touch s-genrtl + +# +# Compile the programs that generate insn-* from the machine description. +# They are compiled with $(HOST_CC), and associated libraries, +# since they need to run on this machine +# even if GCC is being compiled to run on some other machine. + +# $(CONFIG_H) is omitted from the deps of the gen*.o +# because these programs don't really depend on anything +# about the target machine. They do depend on config.h itself, +# since that describes the host machine. + +# Pass the md file through cpp if the target requests it. +$(MD_FILE): $(MD_DEPS) + rm -f $@ + $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@ + mv tmp-$@ $@ + +genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c + +genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c + +gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c + +genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c + +genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c + +genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c + +genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c + +genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c + +genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c + +genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS) + +genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) system.h insn-config.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c + +genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) + +genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c + +gengenrtl : gengenrtl.o $(HOST_LIBDEPS) + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ + gengenrtl.o $(HOST_LIBS) + +gengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c + +# +# Compile the libraries to be used by gen*. +# If we are not cross-building, gen* use the same .o's that cc1 will use, +# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict +# with the rules for rtl.o, alloca.o, etc. +$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h + rm -f $(HOST_PREFIX)rtl.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c + +$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H) + rm -f $(HOST_PREFIX)print-rtl.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c + +$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \ + flags.h $(BASIC_BLOCK_H) $(REGS_H) + rm -f $(HOST_PREFIX)bitmap.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c + +$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H) + rm -f $(HOST_PREFIX)rtlanal.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c + +$(HOST_PREFIX_1)alloca.o: $(srcdir)/../libiberty/alloca.c + rm -f $(HOST_PREFIX)alloca.c + $(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c + +$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c + rm -f $(HOST_PREFIX)obstack.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c + +$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c + rm -f $(HOST_PREFIX)vfprintf.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c + +$(HOST_PREFIX_1)doprint.o: doprint.c + rm -f $(HOST_PREFIX)doprint.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c + +$(HOST_PREFIX_1)malloc.o: malloc.c + rm -f $(HOST_PREFIX)malloc.c + sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c + $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c + +# This satisfies the dependency that we get if you cross-compile a compiler +# that does not need to compile alloca, malloc or whatever. +$(HOST_PREFIX_1): + touch $(HOST_PREFIX_1) + +# +# Remake cpp. + +# Making the preprocessor +cpp$(exeext): $(CCCP)$(exeext) + -rm -f cpp$(exeext) + $(LN) $(CCCP)$(exeext) cpp$(exeext) +cccp$(exeext): cccp.o cexp.o version.o prefix.o mbchar.o $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o mbchar.o \ + version.o $(LIBS) +# CYGNUS LOCAL: built in build directory +cexp.o: cexp.c $(CONFIG_H) system.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c cexp.c +cexp.c: $(srcdir)/cexp.y + $(BISON) $(BISONFLAGS) $(srcdir)/cexp.y -o cexp.c +# We use $(libsubdir)/$(unlibsubdir) to match the +# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used. +cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h \ + mbchar.h prefix.h Makefile + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ + -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ + -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ + -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ + -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ + -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'` + +LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \ + cppulp.o prefix.o version.o \ + mbchar.o + +# All the other archives built/used by this makefile are for targets. This +# one is strictly for the host. +# +libcpp.a: $(LIBCPP_OBJS) + $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS) + if $(RANLIB_TEST) ; then $(RANLIB) libcpp.a ; else true ; fi + +cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \ + libcpp.a $(LIBS) + +cppmain.o: cppmain.c $(CONFIG_H) cpplib.h machmode.h system.h + +cpplib.o: cpplib.c $(CONFIG_H) cpplib.h machmode.h cpphash.h config.status \ + system.h prefix.h Makefile + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ + -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ + -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ + -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ + -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ + -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'` + +cpperror.o: cpperror.c $(CONFIG_H) cpplib.h machmode.h system.h + +cppulp.o: cppulp.c $(CONFIG_H) system.h output.h + +cppexp.o: cppexp.c $(CONFIG_H) cpplib.h machmode.h system.h + +cppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h machmode.h system.h + +cpphash.o: cpphash.c cpplib.h machmode.h cpphash.h $(CONFIG_H) system.h + +cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h machmode.h system.h + +# Note for the stamp targets, we run the program `true' instead of +# having an empty command (nothing following the semicolon). + +getopt.o: $(srcdir)/../libiberty/getopt.c $(srcdir)/../include/getopt.h + rm -f getopt.c + $(LN_S) $(srcdir)/../libiberty/getopt.c getopt.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt.c + +getopt1.o: $(srcdir)/../libiberty/getopt1.c $(srcdir)/../include/getopt.h + rm -f getopt1.c + $(LN_S) $(srcdir)/../libiberty/getopt1.c getopt1.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt1.c + +# This info describes the target machine, so compile with GCC just built. +SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \ + stmp-int-hdrs + -rm -f SYSCALLS.c tmp-SYSCALLS.s + cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c + -rm -f SYSCALLS.c tmp-SYSCALLS.s + +# Build the include directory. The stamp files are stmp-* rather than +# s-* so that mostlyclean does not force the include directory to +# be rebuilt. + +# Build the include directory including float.h (which no longer depends upon +# enquire). +stmp-int-hdrs: $(USER_H) xlimits.h +# Copy in the headers provided with gcc. + rm -rf include + mkdir include + for file in .. $(USER_H); do \ + if [ X$$file != X.. ]; then \ + realfile=`basename $$file`; \ + cp $$file include; \ + chmod a+r include/$$realfile; \ + fi; \ + done + rm -f include/limits.h + cp xlimits.h include/limits.h + chmod a+r include/limits.h + rm -f include/float.h + if [ x$(FLOAT_H) != xMakefile.in ]; then \ + cp $(srcdir)/config/$(FLOAT_H) include/float.h && \ + chmod a+r include/float.h; \ + fi + +# Now that float.h no longer depends upon enquire, this is actually a no-op. +stmp-headers: + touch $@ + +# Remake the info files. +# CYGNUS LOCAL: built in build directory + +doc: info INSTALL +info: cpp.info gcc.info lang.info + +cpp.info: $(srcdir)/cpp.texi + $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi + +gcc.info: $(srcdir)/gcc.texi extend.texi install.texi invoke.texi \ + md.texi rtl.texi tm.texi + $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi + +dvi: gcc.dvi cpp.dvi lang.dvi + +gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi $(srcdir)/tm.texi + TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi + texindex gcc.?? + TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi + +cpp.dvi: $(srcdir)/cpp.texi + TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi + texindex cpp.?? + TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi + +# CYGNUS LOCAL doc +usegcc.dvi: usegcc.texi $(srcdir)/extend.texi $(srcdir)/invoke.texi $(srcdir)/md.texi + TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex usegcc.texi + texindex usegcc.?? + TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex usegcc.texi + +usegcc.texi: $(srcdir)/gcc.texi + sed -e '/@setfilename gcc.info/d' \ + -e '/@c @setfilename usegcc.info/s/@c //' \ + -e '/@set INTERNALS/s/@/@c @/' \ + -e '/@c @clear INTERNALS/s/@c //' \ + $(srcdir)/gcc.texi > usegcc.texi + + +usegcc.info: usegcc.texi $(srcdir)/extend.texi $(srcdir)/invoke.texi + $(MAKEINFO) -I$(srcdir) -o usegcc.info usegcc.texi + +# CYGNUS LOCAL: don't rebuild gcc/INSTALL, ever. +#INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi +# cd $(srcdir); $(MAKEINFO) -D INSTALLONLY \ +# --no-split -o INSTALL install1.texi +# +# Deletion of files made during compilation. +# There are four levels of this: +# `mostlyclean', `clean', `distclean' and `maintainer-clean'. +# `mostlyclean' is useful while working on a particular type of machine. +# It deletes most, but not all, of the files made by compilation. +# It does not delete libgcc.a or its parts, so it won't have to be recompiled. +# `clean' deletes everything made by running `make all'. +# `distclean' also deletes the files made by config. +# `maintainer-clean' also deletes everything that could be regenerated +# automatically, except for `configure'. +# We remove as much from the language subdirectories as we can +# (less duplicated code). + + +mostlyclean: lang.mostlyclean + -rm -f $(STAGESTUFF) +# Delete the temporary source copies for cross compilation. + -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c + -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c + -rm -f $(HOST_PREFIX_1)obstack.c +# Delete the temp files made in the course of building libgcc.a. + -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test + for name in $(LIB1FUNCS); do rm -f $${name}.c; done +# Delete other built files. + -rm -f t-float.h-cross xsys-protos.hT fp-bit.c dp-bit.c +# Delete the stamp and temporary files. + -rm -f s-* tmp-* stamp-* stmp-* + -rm -f */stamp-* */tmp-* +# Delete debugging dump files. + -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop + -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof + -rm -f *.regmove *.mach *.bp *.gcse + -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl + -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2 + -rm -f */*.sched2 */*.stack */*.regmove */*.gcse +# Delete some files made during installation. + -rm -f specs float.h-* enquire SYSCALLS.c.X SYSCALLS.c + -rm -f collect mips-tfile mips-tdump alloca.s +# CYGNUS LOCAL: binary installation +# Delete unwanted output files from TeX. + -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg + -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg +# Delete sorted indices we don't actually use. + -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns +# Delete core dumps. + -rm -f core */core +# CYGNUS LOCAL: built in build directory + -rm -f y.tab.c y.tab.h y.output +# Delete these files here instead of in realclean because they are now created +# in the build subdirectories. + -rm -f c-parse.c c-parse.output c-parse.h + -rm -f cexp.c cexp.output $(BUILD_SO1) $(BUILD_SO2) $(BUILD_SO3) +# END CYGNUS LOCAL +# CYGNUS LOCAL: live range + -rm -f *.range */*.range +# END CYGNUS LOCAL + -rm -f *.bp */*.bp + +# Delete all files made by compilation +# that don't exist in the distribution. +clean: mostlyclean lang.clean +# It may not be quite desirable to delete unprotoize.c here, +# but the spec for `make clean' requires it. +# Using unprotoize.c is not quite right in the first place, +# but what better way is there? + -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready + -rm -f libgcc1.null + -rm -f *.dvi + -rm -f */*.dvi + -if [ -f md.pre-cpp ]; then \ + rm -f md ; \ + fi +# Delete the include directory. + -rm -rf include +# Delete files used by the "multilib" facility (including libgcc subdirs). + -rm -f multilib.h tmpmultilib* + -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \ + rm -rf $(MULTILIB_DIRNAMES); \ + else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \ + rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \ + fi ; fi +# CYGNUS LOCAL: built in build directory + -rm -f c-parse.y +# END CYGNUS LOCAL + -rm -fr stage1 stage2 stage3 stage4 + +# Delete all files that users would normally create +# while building and installing GCC. +distclean: clean lang.distclean + -rm -f tm.h config.h auto-host.h auto-build.h tconfig.h hconfig.h + -rm -f md cstamp-h + -rm -f config.status config.run config.cache config.bak + -rm -f Make-lang Make-hooks Make-host Make-target + -rm -f Makefile specs.h options.h gencheck.h *.oaux + -rm -f gthr-default.h + -rm -f */stage1 */stage2 */stage3 */stage4 */include + -rm -f c-parse.output + -rm -f *.asm + -rm -f float.h + -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak + -rm -f testsuite/{gcc,g++}.{log,sum} + +# Delete anything likely to be found in the source directory +# that shouldn't be in the distribution. +extraclean: distclean lang.extraclean + -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~* + -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej + -rm -f config/*/=* config/*/"#"* config/*/*~* + -rm -f config/*/*.orig config/*/*.rej + -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz + -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs + -rm -f *lose config/*lose config/*/*lose + -rm -f *.s *.s[0-9] *.i config/ChangeLog + -rm -f */=* */"#"* */*~* + -rm -f */patch* */*.orig */*.rej + -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz + -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs + -rm -f */*lose */*.s */*.s[0-9] */*.i + +# Get rid of every file that's generated from some other file, except for `configure'. +# Most of these files ARE PRESENT in the GCC distribution. +maintainer-clean: + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + $(MAKE) distclean lang.maintainer-clean + -rm -f c-parse.y c-gperf.h + -rm -f c-parse.c c-parse.h c-parse.output + -rm -f cexp.c cexp.output TAGS + -rm -f cpp.info* cpp.??s cpp.*aux + -rm -f gcc.info* gcc.??s gcc.*aux +# CYGNUS LOCAL: Delete locally created files. + -rm -f *.as cp-hash.h +# END CYGNUS LOCAL + +# CYGNUS LOCAL: realclean +realclean: maintainer-clean +# END CYGNUS LOCAL +# +# Entry points `install' and `uninstall'. + +# The semicolon is to prevent the install.sh -> install default rule +# from doing anything. Having it run true helps avoid problems and +# noise from versions of make which don't like to have null commands. +install: $(INSTALL_TARGET) ; @true + +# Copy the compiler files into directories where they will be run. +# Install the driver last so that the window when things are +# broken is small. +# CYGNUS LOCAL: install-info done separately. +install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \ + install-man lang.install-normal install-driver + +# Do nothing while making gcc with a cross-compiler. The person who +# makes gcc for the target machine has to know how to put a complete +# gcc together by hand. +install-build: force + @echo You have to install gcc on your target machine by hand. + +# Run this on the target machine +# to finish installation of cross compiler. +# This is not used anymore now that float.h does not depend on enquire. +install-cross-rest: install-float-h-cross + +# Install float.h for cross compiler. +# Run this on the target machine! +# This is not used anymore now that float.h does not depend on enquire. +install-float-h-cross: installdirs +# if [ -f enquire ] ; then true; else false; fi +# Note: don't use -. We should fail right away if enquire was not made. + ./enquire -f > $(tmpdir)/float.h + -rm -f $(libsubdir)/include/float.h + $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h + -rm -f $(tmpdir)/float.h + chmod a-x $(libsubdir)/include/float.h + +# Create the installation directories. +installdirs: + -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi + -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi + -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi + -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi +# This dir isn't currently searched by cpp. +# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi + -fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \ + fdir=$${fdir}/$${dir}; \ + if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \ + done + -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi + -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi + -if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi + -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi + -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi +# We don't use mkdir -p to create the parents of man1dir, +# because some systems don't support it. +# Instead, we use this technique to create the immediate parent of man1dir. + -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \ + if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi + -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; chmod a+rx $(man1dir) ; fi + +# Install the compiler executables built during cross compilation. +install-common: native installdirs lang.install-common + for file in $(COMPILERS); do \ + if [ -f $$file ] ; then \ + rm -f $(libsubdir)/$$file; \ + $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \ + else true; \ + fi; \ + done + for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) ..; do \ + if [ x"$$file" != x.. ]; then \ + rm -f $(libsubdir)/$$file; \ + $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \ + else true; fi; \ + done +# Don't mess with specs if it doesn't exist yet. + -if [ -f specs ] ; then \ + rm -f $(libsubdir)/specs; \ + $(INSTALL_DATA) specs $(libsubdir)/specs; \ + chmod a-x $(libsubdir)/specs; \ + fi + +# Install the driver program as $(target_alias)-gcc +# and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc. +install-driver: xgcc$(exeext) + -if [ -f gcc-cross$(exeext) ] ; then \ + rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \ + $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \ + if [ -d $(gcc_tooldir)/bin/. ] ; then \ + rm -f $(gcc_tooldir)/bin/gcc$(exeext); \ + $(INSTALL_PROGRAM) gcc-cross$(exeext) $(gcc_tooldir)/bin/gcc$(exeext); \ + else true; fi; \ + else \ + rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \ + $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \ + rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \ + $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \ + mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \ + fi + +# Install the info files. +# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir +# to do the install. The sed rule was copied from stmp-int-hdrs. +# CYGNUS LOCAL: Handle an arbitrary set of .info files. +install-info: doc installdirs lang.install-info + -for i in *.info*; do \ + rm -f $(infodir)/$$i; \ + $(INSTALL_DATA) $$i $(infodir)/$$i; \ + done + -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ + if [ -f $(infodir)/dir ] ; then \ + for f in *.info; do \ + install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \ + done; \ + else true; fi; \ + else true; fi; + -chmod a-x $(infodir)/*.info* + +# CYGNUS LOCAL: clean-info +clean-info: + -rm -f *.info* + +# Install the man pages. +install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man + -if [ -f gcc-cross$(exeext) ] ; then \ + rm -f $(man1dir)/$(GCC_CROSS_NAME)$(manext); \ + $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(manext); \ + chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(manext); \ + else \ + rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \ + $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \ + chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \ + fi + -rm -f $(man1dir)/cccp$(manext) + -$(INSTALL_DATA) $(srcdir)/cccp.1 $(man1dir)/cccp$(manext) + -chmod a-x $(man1dir)/cccp$(manext) + # CYGNUS LOCAL: We install cpp.1. + -$(INSTALL_DATA) $(srcdir)/cpp.1 $(man1dir)/cpp$(manext) + -chmod a-x $(man1dir)/cpp$(manext) + +# Install the library. +install-libgcc: libgcc.a installdirs + -if [ -f libgcc.a ] ; then \ + rm -f $(libsubdir)/libgcc.a; \ + $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \ + if $(RANLIB_TEST_FOR_TARGET) ; then \ + (cd $(libsubdir); $(RANLIB_FOR_TARGET) libgcc.a); else true; fi; \ + chmod a-x $(libsubdir)/libgcc.a; \ + else true; fi + +# Install multiple versions of libgcc.a. +install-multilib: stmp-multilib installdirs + for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \ + dir=`echo $$i | sed -e 's/;.*$$//'`; \ + if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \ + for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \ + rm -f $(libsubdir)/$${dir}/$${f}; \ + $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \ + done; \ + if $(RANLIB_TEST_FOR_TARGET); then \ + (cd $(libsubdir)/$${dir}; $(RANLIB_FOR_TARGET) libgcc.a); \ + else true; fi; \ + chmod a-x $(libsubdir)/$${dir}/libgcc.a; \ + done + +# Install all the header files built in the include subdirectory. +install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H) +# Fix symlinks to absolute paths in the installed include directory to +# point to the installed directory, not the build directory. +# Don't need to use LN_S here since we really do need ln -s and no substitutes. + -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \ + if [ $$? -eq 0 ]; then \ + dir=`cd include; pwd`; \ + for i in $$files; do \ + dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \ + if expr "$$dest" : "$$dir.*" > /dev/null; then \ + rm -f $(libsubdir)/include/$$i; \ + ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \ + fi; \ + done; \ + fi + +# Create or recreate the gcc private include file directory. +install-include-dir: installdirs + -rm -rf $(libsubdir)/include + mkdir $(libsubdir)/include + -chmod a+rx $(libsubdir)/include + +# Install the include directory using tar. +install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir + (cd include; \ + tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - ) +# /bin/sh on some systems returns the status of the first tar, +# and that can lose with GNU tar which always writes a full block. +# So use `exit 0' to ignore its exit status. + +# Install the include directory using cpio. +install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir + (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include) + +# Put assert.h where it won't override GNU libc's assert.h. +# It goes in a dir that is searched after GNU libc's headers; +# thus, the following conditionals are no longer needed. +# But it's not worth deleting them now. +## Don't replace the assert.h already there if it is not from GCC. +## This code would be simpler if it tested for -f ... && ! grep ... +## but supposedly the ! operator is missing in sh on some systems. +install-assert-h: assert.h installdirs + if [ -f $(assertdir)/assert.h ]; \ + then \ + if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \ + then \ + rm -f $(assertdir)/assert.h; \ + $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \ + chmod a-x $(assertdir)/assert.h; \ + else true; \ + fi; \ + else \ + rm -f $(assertdir)/assert.h; \ + $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \ + chmod a-x $(assertdir)/assert.h; \ + fi + +# Cancel installation by deleting the installed files. +uninstall: lang.uninstall + -rm -rf $(libsubdir) + -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext) + -rm -rf $(man1dir)/$(GCC_INSTALL_NAME)$(manext) + -rm -rf $(man1dir)/$(GCC_CROSS_NAME)$(manext) + -rm -rf $(man1dir)/cccp$(manext) +# CYGNUS LOCAL: We install cpp.1. + -rm -rf $(man1dir)/cpp$(manext) + -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info* +# +# These targets are for the dejagnu testsuites. The file site.exp +# contains global variables that all the testsuites will use. + +# Set to $(target_alias)/ for cross. +target_subdir = arm-unknown-elf/ + +site.exp: ./config.status Makefile + @echo "Making a new config file..." + -@rm -f ./tmp? + @touch site.exp + -@mv site.exp site.bak + @echo "## these variables are automatically generated by make ##" > ./tmp0 + @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 + @echo "# add them to the last section" >> ./tmp0 + @echo "set rootme \"`pwd`\"" >> ./tmp0 + @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0 + @echo "set host_triplet $(host_canonical)" >> ./tmp0 + @echo "set build_triplet $(build_canonical)" >> ./tmp0 + @echo "set target_triplet $(target)" >> ./tmp0 + @echo "set target_alias $(target_alias)" >> ./tmp0 +# CFLAGS is set even though it's empty to show we reserve the right to set it. + @echo "set CFLAGS \"\"" >> ./tmp0 + @echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0 +# If newlib has been configured, we need to pass -B to gcc so it can find +# newlib's crt0.o if it exists. This will cause a "path prefix not used" +# message if it doesn't, but the testsuite is supposed to ignore the message - +# it's too difficult to tell when to and when not to pass -B (not all targets +# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that +# seems like too selective a test. +# ??? Another way to solve this might be to rely on linker scripts. Then +# theoretically the -B won't be needed. +# We also need to pass -L ../ld so that the linker can find ldscripts. + @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \ + echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \ + echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \ + echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \ + echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \ + echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \ + else true; \ + fi + @if [ -d $(objdir)/../ld ] ; then \ + echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \ + else true; \ + fi + echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 + @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0 + @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 + @cat ./tmp0 > site.exp + @cat site.bak | sed \ + -e '1,/^## All variables above are.*##/ d' >> site.exp + -@rm -f ./tmp? + +CHECK_TARGETS = check-gcc check-g++ check-g77 check-objc +# CYGNUS LOCAL don't build/check g77 or objc +CHECK_TARGETS = check-gcc check-g++ +# END CYGNUS LOCAL + +check: $(CHECK_TARGETS) + +testsuite/site.exp: site.exp + if [ -d testsuite ]; then \ + true; \ + else \ + mkdir testsuite; \ + fi + rm -rf testsuite/site.exp + cp site.exp testsuite/site.exp + +check-g++: testsuite/site.exp + -rootme=`pwd`; export rootme; \ + srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ + cd testsuite; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + if [ -f $${rootme}/../expect/expect ] ; then \ + TCL_LIBRARY=$${srcdir}/../tcl/library ; \ + export TCL_LIBRARY ; fi ; \ + $(RUNTEST) --tool g++ $(RUNTESTFLAGS) + +check-gcc: testsuite/site.exp + -rootme=`pwd`; export rootme; \ + srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ + cd testsuite; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + if [ -f $${rootme}/../expect/expect ] ; then \ + TCL_LIBRARY=$${srcdir}/../tcl/library ; \ + export TCL_LIBRARY ; fi ; \ + $(RUNTEST) --tool gcc $(RUNTESTFLAGS) + +check-g77: testsuite/site.exp + -rootme=`pwd`; export rootme; \ + srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ + cd testsuite; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + if [ -f $${rootme}/../expect/expect ] ; then \ + TCL_LIBRARY=$${srcdir}/../tcl/library ; \ + export TCL_LIBRARY ; fi ; \ + $(RUNTEST) --tool g77 $(RUNTESTFLAGS) + +check-objc: testsuite/site.exp + -rootme=`pwd`; export rootme; \ + srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ + cd testsuite; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + if [ -f $${rootme}/../expect/expect ] ; then \ + TCL_LIBRARY=$${srcdir}/../tcl/library ; \ + export TCL_LIBRARY ; fi ; \ + $(RUNTEST) --tool objc $(RUNTESTFLAGS) + +# CYGNUS LOCAL consistency testing/vmakarov +check-consistency: testsuite/site.exp + -rootme=`pwd`; export rootme; \ + srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ + cd testsuite; \ + EXPECT=${EXPECT} ; export EXPECT ; \ + if [ -f $${rootme}/../expect/expect ] ; then \ + TCL_LIBRARY=$${srcdir}/../tcl/library ; \ + export TCL_LIBRARY ; fi ; \ + $(RUNTEST) --tool consistency $(RUNTESTFLAGS) +# END CYGNUS LOCAL consistency testing/vmakarov + +# These exist for maintenance purposes. + +# Update the tags table. +TAGS: force + cd $(srcdir); \ + mkdir tmp-tags; \ + mv -f c-parse.[ch] cexp.c =*.[chy] tmp-tags; \ + etags *.y *.h *.c; \ + mv tmp-tags/* .; \ + rmdir tmp-tags + +# Create the distribution tar.gz file. +dist: tmp-gcc.xtar + gzip --best < tmp-gcc.xtar > tmp-gcc.xtar.gz + mv tmp-gcc.xtar.gz gcc-$(version).tar.gz + +tmp-gcc.xtar: distdir +# Make the distribution. + tar -chf tmp-gcc.xtar gcc-$(version) + +distdir-cvs: force + if [ -d $(srcdir)/CVS ]; then cd $(srcdir) && cvs -r update; fi + +# This target exists to do the initial work before the language specific +# stuff gets done. +# CYGNUS LOCAL: built in build directory +distdir-start: doc $(srcdir)/INSTALL c-parse.y $(srcdir)/c-gperf.h \ + c-parse.c cexp.c $(srcdir)/config.in $(srcdir)/version.c TAGS + @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \ + then true; \ + else echo "You must update the version number in \`gcc.texi'"; sleep 10;\ + fi +# Update the version number in README + awk '$$1 " " $$2 " " $$3 == "This directory contains" \ + { $$6 = version; print $$0 } \ + $$1 " " $$2 " " $$3 != "This directory contains"' \ + version=$(version) $(srcdir)/README > tmp.README + mv tmp.README README + -rm -rf gcc-$(version) tmp +# Put all the files in a temporary subdirectory +# which has the name that we want to have in the tar file. + mkdir tmp + mkdir tmp/config + mkdir tmp/ginclude + mkdir tmp/objc + for file in `(cd $(srcdir) && echo *[0-9a-zA-Z+])`; do \ + test -f $(srcdir)/$$file && $(LN_S) $(srcdir)/$$file tmp; \ + done + if test "$(srcdir)" != "." ; then \ + for file in c-parse.c cexp.c ; do \ + test -f ./$$file && $(LN_S) ../$$file tmp; \ + done; \ + fi + for file in `(cd $(srcdir)/config && echo *[0-9a-zA-Z+])`; do \ + if test -d $(srcdir)/config/$$file \ + && test "$$file" != RCS && test "$$file" != CVS; then \ + mkdir tmp/config/$$file; \ + for subfile in `(cd $(srcdir)/config/$$file && echo *[0-9a-zA-Z+])`; do \ + $(LN_S) $(srcdir)/config/$$file/$$subfile tmp/config/$$file; \ + done; \ + else \ + $(LN_S) $(srcdir)/config/$$file tmp/config; \ + fi; \ + done + for file in `(cd $(srcdir)/ginclude && echo *[0-9a-zA-Z+])`; do \ + $(LN_S) $(srcdir)/ginclude/$$file tmp/ginclude; \ + done + for file in `(cd $(srcdir)/objc && echo *[0-9a-zA-Z+])`; do \ + $(LN_S) $(srcdir)/objc/$$file tmp/objc; \ + done + $(LN_S) .gdbinit tmp + +# Finish making `distdir', after the languages have done their thing. +distdir-finish: + mv tmp gcc-$(version) +# Get rid of everything we don't want in the distribution. We'd want +# this to use Makefile.in, but it doesn't have the `lang.foo' targets +# expanded. + cd gcc-$(version); make extraclean VERSION_DEP= + +distdir: distdir-cvs distdir-start lang.distdir distdir-finish + +# make diff oldversion=M.N +# creates a diff file between an older distribution and this one. +# The -P option assumes this is GNU diff. +diff: + diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \ + -x cexp.c -x -x TAGS -x INSTALL \ + -x configure -x config.in \ + -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \ + -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \ + $(LANG_DIFF_EXCLUDES) \ + gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff + +bootstrap bootstrap-lean: force +# Only build the C compiler for stage1, because that is the only one that +# we can guarantee will build with the native compiler, and also it is the +# only thing useful for building stage2. + $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" + $(MAKE) stage1 +# This used to define ALLOCA as empty, but that would lead to bad results +# for a subsequent `make install' since that would not have ALLOCA empty. +# To prevent `make install' from compiling alloca.o and then relinking cc1 +# because alloca.o is newer, we permit these recursive makes to compile +# alloca.o. Then cc1 is newer, so it won't have to be relinked. + $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)" + $(MAKE) stage2 + -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi + $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)" + +bootstrap2 bootstrap2-lean: force + $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)" + $(MAKE) stage2 + -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi + $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)" + +bootstrap3 bootstrap3-lean: force + $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)" + +bootstrap4 bootstrap4-lean: force + $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)" + +# Compare the object files in the current directory with those in the +# stage2 directory. + +# ./ avoids bug in some versions of tail. +compare compare3 compare4 compare-lean compare3-lean compare4-lean: force + -rm -f .bad_compare + case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + for file in *$(objext); do \ + tail +16c ./$$file > tmp-foo1; \ + tail +16c stage$$stage/$$file > tmp-foo2 \ + && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ + done + case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + for dir in tmp-foo $(SUBDIRS); do \ + if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \ + for file in $$dir/*$(objext); do \ + tail +16c ./$$file > tmp-foo1; \ + tail +16c stage$$stage/$$file > tmp-foo2 \ + && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ + done; \ + else true; fi; \ + done + -rm -f tmp-foo* + case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + if [ -f .bad_compare ]; then \ + echo "Bootstrap comparison failure!"; \ + cat .bad_compare; \ + exit 1; \ + else \ + case "$@" in \ + *-lean ) rm -rf stage$$stage ;; \ + *) ;; \ + esac; true; \ + fi + +# Compare the object files in the current directory with those in the +# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid +# running tail and the overhead of twice copying each object file. + +gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force + -rm -f .bad_compare + case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + for file in *$(objext); do \ + (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ + done + case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + for dir in tmp-foo $(SUBDIRS); do \ + if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \ + for file in $$dir/*$(objext); do \ + (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ + done; \ + else true; fi; \ + done + case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ + if [ -f .bad_compare ]; then \ + echo "Bootstrap comparison failure!"; \ + cat .bad_compare; \ + exit 1; \ + else \ + case "$@" in \ + *-lean ) rm -rf stage$$stage ;; \ + esac; true; \ + fi + +# Copy the object files from a particular stage into a subdirectory. +stage1-start: + -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi + -for dir in . $(SUBDIRS) ; \ + do \ + if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \ + done + -mv $(STAGESTUFF) stage1 +# Copy as/ld if they exist to stage dir, so that running xgcc from the stage +# dir will work properly. + -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi + -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi + -rm -f stage1/libgcc.a + -cp libgcc.a stage1 + -if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) stage1/libgcc.a; \ + else true; fi + -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + cp stage1/$${f} . ; \ + else true; \ + fi; done +stage1: force stage1-start lang.stage1 + +stage2-start: + -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi + -for dir in . $(SUBDIRS) ; \ + do \ + if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \ + done + -mv $(STAGESTUFF) stage2 +# Copy as/ld if they exist to stage dir, so that running xgcc from the stage +# dir will work properly. + -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi + -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi + -rm -f stage2/libgcc.a + -cp libgcc.a stage2 + -if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) stage2/libgcc.a; \ + else true; fi + -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + cp stage2/$${f} . ; \ + else true; \ + fi; done +stage2: force stage2-start lang.stage2 + +stage3-start: + -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi + -for dir in . $(SUBDIRS) ; \ + do \ + if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \ + done + -mv $(STAGESTUFF) stage3 +# Copy as/ld if they exist to stage dir, so that running xgcc from the stage +# dir will work properly. + -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi + -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi + -rm -f stage3/libgcc.a + -cp libgcc.a stage3 + -if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) stage3/libgcc.a; \ + else true; fi + -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + cp stage3/$${f} . ; \ + else true; \ + fi; done +stage3: force stage3-start lang.stage3 + +stage4-start: + -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi + -for dir in . $(SUBDIRS) ; \ + do \ + if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \ + done + -mv $(STAGESTUFF) stage4 +# Copy as/ld if they exist to stage dir, so that running xgcc from the stage +# dir will work properly. + -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi + -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi + -rm -f stage4/libgcc.a + -cp libgcc.a stage4 + -if $(RANLIB_TEST_FOR_TARGET) ; then \ + $(RANLIB_FOR_TARGET) stage4/libgcc.a; \ + else true; fi + -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ + cp stage4/$${f} . ; \ + else true; \ + fi; done +stage4: force stage4-start lang.stage4 + +# Copy just the executable files from a particular stage into a subdirectory, +# and delete the object files. Use this if you're just verifying a version +# that is pretty sure to work, and you are short of disk space. +risky-stage1: stage1 + -make clean + +risky-stage2: stage2 + -make clean + +risky-stage3: stage3 + -make clean + +risky-stage4: stage4 + -make clean + +#In GNU Make, ignore whether `stage*' exists. +.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap +.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 + +force: + +# --- +# The enquire rules are still useful for building new float-anything.h. +# Special flags for compiling enquire. +# We disable optimization to make floating point more reliable. +ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0 +ENQUIRE_LDFLAGS = $(LDFLAGS) + +# Enquire target (This is a variable so that a target can choose not to +# build it.) +ENQUIRE = enquire + +# Test to see whether <float.h> exists in the system header files, +# and is not derived from GCC. +FLOAT_H_TEST = \ + [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \ + if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \ + then false; \ + else :; fi +# We pretend to not having a usable <float.h>, hence disable the FLOAT_H_TEST +# to ensure, we're emitting a full blown <float.h> ourselves. +FLOAT_H_TEST = false + +# Used to compile enquire with standard cc, but have forgotten why. +# Let's try with GCC. +enquire: enquire.o $(GCC_PARTS) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@ +enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs + if $(FLOAT_H_TEST); then \ + rm -f include/float.h; \ + SYS_FLOAT_H_WRAP=1; \ + else :; \ + SYS_FLOAT_H_WRAP=0; \ + fi; \ + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \ + -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \ + -I. -c $(srcdir)/enquire.c + +# Create float.h source for the native machine. +# Make it empty if we can use the system float.h without changes. +float.h-nat: enquire + -./enquire -f > tmp-float.h + grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h + mv tmp-float.h float.h-nat + +# Create a dummy float.h source for a cross-compiler. +# ??? This isn't used anymore. Should we create config/float-unkn.h +# and make that the default float_format in configure? +float.h-cross: + echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross + echo "#error float.h values not known for cross-compiler" >> t-float.h-cross + echo "#endif" >> t-float.h-cross + mv t-float.h-cross float.h-cross + diff --git a/gcc_arm/auto-host.h b/gcc_arm/auto-host.h new file mode 100644 index 0000000..6f311b0 --- /dev/null +++ b/gcc_arm/auto-host.h @@ -0,0 +1,241 @@ +/* auto-host.h. Generated automatically by configure. */ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* Define if you can safely include both <string.h> and <strings.h>. */ +#define STRING_WITH_STRINGS 1 + +/* Define if printf supports "%p". */ +#define HAVE_PRINTF_PTR 1 + +/* Define if you want expensive run-time checks. */ +/* #undef ENABLE_CHECKING */ + +/* Define if your cpp understands the stringify operator. */ +#define HAVE_CPP_STRINGIFY 1 + +/* Define if your compiler understands volatile. */ +#define HAVE_VOLATILE 1 + +/* Define if your assembler supports specifying the maximum number + of bytes to skip when using the GAS .p2align command. */ +/* #undef HAVE_GAS_MAX_SKIP_P2ALIGN */ + +/* Define if your assembler supports .balign and .p2align. */ +/* #undef HAVE_GAS_BALIGN_AND_P2ALIGN */ + +/* Define if your assembler supports .subsection and .subsection -1 starts + emitting at the beginning of your section */ +/* #undef HAVE_GAS_SUBSECTION_ORDERING */ + +/* Define if you have a working <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Whether malloc must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_MALLOC */ + +/* Whether realloc must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_REALLOC */ + +/* Whether calloc must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_CALLOC */ + +/* Whether free must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_FREE */ + +/* Whether bcopy must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_BCOPY */ + +/* Whether bcmp must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_BCMP */ + +/* Whether bzero must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_BZERO */ + +/* Whether index must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_INDEX */ + +/* Whether rindex must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_RINDEX */ + +/* Whether getenv must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_GETENV */ + +/* Whether atol must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_ATOL */ + +/* Whether sbrk must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_SBRK */ + +/* Whether abort must be declared even if <stdlib.h> is included. */ +/* #undef NEED_DECLARATION_ABORT */ + +/* Whether strerror must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_STRERROR */ + +/* Whether strsignal must be declared even if <string.h> is included. */ +/* #undef NEED_DECLARATION_STRSIGNAL */ + +/* Whether getcwd must be declared even if <unistd.h> is included. */ +/* #undef NEED_DECLARATION_GETCWD */ + +/* Whether getwd must be declared even if <unistd.h> is included. */ +/* #undef NEED_DECLARATION_GETWD */ + +/* Whether getrlimit must be declared even if <sys/resource.h> is included. */ +/* #undef NEED_DECLARATION_GETRLIMIT */ + +/* Whether setrlimit must be declared even if <sys/resource.h> is included. */ +/* #undef NEED_DECLARATION_SETRLIMIT */ + +/* Define if you want expensive run-time checks. */ +/* #undef ENABLE_CHECKING */ + +/* Define to enable the use of a default assembler. */ +/* #undef DEFAULT_ASSEMBLER */ + +/* Define to enable the use of a default linker. */ +/* #undef DEFAULT_LINKER */ + + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define if you have <vfork.h>. */ +/* #undef HAVE_VFORK_H */ + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef pid_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if `sys_siglist' is declared by <signal.h>. */ +#define SYS_SIGLIST_DECLARED 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define vfork as fork if vfork does not work. */ +/* #undef vfork */ + +/* Define if you have the atoll function. */ +#define HAVE_ATOLL 1 + +/* Define if you have the atoq function. */ +/* #undef HAVE_ATOQ */ + +/* Define if you have the bcmp function. */ +#define HAVE_BCMP 1 + +/* Define if you have the bcopy function. */ +#define HAVE_BCOPY 1 + +/* Define if you have the bsearch function. */ +#define HAVE_BSEARCH 1 + +/* Define if you have the bzero function. */ +#define HAVE_BZERO 1 + +/* Define if you have the fputc_unlocked function. */ +#define HAVE_FPUTC_UNLOCKED 1 + +/* Define if you have the fputs_unlocked function. */ +#define HAVE_FPUTS_UNLOCKED 1 + +/* Define if you have the getrlimit function. */ +#define HAVE_GETRLIMIT 1 + +/* Define if you have the gettimeofday function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the index function. */ +#define HAVE_INDEX 1 + +/* Define if you have the isascii function. */ +#define HAVE_ISASCII 1 + +/* Define if you have the kill function. */ +#define HAVE_KILL 1 + +/* Define if you have the popen function. */ +#define HAVE_POPEN 1 + +/* Define if you have the putc_unlocked function. */ +#define HAVE_PUTC_UNLOCKED 1 + +/* Define if you have the putenv function. */ +#define HAVE_PUTENV 1 + +/* Define if you have the rindex function. */ +#define HAVE_RINDEX 1 + +/* Define if you have the setrlimit function. */ +#define HAVE_SETRLIMIT 1 + +/* Define if you have the strchr function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the strrchr function. */ +#define HAVE_STRRCHR 1 + +/* Define if you have the strsignal function. */ +#define HAVE_STRSIGNAL 1 + +/* Define if you have the strtoul function. */ +#define HAVE_STRTOUL 1 + +/* Define if you have the sysconf function. */ +#define HAVE_SYSCONF 1 + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the <stab.h> header file. */ +#define HAVE_STAB_H 1 + +/* Define if you have the <stddef.h> header file. */ +#define HAVE_STDDEF_H 1 + +/* Define if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define if you have the <sys/file.h> header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the <sys/times.h> header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define if you have the <time.h> header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 diff --git a/gcc_arm/c-parse.c b/gcc_arm/c-parse.c deleted file mode 100644 index ee174d1..0000000 --- a/gcc_arm/c-parse.c +++ /dev/null @@ -1,5078 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - IDENTIFIER = 258, - TYPENAME = 259, - SCSPEC = 260, - TYPESPEC = 261, - TYPE_QUAL = 262, - CONSTANT = 263, - STRING = 264, - ELLIPSIS = 265, - SIZEOF = 266, - ENUM = 267, - STRUCT = 268, - UNION = 269, - IF = 270, - ELSE = 271, - WHILE = 272, - DO = 273, - FOR = 274, - SWITCH = 275, - CASE = 276, - DEFAULT = 277, - BREAK = 278, - CONTINUE = 279, - RETURN = 280, - GOTO = 281, - ASM_KEYWORD = 282, - TYPEOF = 283, - ALIGNOF = 284, - ATTRIBUTE = 285, - EXTENSION = 286, - LABEL = 287, - REALPART = 288, - IMAGPART = 289, - ASSIGN = 290, - OROR = 291, - ANDAND = 292, - EQCOMPARE = 293, - ARITHCOMPARE = 294, - RSHIFT = 295, - LSHIFT = 296, - MINUSMINUS = 297, - PLUSPLUS = 298, - UNARY = 299, - HYPERUNARY = 300, - POINTSAT = 301, - INTERFACE = 302, - IMPLEMENTATION = 303, - END = 304, - SELECTOR = 305, - DEFS = 306, - ENCODE = 307, - CLASSNAME = 308, - PUBLIC = 309, - PRIVATE = 310, - PROTECTED = 311, - PROTOCOL = 312, - OBJECTNAME = 313, - CLASS = 314, - ALIAS = 315, - OBJC_STRING = 316 - }; -#endif -/* Tokens. */ -#define IDENTIFIER 258 -#define TYPENAME 259 -#define SCSPEC 260 -#define TYPESPEC 261 -#define TYPE_QUAL 262 -#define CONSTANT 263 -#define STRING 264 -#define ELLIPSIS 265 -#define SIZEOF 266 -#define ENUM 267 -#define STRUCT 268 -#define UNION 269 -#define IF 270 -#define ELSE 271 -#define WHILE 272 -#define DO 273 -#define FOR 274 -#define SWITCH 275 -#define CASE 276 -#define DEFAULT 277 -#define BREAK 278 -#define CONTINUE 279 -#define RETURN 280 -#define GOTO 281 -#define ASM_KEYWORD 282 -#define TYPEOF 283 -#define ALIGNOF 284 -#define ATTRIBUTE 285 -#define EXTENSION 286 -#define LABEL 287 -#define REALPART 288 -#define IMAGPART 289 -#define ASSIGN 290 -#define OROR 291 -#define ANDAND 292 -#define EQCOMPARE 293 -#define ARITHCOMPARE 294 -#define RSHIFT 295 -#define LSHIFT 296 -#define MINUSMINUS 297 -#define PLUSPLUS 298 -#define UNARY 299 -#define HYPERUNARY 300 -#define POINTSAT 301 -#define INTERFACE 302 -#define IMPLEMENTATION 303 -#define END 304 -#define SELECTOR 305 -#define DEFS 306 -#define ENCODE 307 -#define CLASSNAME 308 -#define PUBLIC 309 -#define PRIVATE 310 -#define PROTECTED 311 -#define PROTOCOL 312 -#define OBJECTNAME 313 -#define CLASS 314 -#define ALIAS 315 -#define OBJC_STRING 316 - - - - -/* Copy the first part of user declarations. */ - - -#include "config.h" -#include "system.h" -#include <setjmp.h> - -#include "tree.h" -#include "input.h" -#include "c-lex.h" -#include "c-tree.h" -#include "flags.h" -#include "output.h" -#include "toplev.h" - - -/* Since parsers are distinct for each language, put the language string - definition here. */ -char *language_string = "GNU C"; - -/* Like YYERROR but do call yyerror. */ -#define YYERROR1 { yyerror ("syntax error"); YYERROR; } - -/* Cause the `yydebug' variable to be defined. */ -#define YYDEBUG 1 - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE - -{long itype; tree ttype; enum tree_code code; - char *filename; int lineno; int ends_in_label; } -/* Line 187 of yacc.c. */ - - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Number of statements (loosely speaking) and compound statements - seen so far. */ -static int stmt_count; -static int compstmt_count; - -/* Input file and line number of the end of the body of last simple_if; - used by the stmt-rule immediately after simple_if returns. */ -static char *if_stmt_file; -static int if_stmt_line; - -/* List of types and structure classes of the current declaration. */ -static tree current_declspecs = NULL_TREE; -static tree prefix_attributes = NULL_TREE; - -/* Stack of saved values of current_declspecs and prefix_attributes. */ -static tree declspec_stack; - -/* 1 if we explained undeclared var errors. */ -static int undeclared_variable_notice; - - -/* Tell yyparse how to print a token's value, if yydebug is set. */ - -#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) -extern void yyprint (FILE *, int, YYSTYPE); - - -/* Line 216 of yacc.c. */ - - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -#define YY_(msgid) msgid -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 4 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2427 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 84 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 158 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 404 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 689 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 316 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 80, 2, 2, 2, 52, 43, 2, - 58, 76, 50, 48, 81, 49, 57, 51, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 38, 77, - 2, 35, 2, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 59, 2, 83, 42, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 82, 41, 78, 79, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 36, 39, 40, 44, 45, 46, 47, 53, 54, 55, - 56, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 4, 6, 7, 10, 11, 15, 17, - 19, 25, 28, 32, 37, 42, 45, 48, 51, 54, - 56, 57, 58, 66, 71, 72, 73, 81, 86, 87, - 88, 95, 99, 101, 103, 105, 107, 109, 111, 113, - 115, 117, 119, 120, 122, 124, 128, 130, 133, 136, - 139, 142, 145, 150, 153, 158, 161, 164, 166, 168, - 170, 175, 176, 184, 186, 190, 194, 198, 202, 206, - 210, 214, 218, 222, 226, 230, 234, 235, 240, 241, - 246, 247, 248, 256, 257, 263, 267, 271, 273, 275, - 277, 281, 285, 286, 291, 296, 301, 305, 309, 312, - 315, 317, 320, 321, 323, 326, 330, 332, 334, 337, - 340, 345, 350, 353, 356, 360, 362, 364, 367, 370, - 371, 372, 377, 382, 386, 390, 393, 396, 399, 402, - 406, 407, 410, 413, 416, 419, 423, 424, 427, 430, - 432, 434, 437, 440, 442, 444, 447, 450, 453, 457, - 458, 461, 463, 465, 467, 472, 477, 479, 481, 483, - 485, 489, 491, 495, 496, 501, 502, 509, 513, 514, - 521, 525, 526, 528, 530, 533, 540, 542, 546, 547, - 549, 554, 561, 566, 568, 570, 572, 574, 576, 577, - 582, 584, 585, 588, 590, 594, 598, 601, 602, 607, - 609, 610, 615, 617, 619, 621, 624, 627, 633, 637, - 638, 639, 645, 646, 647, 653, 655, 657, 661, 665, - 670, 674, 678, 682, 684, 688, 693, 698, 702, 706, - 710, 712, 716, 720, 724, 729, 734, 738, 742, 744, - 746, 749, 751, 754, 756, 759, 760, 768, 774, 777, - 778, 786, 792, 795, 796, 805, 806, 814, 817, 818, - 820, 821, 823, 825, 828, 829, 833, 836, 840, 842, - 846, 848, 850, 853, 855, 859, 864, 871, 877, 879, - 883, 885, 887, 891, 894, 897, 898, 900, 902, 905, - 906, 909, 913, 917, 920, 924, 929, 933, 936, 940, - 943, 945, 947, 950, 953, 954, 956, 959, 960, 961, - 963, 965, 968, 972, 974, 977, 979, 982, 989, 995, - 1001, 1004, 1007, 1012, 1013, 1018, 1019, 1020, 1024, 1029, - 1033, 1035, 1037, 1039, 1041, 1044, 1045, 1050, 1052, 1056, - 1057, 1058, 1066, 1072, 1075, 1076, 1077, 1078, 1091, 1092, - 1099, 1102, 1105, 1108, 1112, 1119, 1128, 1139, 1152, 1156, - 1161, 1163, 1165, 1166, 1173, 1177, 1183, 1186, 1190, 1191, - 1193, 1194, 1196, 1197, 1199, 1201, 1205, 1210, 1212, 1216, - 1217, 1220, 1223, 1224, 1229, 1232, 1233, 1235, 1237, 1241, - 1243, 1247, 1252, 1257, 1262, 1267, 1272, 1273, 1276, 1278, - 1281, 1283, 1287, 1289, 1293 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 85, 0, -1, -1, 86, -1, -1, 87, 89, -1, - -1, 86, 88, 89, -1, 91, -1, 90, -1, 27, - 58, 100, 76, 77, -1, 241, 89, -1, 123, 137, - 77, -1, 130, 123, 137, 77, -1, 126, 123, 136, - 77, -1, 130, 77, -1, 126, 77, -1, 1, 77, - -1, 1, 78, -1, 77, -1, -1, -1, 126, 123, - 165, 92, 117, 93, 199, -1, 126, 123, 165, 1, - -1, -1, -1, 130, 123, 168, 94, 117, 95, 199, - -1, 130, 123, 168, 1, -1, -1, -1, 123, 168, - 96, 117, 97, 199, -1, 123, 168, 1, -1, 3, - -1, 4, -1, 43, -1, 49, -1, 48, -1, 54, - -1, 53, -1, 79, -1, 80, -1, 102, -1, -1, - 102, -1, 108, -1, 102, 81, 108, -1, 114, -1, - 50, 106, -1, 241, 106, -1, 99, 106, -1, 40, - 98, -1, 104, 103, -1, 104, 58, 186, 76, -1, - 105, 103, -1, 105, 58, 186, 76, -1, 33, 106, - -1, 34, 106, -1, 11, -1, 29, -1, 103, -1, - 58, 186, 76, 106, -1, -1, 58, 186, 76, 82, - 107, 151, 78, -1, 106, -1, 108, 48, 108, -1, - 108, 49, 108, -1, 108, 50, 108, -1, 108, 51, - 108, -1, 108, 52, 108, -1, 108, 47, 108, -1, - 108, 46, 108, -1, 108, 45, 108, -1, 108, 44, - 108, -1, 108, 43, 108, -1, 108, 41, 108, -1, - 108, 42, 108, -1, -1, 108, 40, 109, 108, -1, - -1, 108, 39, 110, 108, -1, -1, -1, 108, 37, - 111, 100, 38, 112, 108, -1, -1, 108, 37, 113, - 38, 108, -1, 108, 35, 108, -1, 108, 36, 108, - -1, 3, -1, 8, -1, 116, -1, 58, 100, 76, - -1, 58, 1, 76, -1, -1, 58, 115, 201, 76, - -1, 114, 58, 101, 76, -1, 114, 59, 100, 83, - -1, 114, 57, 98, -1, 114, 60, 98, -1, 114, - 54, -1, 114, 53, -1, 9, -1, 116, 9, -1, - -1, 119, -1, 119, 10, -1, 206, 207, 120, -1, - 118, -1, 194, -1, 119, 118, -1, 118, 194, -1, - 128, 123, 136, 77, -1, 131, 123, 137, 77, -1, - 128, 77, -1, 131, 77, -1, 206, 207, 125, -1, - 121, -1, 194, -1, 122, 121, -1, 121, 194, -1, - -1, -1, 126, 123, 136, 77, -1, 130, 123, 137, - 77, -1, 126, 123, 159, -1, 130, 123, 162, -1, - 126, 77, -1, 130, 77, -1, 241, 125, -1, 134, - 127, -1, 130, 134, 127, -1, -1, 127, 135, -1, - 127, 5, -1, 127, 144, -1, 134, 129, -1, 131, - 134, 129, -1, -1, 129, 135, -1, 129, 5, -1, - 131, -1, 144, -1, 130, 131, -1, 130, 144, -1, - 7, -1, 5, -1, 131, 7, -1, 131, 5, -1, - 134, 133, -1, 188, 134, 133, -1, -1, 133, 135, - -1, 6, -1, 172, -1, 4, -1, 28, 58, 100, - 76, -1, 28, 58, 186, 76, -1, 6, -1, 7, - -1, 172, -1, 139, -1, 136, 81, 139, -1, 141, - -1, 137, 81, 139, -1, -1, 27, 58, 116, 76, - -1, -1, 165, 138, 143, 35, 140, 149, -1, 165, - 138, 143, -1, -1, 168, 138, 143, 35, 142, 149, - -1, 168, 138, 143, -1, -1, 144, -1, 145, -1, - 144, 145, -1, 30, 58, 58, 146, 76, 76, -1, - 147, -1, 146, 81, 147, -1, -1, 148, -1, 148, - 58, 3, 76, -1, 148, 58, 3, 81, 102, 76, - -1, 148, 58, 101, 76, -1, 98, -1, 5, -1, - 6, -1, 7, -1, 108, -1, -1, 82, 150, 151, - 78, -1, 1, -1, -1, 152, 177, -1, 153, -1, - 152, 81, 153, -1, 157, 35, 155, -1, 158, 155, - -1, -1, 98, 38, 154, 155, -1, 155, -1, -1, - 82, 156, 151, 78, -1, 108, -1, 1, -1, 158, - -1, 157, 158, -1, 57, 98, -1, 59, 108, 10, - 108, 83, -1, 59, 108, 83, -1, -1, -1, 165, - 160, 117, 161, 201, -1, -1, -1, 168, 163, 117, - 164, 201, -1, 166, -1, 168, -1, 58, 166, 76, - -1, 166, 58, 236, -1, 166, 59, 100, 83, -1, - 166, 59, 83, -1, 50, 189, 166, -1, 144, 124, - 166, -1, 4, -1, 167, 58, 236, -1, 167, 59, - 50, 83, -1, 167, 59, 100, 83, -1, 167, 59, - 83, -1, 50, 189, 167, -1, 144, 124, 167, -1, - 4, -1, 168, 58, 236, -1, 58, 168, 76, -1, - 50, 189, 168, -1, 168, 59, 50, 83, -1, 168, - 59, 100, 83, -1, 168, 59, 83, -1, 144, 124, - 168, -1, 3, -1, 13, -1, 13, 144, -1, 14, - -1, 14, 144, -1, 12, -1, 12, 144, -1, -1, - 169, 98, 82, 173, 179, 78, 143, -1, 169, 82, - 179, 78, 143, -1, 169, 98, -1, -1, 170, 98, - 82, 174, 179, 78, 143, -1, 170, 82, 179, 78, - 143, -1, 170, 98, -1, -1, 171, 98, 82, 175, - 184, 178, 78, 143, -1, -1, 171, 82, 176, 184, - 178, 78, 143, -1, 171, 98, -1, -1, 81, -1, - -1, 81, -1, 180, -1, 180, 181, -1, -1, 180, - 181, 77, -1, 180, 77, -1, 132, 123, 182, -1, - 132, -1, 188, 123, 182, -1, 188, -1, 1, -1, - 241, 181, -1, 183, -1, 182, 81, 183, -1, 206, - 207, 165, 143, -1, 206, 207, 165, 38, 108, 143, - -1, 206, 207, 38, 108, 143, -1, 185, -1, 184, - 81, 185, -1, 1, -1, 98, -1, 98, 35, 108, - -1, 132, 187, -1, 188, 187, -1, -1, 190, -1, - 7, -1, 188, 7, -1, -1, 189, 7, -1, 58, - 190, 76, -1, 50, 189, 190, -1, 50, 189, -1, - 190, 58, 229, -1, 190, 59, 100, 83, -1, 190, - 59, 83, -1, 58, 229, -1, 59, 100, 83, -1, - 59, 83, -1, 192, -1, 209, -1, 192, 209, -1, - 192, 194, -1, -1, 191, -1, 1, 77, -1, -1, - -1, 197, -1, 198, -1, 197, 198, -1, 32, 240, - 77, -1, 201, -1, 1, 201, -1, 82, -1, 200, - 78, -1, 200, 195, 196, 122, 193, 78, -1, 200, - 195, 196, 1, 78, -1, 200, 195, 196, 191, 78, - -1, 203, 208, -1, 203, 1, -1, 15, 58, 100, - 76, -1, -1, 18, 205, 208, 17, -1, -1, -1, - 206, 207, 211, -1, 206, 207, 222, 208, -1, 206, - 207, 210, -1, 211, -1, 222, -1, 201, -1, 219, - -1, 100, 77, -1, -1, 202, 16, 212, 208, -1, - 202, -1, 202, 16, 1, -1, -1, -1, 17, 213, - 58, 100, 76, 214, 208, -1, 204, 58, 100, 76, - 77, -1, 204, 1, -1, -1, -1, -1, 19, 58, - 224, 77, 215, 224, 77, 216, 224, 76, 217, 208, - -1, -1, 20, 58, 100, 76, 218, 208, -1, 23, - 77, -1, 24, 77, -1, 25, 77, -1, 25, 100, - 77, -1, 27, 223, 58, 100, 76, 77, -1, 27, - 223, 58, 100, 38, 225, 76, 77, -1, 27, 223, - 58, 100, 38, 225, 38, 225, 76, 77, -1, 27, - 223, 58, 100, 38, 225, 38, 225, 38, 228, 76, - 77, -1, 26, 98, 77, -1, 26, 50, 100, 77, - -1, 77, -1, 220, -1, -1, 19, 58, 114, 76, - 221, 208, -1, 21, 108, 38, -1, 21, 108, 10, - 108, 38, -1, 22, 38, -1, 98, 38, 143, -1, - -1, 7, -1, -1, 100, -1, -1, 226, -1, 227, - -1, 226, 81, 227, -1, 9, 58, 100, 76, -1, - 116, -1, 228, 81, 116, -1, -1, 230, 231, -1, - 233, 76, -1, -1, 234, 77, 232, 231, -1, 1, - 76, -1, -1, 10, -1, 234, -1, 234, 81, 10, - -1, 235, -1, 234, 81, 235, -1, 126, 123, 167, - 143, -1, 126, 123, 168, 143, -1, 126, 123, 187, - 143, -1, 130, 123, 168, 143, -1, 130, 123, 187, - 143, -1, -1, 237, 238, -1, 231, -1, 239, 76, - -1, 3, -1, 239, 81, 3, -1, 98, -1, 240, - 81, 98, -1, 31, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 234, 234, 238, 253, 253, 254, 254, 258, 259, - 260, 268, 273, 283, 288, 293, 295, 297, 298, 299, - 306, 311, 305, 318, 324, 329, 323, 336, 342, 347, - 341, 354, 362, 363, 366, 368, 370, 372, 374, 376, - 378, 382, 388, 389, 393, 395, 400, 401, 404, 407, - 411, 439, 445, 448, 451, 454, 456, 461, 465, 469, - 470, 474, 473, 505, 506, 508, 510, 512, 514, 516, - 518, 520, 522, 524, 526, 528, 531, 530, 537, 536, - 543, 546, 542, 552, 551, 561, 564, 571, 669, 670, - 672, 678, 681, 680, 717, 719, 721, 725, 731, 733, - 739, 740, 745, 747, 748, 759, 764, 765, 766, 767, - 775, 780, 785, 788, 797, 802, 803, 804, 805, 813, - 824, 828, 833, 838, 843, 848, 850, 852, 862, 864, - 869, 870, 872, 877, 882, 884, 890, 891, 893, 906, - 908, 910, 912, 917, 920, 922, 925, 939, 941, 946, - 947, 955, 956, 957, 961, 963, 969, 970, 971, 975, - 976, 980, 981, 986, 987, 995, 994, 1002, 1011, 1010, - 1019, 1028, 1029, 1034, 1036, 1041, 1046, 1048, 1054, 1055, - 1057, 1059, 1061, 1069, 1070, 1071, 1072, 1078, 1080, 1079, - 1092, 1099, 1101, 1105, 1106, 1112, 1113, 1115, 1114, 1117, - 1122, 1121, 1125, 1127, 1131, 1132, 1136, 1141, 1143, 1149, - 1158, 1148, 1172, 1181, 1171, 1197, 1198, 1204, 1206, 1211, - 1213, 1215, 1222, 1224, 1233, 1238, 1243, 1245, 1247, 1254, - 1256, 1263, 1268, 1270, 1272, 1277, 1279, 1286, 1288, 1292, - 1294, 1299, 1301, 1306, 1308, 1314, 1313, 1319, 1323, 1326, - 1325, 1329, 1333, 1336, 1335, 1342, 1341, 1347, 1351, 1353, - 1356, 1358, 1364, 1366, 1372, 1373, 1375, 1390, 1396, 1401, - 1407, 1412, 1414, 1420, 1421, 1426, 1429, 1433, 1444, 1445, - 1450, 1456, 1458, 1463, 1465, 1471, 1472, 1476, 1478, 1484, - 1485, 1490, 1493, 1495, 1497, 1499, 1501, 1503, 1505, 1507, - 1518, 1526, 1527, 1529, 1533, 1535, 1538, 1542, 1552, 1554, - 1560, 1561, 1565, 1579, 1581, 1584, 1586, 1588, 1596, 1604, - 1616, 1620, 1624, 1639, 1638, 1651, 1655, 1659, 1664, 1669, - 1674, 1676, 1682, 1684, 1685, 1703, 1702, 1710, 1722, 1725, - 1735, 1724, 1745, 1753, 1758, 1770, 1773, 1756, 1800, 1799, - 1813, 1818, 1823, 1827, 1831, 1842, 1849, 1856, 1863, 1874, - 1880, 1884, 1890, 1889, 1945, 1976, 2007, 2022, 2038, 2040, - 2046, 2047, 2053, 2054, 2058, 2059, 2064, 2069, 2071, 2078, - 2078, 2088, 2090, 2089, 2099, 2106, 2107, 2117, 2119, 2124, - 2126, 2133, 2142, 2151, 2160, 2170, 2185, 2185, 2195, 2196, - 2206, 2208, 2214, 2216, 2221 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "IDENTIFIER", "TYPENAME", "SCSPEC", - "TYPESPEC", "TYPE_QUAL", "CONSTANT", "STRING", "ELLIPSIS", "SIZEOF", - "ENUM", "STRUCT", "UNION", "IF", "ELSE", "WHILE", "DO", "FOR", "SWITCH", - "CASE", "DEFAULT", "BREAK", "CONTINUE", "RETURN", "GOTO", "ASM_KEYWORD", - "TYPEOF", "ALIGNOF", "ATTRIBUTE", "EXTENSION", "LABEL", "REALPART", - "IMAGPART", "'='", "ASSIGN", "'?'", "':'", "OROR", "ANDAND", "'|'", - "'^'", "'&'", "EQCOMPARE", "ARITHCOMPARE", "RSHIFT", "LSHIFT", "'+'", - "'-'", "'*'", "'/'", "'%'", "MINUSMINUS", "PLUSPLUS", "UNARY", - "HYPERUNARY", "'.'", "'('", "'['", "POINTSAT", "INTERFACE", - "IMPLEMENTATION", "END", "SELECTOR", "DEFS", "ENCODE", "CLASSNAME", - "PUBLIC", "PRIVATE", "PROTECTED", "PROTOCOL", "OBJECTNAME", "CLASS", - "ALIAS", "OBJC_STRING", "')'", "';'", "'}'", "'~'", "'!'", "','", "'{'", - "']'", "$accept", "program", "extdefs", "@1", "@2", "extdef", "datadef", - "fndef", "@3", "@4", "@5", "@6", "@7", "@8", "identifier", "unop", - "expr", "exprlist", "nonnull_exprlist", "unary_expr", "sizeof", - "alignof", "cast_expr", "@9", "expr_no_commas", "@10", "@11", "@12", - "@13", "@14", "primary", "@15", "string", "old_style_parm_decls", - "lineno_datadecl", "datadecls", "datadecl", "lineno_decl", "decls", - "setspecs", "setattrs", "decl", "typed_declspecs", "reserved_declspecs", - "typed_declspecs_no_prefix_attr", "reserved_declspecs_no_prefix_attr", - "declmods", "declmods_no_prefix_attr", "typed_typespecs", - "reserved_typespecquals", "typespec", "typespecqual_reserved", - "initdecls", "notype_initdecls", "maybeasm", "initdcl", "@16", - "notype_initdcl", "@17", "maybe_attribute", "attributes", "attribute", - "attribute_list", "attrib", "any_word", "init", "@18", - "initlist_maybe_comma", "initlist1", "initelt", "@19", "initval", "@20", - "designator_list", "designator", "nested_function", "@21", "@22", - "notype_nested_function", "@23", "@24", "declarator", - "after_type_declarator", "parm_declarator", "notype_declarator", - "struct_head", "union_head", "enum_head", "structsp", "@25", "@26", - "@27", "@28", "maybecomma", "maybecomma_warn", "component_decl_list", - "component_decl_list2", "component_decl", "components", - "component_declarator", "enumlist", "enumerator", "typename", "absdcl", - "nonempty_type_quals", "type_quals", "absdcl1", "stmts", - "lineno_stmt_or_labels", "xstmts", "errstmt", "pushlevel", - "maybe_label_decls", "label_decls", "label_decl", "compstmt_or_error", - "compstmt_start", "compstmt", "simple_if", "if_prefix", "do_stmt_start", - "@29", "save_filename", "save_lineno", "lineno_labeled_stmt", - "lineno_stmt_or_label", "stmt_or_label", "stmt", "@30", "@31", "@32", - "@33", "@34", "@35", "@36", "all_iter_stmt", "all_iter_stmt_simple", - "@37", "label", "maybe_type_qual", "xexpr", "asm_operands", - "nonnull_asm_operands", "asm_operand", "asm_clobbers", "parmlist", "@38", - "parmlist_1", "@39", "parmlist_2", "parms", "parm", - "parmlist_or_identifiers", "@40", "parmlist_or_identifiers_1", - "identifiers", "identifiers_or_typenames", "extension", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 61, 290, 63, 58, 291, - 292, 124, 94, 38, 293, 294, 295, 296, 43, 45, - 42, 47, 37, 297, 298, 299, 300, 46, 40, 91, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 41, 59, 125, 126, - 33, 44, 123, 93 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 84, 85, 85, 87, 86, 88, 86, 89, 89, - 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, - 92, 93, 91, 91, 94, 95, 91, 91, 96, 97, - 91, 91, 98, 98, 99, 99, 99, 99, 99, 99, - 99, 100, 101, 101, 102, 102, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 104, 105, 106, - 106, 107, 106, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 108, 108, 109, 108, 110, 108, - 111, 112, 108, 113, 108, 108, 108, 114, 114, 114, - 114, 114, 115, 114, 114, 114, 114, 114, 114, 114, - 116, 116, 117, 117, 117, 118, 119, 119, 119, 119, - 120, 120, 120, 120, 121, 122, 122, 122, 122, 123, - 124, 125, 125, 125, 125, 125, 125, 125, 126, 126, - 127, 127, 127, 127, 128, 128, 129, 129, 129, 130, - 130, 130, 130, 131, 131, 131, 131, 132, 132, 133, - 133, 134, 134, 134, 134, 134, 135, 135, 135, 136, - 136, 137, 137, 138, 138, 140, 139, 139, 142, 141, - 141, 143, 143, 144, 144, 145, 146, 146, 147, 147, - 147, 147, 147, 148, 148, 148, 148, 149, 150, 149, - 149, 151, 151, 152, 152, 153, 153, 154, 153, 153, - 156, 155, 155, 155, 157, 157, 158, 158, 158, 160, - 161, 159, 163, 164, 162, 165, 165, 166, 166, 166, - 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, - 167, 168, 168, 168, 168, 168, 168, 168, 168, 169, - 169, 170, 170, 171, 171, 173, 172, 172, 172, 174, - 172, 172, 172, 175, 172, 176, 172, 172, 177, 177, - 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, - 181, 181, 181, 182, 182, 183, 183, 183, 184, 184, - 184, 185, 185, 186, 186, 187, 187, 188, 188, 189, - 189, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 191, 192, 192, 192, 193, 193, 194, 195, 196, 196, - 197, 197, 198, 199, 199, 200, 201, 201, 201, 201, - 202, 202, 203, 205, 204, 206, 207, 208, 208, 209, - 210, 210, 211, 211, 211, 212, 211, 211, 211, 213, - 214, 211, 211, 211, 215, 216, 217, 211, 218, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 219, 221, 220, 222, 222, 222, 222, 223, 223, - 224, 224, 225, 225, 226, 226, 227, 228, 228, 230, - 229, 231, 232, 231, 231, 233, 233, 233, 233, 234, - 234, 235, 235, 235, 235, 235, 237, 236, 238, 238, - 239, 239, 240, 240, 241 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 1, 0, 2, 0, 3, 1, 1, - 5, 2, 3, 4, 4, 2, 2, 2, 2, 1, - 0, 0, 7, 4, 0, 0, 7, 4, 0, 0, - 6, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 1, 1, 3, 1, 2, 2, 2, - 2, 2, 4, 2, 4, 2, 2, 1, 1, 1, - 4, 0, 7, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 0, 4, 0, 4, - 0, 0, 7, 0, 5, 3, 3, 1, 1, 1, - 3, 3, 0, 4, 4, 4, 3, 3, 2, 2, - 1, 2, 0, 1, 2, 3, 1, 1, 2, 2, - 4, 4, 2, 2, 3, 1, 1, 2, 2, 0, - 0, 4, 4, 3, 3, 2, 2, 2, 2, 3, - 0, 2, 2, 2, 2, 3, 0, 2, 2, 1, - 1, 2, 2, 1, 1, 2, 2, 2, 3, 0, - 2, 1, 1, 1, 4, 4, 1, 1, 1, 1, - 3, 1, 3, 0, 4, 0, 6, 3, 0, 6, - 3, 0, 1, 1, 2, 6, 1, 3, 0, 1, - 4, 6, 4, 1, 1, 1, 1, 1, 0, 4, - 1, 0, 2, 1, 3, 3, 2, 0, 4, 1, - 0, 4, 1, 1, 1, 2, 2, 5, 3, 0, - 0, 5, 0, 0, 5, 1, 1, 3, 3, 4, - 3, 3, 3, 1, 3, 4, 4, 3, 3, 3, - 1, 3, 3, 3, 4, 4, 3, 3, 1, 1, - 2, 1, 2, 1, 2, 0, 7, 5, 2, 0, - 7, 5, 2, 0, 8, 0, 7, 2, 0, 1, - 0, 1, 1, 2, 0, 3, 2, 3, 1, 3, - 1, 1, 2, 1, 3, 4, 6, 5, 1, 3, - 1, 1, 3, 2, 2, 0, 1, 1, 2, 0, - 2, 3, 3, 2, 3, 4, 3, 2, 3, 2, - 1, 1, 2, 2, 0, 1, 2, 0, 0, 1, - 1, 2, 3, 1, 2, 1, 2, 6, 5, 5, - 2, 2, 4, 0, 4, 0, 0, 3, 4, 3, - 1, 1, 1, 1, 2, 0, 4, 1, 3, 0, - 0, 7, 5, 2, 0, 0, 0, 12, 0, 6, - 2, 2, 2, 3, 6, 8, 10, 12, 3, 4, - 1, 1, 0, 6, 3, 5, 2, 3, 0, 1, - 0, 1, 0, 1, 1, 3, 4, 1, 3, 0, - 2, 2, 0, 4, 2, 0, 1, 1, 3, 1, - 3, 4, 4, 4, 4, 4, 0, 2, 1, 2, - 1, 3, 1, 3, 1 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 4, 0, 6, 0, 1, 0, 0, 153, 144, 151, - 143, 243, 239, 241, 0, 0, 0, 404, 19, 5, - 9, 8, 0, 119, 119, 139, 130, 140, 173, 0, - 0, 0, 152, 0, 7, 17, 18, 244, 240, 242, - 0, 0, 0, 238, 289, 0, 0, 161, 120, 0, - 16, 0, 15, 0, 141, 130, 142, 146, 145, 128, - 174, 32, 33, 264, 248, 264, 252, 255, 257, 11, - 87, 88, 100, 57, 58, 0, 0, 0, 34, 36, - 35, 0, 38, 37, 0, 39, 40, 0, 0, 41, - 59, 0, 0, 63, 44, 46, 89, 0, 287, 0, - 285, 149, 0, 285, 178, 0, 0, 12, 0, 0, - 31, 0, 396, 0, 0, 171, 223, 289, 0, 0, - 159, 120, 0, 215, 216, 0, 0, 129, 132, 156, - 157, 131, 133, 158, 0, 0, 245, 0, 249, 0, - 253, 55, 56, 50, 47, 0, 0, 0, 0, 49, - 0, 0, 0, 51, 0, 53, 0, 0, 80, 78, - 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 99, 98, 0, 42, 0, 0, 101, - 48, 154, 289, 379, 0, 283, 286, 147, 155, 288, - 149, 284, 184, 185, 186, 183, 0, 176, 179, 290, - 233, 232, 162, 163, 237, 0, 231, 0, 0, 236, - 0, 0, 29, 0, 325, 107, 326, 170, 172, 0, - 0, 14, 0, 0, 23, 0, 171, 396, 0, 13, - 27, 0, 171, 271, 266, 119, 263, 119, 0, 264, - 171, 264, 280, 281, 260, 278, 0, 91, 90, 315, - 307, 0, 0, 10, 45, 0, 0, 85, 86, 0, - 0, 0, 0, 74, 75, 73, 72, 71, 70, 69, - 64, 65, 66, 67, 68, 96, 0, 43, 0, 97, - 293, 0, 297, 0, 299, 0, 379, 0, 150, 148, - 0, 178, 42, 0, 0, 400, 386, 119, 119, 398, - 0, 387, 389, 397, 0, 234, 235, 306, 0, 109, - 104, 108, 0, 168, 221, 217, 160, 222, 21, 167, - 218, 220, 0, 25, 247, 325, 265, 325, 272, 0, - 251, 0, 0, 261, 0, 260, 316, 308, 93, 61, - 60, 52, 54, 0, 0, 79, 77, 94, 95, 292, - 291, 380, 298, 294, 296, 0, 175, 177, 87, 0, - 164, 384, 285, 285, 381, 382, 0, 399, 0, 0, - 30, 313, 105, 119, 119, 136, 0, 0, 165, 219, - 0, 267, 273, 326, 269, 171, 171, 282, 279, 171, - 0, 0, 0, 309, 310, 0, 81, 84, 295, 180, - 0, 182, 230, 289, 379, 120, 171, 171, 171, 289, - 171, 171, 0, 388, 390, 401, 314, 112, 0, 113, - 0, 136, 134, 190, 188, 187, 169, 22, 0, 26, - 325, 0, 246, 250, 256, 171, 402, 0, 0, 0, - 325, 0, 0, 116, 326, 301, 311, 203, 87, 0, - 0, 200, 0, 202, 0, 258, 193, 199, 0, 0, - 0, 0, 293, 0, 396, 0, 391, 392, 393, 293, - 394, 395, 383, 0, 0, 163, 135, 138, 137, 0, - 166, 274, 0, 171, 254, 312, 0, 318, 118, 117, - 305, 0, 319, 303, 326, 302, 0, 206, 0, 0, - 197, 62, 0, 192, 0, 205, 196, 82, 181, 228, - 289, 229, 224, 0, 227, 0, 110, 111, 0, 171, - 0, 275, 403, 317, 0, 153, 0, 339, 323, 0, - 0, 0, 0, 0, 0, 0, 0, 368, 360, 0, - 0, 114, 119, 119, 332, 337, 0, 0, 329, 330, - 333, 361, 331, 0, 0, 208, 0, 0, 194, 195, - 0, 225, 226, 189, 277, 171, 0, 0, 325, 370, - 0, 0, 366, 350, 351, 352, 0, 0, 0, 369, - 0, 171, 334, 125, 0, 126, 0, 0, 321, 326, - 320, 343, 0, 127, 0, 201, 198, 276, 0, 0, - 0, 371, 46, 0, 0, 0, 364, 353, 0, 358, - 0, 367, 0, 123, 209, 0, 124, 212, 338, 325, - 0, 0, 207, 322, 0, 324, 362, 344, 348, 0, - 359, 0, 121, 0, 122, 0, 336, 327, 325, 0, - 340, 325, 370, 325, 365, 372, 0, 210, 213, 328, - 342, 325, 363, 0, 349, 0, 0, 373, 374, 354, - 0, 0, 341, 345, 0, 372, 0, 0, 211, 214, - 370, 0, 0, 355, 375, 0, 376, 0, 0, 346, - 377, 0, 356, 325, 0, 0, 347, 357, 378 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 1, 2, 3, 5, 19, 20, 21, 225, 377, - 231, 380, 114, 308, 452, 87, 146, 276, 89, 90, - 91, 92, 93, 395, 94, 262, 261, 259, 460, 260, - 95, 147, 96, 212, 213, 214, 372, 439, 440, 22, - 109, 541, 297, 59, 373, 422, 298, 25, 100, 187, - 26, 131, 119, 46, 115, 120, 428, 47, 376, 217, - 218, 28, 196, 197, 198, 426, 479, 454, 455, 456, - 557, 457, 499, 458, 459, 613, 633, 660, 616, 635, - 661, 203, 123, 509, 124, 29, 30, 31, 32, 239, - 241, 246, 139, 503, 334, 134, 135, 236, 381, 382, - 244, 245, 102, 185, 103, 105, 186, 441, 442, 491, - 215, 337, 392, 393, 394, 370, 250, 371, 545, 546, - 547, 568, 589, 312, 590, 445, 548, 549, 619, 567, - 651, 642, 670, 683, 643, 550, 551, 641, 552, 580, - 603, 656, 657, 658, 681, 282, 283, 299, 412, 300, - 301, 302, 206, 207, 303, 304, 437, 97 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -470 -static const yytype_int16 yypact[] = -{ - 72, 86, 93, 2287, -470, 2287, 212, -470, -470, -470, - -470, 149, 149, 149, 67, 101, 135, -470, -470, -470, - -470, -470, 429, 141, 209, 228, -470, 149, -470, 57, - 60, 66, -470, 2287, -470, -470, -470, 149, 149, 149, - 2113, 2047, 138, -470, -470, 429, 99, -470, 149, 1376, - -470, 378, -470, 429, 228, -470, 149, -470, -470, 695, - -470, -470, -470, -470, 143, -470, 159, -470, 170, -470, - -470, -470, -470, -470, -470, 2113, 2113, 298, -470, -470, - -470, 2113, -470, -470, 1080, -470, -470, 2113, 182, 186, - -470, 2165, 2198, -470, 2375, 1369, 268, 2113, -470, 203, - 153, -470, 239, 575, 538, 459, 116, -470, 378, 429, - -470, 246, -470, 1451, 771, 149, -470, -470, 378, 118, - -470, 149, 328, 280, 387, 129, 1438, 695, -470, -470, - -470, -470, 149, -470, 267, 1577, -470, 272, -470, 436, - -470, -470, -470, -470, -470, 283, 290, 318, 302, -470, - 303, 2113, 1080, -470, 1080, -470, 2113, 2113, 350, -470, - -470, 2113, 2113, 2113, 2113, 2113, 2113, 2113, 2113, 2113, - 2113, 2113, 2113, -470, -470, 298, 2113, 2113, 298, -470, - -470, -470, -470, 153, 1513, -470, 405, 313, -470, -470, - -470, -470, -470, -470, -470, -470, 110, -470, 363, -470, - 387, -470, -470, 399, 387, 420, -470, 1628, 1566, -470, - 351, 380, -470, 468, 52, -470, -470, 403, 149, 178, - 217, -470, 378, 378, -470, 771, 149, -470, 1619, -470, - -470, 771, 149, -470, -470, 437, 384, 340, 1736, -470, - 149, -470, -470, 430, 390, -470, 436, -470, -470, -470, - 398, 392, 1991, -470, 2375, 407, 412, 2375, 2375, 2113, - 452, 2113, 2113, 2280, 757, 888, 1280, 1161, 547, 547, - 364, 364, -470, -470, -470, -470, 417, 186, 416, -470, - 119, 241, -470, 1681, -470, 418, -470, 1672, -470, 313, - 435, 538, 2231, 78, 440, -470, -470, -470, 1144, -470, - 451, 150, -470, -470, 162, -470, -470, -470, 56, -470, - -470, -470, 1345, -470, 280, -470, -470, 280, -470, 478, - -470, -470, 445, -470, -470, -470, -470, -470, -470, 460, - -470, 470, 2113, 298, 471, 390, -470, 486, -470, -470, - -470, -470, -470, 487, 2113, 1963, 2136, -470, -470, 405, - -470, -470, -470, -470, -470, 472, -470, -470, 168, 475, - -470, -470, 278, 361, -470, -470, 667, -470, 550, 318, - -470, -470, -470, 479, 1003, -470, 1313, 56, -470, -470, - 56, 483, -470, -470, 483, 149, 149, 2375, -470, 149, - 490, 298, 715, 486, -470, 1136, -470, 1751, -470, -470, - 2113, -470, -470, -470, 361, 149, 49, 53, 149, -470, - 53, 149, 1681, -470, -470, -470, -470, -470, 378, -470, - 429, -470, 579, -470, -470, 2375, -470, -470, 1313, -470, - -470, 293, -470, -470, -470, 149, -470, 232, 443, 635, - 491, 493, 809, -470, -470, -470, -470, -470, 535, 298, - 2113, -470, 536, 2375, 497, 496, -470, -470, 167, 1254, - 2113, 193, 394, 447, -470, 1725, -470, -470, -470, 354, - -470, -470, -470, 233, 296, 61, 579, -470, -470, 1136, - -470, -470, 2113, 37, -470, -470, 298, -470, -470, -470, - -470, 500, -470, -470, -470, -470, 1859, -470, 2311, 1136, - -470, -470, 1195, -470, 1367, -470, -470, 1751, -470, 465, - -470, 465, -470, 1778, -470, 507, -470, -470, 523, 2356, - 2113, -470, -470, -470, 1939, 566, 573, -470, -470, 574, - 577, 2113, 570, 560, 590, 2080, 77, 644, -470, 632, - 599, -470, 605, 899, -470, 670, 941, 65, -470, -470, - -470, -470, -470, 867, 2113, -470, 609, 1367, -470, -470, - 372, -470, -470, -470, -470, 2356, 2113, 633, -470, 2113, - 2113, 1803, -470, -470, -470, -470, 613, 2113, 615, -470, - 636, 149, -470, -470, 378, -470, 429, 1024, -470, -470, - -470, -470, 2113, -470, 2330, -470, -470, -470, 620, 2113, - 681, -470, 569, 622, 627, 2113, -470, -470, 628, -470, - 2113, -470, 306, -470, 477, 326, -470, 1041, -470, -470, - 1939, 630, -470, -470, 655, -470, -470, -470, -470, 1883, - -470, 39, -470, 771, -470, 771, -470, -470, -470, 673, - -470, -470, 2113, -470, -470, 738, 674, -470, -470, -470, - -470, -470, -470, 675, -470, 646, 54, 672, -470, -470, - 318, 318, -470, -470, 2113, 738, 677, 738, -470, -470, - 2113, 680, 95, -470, -470, 683, -470, 420, 684, -470, - 268, 197, -470, -470, 685, 420, -470, -470, 268 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -470, -470, -470, -470, -470, 157, -470, -470, -470, -470, - -470, -470, -470, -470, -26, -470, -40, 474, -128, 442, - -470, -470, 9, -470, 449, -470, -470, -470, -470, -470, - 188, -470, -183, -202, 546, -470, -470, 327, -470, -3, - -102, 218, 4, 719, -470, 349, 7, -7, -77, 589, - 18, -154, -377, -51, -106, -56, -470, -470, -470, -123, - 23, 62, -470, 489, -470, 358, -470, -363, -470, 285, - -470, -410, -470, -470, 324, -470, -470, -470, -470, -470, - -470, -37, -63, -312, -14, -470, -470, -470, -29, -470, - -470, -470, -470, -470, 453, -41, -470, 551, 463, 366, - 545, 481, -30, -92, -70, -111, -151, 371, -470, -470, - -188, -470, -470, -470, 422, -237, -470, -129, -470, -470, - -470, -470, -68, -339, -454, 356, -470, 196, -470, -470, - -470, -470, -470, -470, -470, -470, -470, -470, 199, -470, - -469, 156, -470, 155, -470, 537, -470, -245, -470, -470, - -470, 473, -200, -470, -470, -470, -470, 10 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -386 -static const yytype_int16 yytable[] = -{ - 88, 99, 125, 64, 66, 68, 219, 23, 49, 23, - 24, 191, 24, 33, 122, 33, 226, 54, 251, 223, - 51, 53, 293, 318, 137, 309, 27, 320, 27, 323, - 133, 106, 281, 288, 37, 38, 39, 23, 351, 126, - 24, 473, 55, 33, 431, 48, 216, 56, 277, 506, - 406, 143, 202, -103, 148, 220, 27, 369, 235, 101, - 61, 62, 310, 61, 62, 237, 591, 16, 48, 61, - 62, 280, -2, 210, 121, 520, 48, 645, 195, 16, - 61, 62, 132, 16, 141, 142, 4, 179, 111, 60, - 144, 200, 665, -3, 559, 204, 149, 226, 133, 60, - 60, 60, 101, 319, 106, 496, 180, 464, 465, 324, - 60, 112, 113, 243, 600, 646, 518, 330, 60, 112, - 113, 190, 255, 592, 256, 40, 199, 577, 48, 349, - 666, 121, 48, 677, -103, 288, 556, 278, 249, 63, - 427, 121, 65, 429, 285, 238, 216, 596, 67, 275, - 132, 511, 279, 101, 360, 524, 314, 216, 133, 41, - 317, 235, 34, 216, 277, 636, 316, 472, 237, 182, - 101, 678, 101, 653, 112, 113, 107, 183, 184, 16, - 108, 43, 116, 60, 649, 199, 290, 652, 322, 654, - 69, 291, 201, 42, 60, 221, 104, 662, 329, 222, - 331, 675, 504, 182, 443, 200, 229, 612, 16, 204, - 108, 183, 184, 7, 8, 9, 10, 144, 50, 343, - 243, 11, 12, 13, 449, 136, 450, 365, 117, 686, - 27, 366, 325, 57, 327, 58, 118, 15, 367, 16, - 416, 138, 121, 368, 399, 121, 121, 355, 238, 400, - 620, 488, 140, 281, 493, 190, 101, 383, 150, 383, - 133, 340, 432, 433, 512, 195, 434, 151, 478, 508, - 408, 411, 461, 684, 151, 227, 228, 179, 685, 181, - 60, 43, 402, 466, 467, 468, 52, 470, 471, 35, - 36, 54, 462, 315, 362, 363, 43, 116, 469, 286, - 287, 61, 62, 463, 205, 374, 27, 243, 16, 485, - 516, 349, 484, 486, 222, 188, 55, 350, 349, 129, - 130, 56, 478, 16, 444, 11, 12, 13, 403, 224, - 375, 482, -20, -20, -20, -20, 404, 184, 227, 228, - -20, -20, -20, 117, 7, 232, 9, 189, 407, 410, - 240, 118, 11, 12, 13, 111, -20, 43, -163, 247, - 521, 199, 383, -163, 43, 436, 248, 544, 15, 474, - 418, 420, 444, 517, 494, 43, 402, 108, 252, 199, - 253, 43, 116, 632, 16, 405, 48, 222, -83, 27, - 106, 16, 421, 133, 483, 544, 564, 43, 402, 560, - 249, 199, 16, 634, 409, -163, 475, 108, 16, -163, - -20, 409, 404, 184, 170, 171, 172, -270, -270, 404, - 184, 292, 510, 497, 16, 515, 111, 48, 117, 72, - 45, 647, 43, 648, 306, 27, 118, 242, 313, 61, - 62, 121, 597, 48, 403, 112, 113, 133, 200, 204, - 43, 402, 404, 184, 121, 200, 540, 307, 611, 16, - 522, 326, 43, 286, 287, 332, 199, 60, 338, 211, - 539, 333, -106, -106, -106, -106, 336, 16, -106, 44, - -106, -106, -106, 341, 540, 405, 405, 45, 342, 16, - 344, 544, 48, 347, 680, 576, -106, 510, 539, 348, - 542, 352, 688, 543, 111, 45, 553, -163, 226, 44, - 578, 356, -163, 378, -268, -268, 361, 45, 391, 27, - 307, 487, 144, 464, 465, 396, 598, 364, 379, 601, - 604, 668, 669, 153, 155, 615, 54, 608, 385, 584, - 586, 61, 62, 192, 193, 194, 200, 614, 386, 389, - -106, 401, 621, 415, -163, 398, 417, 542, -163, 624, - 543, 55, 180, 553, 430, 216, 56, 216, 435, -304, - 631, 492, 617, -32, 500, 501, 27, 502, 523, 7, - 540, 9, 189, 405, 477, 129, 130, 11, 12, 13, - 562, 11, 12, 13, 539, 168, 169, 170, 171, 172, - 254, 563, 601, 15, -33, 257, 258, 121, 572, 48, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 173, 174, 671, 182, 175, 176, 177, 178, - 601, 566, 569, 183, 184, 570, 211, 573, -115, -115, - -115, -115, -115, -115, -115, 626, -115, -115, -115, -115, - -115, 579, -115, -115, -115, -115, -115, -115, -115, -115, - -115, -115, -115, -115, -115, -115, -115, 574, -115, -115, - 581, 7, 8, 9, 10, -115, 582, 413, -115, 11, - 12, 13, 583, -115, -115, -115, 587, 595, -115, -115, - 607, 599, 609, -115, 610, 15, 623, 16, 625, 627, - 128, 129, 130, 628, 664, 630, 639, 11, 12, 13, - 345, 346, -115, -115, -115, -115, 438, -115, -325, -325, - -325, -325, -325, -325, -325, 16, -325, -325, -325, -325, - -325, 640, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, 655, -325, -325, - 650, 659, 663, 667, 673, -325, 676, 602, -325, 679, - 311, 682, 687, -325, -325, -325, 359, 489, -325, -325, - 476, 593, 211, -325, 127, -325, -325, -325, -325, 289, - 357, 387, 505, -325, -325, -325, 480, 558, 390, 328, - 384, 335, -325, 397, -325, -325, 481, -325, 495, -325, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 211, 490, -325, -325, 388, 446, 637, -325, -325, 638, - -325, 672, 674, 353, -325, 425, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, 0, -325, 414, - -325, 0, -325, -325, 453, 0, 0, 0, 0, -325, - 0, 0, -325, -102, 0, 0, 0, -325, -325, -325, - 0, 0, -325, -325, 0, 0, 0, -325, 0, 0, - 70, 7, 8, 9, 10, 71, 72, 425, 73, 11, - 12, 13, 0, 0, 0, 0, -325, -300, -325, -325, - 0, -325, 0, 0, 0, 15, 74, 16, 17, 498, - 75, 76, 0, 7, 8, 9, 10, 77, 453, 507, - 78, 11, 12, 13, 0, 79, 80, 81, 0, 0, - 82, 83, 0, 0, 0, 84, 0, 15, 453, 16, - 0, 519, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 0, 588, 0, -325, -325, 85, 86, 453, -325, - -325, 453, -325, 453, 0, 0, -325, 0, -325, -325, - -325, -325, -325, -325, -325, -325, -325, -325, -325, 565, - -325, 0, -325, 0, -325, -325, 585, 0, 0, 0, - 571, -325, 0, 0, -325, 0, 0, 0, 0, -325, - -325, -325, 0, 0, -325, -325, 0, 0, 0, -325, - 0, 0, 0, 594, 0, 0, 453, 7, 57, 9, - 58, 0, 0, 0, 0, 11, 12, 13, -325, 0, - -325, -325, 0, -325, 0, 618, 0, -335, -335, 0, - 0, 15, -335, -335, 0, -335, 0, 0, 0, -335, - 0, -335, -335, -335, -335, -335, -335, -335, -335, -335, - -335, -335, 0, -335, 629, -335, 0, -335, -335, 0, - 0, 0, 0, 0, -335, 0, 0, -335, 111, 0, - 0, -163, -335, -335, -335, 0, -163, -335, -335, 0, - 419, 145, -335, 70, 7, 0, 9, 98, 71, 72, - 0, 73, 11, 12, 13, 0, 0, 0, 0, 112, - 113, -335, 0, -335, -335, 0, -335, 0, 15, 74, - 0, 17, 0, 75, 76, 0, 0, 0, -163, 0, - 77, 0, -163, 78, 0, 0, 0, 0, 79, 80, - 81, 0, 0, 82, 83, 0, 0, 447, 84, 448, - 62, 0, 0, 0, 71, 72, 0, 73, 7, 8, - 9, 10, 0, 0, 0, 0, 11, 12, 13, 85, - 86, 0, -92, 0, 0, 74, 0, 17, 0, 75, - 76, 0, 15, 0, 16, 0, 77, 0, 0, 78, - 0, 0, 0, 0, 79, 80, 81, 0, 0, 82, - 83, 0, 0, 449, 84, 450, 447, 0, 448, 62, - 0, 0, 0, 71, 72, 0, 73, 166, 167, 168, - 169, 170, 171, 172, -191, 85, 86, 0, 451, 0, - 0, 0, 0, 0, 74, 0, 17, 0, 75, 76, - 0, 0, 0, 0, 0, 77, 0, 0, 78, 0, - 0, 0, 0, 79, 80, 81, 0, 0, 82, 83, - 0, 0, 449, 84, 450, 447, 0, 70, 0, 0, - 0, 0, 71, 72, 0, 73, 0, 0, 0, 0, - 0, 0, 0, -259, 85, 86, 0, 451, 0, 0, - 0, 0, 0, 74, 0, 17, 0, 75, 76, -204, - 0, 0, 0, 0, 77, 0, 0, 78, 0, 0, - 0, 0, 79, 80, 81, 0, 0, 82, 83, 0, - 0, -204, 84, -204, 423, 0, 70, 0, 0, 0, - 0, 71, 72, 0, 73, 165, 166, 167, 168, 169, - 170, 171, 172, 85, 86, 0, 451, 0, 0, 0, - 0, 0, 74, 0, 17, 0, 75, 76, 0, 7, - 8, 9, 10, 77, 0, 0, 78, 11, 12, 13, - 0, 79, 80, 81, 0, 0, 82, 83, 447, 0, - 70, 84, 0, 15, 0, 71, 72, 110, 73, 0, - -28, -28, -28, -28, 0, 0, 0, 0, -28, -28, - -28, 0, 85, 86, 0, 424, 74, 0, 17, 0, - 75, 76, 0, 111, -28, 0, -163, 77, 0, 0, - 78, -163, 0, 0, 0, 79, 80, 81, 0, 0, - 82, 83, 173, 174, 0, 84, 175, 176, 177, 178, - 0, 0, 0, 0, 112, 113, 0, 0, 0, 230, - 0, 0, -24, -24, -24, -24, 85, 86, 0, 451, - -24, -24, -24, -163, 70, 0, 0, -163, -28, 71, - 72, 0, 73, 0, 0, 111, -24, 0, -163, 0, - 0, 0, 0, -163, 0, 0, 0, 0, 0, 0, - 74, 0, 17, 0, 75, 76, 0, 0, 0, 0, - 0, 77, 0, 0, 78, 0, 112, 113, 0, 79, - 80, 208, 0, 0, 82, 83, 0, 0, 0, 84, - 0, 0, 0, 0, 0, -163, 70, 0, 0, -163, - -24, 71, 72, 0, 73, 0, 0, 0, 0, 0, - 85, 86, 0, 0, 209, 0, 0, 0, 0, 0, - 0, 0, 74, 0, 17, 0, 75, 76, 0, 0, - 0, 0, 0, 77, 0, 0, 78, 0, 0, 0, - 0, 79, 80, 81, 0, 0, 82, 83, 0, 70, - 0, 84, 0, 0, 71, 72, 0, 73, 233, 0, - 0, 7, 0, 9, 98, 0, 0, 0, 0, 11, - 12, 13, 85, 86, 0, 74, 284, 17, 0, 75, - 76, 0, 0, 0, 0, 15, 77, 0, 17, 78, - 0, 0, 0, 0, 79, 80, 81, 0, 0, 82, - 83, 0, 70, 0, 84, 0, 0, 71, 72, 294, - 73, 295, 7, 8, 9, 10, 0, 0, 296, 0, - 11, 12, 13, 0, 0, 85, 86, 0, 74, 305, - 17, 0, 75, 76, 234, -262, 15, 0, 16, 77, - 0, 0, 78, 0, 0, 0, 0, 79, 80, 81, - 0, 0, 82, 83, 0, 70, 0, 84, 0, 0, - 71, 72, 294, 73, 0, 7, 8, 9, 10, 0, - 0, 296, 0, 11, 12, 13, 0, 0, 85, 86, - 0, 74, 321, 17, -385, 75, 76, 0, 0, 15, - 0, 16, 77, 0, 0, 78, 0, 0, 0, 0, - 79, 80, 81, 0, 0, 82, 83, 0, 70, 0, - 84, 0, 0, 71, 72, 0, 73, 233, 0, 0, - 7, 0, 9, 98, 0, 0, 0, 0, 11, 12, - 13, 85, 86, 0, 74, 354, 17, -385, 75, 76, - 0, 0, 0, 0, 15, 77, 0, 17, 78, 0, - 0, 0, 0, 79, 80, 513, 0, 0, 82, 83, - 0, 70, 0, 84, 0, 0, 71, 72, 158, 73, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 85, 86, 0, 74, 514, 17, - 0, 75, 76, 605, 0, 0, 0, 0, 77, 0, - 0, 78, 0, 0, 0, 0, 79, 80, 81, 0, - 0, 82, 83, 0, 0, 0, 84, 0, 156, 157, - 158, 606, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 0, 85, 86, 0, - 0, 561, 448, 525, 8, 9, 10, 71, 72, 0, - 73, 11, 12, 13, 526, 0, 527, 528, 529, 530, - 531, 532, 533, 534, 535, 536, 537, 15, 74, 16, - 17, 0, 75, 76, 0, 0, 0, 0, 0, 77, - 0, 0, 78, 0, 0, 0, 0, 79, 80, 81, - 0, 0, 82, 83, 0, 0, 0, 84, 156, 157, - 158, 644, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 538, 0, 85, 86, - 0, 249, 448, 62, 0, 0, 0, 71, 72, 0, - 73, 0, 0, 0, 526, 0, 527, 528, 529, 530, - 531, 532, 533, 534, 535, 536, 537, 0, 74, 0, - 17, 0, 75, 76, 0, 0, 0, 0, 0, 77, - 0, 0, 78, 0, 0, 0, 0, 79, 80, 81, - 0, 0, 82, 83, 70, 0, 0, 84, 0, 71, - 72, 0, 73, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 538, 0, 85, 86, - 74, 249, 17, 0, 75, 76, 0, 0, 0, 0, - 0, 77, 0, 0, 78, 0, 0, 0, 0, 79, - 80, 81, 0, 0, 82, 83, 0, 0, 0, 84, - 70, 7, 0, 9, 98, 71, 72, 0, 73, 11, - 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 85, 86, 0, 339, 0, 15, 74, 0, 17, 0, - 75, 76, 0, 70, 0, 0, 0, 77, 71, 72, - 78, 73, 0, 0, 0, 79, 80, 81, 0, 0, - 82, 83, 0, 0, 0, 84, 0, 0, 0, 74, - 0, 17, 0, 75, 76, 0, 70, 0, 0, 0, - 77, 71, 72, 78, 73, 0, 85, 86, 79, 80, - 81, 0, 0, 82, 83, 0, 0, 0, 84, 0, - 0, 0, 74, 0, 17, 0, 75, 76, 0, 0, - 0, 0, 0, 77, 0, 0, 78, 575, 0, 85, - 86, 79, 80, 81, 0, 0, 82, 83, 70, 0, - 0, 84, 0, 71, 72, 0, 73, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 0, - 0, 0, 85, 86, 74, 0, 17, 0, 75, 76, - 0, 70, 0, 0, 0, 77, 71, 72, 78, 73, - 0, 0, 0, 79, 80, 81, 0, 0, 82, 83, - 0, 0, 0, 152, 0, 0, 0, 74, 0, 17, - 0, 75, 76, 0, 358, 0, 0, 0, 77, 71, - 72, 78, 73, 0, 85, 86, 79, 80, 81, 0, - 0, 82, 83, 0, 0, 0, 154, 0, 0, 0, - 74, 0, 17, 0, 75, 76, 0, 0, 0, 0, - 0, 77, 0, 0, 78, 0, 0, 85, 86, 79, - 80, 81, 0, 0, 82, 83, 0, 0, 6, 84, - -119, 7, 8, 9, 10, 0, 0, 0, 0, 11, - 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 85, 86, 0, 0, 14, 15, 0, 16, 17, 0, - 0, 554, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 0, 0, 0, 0, -119, 0, 0, - 0, 0, 0, 0, 0, -119, 156, 157, 158, 0, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 18, 156, 157, 158, 0, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 0, 0, 0, 16, 0, 0, 0, - 0, 156, 157, 158, 555, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 0, - 156, 157, 158, 622, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172 -}; - -static const yytype_int16 yycheck[] = -{ - 40, 41, 53, 29, 30, 31, 117, 3, 22, 5, - 3, 103, 5, 3, 51, 5, 122, 24, 147, 121, - 23, 24, 205, 225, 65, 213, 3, 227, 5, 231, - 59, 45, 183, 187, 11, 12, 13, 33, 283, 53, - 33, 418, 24, 33, 383, 22, 114, 24, 176, 459, - 362, 77, 108, 1, 84, 118, 33, 1, 135, 41, - 3, 4, 10, 3, 4, 135, 1, 30, 45, 3, - 4, 182, 0, 113, 51, 38, 53, 38, 104, 30, - 3, 4, 59, 30, 75, 76, 0, 9, 27, 27, - 81, 105, 38, 0, 504, 109, 87, 203, 127, 37, - 38, 39, 84, 226, 118, 444, 97, 58, 59, 232, - 48, 58, 59, 139, 568, 76, 479, 240, 56, 58, - 59, 103, 152, 58, 154, 58, 7, 50, 105, 280, - 76, 108, 109, 38, 82, 289, 499, 177, 82, 82, - 377, 118, 82, 380, 184, 135, 214, 557, 82, 175, - 127, 463, 178, 135, 76, 494, 219, 225, 187, 58, - 223, 238, 5, 231, 292, 619, 222, 412, 238, 50, - 152, 76, 154, 642, 58, 59, 77, 58, 59, 30, - 81, 3, 4, 121, 638, 7, 76, 641, 228, 643, - 33, 81, 76, 58, 132, 77, 58, 651, 239, 81, - 241, 670, 35, 50, 392, 219, 77, 584, 30, 223, - 81, 58, 59, 4, 5, 6, 7, 208, 77, 259, - 246, 12, 13, 14, 57, 82, 59, 77, 50, 683, - 207, 81, 235, 5, 237, 7, 58, 28, 76, 30, - 369, 82, 219, 81, 76, 222, 223, 287, 238, 81, - 589, 439, 82, 404, 442, 237, 238, 325, 76, 327, - 289, 252, 385, 386, 464, 291, 389, 81, 422, 76, - 362, 363, 400, 76, 81, 58, 59, 9, 81, 76, - 218, 3, 4, 406, 407, 408, 77, 410, 411, 77, - 78, 298, 403, 76, 297, 298, 3, 4, 409, 58, - 59, 3, 4, 405, 58, 312, 283, 333, 30, 77, - 77, 462, 435, 81, 81, 76, 298, 76, 469, 6, - 7, 298, 476, 30, 392, 12, 13, 14, 50, 1, - 312, 38, 4, 5, 6, 7, 58, 59, 58, 59, - 12, 13, 14, 50, 4, 78, 6, 7, 362, 363, - 78, 58, 12, 13, 14, 27, 28, 3, 30, 76, - 483, 7, 430, 35, 3, 391, 76, 496, 28, 420, - 373, 374, 440, 77, 442, 3, 4, 81, 76, 7, - 77, 3, 4, 77, 30, 362, 363, 81, 38, 366, - 404, 30, 374, 422, 431, 524, 519, 3, 4, 510, - 82, 7, 30, 77, 50, 77, 420, 81, 30, 81, - 82, 50, 58, 59, 50, 51, 52, 77, 78, 58, - 59, 58, 50, 449, 30, 465, 27, 404, 50, 9, - 58, 633, 3, 635, 83, 412, 58, 1, 35, 3, - 4, 418, 565, 420, 50, 58, 59, 476, 462, 463, - 3, 4, 58, 59, 431, 469, 496, 77, 581, 30, - 486, 77, 3, 58, 59, 35, 7, 405, 76, 1, - 496, 81, 4, 5, 6, 7, 78, 30, 10, 50, - 12, 13, 14, 76, 524, 462, 463, 58, 76, 30, - 38, 620, 469, 76, 677, 535, 28, 50, 524, 83, - 496, 83, 685, 496, 27, 58, 496, 30, 614, 50, - 536, 76, 35, 35, 77, 78, 76, 58, 32, 496, - 77, 78, 513, 58, 59, 38, 566, 76, 83, 569, - 570, 660, 661, 91, 92, 586, 543, 577, 78, 542, - 543, 3, 4, 5, 6, 7, 560, 584, 78, 78, - 82, 76, 592, 3, 77, 83, 77, 553, 81, 599, - 553, 543, 553, 553, 81, 633, 543, 635, 78, 78, - 610, 78, 586, 38, 38, 78, 553, 81, 78, 4, - 620, 6, 7, 560, 5, 6, 7, 12, 13, 14, - 83, 12, 13, 14, 620, 48, 49, 50, 51, 52, - 151, 78, 642, 28, 38, 156, 157, 584, 38, 586, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 53, 54, 664, 50, 57, 58, 59, 60, - 670, 58, 58, 58, 59, 58, 1, 77, 3, 4, - 5, 6, 7, 8, 9, 76, 11, 12, 13, 14, - 15, 7, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 77, 33, 34, - 38, 4, 5, 6, 7, 40, 77, 10, 43, 12, - 13, 14, 77, 48, 49, 50, 16, 78, 53, 54, - 77, 58, 77, 58, 58, 28, 76, 30, 17, 77, - 5, 6, 7, 76, 58, 77, 76, 12, 13, 14, - 261, 262, 77, 78, 79, 80, 1, 82, 3, 4, - 5, 6, 7, 8, 9, 30, 11, 12, 13, 14, - 15, 76, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 9, 33, 34, - 77, 77, 77, 81, 77, 40, 76, 569, 43, 76, - 214, 77, 77, 48, 49, 50, 292, 440, 53, 54, - 421, 553, 1, 58, 55, 4, 5, 6, 7, 190, - 291, 332, 458, 12, 13, 14, 428, 502, 335, 238, - 327, 246, 77, 344, 79, 80, 430, 82, 442, 28, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 1, 440, 3, 4, 333, 393, 620, 8, 9, 620, - 11, 665, 667, 286, 15, 376, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, -1, 29, 366, - 31, -1, 33, 34, 395, -1, -1, -1, -1, 40, - -1, -1, 43, 82, -1, -1, -1, 48, 49, 50, - -1, -1, 53, 54, -1, -1, -1, 58, -1, -1, - 3, 4, 5, 6, 7, 8, 9, 428, 11, 12, - 13, 14, -1, -1, -1, -1, 77, 78, 79, 80, - -1, 82, -1, -1, -1, 28, 29, 30, 31, 450, - 33, 34, -1, 4, 5, 6, 7, 40, 459, 460, - 43, 12, 13, 14, -1, 48, 49, 50, -1, -1, - 53, 54, -1, -1, -1, 58, -1, 28, 479, 30, - -1, 482, 44, 45, 46, 47, 48, 49, 50, 51, - 52, -1, 1, -1, 3, 4, 79, 80, 499, 8, - 9, 502, 11, 504, -1, -1, 15, -1, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 520, - 29, -1, 31, -1, 33, 34, 77, -1, -1, -1, - 531, 40, -1, -1, 43, -1, -1, -1, -1, 48, - 49, 50, -1, -1, 53, 54, -1, -1, -1, 58, - -1, -1, -1, 554, -1, -1, 557, 4, 5, 6, - 7, -1, -1, -1, -1, 12, 13, 14, 77, -1, - 79, 80, -1, 82, -1, 1, -1, 3, 4, -1, - -1, 28, 8, 9, -1, 11, -1, -1, -1, 15, - -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, -1, 29, 605, 31, -1, 33, 34, -1, - -1, -1, -1, -1, 40, -1, -1, 43, 27, -1, - -1, 30, 48, 49, 50, -1, 35, 53, 54, -1, - 77, 1, 58, 3, 4, -1, 6, 7, 8, 9, - -1, 11, 12, 13, 14, -1, -1, -1, -1, 58, - 59, 77, -1, 79, 80, -1, 82, -1, 28, 29, - -1, 31, -1, 33, 34, -1, -1, -1, 77, -1, - 40, -1, 81, 43, -1, -1, -1, -1, 48, 49, - 50, -1, -1, 53, 54, -1, -1, 1, 58, 3, - 4, -1, -1, -1, 8, 9, -1, 11, 4, 5, - 6, 7, -1, -1, -1, -1, 12, 13, 14, 79, - 80, -1, 82, -1, -1, 29, -1, 31, -1, 33, - 34, -1, 28, -1, 30, -1, 40, -1, -1, 43, - -1, -1, -1, -1, 48, 49, 50, -1, -1, 53, - 54, -1, -1, 57, 58, 59, 1, -1, 3, 4, - -1, -1, -1, 8, 9, -1, 11, 46, 47, 48, - 49, 50, 51, 52, 78, 79, 80, -1, 82, -1, - -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, - -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, - -1, -1, -1, 48, 49, 50, -1, -1, 53, 54, - -1, -1, 57, 58, 59, 1, -1, 3, -1, -1, - -1, -1, 8, 9, -1, 11, -1, -1, -1, -1, - -1, -1, -1, 78, 79, 80, -1, 82, -1, -1, - -1, -1, -1, 29, -1, 31, -1, 33, 34, 35, - -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, - -1, -1, 48, 49, 50, -1, -1, 53, 54, -1, - -1, 57, 58, 59, 1, -1, 3, -1, -1, -1, - -1, 8, 9, -1, 11, 45, 46, 47, 48, 49, - 50, 51, 52, 79, 80, -1, 82, -1, -1, -1, - -1, -1, 29, -1, 31, -1, 33, 34, -1, 4, - 5, 6, 7, 40, -1, -1, 43, 12, 13, 14, - -1, 48, 49, 50, -1, -1, 53, 54, 1, -1, - 3, 58, -1, 28, -1, 8, 9, 1, 11, -1, - 4, 5, 6, 7, -1, -1, -1, -1, 12, 13, - 14, -1, 79, 80, -1, 82, 29, -1, 31, -1, - 33, 34, -1, 27, 28, -1, 30, 40, -1, -1, - 43, 35, -1, -1, -1, 48, 49, 50, -1, -1, - 53, 54, 53, 54, -1, 58, 57, 58, 59, 60, - -1, -1, -1, -1, 58, 59, -1, -1, -1, 1, - -1, -1, 4, 5, 6, 7, 79, 80, -1, 82, - 12, 13, 14, 77, 3, -1, -1, 81, 82, 8, - 9, -1, 11, -1, -1, 27, 28, -1, 30, -1, - -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, - 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, - -1, 40, -1, -1, 43, -1, 58, 59, -1, 48, - 49, 50, -1, -1, 53, 54, -1, -1, -1, 58, - -1, -1, -1, -1, -1, 77, 3, -1, -1, 81, - 82, 8, 9, -1, 11, -1, -1, -1, -1, -1, - 79, 80, -1, -1, 83, -1, -1, -1, -1, -1, - -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, - -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, - -1, 48, 49, 50, -1, -1, 53, 54, -1, 3, - -1, 58, -1, -1, 8, 9, -1, 11, 1, -1, - -1, 4, -1, 6, 7, -1, -1, -1, -1, 12, - 13, 14, 79, 80, -1, 29, 83, 31, -1, 33, - 34, -1, -1, -1, -1, 28, 40, -1, 31, 43, - -1, -1, -1, -1, 48, 49, 50, -1, -1, 53, - 54, -1, 3, -1, 58, -1, -1, 8, 9, 1, - 11, 3, 4, 5, 6, 7, -1, -1, 10, -1, - 12, 13, 14, -1, -1, 79, 80, -1, 29, 83, - 31, -1, 33, 34, 77, 78, 28, -1, 30, 40, - -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, - -1, -1, 53, 54, -1, 3, -1, 58, -1, -1, - 8, 9, 1, 11, -1, 4, 5, 6, 7, -1, - -1, 10, -1, 12, 13, 14, -1, -1, 79, 80, - -1, 29, 83, 31, 76, 33, 34, -1, -1, 28, - -1, 30, 40, -1, -1, 43, -1, -1, -1, -1, - 48, 49, 50, -1, -1, 53, 54, -1, 3, -1, - 58, -1, -1, 8, 9, -1, 11, 1, -1, -1, - 4, -1, 6, 7, -1, -1, -1, -1, 12, 13, - 14, 79, 80, -1, 29, 83, 31, 76, 33, 34, - -1, -1, -1, -1, 28, 40, -1, 31, 43, -1, - -1, -1, -1, 48, 49, 50, -1, -1, 53, 54, - -1, 3, -1, 58, -1, -1, 8, 9, 37, 11, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 79, 80, -1, 29, 83, 31, - -1, 33, 34, 10, -1, -1, -1, -1, 40, -1, - -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, - -1, 53, 54, -1, -1, -1, 58, -1, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, -1, 79, 80, -1, - -1, 83, 3, 4, 5, 6, 7, 8, 9, -1, - 11, 12, 13, 14, 15, -1, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, - -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, - -1, -1, 53, 54, -1, -1, -1, 58, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 77, -1, 79, 80, - -1, 82, 3, 4, -1, -1, -1, 8, 9, -1, - 11, -1, -1, -1, 15, -1, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, -1, 29, -1, - 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, - -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, - -1, -1, 53, 54, 3, -1, -1, 58, -1, 8, - 9, -1, 11, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 77, -1, 79, 80, - 29, 82, 31, -1, 33, 34, -1, -1, -1, -1, - -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, - 49, 50, -1, -1, 53, 54, -1, -1, -1, 58, - 3, 4, -1, 6, 7, 8, 9, -1, 11, 12, - 13, 14, -1, -1, -1, -1, -1, -1, -1, -1, - 79, 80, -1, 82, -1, 28, 29, -1, 31, -1, - 33, 34, -1, 3, -1, -1, -1, 40, 8, 9, - 43, 11, -1, -1, -1, 48, 49, 50, -1, -1, - 53, 54, -1, -1, -1, 58, -1, -1, -1, 29, - -1, 31, -1, 33, 34, -1, 3, -1, -1, -1, - 40, 8, 9, 43, 11, -1, 79, 80, 48, 49, - 50, -1, -1, 53, 54, -1, -1, -1, 58, -1, - -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, - -1, -1, -1, 40, -1, -1, 43, 77, -1, 79, - 80, 48, 49, 50, -1, -1, 53, 54, 3, -1, - -1, 58, -1, 8, 9, -1, 11, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, - -1, -1, 79, 80, 29, -1, 31, -1, 33, 34, - -1, 3, -1, -1, -1, 40, 8, 9, 43, 11, - -1, -1, -1, 48, 49, 50, -1, -1, 53, 54, - -1, -1, -1, 58, -1, -1, -1, 29, -1, 31, - -1, 33, 34, -1, 3, -1, -1, -1, 40, 8, - 9, 43, 11, -1, 79, 80, 48, 49, 50, -1, - -1, 53, 54, -1, -1, -1, 58, -1, -1, -1, - 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, - -1, 40, -1, -1, 43, -1, -1, 79, 80, 48, - 49, 50, -1, -1, 53, 54, -1, -1, 1, 58, - 3, 4, 5, 6, 7, -1, -1, -1, -1, 12, - 13, 14, -1, -1, -1, -1, -1, -1, -1, -1, - 79, 80, -1, -1, 27, 28, -1, 30, 31, -1, - -1, 10, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, -1, -1, -1, -1, 50, -1, -1, - -1, -1, -1, -1, -1, 58, 35, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 77, 35, 36, 37, -1, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, -1, -1, -1, 30, -1, -1, -1, - -1, 35, 36, 37, 83, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, - 35, 36, 37, 83, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 85, 86, 87, 0, 88, 1, 4, 5, 6, - 7, 12, 13, 14, 27, 28, 30, 31, 77, 89, - 90, 91, 123, 126, 130, 131, 134, 144, 145, 169, - 170, 171, 172, 241, 89, 77, 78, 144, 144, 144, - 58, 58, 58, 3, 50, 58, 137, 141, 144, 168, - 77, 123, 77, 123, 131, 134, 144, 5, 7, 127, - 145, 3, 4, 82, 98, 82, 98, 82, 98, 89, - 3, 8, 9, 11, 29, 33, 34, 40, 43, 48, - 49, 50, 53, 54, 58, 79, 80, 99, 100, 102, - 103, 104, 105, 106, 108, 114, 116, 241, 7, 100, - 132, 134, 186, 188, 58, 189, 168, 77, 81, 124, - 1, 27, 58, 59, 96, 138, 4, 50, 58, 136, - 139, 144, 165, 166, 168, 137, 168, 127, 5, 6, - 7, 135, 144, 172, 179, 180, 82, 179, 82, 176, - 82, 106, 106, 98, 106, 1, 100, 115, 186, 106, - 76, 81, 58, 103, 58, 103, 35, 36, 37, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 57, 58, 59, 60, 9, - 106, 76, 50, 58, 59, 187, 190, 133, 76, 7, - 134, 187, 5, 6, 7, 98, 146, 147, 148, 7, - 168, 76, 139, 165, 168, 58, 236, 237, 50, 83, - 100, 1, 117, 118, 119, 194, 206, 143, 144, 189, - 166, 77, 81, 124, 1, 92, 138, 58, 59, 77, - 1, 94, 78, 1, 77, 132, 181, 188, 241, 173, - 78, 174, 1, 98, 184, 185, 175, 76, 76, 82, - 200, 201, 76, 77, 108, 186, 186, 108, 108, 111, - 113, 110, 109, 108, 108, 108, 108, 108, 108, 108, - 108, 108, 108, 108, 108, 98, 101, 102, 100, 98, - 189, 190, 229, 230, 83, 100, 58, 59, 135, 133, - 76, 81, 58, 116, 1, 3, 10, 126, 130, 231, - 233, 234, 235, 238, 239, 83, 83, 77, 97, 194, - 10, 118, 207, 35, 166, 76, 139, 166, 117, 143, - 236, 83, 100, 117, 143, 123, 77, 123, 181, 179, - 143, 179, 35, 81, 178, 184, 78, 195, 76, 82, - 106, 76, 76, 100, 38, 108, 108, 76, 83, 190, - 76, 231, 83, 229, 83, 100, 76, 147, 3, 101, - 76, 76, 123, 123, 76, 77, 81, 76, 81, 1, - 199, 201, 120, 128, 131, 134, 142, 93, 35, 83, - 95, 182, 183, 206, 182, 78, 78, 108, 185, 78, - 178, 32, 196, 197, 198, 107, 38, 108, 83, 76, - 81, 76, 4, 50, 58, 144, 167, 168, 187, 50, - 168, 187, 232, 10, 235, 3, 201, 77, 123, 77, - 123, 134, 129, 1, 82, 108, 149, 199, 140, 199, - 81, 207, 143, 143, 143, 78, 98, 240, 1, 121, - 122, 191, 192, 194, 206, 209, 198, 1, 3, 57, - 59, 82, 98, 108, 151, 152, 153, 155, 157, 158, - 112, 102, 189, 124, 58, 59, 143, 143, 143, 189, - 143, 143, 231, 136, 137, 168, 129, 5, 135, 150, - 149, 183, 38, 165, 143, 77, 81, 78, 194, 121, - 191, 193, 78, 194, 206, 209, 207, 98, 108, 156, - 38, 78, 81, 177, 35, 158, 155, 108, 76, 167, - 50, 167, 236, 50, 83, 100, 77, 77, 151, 108, - 38, 143, 98, 78, 207, 4, 15, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 77, 98, - 100, 125, 126, 130, 201, 202, 203, 204, 210, 211, - 219, 220, 222, 241, 10, 83, 151, 154, 153, 155, - 189, 83, 83, 78, 143, 108, 58, 213, 205, 58, - 58, 108, 38, 77, 77, 77, 100, 50, 98, 7, - 223, 38, 77, 77, 123, 77, 123, 16, 1, 206, - 208, 1, 58, 125, 108, 78, 155, 143, 100, 58, - 208, 100, 114, 224, 100, 10, 38, 77, 100, 77, - 58, 143, 136, 159, 165, 137, 162, 168, 1, 212, - 207, 100, 83, 76, 100, 17, 76, 77, 76, 108, - 77, 100, 77, 160, 77, 163, 208, 211, 222, 76, - 76, 221, 215, 218, 38, 38, 76, 117, 117, 208, - 77, 214, 208, 224, 208, 9, 225, 226, 227, 77, - 161, 164, 208, 77, 58, 38, 76, 81, 201, 201, - 216, 100, 225, 77, 227, 224, 76, 38, 76, 76, - 116, 228, 77, 217, 76, 81, 208, 77, 116 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: - - { if (pedantic) - pedwarn ("ANSI C forbids an empty source file"); - ;} - break; - - case 3: - - { - /* In case there were missing closebraces, - get us back to the global binding level. */ - while (! global_bindings_p ()) - poplevel (0, 0, 0); - ;} - break; - - case 4: - - {(yyval.ttype) = NULL_TREE; ;} - break; - - case 6: - - {(yyval.ttype) = NULL_TREE; ;} - break; - - case 10: - - { STRIP_NOPS ((yyvsp[(3) - (5)].ttype)); - if ((TREE_CODE ((yyvsp[(3) - (5)].ttype)) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND ((yyvsp[(3) - (5)].ttype), 0)) == STRING_CST) - || TREE_CODE ((yyvsp[(3) - (5)].ttype)) == STRING_CST) - assemble_asm ((yyvsp[(3) - (5)].ttype)); - else - error ("argument of `asm' is not a constant string"); ;} - break; - - case 11: - - { pedantic = (yyvsp[(1) - (2)].itype); ;} - break; - - case 12: - - { if (pedantic) - error ("ANSI C forbids data definition with no type or storage class"); - else if (!flag_traditional) - warning ("data definition has no type or storage class"); - - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(1) - (3)].itype)); ;} - break; - - case 13: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 14: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 15: - - { pedwarn ("empty declaration"); ;} - break; - - case 16: - - { shadow_tag ((yyvsp[(1) - (2)].ttype)); ;} - break; - - case 19: - - { if (pedantic) - pedwarn ("ANSI C does not allow extra `;' outside of a function"); ;} - break; - - case 20: - - { if (! start_function (current_declspecs, (yyvsp[(3) - (3)].ttype), - prefix_attributes, NULL_TREE, 0)) - YYERROR1; - reinit_parse_for_function (); ;} - break; - - case 21: - - { store_parm_decls (); ;} - break; - - case 22: - - { finish_function (0); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (7)].itype)); ;} - break; - - case 23: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 24: - - { if (! start_function (current_declspecs, (yyvsp[(3) - (3)].ttype), - prefix_attributes, NULL_TREE, 0)) - YYERROR1; - reinit_parse_for_function (); ;} - break; - - case 25: - - { store_parm_decls (); ;} - break; - - case 26: - - { finish_function (0); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (7)].itype)); ;} - break; - - case 27: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 28: - - { if (! start_function (NULL_TREE, (yyvsp[(2) - (2)].ttype), - prefix_attributes, NULL_TREE, 0)) - YYERROR1; - reinit_parse_for_function (); ;} - break; - - case 29: - - { store_parm_decls (); ;} - break; - - case 30: - - { finish_function (0); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(1) - (6)].itype)); ;} - break; - - case 31: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(1) - (3)].itype)); ;} - break; - - case 34: - - { (yyval.code) = ADDR_EXPR; ;} - break; - - case 35: - - { (yyval.code) = NEGATE_EXPR; ;} - break; - - case 36: - - { (yyval.code) = CONVERT_EXPR; ;} - break; - - case 37: - - { (yyval.code) = PREINCREMENT_EXPR; ;} - break; - - case 38: - - { (yyval.code) = PREDECREMENT_EXPR; ;} - break; - - case 39: - - { (yyval.code) = BIT_NOT_EXPR; ;} - break; - - case 40: - - { (yyval.code) = TRUTH_NOT_EXPR; ;} - break; - - case 41: - - { (yyval.ttype) = build_compound_expr ((yyvsp[(1) - (1)].ttype)); ;} - break; - - case 42: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 44: - - { (yyval.ttype) = build_tree_list (NULL_TREE, (yyvsp[(1) - (1)].ttype)); ;} - break; - - case 45: - - { chainon ((yyvsp[(1) - (3)].ttype), build_tree_list (NULL_TREE, (yyvsp[(3) - (3)].ttype))); ;} - break; - - case 47: - - { (yyval.ttype) = build_indirect_ref ((yyvsp[(2) - (2)].ttype), "unary *"); ;} - break; - - case 48: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); - pedantic = (yyvsp[(1) - (2)].itype); ;} - break; - - case 49: - - { (yyval.ttype) = build_unary_op ((yyvsp[(1) - (2)].code), (yyvsp[(2) - (2)].ttype), 0); - overflow_warning ((yyval.ttype)); ;} - break; - - case 50: - - { tree label = lookup_label ((yyvsp[(2) - (2)].ttype)); - if (pedantic) - pedwarn ("ANSI C forbids `&&'"); - if (label == 0) - (yyval.ttype) = null_pointer_node; - else - { - TREE_USED (label) = 1; - (yyval.ttype) = build1 (ADDR_EXPR, ptr_type_node, label); - TREE_CONSTANT ((yyval.ttype)) = 1; - } - ;} - break; - - case 51: - - { skip_evaluation--; - if (TREE_CODE ((yyvsp[(2) - (2)].ttype)) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND ((yyvsp[(2) - (2)].ttype), 1))) - error ("`sizeof' applied to a bit-field"); - (yyval.ttype) = c_sizeof (TREE_TYPE ((yyvsp[(2) - (2)].ttype))); ;} - break; - - case 52: - - { skip_evaluation--; - (yyval.ttype) = c_sizeof (groktypename ((yyvsp[(3) - (4)].ttype))); ;} - break; - - case 53: - - { skip_evaluation--; - (yyval.ttype) = c_alignof_expr ((yyvsp[(2) - (2)].ttype)); ;} - break; - - case 54: - - { skip_evaluation--; - (yyval.ttype) = c_alignof (groktypename ((yyvsp[(3) - (4)].ttype))); ;} - break; - - case 55: - - { (yyval.ttype) = build_unary_op (REALPART_EXPR, (yyvsp[(2) - (2)].ttype), 0); ;} - break; - - case 56: - - { (yyval.ttype) = build_unary_op (IMAGPART_EXPR, (yyvsp[(2) - (2)].ttype), 0); ;} - break; - - case 57: - - { skip_evaluation++; ;} - break; - - case 58: - - { skip_evaluation++; ;} - break; - - case 60: - - { tree type = groktypename ((yyvsp[(2) - (4)].ttype)); - (yyval.ttype) = build_c_cast (type, (yyvsp[(4) - (4)].ttype)); ;} - break; - - case 61: - - { start_init (NULL_TREE, NULL, 0); - (yyvsp[(2) - (4)].ttype) = groktypename ((yyvsp[(2) - (4)].ttype)); - really_start_incremental_init ((yyvsp[(2) - (4)].ttype)); ;} - break; - - case 62: - - { char *name; - tree result = pop_init_level (0); - tree type = (yyvsp[(2) - (7)].ttype); - finish_init (); - - if (pedantic && ! flag_isoc9x) - pedwarn ("ANSI C forbids constructor expressions"); - if (TYPE_NAME (type) != 0) - { - if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - name = IDENTIFIER_POINTER (TYPE_NAME (type)); - else - name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); - } - else - name = ""; - (yyval.ttype) = result; - if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0) - { - int failure = complete_array_type (type, (yyval.ttype), 1); - if (failure) - abort (); - } - ;} - break; - - case 64: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 65: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 66: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 67: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 68: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 69: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 70: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 71: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 72: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 73: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 74: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 75: - - { (yyval.ttype) = parser_build_binary_op ((yyvsp[(2) - (3)].code), (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 76: - - { (yyvsp[(1) - (2)].ttype) = truthvalue_conversion (default_conversion ((yyvsp[(1) - (2)].ttype))); - skip_evaluation += (yyvsp[(1) - (2)].ttype) == boolean_false_node; ;} - break; - - case 77: - - { skip_evaluation -= (yyvsp[(1) - (4)].ttype) == boolean_false_node; - (yyval.ttype) = parser_build_binary_op (TRUTH_ANDIF_EXPR, (yyvsp[(1) - (4)].ttype), (yyvsp[(4) - (4)].ttype)); ;} - break; - - case 78: - - { (yyvsp[(1) - (2)].ttype) = truthvalue_conversion (default_conversion ((yyvsp[(1) - (2)].ttype))); - skip_evaluation += (yyvsp[(1) - (2)].ttype) == boolean_true_node; ;} - break; - - case 79: - - { skip_evaluation -= (yyvsp[(1) - (4)].ttype) == boolean_true_node; - (yyval.ttype) = parser_build_binary_op (TRUTH_ORIF_EXPR, (yyvsp[(1) - (4)].ttype), (yyvsp[(4) - (4)].ttype)); ;} - break; - - case 80: - - { (yyvsp[(1) - (2)].ttype) = truthvalue_conversion (default_conversion ((yyvsp[(1) - (2)].ttype))); - skip_evaluation += (yyvsp[(1) - (2)].ttype) == boolean_false_node; ;} - break; - - case 81: - - { skip_evaluation += (((yyvsp[(1) - (5)].ttype) == boolean_true_node) - - ((yyvsp[(1) - (5)].ttype) == boolean_false_node)); ;} - break; - - case 82: - - { skip_evaluation -= (yyvsp[(1) - (7)].ttype) == boolean_true_node; - (yyval.ttype) = build_conditional_expr ((yyvsp[(1) - (7)].ttype), (yyvsp[(4) - (7)].ttype), (yyvsp[(7) - (7)].ttype)); ;} - break; - - case 83: - - { if (pedantic) - pedwarn ("ANSI C forbids omitting the middle term of a ?: expression"); - /* Make sure first operand is calculated only once. */ - (yyvsp[(2) - (2)].ttype) = save_expr ((yyvsp[(1) - (2)].ttype)); - (yyvsp[(1) - (2)].ttype) = truthvalue_conversion (default_conversion ((yyvsp[(2) - (2)].ttype))); - skip_evaluation += (yyvsp[(1) - (2)].ttype) == boolean_true_node; ;} - break; - - case 84: - - { skip_evaluation -= (yyvsp[(1) - (5)].ttype) == boolean_true_node; - (yyval.ttype) = build_conditional_expr ((yyvsp[(1) - (5)].ttype), (yyvsp[(2) - (5)].ttype), (yyvsp[(5) - (5)].ttype)); ;} - break; - - case 85: - - { (yyval.ttype) = build_modify_expr ((yyvsp[(1) - (3)].ttype), NOP_EXPR, (yyvsp[(3) - (3)].ttype)); - C_SET_EXP_ORIGINAL_CODE ((yyval.ttype), MODIFY_EXPR); ;} - break; - - case 86: - - { (yyval.ttype) = build_modify_expr ((yyvsp[(1) - (3)].ttype), (yyvsp[(2) - (3)].code), (yyvsp[(3) - (3)].ttype)); - /* This inhibits warnings in truthvalue_conversion. */ - C_SET_EXP_ORIGINAL_CODE ((yyval.ttype), ERROR_MARK); ;} - break; - - case 87: - - { - (yyval.ttype) = lastiddecl; - if (!(yyval.ttype) || (yyval.ttype) == error_mark_node) - { - if (yychar == YYEMPTY) - yychar = YYLEX; - if (yychar == '(') - { - { - /* Ordinary implicit function declaration. */ - (yyval.ttype) = implicitly_declare ((yyvsp[(1) - (1)].ttype)); - assemble_external ((yyval.ttype)); - TREE_USED ((yyval.ttype)) = 1; - } - } - else if (current_function_decl == 0) - { - error ("`%s' undeclared here (not in a function)", - IDENTIFIER_POINTER ((yyvsp[(1) - (1)].ttype))); - (yyval.ttype) = error_mark_node; - } - else - { - { - if (IDENTIFIER_GLOBAL_VALUE ((yyvsp[(1) - (1)].ttype)) != error_mark_node - || IDENTIFIER_ERROR_LOCUS ((yyvsp[(1) - (1)].ttype)) != current_function_decl) - { - error ("`%s' undeclared (first use in this function)", - IDENTIFIER_POINTER ((yyvsp[(1) - (1)].ttype))); - - if (! undeclared_variable_notice) - { - error ("(Each undeclared identifier is reported only once"); - error ("for each function it appears in.)"); - undeclared_variable_notice = 1; - } - } - (yyval.ttype) = error_mark_node; - /* Prevent repeated error messages. */ - IDENTIFIER_GLOBAL_VALUE ((yyvsp[(1) - (1)].ttype)) = error_mark_node; - IDENTIFIER_ERROR_LOCUS ((yyvsp[(1) - (1)].ttype)) = current_function_decl; - } - } - } - else if (TREE_TYPE ((yyval.ttype)) == error_mark_node) - (yyval.ttype) = error_mark_node; - else if (C_DECL_ANTICIPATED ((yyval.ttype))) - { - /* The first time we see a build-in function used, - if it has not been declared. */ - C_DECL_ANTICIPATED ((yyval.ttype)) = 0; - if (yychar == YYEMPTY) - yychar = YYLEX; - if (yychar == '(') - { - /* Omit the implicit declaration we - would ordinarily do, so we don't lose - the actual built in type. - But print a diagnostic for the mismatch. */ - if (TREE_CODE ((yyval.ttype)) != FUNCTION_DECL) - error ("`%s' implicitly declared as function", - IDENTIFIER_POINTER (DECL_NAME ((yyval.ttype)))); - else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ((yyval.ttype)))) - != TYPE_MODE (integer_type_node)) - && (TREE_TYPE (TREE_TYPE ((yyval.ttype))) - != void_type_node)) - pedwarn ("type mismatch in implicit declaration for built-in function `%s'", - IDENTIFIER_POINTER (DECL_NAME ((yyval.ttype)))); - /* If it really returns void, change that to int. */ - if (TREE_TYPE (TREE_TYPE ((yyval.ttype))) == void_type_node) - TREE_TYPE ((yyval.ttype)) - = build_function_type (integer_type_node, - TYPE_ARG_TYPES (TREE_TYPE ((yyval.ttype)))); - } - else - pedwarn ("built-in function `%s' used without declaration", - IDENTIFIER_POINTER (DECL_NAME ((yyval.ttype)))); - - /* Do what we would ordinarily do when a fn is used. */ - assemble_external ((yyval.ttype)); - TREE_USED ((yyval.ttype)) = 1; - } - else - { - assemble_external ((yyval.ttype)); - TREE_USED ((yyval.ttype)) = 1; - } - - if (TREE_CODE ((yyval.ttype)) == CONST_DECL) - { - (yyval.ttype) = DECL_INITIAL ((yyval.ttype)); - /* This is to prevent an enum whose value is 0 - from being considered a null pointer constant. */ - (yyval.ttype) = build1 (NOP_EXPR, TREE_TYPE ((yyval.ttype)), (yyval.ttype)); - TREE_CONSTANT ((yyval.ttype)) = 1; - } - ;} - break; - - case 89: - - { (yyval.ttype) = combine_strings ((yyvsp[(1) - (1)].ttype)); ;} - break; - - case 90: - - { char class = TREE_CODE_CLASS (TREE_CODE ((yyvsp[(2) - (3)].ttype))); - if (class == 'e' || class == '1' - || class == '2' || class == '<') - C_SET_EXP_ORIGINAL_CODE ((yyvsp[(2) - (3)].ttype), ERROR_MARK); - (yyval.ttype) = (yyvsp[(2) - (3)].ttype); ;} - break; - - case 91: - - { (yyval.ttype) = error_mark_node; ;} - break; - - case 92: - - { if (current_function_decl == 0) - { - error ("braced-group within expression allowed only inside a function"); - YYERROR; - } - /* We must force a BLOCK for this level - so that, if it is not expanded later, - there is a way to turn off the entire subtree of blocks - that are contained in it. */ - keep_next_level (); - push_iterator_stack (); - push_label_level (); - (yyval.ttype) = expand_start_stmt_expr (); ;} - break; - - case 93: - - { tree rtl_exp; - if (pedantic) - pedwarn ("ANSI C forbids braced-groups within expressions"); - pop_iterator_stack (); - pop_label_level (); - rtl_exp = expand_end_stmt_expr ((yyvsp[(2) - (4)].ttype)); - /* The statements have side effects, so the group does. */ - TREE_SIDE_EFFECTS (rtl_exp) = 1; - - if (TREE_CODE ((yyvsp[(3) - (4)].ttype)) == BLOCK) - { - /* Make a BIND_EXPR for the BLOCK already made. */ - (yyval.ttype) = build (BIND_EXPR, TREE_TYPE (rtl_exp), - NULL_TREE, rtl_exp, (yyvsp[(3) - (4)].ttype)); - /* Remove the block from the tree at this point. - It gets put back at the proper place - when the BIND_EXPR is expanded. */ - delete_block ((yyvsp[(3) - (4)].ttype)); - } - else - (yyval.ttype) = (yyvsp[(3) - (4)].ttype); - ;} - break; - - case 94: - - { (yyval.ttype) = build_function_call ((yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 95: - - { (yyval.ttype) = build_array_ref ((yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 96: - - { - (yyval.ttype) = build_component_ref ((yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); - ;} - break; - - case 97: - - { - tree expr = build_indirect_ref ((yyvsp[(1) - (3)].ttype), "->"); - - (yyval.ttype) = build_component_ref (expr, (yyvsp[(3) - (3)].ttype)); - ;} - break; - - case 98: - - { (yyval.ttype) = build_unary_op (POSTINCREMENT_EXPR, (yyvsp[(1) - (2)].ttype), 0); ;} - break; - - case 99: - - { (yyval.ttype) = build_unary_op (POSTDECREMENT_EXPR, (yyvsp[(1) - (2)].ttype), 0); ;} - break; - - case 101: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 104: - - { c_mark_varargs (); - if (pedantic) - pedwarn ("ANSI C does not permit use of `varargs.h'"); ;} - break; - - case 105: - - { ;} - break; - - case 110: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 111: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 112: - - { shadow_tag_warned ((yyvsp[(1) - (2)].ttype), 1); - pedwarn ("empty declaration"); ;} - break; - - case 113: - - { pedwarn ("empty declaration"); ;} - break; - - case 114: - - { ;} - break; - - case 119: - - { (yyval.itype) = suspend_momentary (); - pending_xref_error (); - declspec_stack = tree_cons (prefix_attributes, - current_declspecs, - declspec_stack); - split_specs_attrs ((yyvsp[(0) - (0)].ttype), - ¤t_declspecs, &prefix_attributes); ;} - break; - - case 120: - - { prefix_attributes = chainon (prefix_attributes, (yyvsp[(0) - (0)].ttype)); ;} - break; - - case 121: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 122: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 123: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (3)].itype)); ;} - break; - - case 124: - - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (3)].itype)); ;} - break; - - case 125: - - { shadow_tag ((yyvsp[(1) - (2)].ttype)); ;} - break; - - case 126: - - { pedwarn ("empty declaration"); ;} - break; - - case 127: - - { pedantic = (yyvsp[(1) - (2)].itype); ;} - break; - - case 128: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 129: - - { (yyval.ttype) = chainon ((yyvsp[(3) - (3)].ttype), tree_cons (NULL_TREE, (yyvsp[(2) - (3)].ttype), (yyvsp[(1) - (3)].ttype))); ;} - break; - - case 130: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 131: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 132: - - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ((yyvsp[(2) - (2)].ttype))); - (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 133: - - { (yyval.ttype) = tree_cons ((yyvsp[(2) - (2)].ttype), NULL_TREE, (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 134: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 135: - - { (yyval.ttype) = chainon ((yyvsp[(3) - (3)].ttype), tree_cons (NULL_TREE, (yyvsp[(2) - (3)].ttype), (yyvsp[(1) - (3)].ttype))); ;} - break; - - case 136: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 137: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 138: - - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ((yyvsp[(2) - (2)].ttype))); - (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 139: - - { (yyval.ttype) = (yyvsp[(1) - (1)].ttype); ;} - break; - - case 140: - - { (yyval.ttype) = tree_cons ((yyvsp[(1) - (1)].ttype), NULL_TREE, NULL_TREE); ;} - break; - - case 141: - - { (yyval.ttype) = chainon ((yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 142: - - { (yyval.ttype) = tree_cons ((yyvsp[(2) - (2)].ttype), NULL_TREE, (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 143: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(1) - (1)].ttype), NULL_TREE); - TREE_STATIC ((yyval.ttype)) = 1; ;} - break; - - case 144: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(1) - (1)].ttype), NULL_TREE); ;} - break; - - case 145: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); - TREE_STATIC ((yyval.ttype)) = 1; ;} - break; - - case 146: - - { if (extra_warnings && TREE_STATIC ((yyvsp[(1) - (2)].ttype))) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ((yyvsp[(2) - (2)].ttype))); - (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); - TREE_STATIC ((yyval.ttype)) = TREE_STATIC ((yyvsp[(1) - (2)].ttype)); ;} - break; - - case 147: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 148: - - { (yyval.ttype) = chainon ((yyvsp[(3) - (3)].ttype), tree_cons (NULL_TREE, (yyvsp[(2) - (3)].ttype), (yyvsp[(1) - (3)].ttype))); ;} - break; - - case 149: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 150: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 153: - - { /* For a typedef name, record the meaning, not the name. - In case of `foo foo, bar;'. */ - (yyval.ttype) = lookup_name ((yyvsp[(1) - (1)].ttype)); ;} - break; - - case 154: - - { (yyval.ttype) = TREE_TYPE ((yyvsp[(3) - (4)].ttype)); ;} - break; - - case 155: - - { (yyval.ttype) = groktypename ((yyvsp[(3) - (4)].ttype)); ;} - break; - - case 163: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 164: - - { if (TREE_CHAIN ((yyvsp[(3) - (4)].ttype))) (yyvsp[(3) - (4)].ttype) = combine_strings ((yyvsp[(3) - (4)].ttype)); - (yyval.ttype) = (yyvsp[(3) - (4)].ttype); - ;} - break; - - case 165: - - { (yyval.ttype) = start_decl ((yyvsp[(1) - (4)].ttype), current_declspecs, 1, - (yyvsp[(3) - (4)].ttype), prefix_attributes); - start_init ((yyval.ttype), (yyvsp[(2) - (4)].ttype), global_bindings_p ()); ;} - break; - - case 166: - - { finish_init (); - finish_decl ((yyvsp[(5) - (6)].ttype), (yyvsp[(6) - (6)].ttype), (yyvsp[(2) - (6)].ttype)); ;} - break; - - case 167: - - { tree d = start_decl ((yyvsp[(1) - (3)].ttype), current_declspecs, 0, - (yyvsp[(3) - (3)].ttype), prefix_attributes); - finish_decl (d, NULL_TREE, (yyvsp[(2) - (3)].ttype)); - ;} - break; - - case 168: - - { (yyval.ttype) = start_decl ((yyvsp[(1) - (4)].ttype), current_declspecs, 1, - (yyvsp[(3) - (4)].ttype), prefix_attributes); - start_init ((yyval.ttype), (yyvsp[(2) - (4)].ttype), global_bindings_p ()); ;} - break; - - case 169: - - { finish_init (); - decl_attributes ((yyvsp[(5) - (6)].ttype), (yyvsp[(3) - (6)].ttype), prefix_attributes); - finish_decl ((yyvsp[(5) - (6)].ttype), (yyvsp[(6) - (6)].ttype), (yyvsp[(2) - (6)].ttype)); ;} - break; - - case 170: - - { tree d = start_decl ((yyvsp[(1) - (3)].ttype), current_declspecs, 0, - (yyvsp[(3) - (3)].ttype), prefix_attributes); - finish_decl (d, NULL_TREE, (yyvsp[(2) - (3)].ttype)); ;} - break; - - case 171: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 172: - - { (yyval.ttype) = (yyvsp[(1) - (1)].ttype); ;} - break; - - case 173: - - { (yyval.ttype) = (yyvsp[(1) - (1)].ttype); ;} - break; - - case 174: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 175: - - { (yyval.ttype) = (yyvsp[(4) - (6)].ttype); ;} - break; - - case 176: - - { (yyval.ttype) = (yyvsp[(1) - (1)].ttype); ;} - break; - - case 177: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 178: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 179: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (1)].ttype), NULL_TREE); ;} - break; - - case 180: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (4)].ttype), build_tree_list (NULL_TREE, (yyvsp[(3) - (4)].ttype))); ;} - break; - - case 181: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (6)].ttype), tree_cons (NULL_TREE, (yyvsp[(3) - (6)].ttype), (yyvsp[(5) - (6)].ttype))); ;} - break; - - case 182: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 188: - - { really_start_incremental_init (NULL_TREE); - /* Note that the call to clear_momentary - is in process_init_element. */ - push_momentary (); ;} - break; - - case 189: - - { (yyval.ttype) = pop_init_level (0); - if ((yyval.ttype) == error_mark_node - && ! (yychar == STRING || yychar == CONSTANT)) - pop_momentary (); - else - pop_momentary_nofree (); ;} - break; - - case 190: - - { (yyval.ttype) = error_mark_node; ;} - break; - - case 191: - - { if (pedantic) - pedwarn ("ANSI C forbids empty initializer braces"); ;} - break; - - case 197: - - { set_init_label ((yyvsp[(1) - (2)].ttype)); ;} - break; - - case 200: - - { push_init_level (0); ;} - break; - - case 201: - - { process_init_element (pop_init_level (0)); ;} - break; - - case 202: - - { process_init_element ((yyvsp[(1) - (1)].ttype)); ;} - break; - - case 206: - - { set_init_label ((yyvsp[(2) - (2)].ttype)); ;} - break; - - case 207: - - { set_init_index ((yyvsp[(2) - (5)].ttype), (yyvsp[(4) - (5)].ttype)); ;} - break; - - case 208: - - { set_init_index ((yyvsp[(2) - (3)].ttype), NULL_TREE); ;} - break; - - case 209: - - { push_c_function_context (); - if (! start_function (current_declspecs, (yyvsp[(1) - (1)].ttype), - prefix_attributes, NULL_TREE, 1)) - { - pop_c_function_context (); - YYERROR1; - } - reinit_parse_for_function (); ;} - break; - - case 210: - - { store_parm_decls (); ;} - break; - - case 211: - - { finish_function (1); - pop_c_function_context (); ;} - break; - - case 212: - - { push_c_function_context (); - if (! start_function (current_declspecs, (yyvsp[(1) - (1)].ttype), - prefix_attributes, NULL_TREE, 1)) - { - pop_c_function_context (); - YYERROR1; - } - reinit_parse_for_function (); ;} - break; - - case 213: - - { store_parm_decls (); ;} - break; - - case 214: - - { finish_function (1); - pop_c_function_context (); ;} - break; - - case 217: - - { (yyval.ttype) = (yyvsp[(2) - (3)].ttype); ;} - break; - - case 218: - - { (yyval.ttype) = build_nt (CALL_EXPR, (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype), NULL_TREE); ;} - break; - - case 219: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 220: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (3)].ttype), NULL_TREE); ;} - break; - - case 221: - - { (yyval.ttype) = make_pointer_declarator ((yyvsp[(2) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 222: - - { (yyval.ttype) = (yyvsp[(3) - (3)].ttype); ;} - break; - - case 224: - - { (yyval.ttype) = build_nt (CALL_EXPR, (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype), NULL_TREE); ;} - break; - - case 225: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (4)].ttype), NULL_TREE); - if (! flag_isoc9x) - error ("`[*]' in parameter declaration only allowed in ISO C 9x"); - ;} - break; - - case 226: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 227: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (3)].ttype), NULL_TREE); ;} - break; - - case 228: - - { (yyval.ttype) = make_pointer_declarator ((yyvsp[(2) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 229: - - { (yyval.ttype) = (yyvsp[(3) - (3)].ttype); ;} - break; - - case 231: - - { (yyval.ttype) = build_nt (CALL_EXPR, (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype), NULL_TREE); ;} - break; - - case 232: - - { (yyval.ttype) = (yyvsp[(2) - (3)].ttype); ;} - break; - - case 233: - - { (yyval.ttype) = make_pointer_declarator ((yyvsp[(2) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 234: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (4)].ttype), NULL_TREE); - if (! flag_isoc9x) - error ("`[*]' in parameter declaration only allowed in ISO C 9x"); - ;} - break; - - case 235: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 236: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (3)].ttype), NULL_TREE); ;} - break; - - case 237: - - { (yyval.ttype) = (yyvsp[(3) - (3)].ttype); ;} - break; - - case 239: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 240: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); ;} - break; - - case 241: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 242: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); ;} - break; - - case 243: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 244: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); ;} - break; - - case 245: - - { (yyval.ttype) = start_struct (RECORD_TYPE, (yyvsp[(2) - (3)].ttype)); - /* Start scope of tag before parsing components. */ - ;} - break; - - case 246: - - { (yyval.ttype) = finish_struct ((yyvsp[(4) - (7)].ttype), (yyvsp[(5) - (7)].ttype), chainon ((yyvsp[(1) - (7)].ttype), (yyvsp[(7) - (7)].ttype))); ;} - break; - - case 247: - - { (yyval.ttype) = finish_struct (start_struct (RECORD_TYPE, NULL_TREE), - (yyvsp[(3) - (5)].ttype), chainon ((yyvsp[(1) - (5)].ttype), (yyvsp[(5) - (5)].ttype))); - ;} - break; - - case 248: - - { (yyval.ttype) = xref_tag (RECORD_TYPE, (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 249: - - { (yyval.ttype) = start_struct (UNION_TYPE, (yyvsp[(2) - (3)].ttype)); ;} - break; - - case 250: - - { (yyval.ttype) = finish_struct ((yyvsp[(4) - (7)].ttype), (yyvsp[(5) - (7)].ttype), chainon ((yyvsp[(1) - (7)].ttype), (yyvsp[(7) - (7)].ttype))); ;} - break; - - case 251: - - { (yyval.ttype) = finish_struct (start_struct (UNION_TYPE, NULL_TREE), - (yyvsp[(3) - (5)].ttype), chainon ((yyvsp[(1) - (5)].ttype), (yyvsp[(5) - (5)].ttype))); - ;} - break; - - case 252: - - { (yyval.ttype) = xref_tag (UNION_TYPE, (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 253: - - { (yyvsp[(3) - (3)].itype) = suspend_momentary (); - (yyval.ttype) = start_enum ((yyvsp[(2) - (3)].ttype)); ;} - break; - - case 254: - - { (yyval.ttype)= finish_enum ((yyvsp[(4) - (8)].ttype), nreverse ((yyvsp[(5) - (8)].ttype)), chainon ((yyvsp[(1) - (8)].ttype), (yyvsp[(8) - (8)].ttype))); - resume_momentary ((yyvsp[(3) - (8)].itype)); ;} - break; - - case 255: - - { (yyvsp[(2) - (2)].itype) = suspend_momentary (); - (yyval.ttype) = start_enum (NULL_TREE); ;} - break; - - case 256: - - { (yyval.ttype)= finish_enum ((yyvsp[(3) - (7)].ttype), nreverse ((yyvsp[(4) - (7)].ttype)), chainon ((yyvsp[(1) - (7)].ttype), (yyvsp[(7) - (7)].ttype))); - resume_momentary ((yyvsp[(2) - (7)].itype)); ;} - break; - - case 257: - - { (yyval.ttype) = xref_tag (ENUMERAL_TYPE, (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 261: - - { if (pedantic && ! flag_isoc9x) - pedwarn ("comma at end of enumerator list"); ;} - break; - - case 262: - - { (yyval.ttype) = (yyvsp[(1) - (1)].ttype); ;} - break; - - case 263: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); - pedwarn ("no semicolon at end of struct or union"); ;} - break; - - case 264: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 265: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (3)].ttype), (yyvsp[(2) - (3)].ttype)); ;} - break; - - case 266: - - { if (pedantic) - pedwarn ("extra semicolon in struct or union specified"); ;} - break; - - case 267: - - { (yyval.ttype) = (yyvsp[(3) - (3)].ttype); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (3)].itype)); ;} - break; - - case 268: - - { if (pedantic) - pedwarn ("ANSI C forbids member declarations with no members"); - shadow_tag((yyvsp[(1) - (1)].ttype)); - (yyval.ttype) = NULL_TREE; ;} - break; - - case 269: - - { (yyval.ttype) = (yyvsp[(3) - (3)].ttype); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (3)].itype)); ;} - break; - - case 270: - - { if (pedantic) - pedwarn ("ANSI C forbids member declarations with no members"); - shadow_tag((yyvsp[(1) - (1)].ttype)); - (yyval.ttype) = NULL_TREE; ;} - break; - - case 271: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 272: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); - pedantic = (yyvsp[(1) - (2)].itype); ;} - break; - - case 274: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 275: - - { (yyval.ttype) = grokfield ((yyvsp[(1) - (4)].filename), (yyvsp[(2) - (4)].lineno), (yyvsp[(3) - (4)].ttype), current_declspecs, NULL_TREE); - decl_attributes ((yyval.ttype), (yyvsp[(4) - (4)].ttype), prefix_attributes); ;} - break; - - case 276: - - { (yyval.ttype) = grokfield ((yyvsp[(1) - (6)].filename), (yyvsp[(2) - (6)].lineno), (yyvsp[(3) - (6)].ttype), current_declspecs, (yyvsp[(5) - (6)].ttype)); - decl_attributes ((yyval.ttype), (yyvsp[(6) - (6)].ttype), prefix_attributes); ;} - break; - - case 277: - - { (yyval.ttype) = grokfield ((yyvsp[(1) - (5)].filename), (yyvsp[(2) - (5)].lineno), NULL_TREE, current_declspecs, (yyvsp[(4) - (5)].ttype)); - decl_attributes ((yyval.ttype), (yyvsp[(5) - (5)].ttype), prefix_attributes); ;} - break; - - case 279: - - { if ((yyvsp[(1) - (3)].ttype) == error_mark_node) - (yyval.ttype) = (yyvsp[(1) - (3)].ttype); - else - (yyval.ttype) = chainon ((yyvsp[(3) - (3)].ttype), (yyvsp[(1) - (3)].ttype)); ;} - break; - - case 280: - - { (yyval.ttype) = error_mark_node; ;} - break; - - case 281: - - { (yyval.ttype) = build_enumerator ((yyvsp[(1) - (1)].ttype), NULL_TREE); ;} - break; - - case 282: - - { (yyval.ttype) = build_enumerator ((yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 283: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 284: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (2)].ttype), (yyvsp[(2) - (2)].ttype)); ;} - break; - - case 285: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 287: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(1) - (1)].ttype), NULL_TREE); ;} - break; - - case 288: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 289: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 290: - - { (yyval.ttype) = tree_cons (NULL_TREE, (yyvsp[(2) - (2)].ttype), (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 291: - - { (yyval.ttype) = (yyvsp[(2) - (3)].ttype); ;} - break; - - case 292: - - { (yyval.ttype) = make_pointer_declarator ((yyvsp[(2) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 293: - - { (yyval.ttype) = make_pointer_declarator ((yyvsp[(2) - (2)].ttype), NULL_TREE); ;} - break; - - case 294: - - { (yyval.ttype) = build_nt (CALL_EXPR, (yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype), NULL_TREE); ;} - break; - - case 295: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 296: - - { (yyval.ttype) = build_nt (ARRAY_REF, (yyvsp[(1) - (3)].ttype), NULL_TREE); ;} - break; - - case 297: - - { (yyval.ttype) = build_nt (CALL_EXPR, NULL_TREE, (yyvsp[(2) - (2)].ttype), NULL_TREE); ;} - break; - - case 298: - - { (yyval.ttype) = build_nt (ARRAY_REF, NULL_TREE, (yyvsp[(2) - (3)].ttype)); ;} - break; - - case 299: - - { (yyval.ttype) = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); ;} - break; - - case 300: - - { - if (pedantic && (yyvsp[(1) - (1)].ends_in_label)) - pedwarn ("ANSI C forbids label at end of compound statement"); - ;} - break; - - case 302: - - { (yyval.ends_in_label) = (yyvsp[(2) - (2)].ends_in_label); ;} - break; - - case 303: - - { (yyval.ends_in_label) = 0; ;} - break; - - case 307: - - { emit_line_note (input_filename, lineno); - pushlevel (0); - clear_last_expr (); - push_momentary (); - expand_start_bindings (0); - ;} - break; - - case 309: - - { if (pedantic) - pedwarn ("ANSI C forbids label declarations"); ;} - break; - - case 312: - - { tree link; - for (link = (yyvsp[(2) - (3)].ttype); link; link = TREE_CHAIN (link)) - { - tree label = shadow_label (TREE_VALUE (link)); - C_DECLARED_LABEL_FLAG (label) = 1; - declare_nonlocal_label (label); - } - ;} - break; - - case 313: - - {;} - break; - - case 315: - - { compstmt_count++; ;} - break; - - case 316: - - { (yyval.ttype) = convert (void_type_node, integer_zero_node); ;} - break; - - case 317: - - { emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), 1, 0); - (yyval.ttype) = poplevel (1, 1, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); ;} - break; - - case 318: - - { emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), kept_level_p (), 0); - (yyval.ttype) = poplevel (kept_level_p (), 0, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); ;} - break; - - case 319: - - { emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), kept_level_p (), 0); - (yyval.ttype) = poplevel (kept_level_p (), 0, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); ;} - break; - - case 322: - - { emit_line_note ((yyvsp[(-1) - (4)].filename), (yyvsp[(0) - (4)].lineno)); - c_expand_start_cond (truthvalue_conversion ((yyvsp[(3) - (4)].ttype)), 0, - compstmt_count); - (yyval.itype) = stmt_count; - if_stmt_file = (yyvsp[(-1) - (4)].filename); - if_stmt_line = (yyvsp[(0) - (4)].lineno); - position_after_white_space (); ;} - break; - - case 323: - - { stmt_count++; - compstmt_count++; - emit_line_note ((yyvsp[(-1) - (1)].filename), (yyvsp[(0) - (1)].lineno)); - /* See comment in `while' alternative, above. */ - emit_nop (); - expand_start_loop_continue_elsewhere (1); - position_after_white_space (); ;} - break; - - case 324: - - { expand_loop_continue_here (); ;} - break; - - case 325: - - { (yyval.filename) = input_filename; ;} - break; - - case 326: - - { (yyval.lineno) = lineno; ;} - break; - - case 327: - - { ;} - break; - - case 328: - - { ;} - break; - - case 329: - - { (yyval.ends_in_label) = (yyvsp[(3) - (3)].ends_in_label); ;} - break; - - case 330: - - { (yyval.ends_in_label) = 0; ;} - break; - - case 331: - - { (yyval.ends_in_label) = 1; ;} - break; - - case 332: - - { stmt_count++; ;} - break; - - case 334: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (2)].filename), (yyvsp[(0) - (2)].lineno)); -/* It appears that this should not be done--that a non-lvalue array - shouldn't get an error if the value isn't used. - Section 3.2.2.1 says that an array lvalue gets converted to a pointer - if it appears as a top-level expression, - but says nothing about non-lvalue arrays. */ -#if 0 - /* Call default_conversion to get an error - on referring to a register array if pedantic. */ - if (TREE_CODE (TREE_TYPE ((yyvsp[(1) - (2)].ttype))) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE ((yyvsp[(1) - (2)].ttype))) == FUNCTION_TYPE) - (yyvsp[(1) - (2)].ttype) = default_conversion ((yyvsp[(1) - (2)].ttype)); -#endif - iterator_expand ((yyvsp[(1) - (2)].ttype)); - clear_momentary (); ;} - break; - - case 335: - - { c_expand_start_else (); - (yyvsp[(1) - (2)].itype) = stmt_count; - position_after_white_space (); ;} - break; - - case 336: - - { c_expand_end_cond (); - if (extra_warnings && stmt_count == (yyvsp[(1) - (4)].itype)) - warning ("empty body in an else-statement"); ;} - break; - - case 337: - - { c_expand_end_cond (); - /* This warning is here instead of in simple_if, because we - do not want a warning if an empty if is followed by an - else statement. Increment stmt_count so we don't - give a second error if this is a nested `if'. */ - if (extra_warnings && stmt_count++ == (yyvsp[(1) - (1)].itype)) - warning_with_file_and_line (if_stmt_file, if_stmt_line, - "empty body in an if-statement"); ;} - break; - - case 338: - - { c_expand_end_cond (); ;} - break; - - case 339: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (1)].filename), (yyvsp[(0) - (1)].lineno)); - /* The emit_nop used to come before emit_line_note, - but that made the nop seem like part of the preceding line. - And that was confusing when the preceding line was - inside of an if statement and was not really executed. - I think it ought to work to put the nop after the line number. - We will see. --rms, July 15, 1991. */ - emit_nop (); ;} - break; - - case 340: - - { /* Don't start the loop till we have succeeded - in parsing the end test. This is to make sure - that we end every loop we start. */ - expand_start_loop (1); - emit_line_note (input_filename, lineno); - expand_exit_loop_if_false (NULL, - truthvalue_conversion ((yyvsp[(4) - (5)].ttype))); - position_after_white_space (); ;} - break; - - case 341: - - { expand_end_loop (); ;} - break; - - case 342: - - { emit_line_note (input_filename, lineno); - expand_exit_loop_if_false (NULL, - truthvalue_conversion ((yyvsp[(3) - (5)].ttype))); - expand_end_loop (); - clear_momentary (); ;} - break; - - case 343: - - { expand_end_loop (); - clear_momentary (); ;} - break; - - case 344: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (4)].filename), (yyvsp[(0) - (4)].lineno)); - /* See comment in `while' alternative, above. */ - emit_nop (); - if ((yyvsp[(3) - (4)].ttype)) c_expand_expr_stmt ((yyvsp[(3) - (4)].ttype)); - /* Next step is to call expand_start_loop_continue_elsewhere, - but wait till after we parse the entire for (...). - Otherwise, invalid input might cause us to call that - fn without calling expand_end_loop. */ - ;} - break; - - case 345: - - { (yyvsp[(7) - (7)].lineno) = lineno; - (yyval.filename) = input_filename; ;} - break; - - case 346: - - { - /* Start the loop. Doing this after parsing - all the expressions ensures we will end the loop. */ - expand_start_loop_continue_elsewhere (1); - /* Emit the end-test, with a line number. */ - emit_line_note ((yyvsp[(8) - (10)].filename), (yyvsp[(7) - (10)].lineno)); - if ((yyvsp[(6) - (10)].ttype)) - expand_exit_loop_if_false (NULL, - truthvalue_conversion ((yyvsp[(6) - (10)].ttype))); - /* Don't let the tree nodes for $9 be discarded by - clear_momentary during the parsing of the next stmt. */ - push_momentary (); - (yyvsp[(7) - (10)].lineno) = lineno; - (yyvsp[(8) - (10)].filename) = input_filename; - position_after_white_space (); ;} - break; - - case 347: - - { /* Emit the increment expression, with a line number. */ - emit_line_note ((yyvsp[(8) - (12)].filename), (yyvsp[(7) - (12)].lineno)); - expand_loop_continue_here (); - if ((yyvsp[(9) - (12)].ttype)) - c_expand_expr_stmt ((yyvsp[(9) - (12)].ttype)); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); - expand_end_loop (); ;} - break; - - case 348: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (4)].filename), (yyvsp[(0) - (4)].lineno)); - c_expand_start_case ((yyvsp[(3) - (4)].ttype)); - /* Don't let the tree nodes for $3 be discarded by - clear_momentary during the parsing of the next stmt. */ - push_momentary (); - position_after_white_space (); ;} - break; - - case 349: - - { expand_end_case ((yyvsp[(3) - (6)].ttype)); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); ;} - break; - - case 350: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (2)].filename), (yyvsp[(0) - (2)].lineno)); - if ( ! expand_exit_something ()) - error ("break statement not within loop or switch"); ;} - break; - - case 351: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (2)].filename), (yyvsp[(0) - (2)].lineno)); - if (! expand_continue_loop (NULL)) - error ("continue statement not within a loop"); ;} - break; - - case 352: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (2)].filename), (yyvsp[(0) - (2)].lineno)); - c_expand_return (NULL_TREE); ;} - break; - - case 353: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (3)].filename), (yyvsp[(0) - (3)].lineno)); - c_expand_return ((yyvsp[(2) - (3)].ttype)); ;} - break; - - case 354: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (6)].filename), (yyvsp[(0) - (6)].lineno)); - STRIP_NOPS ((yyvsp[(4) - (6)].ttype)); - if ((TREE_CODE ((yyvsp[(4) - (6)].ttype)) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND ((yyvsp[(4) - (6)].ttype), 0)) == STRING_CST) - || TREE_CODE ((yyvsp[(4) - (6)].ttype)) == STRING_CST) - expand_asm ((yyvsp[(4) - (6)].ttype)); - else - error ("argument of `asm' is not a constant string"); ;} - break; - - case 355: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (8)].filename), (yyvsp[(0) - (8)].lineno)); - c_expand_asm_operands ((yyvsp[(4) - (8)].ttype), (yyvsp[(6) - (8)].ttype), NULL_TREE, NULL_TREE, - (yyvsp[(2) - (8)].ttype) == ridpointers[(int)RID_VOLATILE], - input_filename, lineno); ;} - break; - - case 356: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (10)].filename), (yyvsp[(0) - (10)].lineno)); - c_expand_asm_operands ((yyvsp[(4) - (10)].ttype), (yyvsp[(6) - (10)].ttype), (yyvsp[(8) - (10)].ttype), NULL_TREE, - (yyvsp[(2) - (10)].ttype) == ridpointers[(int)RID_VOLATILE], - input_filename, lineno); ;} - break; - - case 357: - - { stmt_count++; - emit_line_note ((yyvsp[(-1) - (12)].filename), (yyvsp[(0) - (12)].lineno)); - c_expand_asm_operands ((yyvsp[(4) - (12)].ttype), (yyvsp[(6) - (12)].ttype), (yyvsp[(8) - (12)].ttype), (yyvsp[(10) - (12)].ttype), - (yyvsp[(2) - (12)].ttype) == ridpointers[(int)RID_VOLATILE], - input_filename, lineno); ;} - break; - - case 358: - - { tree decl; - stmt_count++; - emit_line_note ((yyvsp[(-1) - (3)].filename), (yyvsp[(0) - (3)].lineno)); - decl = lookup_label ((yyvsp[(2) - (3)].ttype)); - if (decl != 0) - { - TREE_USED (decl) = 1; - expand_goto (decl); - } - ;} - break; - - case 359: - - { if (pedantic) - pedwarn ("ANSI C forbids `goto *expr;'"); - stmt_count++; - emit_line_note ((yyvsp[(-1) - (4)].filename), (yyvsp[(0) - (4)].lineno)); - expand_computed_goto (convert (ptr_type_node, (yyvsp[(3) - (4)].ttype))); ;} - break; - - case 362: - - { - /* The value returned by this action is */ - /* 1 if everything is OK */ - /* 0 in case of error or already bound iterator */ - - (yyval.itype) = 0; - if (TREE_CODE ((yyvsp[(3) - (4)].ttype)) != VAR_DECL) - error ("invalid `for (ITERATOR)' syntax"); - else if (! ITERATOR_P ((yyvsp[(3) - (4)].ttype))) - error ("`%s' is not an iterator", - IDENTIFIER_POINTER (DECL_NAME ((yyvsp[(3) - (4)].ttype)))); - else if (ITERATOR_BOUND_P ((yyvsp[(3) - (4)].ttype))) - error ("`for (%s)' inside expansion of same iterator", - IDENTIFIER_POINTER (DECL_NAME ((yyvsp[(3) - (4)].ttype)))); - else - { - (yyval.itype) = 1; - iterator_for_loop_start ((yyvsp[(3) - (4)].ttype)); - } - ;} - break; - - case 363: - - { - if ((yyvsp[(5) - (6)].itype)) - iterator_for_loop_end ((yyvsp[(3) - (6)].ttype)); - ;} - break; - - case 364: - - { register tree value = check_case_value ((yyvsp[(2) - (3)].ttype)); - register tree label - = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - stmt_count++; - - if (value != error_mark_node) - { - tree duplicate; - int success; - - if (pedantic && ! INTEGRAL_TYPE_P (TREE_TYPE (value))) - pedwarn ("label must have integral type in ANSI C"); - - success = pushcase (value, convert_and_check, - label, &duplicate); - - if (success == 1) - error ("case label not within a switch statement"); - else if (success == 2) - { - error ("duplicate case value"); - error_with_decl (duplicate, "this is the first entry for that value"); - } - else if (success == 3) - warning ("case value out of range"); - else if (success == 5) - error ("case label within scope of cleanup or variable array"); - } - position_after_white_space (); ;} - break; - - case 365: - - { register tree value1 = check_case_value ((yyvsp[(2) - (5)].ttype)); - register tree value2 = check_case_value ((yyvsp[(4) - (5)].ttype)); - register tree label - = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - if (pedantic) - pedwarn ("ANSI C forbids case ranges"); - stmt_count++; - - if (value1 != error_mark_node && value2 != error_mark_node) - { - tree duplicate; - int success = pushcase_range (value1, value2, - convert_and_check, label, - &duplicate); - if (success == 1) - error ("case label not within a switch statement"); - else if (success == 2) - { - error ("duplicate case value"); - error_with_decl (duplicate, "this is the first entry for that value"); - } - else if (success == 3) - warning ("case value out of range"); - else if (success == 4) - warning ("empty case range"); - else if (success == 5) - error ("case label within scope of cleanup or variable array"); - } - position_after_white_space (); ;} - break; - - case 366: - - { - tree duplicate; - register tree label - = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - int success = pushcase (NULL_TREE, 0, label, &duplicate); - stmt_count++; - if (success == 1) - error ("default label not within a switch statement"); - else if (success == 2) - { - error ("multiple default labels in one switch"); - error_with_decl (duplicate, "this is the first default label"); - } - position_after_white_space (); ;} - break; - - case 367: - - { tree label = define_label (input_filename, lineno, (yyvsp[(1) - (3)].ttype)); - stmt_count++; - emit_nop (); - if (label) - { - expand_label (label); - decl_attributes (label, (yyvsp[(3) - (3)].ttype), NULL_TREE); - } - position_after_white_space (); ;} - break; - - case 368: - - { emit_line_note (input_filename, lineno); - (yyval.ttype) = NULL_TREE; ;} - break; - - case 369: - - { emit_line_note (input_filename, lineno); ;} - break; - - case 370: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 372: - - { (yyval.ttype) = NULL_TREE; ;} - break; - - case 375: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (3)].ttype), (yyvsp[(3) - (3)].ttype)); ;} - break; - - case 376: - - { (yyval.ttype) = build_tree_list ((yyvsp[(1) - (4)].ttype), (yyvsp[(3) - (4)].ttype)); ;} - break; - - case 377: - - { (yyval.ttype) = tree_cons (NULL_TREE, combine_strings ((yyvsp[(1) - (1)].ttype)), NULL_TREE); ;} - break; - - case 378: - - { (yyval.ttype) = tree_cons (NULL_TREE, combine_strings ((yyvsp[(3) - (3)].ttype)), (yyvsp[(1) - (3)].ttype)); ;} - break; - - case 379: - - { pushlevel (0); - clear_parm_order (); - declare_parm_level (0); ;} - break; - - case 380: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); - parmlist_tags_warning (); - poplevel (0, 0, 0); ;} - break; - - case 382: - - { tree parm; - if (pedantic) - pedwarn ("ANSI C forbids forward parameter declarations"); - /* Mark the forward decls as such. */ - for (parm = getdecls (); parm; parm = TREE_CHAIN (parm)) - TREE_ASM_WRITTEN (parm) = 1; - clear_parm_order (); ;} - break; - - case 383: - - { (yyval.ttype) = (yyvsp[(4) - (4)].ttype); ;} - break; - - case 384: - - { (yyval.ttype) = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ;} - break; - - case 385: - - { (yyval.ttype) = get_parm_info (0); ;} - break; - - case 386: - - { (yyval.ttype) = get_parm_info (0); - /* Gcc used to allow this as an extension. However, it does - not work for all targets, and thus has been disabled. - Also, since func (...) and func () are indistinguishable, - it caused problems with the code in expand_builtin which - tries to verify that BUILT_IN_NEXT_ARG is being used - correctly. */ - error ("ANSI C requires a named argument before `...'"); - ;} - break; - - case 387: - - { (yyval.ttype) = get_parm_info (1); ;} - break; - - case 388: - - { (yyval.ttype) = get_parm_info (0); ;} - break; - - case 389: - - { push_parm_decl ((yyvsp[(1) - (1)].ttype)); ;} - break; - - case 390: - - { push_parm_decl ((yyvsp[(3) - (3)].ttype)); ;} - break; - - case 391: - - { (yyval.ttype) = build_tree_list (build_tree_list (current_declspecs, - (yyvsp[(3) - (4)].ttype)), - build_tree_list (prefix_attributes, - (yyvsp[(4) - (4)].ttype))); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 392: - - { (yyval.ttype) = build_tree_list (build_tree_list (current_declspecs, - (yyvsp[(3) - (4)].ttype)), - build_tree_list (prefix_attributes, - (yyvsp[(4) - (4)].ttype))); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 393: - - { (yyval.ttype) = build_tree_list (build_tree_list (current_declspecs, - (yyvsp[(3) - (4)].ttype)), - build_tree_list (prefix_attributes, - (yyvsp[(4) - (4)].ttype))); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 394: - - { (yyval.ttype) = build_tree_list (build_tree_list (current_declspecs, - (yyvsp[(3) - (4)].ttype)), - build_tree_list (prefix_attributes, - (yyvsp[(4) - (4)].ttype))); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 395: - - { (yyval.ttype) = build_tree_list (build_tree_list (current_declspecs, - (yyvsp[(3) - (4)].ttype)), - build_tree_list (prefix_attributes, - (yyvsp[(4) - (4)].ttype))); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ((yyvsp[(2) - (4)].itype)); ;} - break; - - case 396: - - { pushlevel (0); - clear_parm_order (); - declare_parm_level (1); ;} - break; - - case 397: - - { (yyval.ttype) = (yyvsp[(2) - (2)].ttype); - parmlist_tags_warning (); - poplevel (0, 0, 0); ;} - break; - - case 399: - - { tree t; - for (t = (yyvsp[(1) - (2)].ttype); t; t = TREE_CHAIN (t)) - if (TREE_VALUE (t) == NULL_TREE) - error ("`...' in old-style identifier list"); - (yyval.ttype) = tree_cons (NULL_TREE, NULL_TREE, (yyvsp[(1) - (2)].ttype)); ;} - break; - - case 400: - - { (yyval.ttype) = build_tree_list (NULL_TREE, (yyvsp[(1) - (1)].ttype)); ;} - break; - - case 401: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (3)].ttype), build_tree_list (NULL_TREE, (yyvsp[(3) - (3)].ttype))); ;} - break; - - case 402: - - { (yyval.ttype) = build_tree_list (NULL_TREE, (yyvsp[(1) - (1)].ttype)); ;} - break; - - case 403: - - { (yyval.ttype) = chainon ((yyvsp[(1) - (3)].ttype), build_tree_list (NULL_TREE, (yyvsp[(3) - (3)].ttype))); ;} - break; - - case 404: - - { (yyval.itype) = pedantic; - pedantic = 0; ;} - break; - - -/* Line 1267 of yacc.c. */ - - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - - - - diff --git a/gcc_arm/c-parse.h b/gcc_arm/c-parse.h deleted file mode 100644 index e8521ac..0000000 --- a/gcc_arm/c-parse.h +++ /dev/null @@ -1,114 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#define IDENTIFIER 258 -#define TYPENAME 259 -#define SCSPEC 260 -#define TYPESPEC 261 -#define TYPE_QUAL 262 -#define CONSTANT 263 -#define STRING 264 -#define ELLIPSIS 265 -#define SIZEOF 266 -#define ENUM 267 -#define STRUCT 268 -#define UNION 269 -#define IF 270 -#define ELSE 271 -#define WHILE 272 -#define DO 273 -#define FOR 274 -#define SWITCH 275 -#define CASE 276 -#define DEFAULT 277 -#define BREAK 278 -#define CONTINUE 279 -#define RETURN 280 -#define GOTO 281 -#define ASM_KEYWORD 282 -#define TYPEOF 283 -#define ALIGNOF 284 -#define ATTRIBUTE 285 -#define EXTENSION 286 -#define LABEL 287 -#define REALPART 288 -#define IMAGPART 289 -#define ASSIGN 290 -#define OROR 291 -#define ANDAND 292 -#define EQCOMPARE 293 -#define ARITHCOMPARE 294 -#define RSHIFT 295 -#define LSHIFT 296 -#define MINUSMINUS 297 -#define PLUSPLUS 298 -#define UNARY 299 -#define HYPERUNARY 300 -#define POINTSAT 301 -#define INTERFACE 302 -#define IMPLEMENTATION 303 -#define END 304 -#define SELECTOR 305 -#define DEFS 306 -#define ENCODE 307 -#define CLASSNAME 308 -#define PUBLIC 309 -#define PRIVATE 310 -#define PROTECTED 311 -#define PROTOCOL 312 -#define OBJECTNAME 313 -#define CLASS 314 -#define ALIAS 315 -#define OBJC_STRING 316 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 87 "c-parse.y" -{long itype; tree ttype; enum tree_code code; - char *filename; int lineno; int ends_in_label; } -/* Line 1489 of yacc.c. */ -#line 174 "c-parse.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE yylval; - diff --git a/gcc_arm/config.bak b/gcc_arm/config.bak new file mode 100755 index 0000000..9ef8f17 --- /dev/null +++ b/gcc_arm/config.bak @@ -0,0 +1,588 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host cameron-HP-Pavilion-g7-Notebook-PC: +# +# ./configure --target=arm-elf --host=i686-linux-gnu +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} ./configure --target=arm-elf --host=i686-linux-gnu --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} ./configure --target=arm-elf --host=i686-linux-gnu --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. + +trap 'rm -fr Makefile auto-host.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@SHELL@%/bin/sh%g +s%@CFLAGS@%-g -O2%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@FFLAGS@%%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr/local%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@host@%i686-pc-linux-gnu%g +s%@host_alias@%i686-linux-gnu%g +s%@host_cpu@%i686%g +s%@host_vendor@%pc%g +s%@host_os@%linux-gnu%g +s%@target@%arm-unknown-elf%g +s%@target_alias@%arm-elf%g +s%@target_cpu@%arm%g +s%@target_vendor@%unknown%g +s%@target_os@%elf%g +s%@build@%i686-pc-linux-gnu%g +s%@build_alias@%i686-linux-gnu%g +s%@build_cpu@%i686%g +s%@build_vendor@%pc%g +s%@build_os@%linux-gnu%g +s%@CC@%gcc%g +s%@stage1_warn_cflags@%$(WARN_CFLAGS)%g +s%@SET_MAKE@%%g +s%@AWK@%mawk%g +s%@LEX@%flex%g +s%@LEXLIB@%%g +s%@LN@%ln%g +s%@LN_S@%ln -s%g +s%@RANLIB@%ranlib%g +s%@YACC@%bison -y%g +s%@INSTALL@%/usr/bin/install -c%g +s%@INSTALL_PROGRAM@%${INSTALL}%g +s%@INSTALL_DATA@%${INSTALL} -m 644%g +s%@CPP@%gcc -E%g +s%@gnat@%no%g +s%@vfprintf@%%g +s%@doprint@%%g +s%@manext@%.1%g +s%@objext@%.o%g +s%@gthread_flags@%%g +s%@build_canonical@%i686-pc-linux-gnu%g +s%@host_canonical@%i686-pc-linux-gnu%g +s%@target_subdir@%arm-unknown-elf/%g +s%@inhibit_libc@%%g +s%@sched_prefix@%%g +s%@sched_cflags@%%g +s%@gcc_tooldir@%$(libsubdir)/$(unlibsubdir)/../$(target_alias)%g +s%@dollar@%%g +s%@objdir@%/home/cameron/programming/agbcc2/gcc_arm%g +s%@subdirs@%%g +s%@all_languages@%%g +s%@all_boot_languages@%%g +s%@all_compilers@%%g +s%@all_lang_makefiles@%%g +s%@all_stagestuff@%%g +s%@all_diff_excludes@%%g +s%@all_lib2funcs@%%g +s%@all_headers@%%g +s%@cpp_main@%cccp%g +s%@extra_passes@%%g +s%@extra_programs@%%g +s%@extra_parts@%%g +s%@extra_c_objs@%%g +s%@extra_cxx_objs@%%g +s%@extra_cpp_objs@%%g +s%@extra_c_flags@% -DMULTIBYTE_CHARS=1%g +s%@extra_objs@% %g +s%@host_extra_gcc_objs@%%g +s%@extra_headers_list@%%g +s%@dep_host_xmake_file@%%g +s%@dep_tmake_file@% ./config/arm/t-arm-elf%g +s%@out_file@%arm/arm.c%g +s%@out_object_file@%arm.o%g +s%@md_file@%arm/arm.md%g +s%@tm_file_list@% gansidecl.h $(srcdir)/config/arm/unknown-elf.h%g +s%@build_xm_file_list@% auto-host.h gansidecl.h $(srcdir)/config/i386/xm-i386.h%g +s%@host_xm_file_list@% auto-host.h gansidecl.h $(srcdir)/config/i386/xm-i386.h%g +s%@lang_specs_files@%%g +s%@lang_options_files@%%g +s%@lang_tree_files@%%g +s%@thread_file@%single%g +s%@objc_boehm_gc@%%g +s%@JAVAGC@%boehm%g +s%@gcc_version@%2.9-arm-000512%g +s%@gcc_version_trigger@%./version.c%g +s%@local_prefix@%$(prefix)%g +s%@gcc_gxx_include_dir@%$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include/g++-%g +s%@fixincludes@%fixincludes%g +s%@build_install_headers_dir@%install-headers-tar%g +s%@build_exeext@%%g +s%@host_exeext@%%g +s%@float_h_file@%float-i64.h%g +s%@cc_set_by_configure@%$(CC)%g +s%@stage_prefix_set_by_configure@%$(STAGE_PREFIX)%g +s%@install@%%g +s%@symbolic_link@%ln -s%g +/@target_overrides@/r Make-target +s%@target_overrides@%%g +/@host_overrides@/r Make-host +s%@host_overrides@%%g +s%@cross_defines@%CROSS=-DCROSS_COMPILE%g +/@cross_overrides@/r /home/cameron/programming/agbcc2/gcc_arm/cross-make +s%@cross_overrides@%%g +/@build_overrides@/r /dev/null +s%@build_overrides@%%g +/@language_fragments@/r Make-lang +s%@language_fragments@%%g +/@language_hooks@/r Make-hooks +s%@language_hooks@%%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"Makefile"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then + CONFIG_HEADERS="auto-host.h:config.in" +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_VOLATILE${ac_dB}HAVE_VOLATILE${ac_dC}1${ac_dD} +${ac_uA}HAVE_VOLATILE${ac_uB}HAVE_VOLATILE${ac_uC}1${ac_uD} +${ac_eA}HAVE_VOLATILE${ac_eB}HAVE_VOLATILE${ac_eC}1${ac_eD} +${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD} +${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD} +${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD} +${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD} +${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD} +${ac_eA}TIME_WITH_SYS_TIME${ac_eB}TIME_WITH_SYS_TIME${ac_eC}1${ac_eD} +${ac_dA}STRING_WITH_STRINGS${ac_dB}STRING_WITH_STRINGS${ac_dC}1${ac_dD} +${ac_uA}STRING_WITH_STRINGS${ac_uB}STRING_WITH_STRINGS${ac_uC}1${ac_uD} +${ac_eA}STRING_WITH_STRINGS${ac_eB}STRING_WITH_STRINGS${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYS_WAIT_H${ac_dB}HAVE_SYS_WAIT_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_WAIT_H${ac_uB}HAVE_SYS_WAIT_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_WAIT_H${ac_eB}HAVE_SYS_WAIT_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_LIMITS_H${ac_dB}HAVE_LIMITS_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_LIMITS_H${ac_uB}HAVE_LIMITS_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_LIMITS_H${ac_eB}HAVE_LIMITS_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STDDEF_H${ac_dB}HAVE_STDDEF_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STDDEF_H${ac_uB}HAVE_STDDEF_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STDDEF_H${ac_eB}HAVE_STDDEF_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRING_H${ac_eB}HAVE_STRING_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_STRINGS_H${ac_dB}HAVE_STRINGS_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRINGS_H${ac_uB}HAVE_STRINGS_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRINGS_H${ac_eB}HAVE_STRINGS_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STDLIB_H${ac_dB}HAVE_STDLIB_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STDLIB_H${ac_uB}HAVE_STDLIB_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STDLIB_H${ac_eB}HAVE_STDLIB_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_TIME_H${ac_dB}HAVE_TIME_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_TIME_H${ac_uB}HAVE_TIME_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_TIME_H${ac_eB}HAVE_TIME_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_FCNTL_H${ac_dB}HAVE_FCNTL_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_FCNTL_H${ac_uB}HAVE_FCNTL_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_FCNTL_H${ac_eB}HAVE_FCNTL_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STAB_H${ac_dB}HAVE_STAB_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STAB_H${ac_uB}HAVE_STAB_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STAB_H${ac_eB}HAVE_STAB_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_FILE_H${ac_dB}HAVE_SYS_FILE_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_FILE_H${ac_uB}HAVE_SYS_FILE_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_FILE_H${ac_eB}HAVE_SYS_FILE_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_TIME_H${ac_dB}HAVE_SYS_TIME_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TIME_H${ac_uB}HAVE_SYS_TIME_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TIME_H${ac_eB}HAVE_SYS_TIME_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYS_RESOURCE_H${ac_dB}HAVE_SYS_RESOURCE_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_RESOURCE_H${ac_uB}HAVE_SYS_RESOURCE_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_RESOURCE_H${ac_eB}HAVE_SYS_RESOURCE_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_TIMES_H${ac_dB}HAVE_SYS_TIMES_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TIMES_H${ac_uB}HAVE_SYS_TIMES_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TIMES_H${ac_eB}HAVE_SYS_TIMES_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_STAT_H${ac_dB}HAVE_SYS_STAT_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_STAT_H${ac_uB}HAVE_SYS_STAT_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_STAT_H${ac_eB}HAVE_SYS_STAT_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_CPP_STRINGIFY${ac_dB}HAVE_CPP_STRINGIFY${ac_dC}1${ac_dD} +${ac_uA}HAVE_CPP_STRINGIFY${ac_uB}HAVE_CPP_STRINGIFY${ac_uC}1${ac_uD} +${ac_eA}HAVE_CPP_STRINGIFY${ac_eB}HAVE_CPP_STRINGIFY${ac_eC}1${ac_eD} +${ac_dA}HAVE_INTTYPES_H${ac_dB}HAVE_INTTYPES_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_INTTYPES_H${ac_uB}HAVE_INTTYPES_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_INTTYPES_H${ac_eB}HAVE_INTTYPES_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRTOUL${ac_dB}HAVE_STRTOUL${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRTOUL${ac_uB}HAVE_STRTOUL${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRTOUL${ac_eB}HAVE_STRTOUL${ac_eC}1${ac_eD} +${ac_dA}HAVE_BSEARCH${ac_dB}HAVE_BSEARCH${ac_dC}1${ac_dD} +${ac_uA}HAVE_BSEARCH${ac_uB}HAVE_BSEARCH${ac_uC}1${ac_uD} +${ac_eA}HAVE_BSEARCH${ac_eB}HAVE_BSEARCH${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_STRERROR${ac_dB}HAVE_STRERROR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRERROR${ac_uB}HAVE_STRERROR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRERROR${ac_eB}HAVE_STRERROR${ac_eC}1${ac_eD} +${ac_dA}HAVE_PUTENV${ac_dB}HAVE_PUTENV${ac_dC}1${ac_dD} +${ac_uA}HAVE_PUTENV${ac_uB}HAVE_PUTENV${ac_uC}1${ac_uD} +${ac_eA}HAVE_PUTENV${ac_eB}HAVE_PUTENV${ac_eC}1${ac_eD} +${ac_dA}HAVE_POPEN${ac_dB}HAVE_POPEN${ac_dC}1${ac_dD} +${ac_uA}HAVE_POPEN${ac_uB}HAVE_POPEN${ac_uC}1${ac_uD} +${ac_eA}HAVE_POPEN${ac_eB}HAVE_POPEN${ac_eC}1${ac_eD} +${ac_dA}HAVE_BCOPY${ac_dB}HAVE_BCOPY${ac_dC}1${ac_dD} +${ac_uA}HAVE_BCOPY${ac_uB}HAVE_BCOPY${ac_uC}1${ac_uD} +${ac_eA}HAVE_BCOPY${ac_eB}HAVE_BCOPY${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_BZERO${ac_dB}HAVE_BZERO${ac_dC}1${ac_dD} +${ac_uA}HAVE_BZERO${ac_uB}HAVE_BZERO${ac_uC}1${ac_uD} +${ac_eA}HAVE_BZERO${ac_eB}HAVE_BZERO${ac_eC}1${ac_eD} +${ac_dA}HAVE_BCMP${ac_dB}HAVE_BCMP${ac_dC}1${ac_dD} +${ac_uA}HAVE_BCMP${ac_uB}HAVE_BCMP${ac_uC}1${ac_uD} +${ac_eA}HAVE_BCMP${ac_eB}HAVE_BCMP${ac_eC}1${ac_eD} +${ac_dA}HAVE_INDEX${ac_dB}HAVE_INDEX${ac_dC}1${ac_dD} +${ac_uA}HAVE_INDEX${ac_uB}HAVE_INDEX${ac_uC}1${ac_uD} +${ac_eA}HAVE_INDEX${ac_eB}HAVE_INDEX${ac_eC}1${ac_eD} +${ac_dA}HAVE_RINDEX${ac_dB}HAVE_RINDEX${ac_dC}1${ac_dD} +${ac_uA}HAVE_RINDEX${ac_uB}HAVE_RINDEX${ac_uC}1${ac_uD} +${ac_eA}HAVE_RINDEX${ac_eB}HAVE_RINDEX${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_STRCHR${ac_dB}HAVE_STRCHR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRCHR${ac_uB}HAVE_STRCHR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRCHR${ac_eB}HAVE_STRCHR${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRRCHR${ac_dB}HAVE_STRRCHR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRRCHR${ac_uB}HAVE_STRRCHR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRRCHR${ac_eB}HAVE_STRRCHR${ac_eC}1${ac_eD} +${ac_dA}HAVE_KILL${ac_dB}HAVE_KILL${ac_dC}1${ac_dD} +${ac_uA}HAVE_KILL${ac_uB}HAVE_KILL${ac_uC}1${ac_uD} +${ac_eA}HAVE_KILL${ac_eB}HAVE_KILL${ac_eC}1${ac_eD} +${ac_dA}HAVE_GETRLIMIT${ac_dB}HAVE_GETRLIMIT${ac_dC}1${ac_dD} +${ac_uA}HAVE_GETRLIMIT${ac_uB}HAVE_GETRLIMIT${ac_uC}1${ac_uD} +${ac_eA}HAVE_GETRLIMIT${ac_eB}HAVE_GETRLIMIT${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SETRLIMIT${ac_dB}HAVE_SETRLIMIT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SETRLIMIT${ac_uB}HAVE_SETRLIMIT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SETRLIMIT${ac_eB}HAVE_SETRLIMIT${ac_eC}1${ac_eD} +${ac_dA}HAVE_ATOLL${ac_dB}HAVE_ATOLL${ac_dC}1${ac_dD} +${ac_uA}HAVE_ATOLL${ac_uB}HAVE_ATOLL${ac_uC}1${ac_uD} +${ac_eA}HAVE_ATOLL${ac_eB}HAVE_ATOLL${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCONF${ac_dB}HAVE_SYSCONF${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCONF${ac_uB}HAVE_SYSCONF${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCONF${ac_eB}HAVE_SYSCONF${ac_eC}1${ac_eD} +${ac_dA}HAVE_ISASCII${ac_dB}HAVE_ISASCII${ac_dC}1${ac_dD} +${ac_uA}HAVE_ISASCII${ac_uB}HAVE_ISASCII${ac_uC}1${ac_uD} +${ac_eA}HAVE_ISASCII${ac_eB}HAVE_ISASCII${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_GETTIMEOFDAY${ac_dB}HAVE_GETTIMEOFDAY${ac_dC}1${ac_dD} +${ac_uA}HAVE_GETTIMEOFDAY${ac_uB}HAVE_GETTIMEOFDAY${ac_uC}1${ac_uD} +${ac_eA}HAVE_GETTIMEOFDAY${ac_eB}HAVE_GETTIMEOFDAY${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRSIGNAL${ac_dB}HAVE_STRSIGNAL${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRSIGNAL${ac_uB}HAVE_STRSIGNAL${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRSIGNAL${ac_eB}HAVE_STRSIGNAL${ac_eC}1${ac_eD} +${ac_dA}HAVE_PUTC_UNLOCKED${ac_dB}HAVE_PUTC_UNLOCKED${ac_dC}1${ac_dD} +${ac_uA}HAVE_PUTC_UNLOCKED${ac_uB}HAVE_PUTC_UNLOCKED${ac_uC}1${ac_uD} +${ac_eA}HAVE_PUTC_UNLOCKED${ac_eB}HAVE_PUTC_UNLOCKED${ac_eC}1${ac_eD} +${ac_dA}HAVE_FPUTC_UNLOCKED${ac_dB}HAVE_FPUTC_UNLOCKED${ac_dC}1${ac_dD} +${ac_uA}HAVE_FPUTC_UNLOCKED${ac_uB}HAVE_FPUTC_UNLOCKED${ac_uC}1${ac_uD} +${ac_eA}HAVE_FPUTC_UNLOCKED${ac_eB}HAVE_FPUTC_UNLOCKED${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_FPUTS_UNLOCKED${ac_dB}HAVE_FPUTS_UNLOCKED${ac_dC}1${ac_dD} +${ac_uA}HAVE_FPUTS_UNLOCKED${ac_uB}HAVE_FPUTS_UNLOCKED${ac_uC}1${ac_uD} +${ac_eA}HAVE_FPUTS_UNLOCKED${ac_eB}HAVE_FPUTS_UNLOCKED${ac_eC}1${ac_eD} +${ac_dA}HAVE_VPRINTF${ac_dB}HAVE_VPRINTF${ac_dC}1${ac_dD} +${ac_uA}HAVE_VPRINTF${ac_uB}HAVE_VPRINTF${ac_uC}1${ac_uD} +${ac_eA}HAVE_VPRINTF${ac_eB}HAVE_VPRINTF${ac_eC}1${ac_eD} +${ac_dA}HAVE_PRINTF_PTR${ac_dB}HAVE_PRINTF_PTR${ac_dC}1${ac_dD} +${ac_uA}HAVE_PRINTF_PTR${ac_uB}HAVE_PRINTF_PTR${ac_uC}1${ac_uD} +${ac_eA}HAVE_PRINTF_PTR${ac_eB}HAVE_PRINTF_PTR${ac_eC}1${ac_eD} +${ac_dA}SYS_SIGLIST_DECLARED${ac_dB}SYS_SIGLIST_DECLARED${ac_dC}1${ac_dD} +${ac_uA}SYS_SIGLIST_DECLARED${ac_uB}SYS_SIGLIST_DECLARED${ac_uC}1${ac_uD} +${ac_eA}SYS_SIGLIST_DECLARED${ac_eB}SYS_SIGLIST_DECLARED${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + +host='i686-pc-linux-gnu' +build='i686-pc-linux-gnu' +target='arm-unknown-elf' +target_alias='arm-elf' +srcdir='.' +subdirs='' +oldstyle_subdirs='' +symbolic_link='ln -s' +program_transform_set='' +program_transform_name='s,x,x,' +dep_host_xmake_file='' +host_xmake_file='i386/x-i386' +dep_tmake_file=' ./config/arm/t-arm-elf' +tmake_file='arm/t-arm-elf' +thread_file='single' +gcc_version='2.9-arm-000512' +gcc_version_trigger='./version.c' +local_prefix='$(prefix)' +build_install_headers_dir='install-headers-tar' +build_exeext='' +host_exeext='' +out_file='arm/arm.c' +gdb_needs_out_file_path='' +SET_MAKE='' +target_list='all.build all.cross start.encap rest.encap info dvi install-normal install-common install-info install-man uninstall distdir mostlyclean clean distclean extraclean maintainer-clean stage1 stage2 stage3 stage4' +target_overrides='Make-target' +host_overrides='Make-host' +cross_defines='CROSS=-DCROSS_COMPILE' +cross_overrides='/home/cameron/programming/agbcc2/gcc_arm/cross-make' +build_overrides='/dev/null' + + +. $srcdir/configure.lang +case x$CONFIG_HEADERS in +xauto-host.h:config.in) +echo > cstamp-h ;; +esac +# If the host supports symlinks, point stage[1234] at ../stage[1234] so +# bootstrapping and the installation procedure can still use +# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, +# FLAGS_TO_PASS has been modified to solve the problem there. +# This is virtually a duplicate of what happens in configure.lang; we do +# an extra check to make sure this only happens if ln -s can be used. +if test "$symbolic_link" = "ln -s"; then + for d in .. ${subdirs} ; do + if test $d != ..; then + STARTDIR=`pwd` + cd $d + for t in stage1 stage2 stage3 stage4 include + do + rm -f $t + $symbolic_link ../$t $t 2>/dev/null + done + cd $STARTDIR + fi + done +else true ; fi + +exit 0 diff --git a/gcc_arm/config.cache b/gcc_arm/config.cache new file mode 100644 index 0000000..95f6f2f --- /dev/null +++ b/gcc_arm/config.cache @@ -0,0 +1,108 @@ +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_decl_sys_siglist=${ac_cv_decl_sys_siglist='yes'} +ac_cv_func_atoll=${ac_cv_func_atoll='yes'} +ac_cv_func_atoq=${ac_cv_func_atoq='no'} +ac_cv_func_bcmp=${ac_cv_func_bcmp='yes'} +ac_cv_func_bcopy=${ac_cv_func_bcopy='yes'} +ac_cv_func_bsearch=${ac_cv_func_bsearch='yes'} +ac_cv_func_bzero=${ac_cv_func_bzero='yes'} +ac_cv_func_fputc_unlocked=${ac_cv_func_fputc_unlocked='yes'} +ac_cv_func_fputs_unlocked=${ac_cv_func_fputs_unlocked='yes'} +ac_cv_func_getrlimit=${ac_cv_func_getrlimit='yes'} +ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'} +ac_cv_func_index=${ac_cv_func_index='yes'} +ac_cv_func_isascii=${ac_cv_func_isascii='yes'} +ac_cv_func_kill=${ac_cv_func_kill='yes'} +ac_cv_func_popen=${ac_cv_func_popen='yes'} +ac_cv_func_putc_unlocked=${ac_cv_func_putc_unlocked='yes'} +ac_cv_func_putenv=${ac_cv_func_putenv='yes'} +ac_cv_func_rindex=${ac_cv_func_rindex='yes'} +ac_cv_func_setrlimit=${ac_cv_func_setrlimit='yes'} +ac_cv_func_strchr=${ac_cv_func_strchr='yes'} +ac_cv_func_strerror=${ac_cv_func_strerror='yes'} +ac_cv_func_strrchr=${ac_cv_func_strrchr='yes'} +ac_cv_func_strsignal=${ac_cv_func_strsignal='yes'} +ac_cv_func_strtoul=${ac_cv_func_strtoul='yes'} +ac_cv_func_sysconf=${ac_cv_func_sysconf='yes'} +ac_cv_func_vfork_works=${ac_cv_func_vfork_works='yes'} +ac_cv_func_vprintf=${ac_cv_func_vprintf='yes'} +ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h='yes'} +ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'} +ac_cv_header_pthread_h=${ac_cv_header_pthread_h='yes'} +ac_cv_header_stab_h=${ac_cv_header_stab_h='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_header_stddef_h=${ac_cv_header_stddef_h='yes'} +ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'} +ac_cv_header_string_h=${ac_cv_header_string_h='yes'} +ac_cv_header_strings_h=${ac_cv_header_strings_h='yes'} +ac_cv_header_sys_file_h=${ac_cv_header_sys_file_h='yes'} +ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'} +ac_cv_header_sys_resource_h=${ac_cv_header_sys_resource_h='yes'} +ac_cv_header_sys_stat_h=${ac_cv_header_sys_stat_h='yes'} +ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'} +ac_cv_header_sys_times_h=${ac_cv_header_sys_times_h='yes'} +ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'} +ac_cv_header_thread_h=${ac_cv_header_thread_h='no'} +ac_cv_header_time=${ac_cv_header_time='yes'} +ac_cv_header_time_h=${ac_cv_header_time_h='yes'} +ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'} +ac_cv_header_vfork_h=${ac_cv_header_vfork_h='no'} +ac_cv_lib_fl_yywrap=${ac_cv_lib_fl_yywrap='no'} +ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} +ac_cv_prog_AWK=${ac_cv_prog_AWK='mawk'} +ac_cv_prog_CC=${ac_cv_prog_CC='gcc'} +ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'} +ac_cv_prog_LEX=${ac_cv_prog_LEX='flex'} +ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'} +ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'} +ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'} +ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'} +ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'} +ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'} +ac_cv_prog_gnat=${ac_cv_prog_gnat='no'} +ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'} +ac_cv_type_pid_t=${ac_cv_type_pid_t='yes'} +gcc_cv_as=${gcc_cv_as=''} +gcc_cv_as_alignment_features=${gcc_cv_as_alignment_features=''} +gcc_cv_as_gas_srcdir=${gcc_cv_as_gas_srcdir='./gas'} +gcc_cv_as_subsections=${gcc_cv_as_subsections=''} +gcc_cv_c_have_stringify=${gcc_cv_c_have_stringify='yes'} +gcc_cv_c_volatile=${gcc_cv_c_volatile='yes'} +gcc_cv_decl_needed_abort=${gcc_cv_decl_needed_abort='no'} +gcc_cv_decl_needed_atof=${gcc_cv_decl_needed_atof='no'} +gcc_cv_decl_needed_atol=${gcc_cv_decl_needed_atol='no'} +gcc_cv_decl_needed_bcmp=${gcc_cv_decl_needed_bcmp='no'} +gcc_cv_decl_needed_bcopy=${gcc_cv_decl_needed_bcopy='no'} +gcc_cv_decl_needed_bzero=${gcc_cv_decl_needed_bzero='no'} +gcc_cv_decl_needed_calloc=${gcc_cv_decl_needed_calloc='no'} +gcc_cv_decl_needed_free=${gcc_cv_decl_needed_free='no'} +gcc_cv_decl_needed_getcwd=${gcc_cv_decl_needed_getcwd='no'} +gcc_cv_decl_needed_getenv=${gcc_cv_decl_needed_getenv='no'} +gcc_cv_decl_needed_getrlimit=${gcc_cv_decl_needed_getrlimit='no'} +gcc_cv_decl_needed_getwd=${gcc_cv_decl_needed_getwd='no'} +gcc_cv_decl_needed_index=${gcc_cv_decl_needed_index='no'} +gcc_cv_decl_needed_malloc=${gcc_cv_decl_needed_malloc='no'} +gcc_cv_decl_needed_realloc=${gcc_cv_decl_needed_realloc='no'} +gcc_cv_decl_needed_rindex=${gcc_cv_decl_needed_rindex='no'} +gcc_cv_decl_needed_sbrk=${gcc_cv_decl_needed_sbrk='no'} +gcc_cv_decl_needed_setrlimit=${gcc_cv_decl_needed_setrlimit='no'} +gcc_cv_decl_needed_strerror=${gcc_cv_decl_needed_strerror='no'} +gcc_cv_decl_needed_strsignal=${gcc_cv_decl_needed_strsignal='no'} +gcc_cv_func_printf_ptr=${gcc_cv_func_printf_ptr='yes'} +gcc_cv_header_inttypes_h=${gcc_cv_header_inttypes_h='yes'} +gcc_cv_header_string=${gcc_cv_header_string='yes'} +gcc_cv_prog_LN=${gcc_cv_prog_LN='ln'} +gcc_cv_prog_LN_S=${gcc_cv_prog_LN_S='ln -s'} diff --git a/gcc_arm/config.h b/gcc_arm/config.h new file mode 100644 index 0000000..0c48f96 --- /dev/null +++ b/gcc_arm/config.h @@ -0,0 +1,12 @@ +#include "auto-host.h" +#include "gansidecl.h" +#include "i386/xm-i386.h" +#ifndef HAVE_ATEXIT +#define HAVE_ATEXIT +#endif +#ifndef POSIX +#define POSIX +#endif +#ifndef BSTRING +#define BSTRING +#endif diff --git a/gcc_arm/config.status b/gcc_arm/config.status new file mode 100755 index 0000000..9ef8f17 --- /dev/null +++ b/gcc_arm/config.status @@ -0,0 +1,588 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host cameron-HP-Pavilion-g7-Notebook-PC: +# +# ./configure --target=arm-elf --host=i686-linux-gnu +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} ./configure --target=arm-elf --host=i686-linux-gnu --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} ./configure --target=arm-elf --host=i686-linux-gnu --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. + +trap 'rm -fr Makefile auto-host.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@SHELL@%/bin/sh%g +s%@CFLAGS@%-g -O2%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@FFLAGS@%%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr/local%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@host@%i686-pc-linux-gnu%g +s%@host_alias@%i686-linux-gnu%g +s%@host_cpu@%i686%g +s%@host_vendor@%pc%g +s%@host_os@%linux-gnu%g +s%@target@%arm-unknown-elf%g +s%@target_alias@%arm-elf%g +s%@target_cpu@%arm%g +s%@target_vendor@%unknown%g +s%@target_os@%elf%g +s%@build@%i686-pc-linux-gnu%g +s%@build_alias@%i686-linux-gnu%g +s%@build_cpu@%i686%g +s%@build_vendor@%pc%g +s%@build_os@%linux-gnu%g +s%@CC@%gcc%g +s%@stage1_warn_cflags@%$(WARN_CFLAGS)%g +s%@SET_MAKE@%%g +s%@AWK@%mawk%g +s%@LEX@%flex%g +s%@LEXLIB@%%g +s%@LN@%ln%g +s%@LN_S@%ln -s%g +s%@RANLIB@%ranlib%g +s%@YACC@%bison -y%g +s%@INSTALL@%/usr/bin/install -c%g +s%@INSTALL_PROGRAM@%${INSTALL}%g +s%@INSTALL_DATA@%${INSTALL} -m 644%g +s%@CPP@%gcc -E%g +s%@gnat@%no%g +s%@vfprintf@%%g +s%@doprint@%%g +s%@manext@%.1%g +s%@objext@%.o%g +s%@gthread_flags@%%g +s%@build_canonical@%i686-pc-linux-gnu%g +s%@host_canonical@%i686-pc-linux-gnu%g +s%@target_subdir@%arm-unknown-elf/%g +s%@inhibit_libc@%%g +s%@sched_prefix@%%g +s%@sched_cflags@%%g +s%@gcc_tooldir@%$(libsubdir)/$(unlibsubdir)/../$(target_alias)%g +s%@dollar@%%g +s%@objdir@%/home/cameron/programming/agbcc2/gcc_arm%g +s%@subdirs@%%g +s%@all_languages@%%g +s%@all_boot_languages@%%g +s%@all_compilers@%%g +s%@all_lang_makefiles@%%g +s%@all_stagestuff@%%g +s%@all_diff_excludes@%%g +s%@all_lib2funcs@%%g +s%@all_headers@%%g +s%@cpp_main@%cccp%g +s%@extra_passes@%%g +s%@extra_programs@%%g +s%@extra_parts@%%g +s%@extra_c_objs@%%g +s%@extra_cxx_objs@%%g +s%@extra_cpp_objs@%%g +s%@extra_c_flags@% -DMULTIBYTE_CHARS=1%g +s%@extra_objs@% %g +s%@host_extra_gcc_objs@%%g +s%@extra_headers_list@%%g +s%@dep_host_xmake_file@%%g +s%@dep_tmake_file@% ./config/arm/t-arm-elf%g +s%@out_file@%arm/arm.c%g +s%@out_object_file@%arm.o%g +s%@md_file@%arm/arm.md%g +s%@tm_file_list@% gansidecl.h $(srcdir)/config/arm/unknown-elf.h%g +s%@build_xm_file_list@% auto-host.h gansidecl.h $(srcdir)/config/i386/xm-i386.h%g +s%@host_xm_file_list@% auto-host.h gansidecl.h $(srcdir)/config/i386/xm-i386.h%g +s%@lang_specs_files@%%g +s%@lang_options_files@%%g +s%@lang_tree_files@%%g +s%@thread_file@%single%g +s%@objc_boehm_gc@%%g +s%@JAVAGC@%boehm%g +s%@gcc_version@%2.9-arm-000512%g +s%@gcc_version_trigger@%./version.c%g +s%@local_prefix@%$(prefix)%g +s%@gcc_gxx_include_dir@%$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include/g++-%g +s%@fixincludes@%fixincludes%g +s%@build_install_headers_dir@%install-headers-tar%g +s%@build_exeext@%%g +s%@host_exeext@%%g +s%@float_h_file@%float-i64.h%g +s%@cc_set_by_configure@%$(CC)%g +s%@stage_prefix_set_by_configure@%$(STAGE_PREFIX)%g +s%@install@%%g +s%@symbolic_link@%ln -s%g +/@target_overrides@/r Make-target +s%@target_overrides@%%g +/@host_overrides@/r Make-host +s%@host_overrides@%%g +s%@cross_defines@%CROSS=-DCROSS_COMPILE%g +/@cross_overrides@/r /home/cameron/programming/agbcc2/gcc_arm/cross-make +s%@cross_overrides@%%g +/@build_overrides@/r /dev/null +s%@build_overrides@%%g +/@language_fragments@/r Make-lang +s%@language_fragments@%%g +/@language_hooks@/r Make-hooks +s%@language_hooks@%%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"Makefile"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then + CONFIG_HEADERS="auto-host.h:config.in" +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_VOLATILE${ac_dB}HAVE_VOLATILE${ac_dC}1${ac_dD} +${ac_uA}HAVE_VOLATILE${ac_uB}HAVE_VOLATILE${ac_uC}1${ac_uD} +${ac_eA}HAVE_VOLATILE${ac_eB}HAVE_VOLATILE${ac_eC}1${ac_eD} +${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD} +${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD} +${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD} +${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD} +${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD} +${ac_eA}TIME_WITH_SYS_TIME${ac_eB}TIME_WITH_SYS_TIME${ac_eC}1${ac_eD} +${ac_dA}STRING_WITH_STRINGS${ac_dB}STRING_WITH_STRINGS${ac_dC}1${ac_dD} +${ac_uA}STRING_WITH_STRINGS${ac_uB}STRING_WITH_STRINGS${ac_uC}1${ac_uD} +${ac_eA}STRING_WITH_STRINGS${ac_eB}STRING_WITH_STRINGS${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYS_WAIT_H${ac_dB}HAVE_SYS_WAIT_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_WAIT_H${ac_uB}HAVE_SYS_WAIT_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_WAIT_H${ac_eB}HAVE_SYS_WAIT_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_LIMITS_H${ac_dB}HAVE_LIMITS_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_LIMITS_H${ac_uB}HAVE_LIMITS_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_LIMITS_H${ac_eB}HAVE_LIMITS_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STDDEF_H${ac_dB}HAVE_STDDEF_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STDDEF_H${ac_uB}HAVE_STDDEF_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STDDEF_H${ac_eB}HAVE_STDDEF_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRING_H${ac_eB}HAVE_STRING_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_STRINGS_H${ac_dB}HAVE_STRINGS_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRINGS_H${ac_uB}HAVE_STRINGS_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRINGS_H${ac_eB}HAVE_STRINGS_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STDLIB_H${ac_dB}HAVE_STDLIB_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STDLIB_H${ac_uB}HAVE_STDLIB_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STDLIB_H${ac_eB}HAVE_STDLIB_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_TIME_H${ac_dB}HAVE_TIME_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_TIME_H${ac_uB}HAVE_TIME_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_TIME_H${ac_eB}HAVE_TIME_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_FCNTL_H${ac_dB}HAVE_FCNTL_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_FCNTL_H${ac_uB}HAVE_FCNTL_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_FCNTL_H${ac_eB}HAVE_FCNTL_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STAB_H${ac_dB}HAVE_STAB_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_STAB_H${ac_uB}HAVE_STAB_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_STAB_H${ac_eB}HAVE_STAB_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_FILE_H${ac_dB}HAVE_SYS_FILE_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_FILE_H${ac_uB}HAVE_SYS_FILE_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_FILE_H${ac_eB}HAVE_SYS_FILE_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_TIME_H${ac_dB}HAVE_SYS_TIME_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TIME_H${ac_uB}HAVE_SYS_TIME_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TIME_H${ac_eB}HAVE_SYS_TIME_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYS_RESOURCE_H${ac_dB}HAVE_SYS_RESOURCE_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_RESOURCE_H${ac_uB}HAVE_SYS_RESOURCE_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_RESOURCE_H${ac_eB}HAVE_SYS_RESOURCE_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_TIMES_H${ac_dB}HAVE_SYS_TIMES_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TIMES_H${ac_uB}HAVE_SYS_TIMES_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TIMES_H${ac_eB}HAVE_SYS_TIMES_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_STAT_H${ac_dB}HAVE_SYS_STAT_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_STAT_H${ac_uB}HAVE_SYS_STAT_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_STAT_H${ac_eB}HAVE_SYS_STAT_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_CPP_STRINGIFY${ac_dB}HAVE_CPP_STRINGIFY${ac_dC}1${ac_dD} +${ac_uA}HAVE_CPP_STRINGIFY${ac_uB}HAVE_CPP_STRINGIFY${ac_uC}1${ac_uD} +${ac_eA}HAVE_CPP_STRINGIFY${ac_eB}HAVE_CPP_STRINGIFY${ac_eC}1${ac_eD} +${ac_dA}HAVE_INTTYPES_H${ac_dB}HAVE_INTTYPES_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_INTTYPES_H${ac_uB}HAVE_INTTYPES_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_INTTYPES_H${ac_eB}HAVE_INTTYPES_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRTOUL${ac_dB}HAVE_STRTOUL${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRTOUL${ac_uB}HAVE_STRTOUL${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRTOUL${ac_eB}HAVE_STRTOUL${ac_eC}1${ac_eD} +${ac_dA}HAVE_BSEARCH${ac_dB}HAVE_BSEARCH${ac_dC}1${ac_dD} +${ac_uA}HAVE_BSEARCH${ac_uB}HAVE_BSEARCH${ac_uC}1${ac_uD} +${ac_eA}HAVE_BSEARCH${ac_eB}HAVE_BSEARCH${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_STRERROR${ac_dB}HAVE_STRERROR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRERROR${ac_uB}HAVE_STRERROR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRERROR${ac_eB}HAVE_STRERROR${ac_eC}1${ac_eD} +${ac_dA}HAVE_PUTENV${ac_dB}HAVE_PUTENV${ac_dC}1${ac_dD} +${ac_uA}HAVE_PUTENV${ac_uB}HAVE_PUTENV${ac_uC}1${ac_uD} +${ac_eA}HAVE_PUTENV${ac_eB}HAVE_PUTENV${ac_eC}1${ac_eD} +${ac_dA}HAVE_POPEN${ac_dB}HAVE_POPEN${ac_dC}1${ac_dD} +${ac_uA}HAVE_POPEN${ac_uB}HAVE_POPEN${ac_uC}1${ac_uD} +${ac_eA}HAVE_POPEN${ac_eB}HAVE_POPEN${ac_eC}1${ac_eD} +${ac_dA}HAVE_BCOPY${ac_dB}HAVE_BCOPY${ac_dC}1${ac_dD} +${ac_uA}HAVE_BCOPY${ac_uB}HAVE_BCOPY${ac_uC}1${ac_uD} +${ac_eA}HAVE_BCOPY${ac_eB}HAVE_BCOPY${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_BZERO${ac_dB}HAVE_BZERO${ac_dC}1${ac_dD} +${ac_uA}HAVE_BZERO${ac_uB}HAVE_BZERO${ac_uC}1${ac_uD} +${ac_eA}HAVE_BZERO${ac_eB}HAVE_BZERO${ac_eC}1${ac_eD} +${ac_dA}HAVE_BCMP${ac_dB}HAVE_BCMP${ac_dC}1${ac_dD} +${ac_uA}HAVE_BCMP${ac_uB}HAVE_BCMP${ac_uC}1${ac_uD} +${ac_eA}HAVE_BCMP${ac_eB}HAVE_BCMP${ac_eC}1${ac_eD} +${ac_dA}HAVE_INDEX${ac_dB}HAVE_INDEX${ac_dC}1${ac_dD} +${ac_uA}HAVE_INDEX${ac_uB}HAVE_INDEX${ac_uC}1${ac_uD} +${ac_eA}HAVE_INDEX${ac_eB}HAVE_INDEX${ac_eC}1${ac_eD} +${ac_dA}HAVE_RINDEX${ac_dB}HAVE_RINDEX${ac_dC}1${ac_dD} +${ac_uA}HAVE_RINDEX${ac_uB}HAVE_RINDEX${ac_uC}1${ac_uD} +${ac_eA}HAVE_RINDEX${ac_eB}HAVE_RINDEX${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_STRCHR${ac_dB}HAVE_STRCHR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRCHR${ac_uB}HAVE_STRCHR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRCHR${ac_eB}HAVE_STRCHR${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRRCHR${ac_dB}HAVE_STRRCHR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRRCHR${ac_uB}HAVE_STRRCHR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRRCHR${ac_eB}HAVE_STRRCHR${ac_eC}1${ac_eD} +${ac_dA}HAVE_KILL${ac_dB}HAVE_KILL${ac_dC}1${ac_dD} +${ac_uA}HAVE_KILL${ac_uB}HAVE_KILL${ac_uC}1${ac_uD} +${ac_eA}HAVE_KILL${ac_eB}HAVE_KILL${ac_eC}1${ac_eD} +${ac_dA}HAVE_GETRLIMIT${ac_dB}HAVE_GETRLIMIT${ac_dC}1${ac_dD} +${ac_uA}HAVE_GETRLIMIT${ac_uB}HAVE_GETRLIMIT${ac_uC}1${ac_uD} +${ac_eA}HAVE_GETRLIMIT${ac_eB}HAVE_GETRLIMIT${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SETRLIMIT${ac_dB}HAVE_SETRLIMIT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SETRLIMIT${ac_uB}HAVE_SETRLIMIT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SETRLIMIT${ac_eB}HAVE_SETRLIMIT${ac_eC}1${ac_eD} +${ac_dA}HAVE_ATOLL${ac_dB}HAVE_ATOLL${ac_dC}1${ac_dD} +${ac_uA}HAVE_ATOLL${ac_uB}HAVE_ATOLL${ac_uC}1${ac_uD} +${ac_eA}HAVE_ATOLL${ac_eB}HAVE_ATOLL${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCONF${ac_dB}HAVE_SYSCONF${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCONF${ac_uB}HAVE_SYSCONF${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCONF${ac_eB}HAVE_SYSCONF${ac_eC}1${ac_eD} +${ac_dA}HAVE_ISASCII${ac_dB}HAVE_ISASCII${ac_dC}1${ac_dD} +${ac_uA}HAVE_ISASCII${ac_uB}HAVE_ISASCII${ac_uC}1${ac_uD} +${ac_eA}HAVE_ISASCII${ac_eB}HAVE_ISASCII${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_GETTIMEOFDAY${ac_dB}HAVE_GETTIMEOFDAY${ac_dC}1${ac_dD} +${ac_uA}HAVE_GETTIMEOFDAY${ac_uB}HAVE_GETTIMEOFDAY${ac_uC}1${ac_uD} +${ac_eA}HAVE_GETTIMEOFDAY${ac_eB}HAVE_GETTIMEOFDAY${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRSIGNAL${ac_dB}HAVE_STRSIGNAL${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRSIGNAL${ac_uB}HAVE_STRSIGNAL${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRSIGNAL${ac_eB}HAVE_STRSIGNAL${ac_eC}1${ac_eD} +${ac_dA}HAVE_PUTC_UNLOCKED${ac_dB}HAVE_PUTC_UNLOCKED${ac_dC}1${ac_dD} +${ac_uA}HAVE_PUTC_UNLOCKED${ac_uB}HAVE_PUTC_UNLOCKED${ac_uC}1${ac_uD} +${ac_eA}HAVE_PUTC_UNLOCKED${ac_eB}HAVE_PUTC_UNLOCKED${ac_eC}1${ac_eD} +${ac_dA}HAVE_FPUTC_UNLOCKED${ac_dB}HAVE_FPUTC_UNLOCKED${ac_dC}1${ac_dD} +${ac_uA}HAVE_FPUTC_UNLOCKED${ac_uB}HAVE_FPUTC_UNLOCKED${ac_uC}1${ac_uD} +${ac_eA}HAVE_FPUTC_UNLOCKED${ac_eB}HAVE_FPUTC_UNLOCKED${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_FPUTS_UNLOCKED${ac_dB}HAVE_FPUTS_UNLOCKED${ac_dC}1${ac_dD} +${ac_uA}HAVE_FPUTS_UNLOCKED${ac_uB}HAVE_FPUTS_UNLOCKED${ac_uC}1${ac_uD} +${ac_eA}HAVE_FPUTS_UNLOCKED${ac_eB}HAVE_FPUTS_UNLOCKED${ac_eC}1${ac_eD} +${ac_dA}HAVE_VPRINTF${ac_dB}HAVE_VPRINTF${ac_dC}1${ac_dD} +${ac_uA}HAVE_VPRINTF${ac_uB}HAVE_VPRINTF${ac_uC}1${ac_uD} +${ac_eA}HAVE_VPRINTF${ac_eB}HAVE_VPRINTF${ac_eC}1${ac_eD} +${ac_dA}HAVE_PRINTF_PTR${ac_dB}HAVE_PRINTF_PTR${ac_dC}1${ac_dD} +${ac_uA}HAVE_PRINTF_PTR${ac_uB}HAVE_PRINTF_PTR${ac_uC}1${ac_uD} +${ac_eA}HAVE_PRINTF_PTR${ac_eB}HAVE_PRINTF_PTR${ac_eC}1${ac_eD} +${ac_dA}SYS_SIGLIST_DECLARED${ac_dB}SYS_SIGLIST_DECLARED${ac_dC}1${ac_dD} +${ac_uA}SYS_SIGLIST_DECLARED${ac_uB}SYS_SIGLIST_DECLARED${ac_uC}1${ac_uD} +${ac_eA}SYS_SIGLIST_DECLARED${ac_eB}SYS_SIGLIST_DECLARED${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + +host='i686-pc-linux-gnu' +build='i686-pc-linux-gnu' +target='arm-unknown-elf' +target_alias='arm-elf' +srcdir='.' +subdirs='' +oldstyle_subdirs='' +symbolic_link='ln -s' +program_transform_set='' +program_transform_name='s,x,x,' +dep_host_xmake_file='' +host_xmake_file='i386/x-i386' +dep_tmake_file=' ./config/arm/t-arm-elf' +tmake_file='arm/t-arm-elf' +thread_file='single' +gcc_version='2.9-arm-000512' +gcc_version_trigger='./version.c' +local_prefix='$(prefix)' +build_install_headers_dir='install-headers-tar' +build_exeext='' +host_exeext='' +out_file='arm/arm.c' +gdb_needs_out_file_path='' +SET_MAKE='' +target_list='all.build all.cross start.encap rest.encap info dvi install-normal install-common install-info install-man uninstall distdir mostlyclean clean distclean extraclean maintainer-clean stage1 stage2 stage3 stage4' +target_overrides='Make-target' +host_overrides='Make-host' +cross_defines='CROSS=-DCROSS_COMPILE' +cross_overrides='/home/cameron/programming/agbcc2/gcc_arm/cross-make' +build_overrides='/dev/null' + + +. $srcdir/configure.lang +case x$CONFIG_HEADERS in +xauto-host.h:config.in) +echo > cstamp-h ;; +esac +# If the host supports symlinks, point stage[1234] at ../stage[1234] so +# bootstrapping and the installation procedure can still use +# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, +# FLAGS_TO_PASS has been modified to solve the problem there. +# This is virtually a duplicate of what happens in configure.lang; we do +# an extra check to make sure this only happens if ln -s can be used. +if test "$symbolic_link" = "ln -s"; then + for d in .. ${subdirs} ; do + if test $d != ..; then + STARTDIR=`pwd` + cd $d + for t in stage1 stage2 stage3 stage4 include + do + rm -f $t + $symbolic_link ../$t $t 2>/dev/null + done + cd $STARTDIR + fi + done +else true ; fi + +exit 0 diff --git a/gcc_arm/cstamp-h b/gcc_arm/cstamp-h new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/gcc_arm/cstamp-h @@ -0,0 +1 @@ + diff --git a/gcc_arm/gencheck.h b/gcc_arm/gencheck.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc_arm/gencheck.h diff --git a/gcc_arm/hconfig.h b/gcc_arm/hconfig.h new file mode 100644 index 0000000..0c48f96 --- /dev/null +++ b/gcc_arm/hconfig.h @@ -0,0 +1,12 @@ +#include "auto-host.h" +#include "gansidecl.h" +#include "i386/xm-i386.h" +#ifndef HAVE_ATEXIT +#define HAVE_ATEXIT +#endif +#ifndef POSIX +#define POSIX +#endif +#ifndef BSTRING +#define BSTRING +#endif diff --git a/gcc_arm/obstack.c b/gcc_arm/obstack.c new file mode 120000 index 0000000..4b7c220 --- /dev/null +++ b/gcc_arm/obstack.c @@ -0,0 +1 @@ +./../libiberty/obstack.c
\ No newline at end of file diff --git a/gcc_arm/options.h b/gcc_arm/options.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc_arm/options.h diff --git a/gcc_arm/specs.h b/gcc_arm/specs.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gcc_arm/specs.h diff --git a/gcc_arm/splay-tree.c b/gcc_arm/splay-tree.c new file mode 120000 index 0000000..5f74d20 --- /dev/null +++ b/gcc_arm/splay-tree.c @@ -0,0 +1 @@ +./../libiberty/splay-tree.c
\ No newline at end of file diff --git a/gcc_arm/tconfig.h b/gcc_arm/tconfig.h new file mode 100644 index 0000000..1fa5d1e --- /dev/null +++ b/gcc_arm/tconfig.h @@ -0,0 +1,2 @@ +#include "gansidecl.h" +#include "arm/xm-arm.h" diff --git a/gcc_arm/tm.h b/gcc_arm/tm.h new file mode 100644 index 0000000..bda15db --- /dev/null +++ b/gcc_arm/tm.h @@ -0,0 +1,3 @@ +#define TARGET_CPU_DEFAULT (TARGET_CPU_generic) +#include "gansidecl.h" +#include "arm/unknown-elf.h" diff --git a/gcc_arm/tmp-emsgids.c b/gcc_arm/tmp-emsgids.c deleted file mode 100755 index 67e8adb..0000000 --- a/gcc_arm/tmp-emsgids.c +++ /dev/null @@ -1,96 +0,0 @@ -#line 59 "config/arc/arc.h" -_("may not use both -EB and -EL") -#line 176 "config/arm/arm.h" -_("-mapcs-26 and -mapcs-32 may not be used together") -#line 187 "config/arm/arm.h" -_("-msoft-float and -mhard_float may not be used together") -#line 198 "config/arm/arm.h" -_("-mbig-endian and -mlittle-endian may not be used together") -#line 72 "config/arm/riscix.h" -_("-mbsd and -pedantic incompatible") -#line 73 "config/arm/riscix.h" -_("-mbsd and -mxopen incompatible") -#line 74 "config/arm/riscix.h" -_("-mxopen and -pedantic incompatible") -#line 133 "config/arm/riscix.h" -_("-mbsd and -pedantic incompatible") -#line 134 "config/arm/riscix.h" -_("-mbsd and -mxopen incompatible") -#line 135 "config/arm/riscix.h" -_("-mxopen and -pedantic incompatible") -#line 126 "config/dsp16xx/dsp16xx.h" -_("A -ifile option requires a -map option") -#line 135 "config/dsp16xx/dsp16xx.h" -_("A -ifile option requires a -map option") -#line 809 "config/i386/sco5.h" -_("-static not valid with -mcoff") -#line 810 "config/i386/sco5.h" -_("-shared not valid with -mcoff") -#line 811 "config/i386/sco5.h" -_("-symbolic not valid with -mcoff") -#line 847 "config/i386/sco5.h" -_("-fpic is not valid with -mcoff") -#line 848 "config/i386/sco5.h" -_("-fPIC is not valid with -mcoff") -#line 882 "config/i386/sco5.h" -_("-static not valid with -mcoff") -#line 883 "config/i386/sco5.h" -_("-shared not valid with -mcoff") -#line 884 "config/i386/sco5.h" -_("-symbolic not valid with -mcoff") -#line 885 "config/i386/sco5.h" -_("-fpic not valid with -mcoff") -#line 886 "config/i386/sco5.h" -_("-fPIC not valid with -mcoff") -#line 305 "config/i860/fx2800.h" -_("-p option not supported: use -pg instead") -#line 674 "config/mips/mips.h" -_("-pipe is not supported.") -#line 811 "config/mips/mips.h" -_("may not use both -mfp64 and -msingle-float") -#line 812 "config/mips/mips.h" -_("may not use both -mfp64 and -m4650") -#line 815 "config/mips/mips.h" -_("may not use both -EB and -EL") -#line 27 "config/mips/r3900.h" -_("-mhard-float not supported.") -#line 29 "config/mips/r3900.h" -_("-msingle-float and -msoft-float can not both be specified.") -#line 41 "config/mips/r3900.h" -_("-mhard-float not supported.") -#line 43 "config/mips/r3900.h" -_("-msingle-float and -msoft-float can not both be specified.") -#line 166 "config/nextstep.h" -_("-p profiling is no longer supported. Use -pg instead.") -#line 169 "config/nextstep.h" -_("-p profiling is no longer supported. Use -pg instead.") -#line 36 "config/vax/vax.h" -_("profiling not supported with -mg\n") -#line 37 "config/vax/vax.h" -_("profiling not supported with -mg\n") -#line 32 "cp/lang-specs.h" -_("GNU C++ does not support -C without using -E") -#line 45 "cp/lang-specs.h" -_("-pg and -fomit-frame-pointer are incompatible") -#line 56 "cp/lang-specs.h" -_("-pg and -fomit-frame-pointer are incompatible") -#line 603 "gcc.c" -_("GNU C does not support -C without using -E") -#line 617 "gcc.c" -_("-pg and -fomit-frame-pointer are incompatible") -#line 624 "gcc.c" -_("GNU C does not support -C without using -E") -#line 633 "gcc.c" -_("-E required when input is from standard input") -#line 637 "gcc.c" -_("GNU C does not support -C without using -E") -#line 652 "gcc.c" -_("-pg and -fomit-frame-pointer are incompatible") -#line 659 "gcc.c" -_("Compilation of header file requested") -#line 661 "gcc.c" -_("GNU C does not support -C without using -E") -#line 676 "gcc.c" -_("-pg and -fomit-frame-pointer are incompatible") -#line 689 "gcc.c" -_("GNU C does not support -C without using -E") diff --git a/include/ansidecl.h b/include/ansidecl.h new file mode 100755 index 0000000..cdb9fb7 --- /dev/null +++ b/include/ansidecl.h @@ -0,0 +1,163 @@ +/* ANSI and traditional C compatability macros + Copyright 1991, 1992, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + +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 of the License, 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. */ + +/* ANSI and traditional C compatibility macros + + ANSI C is assumed if __STDC__ is #defined. + + Macro ANSI C definition Traditional C definition + ----- ---- - ---------- ----------- - ---------- + PTR `void *' `char *' + LONG_DOUBLE `long double' `double' + VOLATILE `volatile' `' + SIGNED `signed' `' + PTRCONST `void *const' `char *' + ANSI_PROTOTYPES 1 not defined + + CONST is also defined, but is obsolete. Just use const. + + obsolete -- DEFUN (name, arglist, args) + + Defines function NAME. + + ARGLIST lists the arguments, separated by commas and enclosed in + parentheses. ARGLIST becomes the argument list in traditional C. + + ARGS list the arguments with their types. It becomes a prototype in + ANSI C, and the type declarations in traditional C. Arguments should + be separated with `AND'. For functions with a variable number of + arguments, the last thing listed should be `DOTS'. + + obsolete -- DEFUN_VOID (name) + + Defines a function NAME, which takes no arguments. + + obsolete -- EXFUN (name, (prototype)) -- obsolete. + + Replaced by PARAMS. Do not use; will disappear someday soon. + Was used in external function declarations. + In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in + parentheses). In traditional C it is `NAME()'. + For a function that takes no arguments, PROTOTYPE should be `(void)'. + + obsolete -- PROTO (type, name, (prototype) -- obsolete. + + This one has also been replaced by PARAMS. Do not use. + + PARAMS ((args)) + + We could use the EXFUN macro to handle prototype declarations, but + the name is misleading and the result is ugly. So we just define a + simple macro to handle the parameter lists, as in: + + static int foo PARAMS ((int, char)); + + This produces: `static int foo();' or `static int foo (int, char);' + + EXFUN would have done it like this: + + static int EXFUN (foo, (int, char)); + + but the function is not external...and it's hard to visually parse + the function name out of the mess. EXFUN should be considered + obsolete; new code should be written to use PARAMS. + + DOTS is also obsolete. + + Examples: + + extern int printf PARAMS ((const char *format, ...)); +*/ + +#ifndef _ANSIDECL_H + +#define _ANSIDECL_H 1 + + +/* Every source file includes this file, + so they will all get the switch for lint. */ +/* LINTLIBRARY */ + + +#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) +/* All known AIX compilers implement these things (but don't always + define __STDC__). The RISC/OS MIPS compiler defines these things + in SVR4 mode, but does not define __STDC__. */ + +#define PTR void * +#define PTRCONST void *CONST +#define LONG_DOUBLE long double + +#ifndef IN_GCC +#define AND , +#define NOARGS void +#define VOLATILE volatile +#define SIGNED signed +#endif /* ! IN_GCC */ + +#define PARAMS(paramlist) paramlist +#define ANSI_PROTOTYPES 1 + +#define VPARAMS(ARGS) ARGS +#define VA_START(va_list,var) va_start(va_list,var) + +/* These are obsolete. Do not use. */ +#ifndef IN_GCC +#define CONST const +#define DOTS , ... +#define PROTO(type, name, arglist) type name arglist +#define EXFUN(name, proto) name proto +#define DEFUN(name, arglist, args) name(args) +#define DEFUN_VOID(name) name(void) +#endif /* ! IN_GCC */ + +#else /* Not ANSI C. */ + +#define PTR char * +#define PTRCONST PTR +#define LONG_DOUBLE double + +#ifndef IN_GCC +#define AND ; +#define NOARGS +#define VOLATILE +#define SIGNED +#endif /* !IN_GCC */ + +#ifndef const /* some systems define it in header files for non-ansi mode */ +#define const +#endif + +#define PARAMS(paramlist) () + +#define VPARAMS(ARGS) (va_alist) va_dcl +#define VA_START(va_list,var) va_start(va_list) + +/* These are obsolete. Do not use. */ +#ifndef IN_GCC +#define CONST +#define DOTS +#define PROTO(type, name, arglist) type name () +#define EXFUN(name, proto) name() +#define DEFUN(name, arglist, args) name arglist args; +#define DEFUN_VOID(name) name() +#endif /* ! IN_GCC */ + +#endif /* ANSI C. */ + +#endif /* ansidecl.h */ diff --git a/include/libiberty.h b/include/libiberty.h new file mode 100755 index 0000000..ca0043d --- /dev/null +++ b/include/libiberty.h @@ -0,0 +1,180 @@ +/* Function declarations for libiberty. + Written by Cygnus Support, 1994. + + The libiberty library provides a number of functions which are + missing on some operating systems. We do not declare those here, + to avoid conflicts with the system header files on operating + systems that do support those functions. In this file we only + declare those functions which are specific to libiberty. */ + +#ifndef LIBIBERTY_H +#define LIBIBERTY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ansidecl.h" + +/* Build an argument vector from a string. Allocates memory using + malloc. Use freeargv to free the vector. */ + +extern char **buildargv PARAMS ((char *)); + +/* Free a vector returned by buildargv. */ + +extern void freeargv PARAMS ((char **)); + +/* Duplicate an argument vector. Allocates memory using malloc. Use + freeargv to free the vector. */ + +extern char **dupargv PARAMS ((char **)); + + +/* Return the last component of a path name. Note that we can't use a + prototype here because the parameter is declared inconsistently + across different systems, sometimes as "char *" and sometimes as + "const char *" */ + +#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) +extern char *basename PARAMS ((const char *)); +#else +extern char *basename (); +#endif + +/* Concatenate an arbitrary number of strings, up to (char *) NULL. + Allocates memory using xmalloc. */ + +extern char *concat PARAMS ((const char *, ...)); + +/* Check whether two file descriptors refer to the same file. */ + +extern int fdmatch PARAMS ((int fd1, int fd2)); + +/* Get the amount of time the process has run, in microseconds. */ + +extern long get_run_time PARAMS ((void)); + +/* Choose a temporary directory to use for scratch files. */ + +extern char *choose_temp_base PARAMS ((void)); + +/* Allocate memory filled with spaces. Allocates using malloc. */ + +extern const char *spaces PARAMS ((int count)); + +/* Return the maximum error number for which strerror will return a + string. */ + +extern int errno_max PARAMS ((void)); + +/* Return the name of an errno value (e.g., strerrno (EINVAL) returns + "EINVAL"). */ + +extern const char *strerrno PARAMS ((int)); + +/* Given the name of an errno value, return the value. */ + +extern int strtoerrno PARAMS ((const char *)); + +/* ANSI's strerror(), but more robust. */ + +extern char *xstrerror PARAMS ((int)); + +/* Return the maximum signal number for which strsignal will return a + string. */ + +extern int signo_max PARAMS ((void)); + +/* Return a signal message string for a signal number + (e.g., strsignal (SIGHUP) returns something like "Hangup"). */ +/* This is commented out as it can conflict with one in system headers. + We still document its existence though. */ + +/*extern const char *strsignal PARAMS ((int));*/ + +/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns + "SIGHUP"). */ + +extern const char *strsigno PARAMS ((int)); + +/* Given the name of a signal, return its number. */ + +extern int strtosigno PARAMS ((const char *)); + +/* Register a function to be run by xexit. Returns 0 on success. */ + +extern int xatexit PARAMS ((void (*fn) (void))); + +/* Exit, calling all the functions registered with xatexit. */ + +#ifndef __GNUC__ +extern void xexit PARAMS ((int status)); +#else +void xexit PARAMS ((int status)) __attribute__ ((noreturn)); +#endif + +/* Set the program name used by xmalloc. */ + +extern void xmalloc_set_program_name PARAMS ((const char *)); + +/* 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> +#endif +extern PTR xmalloc PARAMS ((size_t)); + +/* Reallocate memory without fail. This works like xmalloc. + + FIXME: We do not declare the parameter types for the same reason as + xmalloc. */ + +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)); + +/* Copy a string into a memory buffer without fail. */ + +extern char *xstrdup PARAMS ((const char *)); + +/* hex character manipulation routines */ + +#define _hex_array_size 256 +#define _hex_bad 99 +extern 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 + the argument being performed exactly once. */ +#define hex_value(c) (_hex_value[(unsigned char) (c)]) + +/* Definitions used by the pexecute routine. */ + +#define PEXECUTE_FIRST 1 +#define PEXECUTE_LAST 2 +#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST) +#define PEXECUTE_SEARCH 4 +#define PEXECUTE_VERBOSE 8 + +/* Execute a program. */ + +extern int pexecute PARAMS ((const char *, char * const *, const char *, + const char *, char **, char **, int)); + +/* Wait for pexecute to finish. */ + +extern int pwait PARAMS ((int, int *, int)); + +#ifdef __cplusplus +} +#endif + + +#endif /* ! defined (LIBIBERTY_H) */ diff --git a/include/obstack.h b/include/obstack.h new file mode 100755 index 0000000..09f1422 --- /dev/null +++ b/include/obstack.h @@ -0,0 +1,594 @@ +/* obstack.h - object stack macros + Copyright (C) 1988,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. + + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + 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. */ + +/* Summary: + +All the apparent functions defined here are macros. The idea +is that you would use these pre-tested macros to solve a +very specific set of problems, and they would run fast. +Caution: no side-effects in arguments please!! They may be +evaluated MANY times!! + +These macros operate a stack of objects. Each object starts life +small, and may grow to maturity. (Consider building a word syllable +by syllable.) An object can move while it is growing. Once it has +been "finished" it never changes address again. So the "top of the +stack" is typically an immature growing object, while the rest of the +stack is of mature, fixed size and fixed address objects. + +These routines grab large chunks of memory, using a function you +supply, called `obstack_chunk_alloc'. On occasion, they free chunks, +by calling `obstack_chunk_free'. You must define them and declare +them before using any obstack macros. + +Each independent stack is represented by a `struct obstack'. +Each of the obstack macros expects a pointer to such a structure +as the first argument. + +One motivation for this package is the problem of growing char strings +in symbol tables. Unless you are "fascist pig with a read-only mind" +--Gosper's immortal quote from HAKMEM item 154, out of context--you +would not like to put any arbitrary upper limit on the length of your +symbols. + +In practice this often means you will build many short symbols and a +few long symbols. At the time you are reading a symbol you don't know +how long it is. One traditional method is to read a symbol into a +buffer, realloc()ating the buffer every time you try to read a symbol +that is longer than the buffer. This is beaut, but you still will +want to copy the symbol from the buffer to a more permanent +symbol-table entry say about half the time. + +With obstacks, you can work differently. Use one obstack for all symbol +names. As you read a symbol, grow the name in the obstack gradually. +When the name is complete, finalize it. Then, if the symbol exists already, +free the newly read name. + +The way we do this is to take a large chunk, allocating memory from +low addresses. When you want to build a symbol in the chunk you just +add chars above the current "high water mark" in the chunk. When you +have finished adding chars, because you got to the end of the symbol, +you know how long the chars are, and you can create a new object. +Mostly the chars will not burst over the highest address of the chunk, +because you would typically expect a chunk to be (say) 100 times as +long as an average object. + +In case that isn't clear, when we have enough chars to make up +the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) +so we just point to it where it lies. No moving of chars is +needed and this is the second win: potentially long strings need +never be explicitly shuffled. Once an object is formed, it does not +change its address during its lifetime. + +When the chars burst over a chunk boundary, we allocate a larger +chunk, and then copy the partly formed object from the end of the old +chunk to the beginning of the new larger chunk. We then carry on +accreting characters to the end of the object as we normally would. + +A special macro is provided to add a single char at a time to a +growing object. This allows the use of register variables, which +break the ordinary 'growth' macro. + +Summary: + We allocate large chunks. + We carve out one object at a time from the current chunk. + Once carved, an object never moves. + We are free to append data of any size to the currently + growing object. + Exactly one object is growing in an obstack at any one time. + You can run one obstack per control block. + You may have as many control blocks as you dare. + Because of the way we do it, you can `unwind' an obstack + back to a previous state. (You may remove objects much + as you would with a stack.) +*/ + + +/* Don't do the contents of this file more than once. */ + +#ifndef _OBSTACK_H +#define _OBSTACK_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* We use subtraction of (char *) 0 instead of casting to int + because on word-addressable machines a simple cast to int + may ignore the byte-within-word field of the pointer. */ + +#ifndef __PTR_TO_INT +# define __PTR_TO_INT(P) ((P) - (char *) 0) +#endif + +#ifndef __INT_TO_PTR +# define __INT_TO_PTR(P) ((P) + (char *) 0) +#endif + +/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is + defined, as with GNU C, use that; that way we don't pollute the + namespace with <stddef.h>'s symbols. Otherwise, if <stddef.h> is + available, include it and use ptrdiff_t. In traditional C, long is + the best that we can do. */ + +#ifdef __PTRDIFF_TYPE__ +# define PTR_INT_TYPE __PTRDIFF_TYPE__ +#else +# ifdef HAVE_STDDEF_H +# include <stddef.h> +# define PTR_INT_TYPE ptrdiff_t +# else +# define PTR_INT_TYPE long +# endif +#endif + +#if defined _LIBC || defined HAVE_STRING_H +# include <string.h> +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +#else +# ifdef memcpy +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +# else +# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N)) +# endif +#endif + +struct _obstack_chunk /* Lives at front of each chunk. */ +{ + char *limit; /* 1 past end of this chunk */ + struct _obstack_chunk *prev; /* address of prior chunk or NULL */ + char contents[4]; /* objects begin here */ +}; + +struct obstack /* control current object in current chunk */ +{ + long chunk_size; /* preferred size to allocate chunks in */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ + PTR_INT_TYPE temp; /* Temporary for some macros. */ + int alignment_mask; /* Mask of alignment for each object. */ +#if defined __STDC__ && __STDC__ + /* These prototypes vary based on `use_extra_arg', and we use + casts to the prototypeless function type in all assignments, + but having prototypes here quiets -Wstrict-prototypes. */ + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#else + struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ + void (*freefun) (); /* User's function to free a chunk. */ + char *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#endif + unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object:1;/* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed:1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ +}; + +/* Declare the external functions we use; they are in obstack.c. */ + +#if defined __STDC__ && __STDC__ +extern void _obstack_newchunk (struct obstack *, int); +extern void _obstack_free (struct obstack *, void *); +extern int _obstack_begin (struct obstack *, int, int, + void *(*) (long), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, int, int, + void *(*) (void *, long), + void (*) (void *, void *), void *); +extern int _obstack_memory_used (struct obstack *); +#else +extern void _obstack_newchunk (); +extern void _obstack_free (); +extern int _obstack_begin (); +extern int _obstack_begin_1 (); +extern int _obstack_memory_used (); +#endif + +#if defined __STDC__ && __STDC__ + +/* Do the function-declarations after the structs + but before defining the macros. */ + +void obstack_init (struct obstack *obstack); + +void * obstack_alloc (struct obstack *obstack, int size); + +void * obstack_copy (struct obstack *obstack, void *address, int size); +void * obstack_copy0 (struct obstack *obstack, void *address, int size); + +void obstack_free (struct obstack *obstack, void *block); + +void obstack_blank (struct obstack *obstack, int size); + +void obstack_grow (struct obstack *obstack, void *data, int size); +void obstack_grow0 (struct obstack *obstack, void *data, int size); + +void obstack_1grow (struct obstack *obstack, int data_char); +void obstack_ptr_grow (struct obstack *obstack, void *data); +void obstack_int_grow (struct obstack *obstack, int data); + +void * obstack_finish (struct obstack *obstack); + +int obstack_object_size (struct obstack *obstack); + +int obstack_room (struct obstack *obstack); +void obstack_make_room (struct obstack *obstack, int size); +void obstack_1grow_fast (struct obstack *obstack, int data_char); +void obstack_ptr_grow_fast (struct obstack *obstack, void *data); +void obstack_int_grow_fast (struct obstack *obstack, int data); +void obstack_blank_fast (struct obstack *obstack, int size); + +void * obstack_base (struct obstack *obstack); +void * obstack_next_free (struct obstack *obstack); +int obstack_alignment_mask (struct obstack *obstack); +int obstack_chunk_size (struct obstack *obstack); +int obstack_memory_used (struct obstack *obstack); + +#endif /* __STDC__ */ + +/* Non-ANSI C cannot really support alternative functions for these macros, + so we do not declare them. */ + +/* Error handler called when `obstack_chunk_alloc' failed to allocate + more memory. This can be set to a user defined function. The + default action is to print a message and abort. */ +#if defined __STDC__ && __STDC__ +extern void (*obstack_alloc_failed_handler) (void); +#else +extern void (*obstack_alloc_failed_handler) (); +#endif + +/* Exit value used when `print_and_abort' is used. */ +extern int obstack_exit_failure; + +/* Pointer to beginning of object being allocated or to be allocated next. + Note that this might not be the final address of the object + because a new chunk might be needed to hold the final size. */ + +#define obstack_base(h) ((h)->object_base) + +/* Size for allocating ordinary chunks. */ + +#define obstack_chunk_size(h) ((h)->chunk_size) + +/* Pointer to next byte not yet allocated in current chunk. */ + +#define obstack_next_free(h) ((h)->next_free) + +/* Mask specifying low bits that should be clear in address of an object. */ + +#define obstack_alignment_mask(h) ((h)->alignment_mask) + +/* To prevent prototype warnings provide complete argument list in + standard C version. */ +#if defined __STDC__ && __STDC__ + +# define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) + +# define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) + +# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun)) + +# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) (void *, long)) (chunkfun), \ + (void (*) (void *, void *)) (freefun), (arg)) + +# define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) + +# define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) + +#else + +# define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) + +# define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) + +# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) ()) (chunkfun), (void (*) ()) (freefun)) + +# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg)) + +# define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun)) + +# define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)()) (newfreefun)) + +#endif + +#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) + +#define obstack_blank_fast(h,n) ((h)->next_free += (n)) + +#define obstack_memory_used(h) _obstack_memory_used (h) + +#if defined __GNUC__ && defined __STDC__ && __STDC__ +/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ +# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) +# define __extension__ +# endif + +/* For GNU C, if not -traditional, + we can define these macros to compute all args only once + without using a global variable. + Also, we can avoid using the `temp' slot, to make faster code. */ + +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (unsigned) (__o->next_free - __o->object_base); }) + +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (unsigned) (__o->chunk_limit - __o->next_free); }) + +# define obstack_make_room(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) + +# define obstack_grow(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len > __o->chunk_limit) \ + _obstack_newchunk (__o, __len); \ + _obstack_memcpy (__o->next_free, (char *) (where), __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, __len + 1); \ + _obstack_memcpy (__o->next_free, (char *) (where), __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, 1); \ + *(__o->next_free)++ = (datum); \ + (void) 0; }) + +/* These assume that the obstack alignment is good enough for pointers or ints, + and that the data added so far to the current object + shares that much alignment. */ + +# define obstack_ptr_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (void *)); \ + *((void **)__o->next_free) = ((void *)datum); \ + __o->next_free += sizeof (void *); \ + (void) 0; }) + +# define obstack_int_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (int) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (int)); \ + *((int *)__o->next_free)++ = ((int)datum); \ + (void) 0; }) + +# define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr) +# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) + +# define obstack_blank(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_alloc(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a name conflict + when obstack_blank is called. */ +# define obstack_finish(OBSTACK) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + void *value; \ + value = (void *) __o1->object_base; \ + if (__o1->next_free == value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\ + & ~ (__o1->alignment_mask)); \ + if (__o1->next_free - (char *)__o1->chunk \ + > __o1->chunk_limit - (char *)__o1->chunk) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + value; }) + +# define obstack_free(OBSTACK, OBJ) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + void *__obj = (OBJ); \ + if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ + __o->next_free = __o->object_base = __obj; \ + else (obstack_free) (__o, __obj); }) + +#else /* not __GNUC__ or not __STDC__ */ + +# define obstack_object_size(h) \ + (unsigned) ((h)->next_free - (h)->object_base) + +# define obstack_room(h) \ + (unsigned) ((h)->chunk_limit - (h)->next_free) + +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) + +/* Note that the call to _obstack_newchunk is enclosed in (..., 0) + so that we can avoid having void expressions + in the arms of the conditional expression. + Casting the third operand to void was tried before, + but some compilers won't accept it. */ + +# define obstack_make_room(h,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0)) + +# define obstack_grow(h,where,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ + _obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ + (h)->next_free += (h)->temp) + +# define obstack_grow0(h,where,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ + _obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ + (h)->next_free += (h)->temp, \ + *((h)->next_free)++ = 0) + +# define obstack_1grow(h,datum) \ +( (((h)->next_free + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + (*((h)->next_free)++ = (datum))) + +# define obstack_ptr_grow(h,datum) \ +( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum))) + +# define obstack_int_grow(h,datum) \ +( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum))) + +# define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr) +# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) + +# define obstack_blank(h,length) \ +( (h)->temp = (length), \ + (((h)->chunk_limit - (h)->next_free < (h)->temp) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ + ((h)->next_free += (h)->temp)) + +# define obstack_alloc(h,length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h,where,length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h,where,length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ +( ((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp = __PTR_TO_INT ((h)->object_base), \ + (h)->next_free \ + = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ + & ~ ((h)->alignment_mask)), \ + (((h)->next_free - (char *) (h)->chunk \ + > (h)->chunk_limit - (char *) (h)->chunk) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + __INT_TO_PTR ((h)->temp)) + +# if defined __STDC__ && __STDC__ +# define obstack_free(h,obj) \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ + (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp + (char *) (h)->chunk) \ + : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) +# else +# define obstack_free(h,obj) \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ + (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp + (char *) (h)->chunk) \ + : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0))) +# endif + +#endif /* not __GNUC__ or not __STDC__ */ + +#ifdef __cplusplus +} /* C++ */ +#endif + +#endif /* obstack.h */ diff --git a/include/splay-tree.h b/include/splay-tree.h new file mode 100755 index 0000000..1aaaf09 --- /dev/null +++ b/include/splay-tree.h @@ -0,0 +1,112 @@ +/* A splay-tree datatype. + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Mark Mitchell (mark@markmitchell.com). + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* For an easily readable description of splay-trees, see: + + Lewis, Harry R. and Denenberg, Larry. Data Structures and Their + Algorithms. Harper-Collins, Inc. 1991. + + The major feature of splay trees is that all basic tree operations + are amortized O(log n) time for a tree with n nodes. */ + +#ifndef _SPLAY_TREE_H +#define _SPLAY_TREE_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <ansidecl.h> + +/* Use typedefs for the key and data types to facilitate changing + these types, if necessary. These types should be sufficiently wide + that any pointer or scalar can be cast to these types, and then + cast back, without loss of precision. */ +typedef unsigned long int splay_tree_key; +typedef unsigned long int splay_tree_value; + +/* Forward declaration for a node in the tree. */ +typedef struct splay_tree_node *splay_tree_node; + +/* The type of a function which compares two splay-tree keys. The + function should return values as for qsort. */ +typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key)); + +/* The type of a function used to deallocate any resources associated + with the key. */ +typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key)); + +/* The type of a function used to deallocate any resources associated + with the value. */ +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 nodes in the splay tree. */ +struct splay_tree_node +{ + /* The key. */ + splay_tree_key key; + + /* The value. */ + splay_tree_value value; + + /* The left and right children, respectively. */ + splay_tree_node left; + splay_tree_node right; +}; + +/* The splay tree itself. */ +typedef struct splay_tree +{ + /* The root of the tree. */ + splay_tree_node root; + + /* The comparision function. */ + splay_tree_compare_fn comp; + + /* The deallocate-key function. NULL if no cleanup is necessary. */ + splay_tree_delete_key_fn delete_key; + + /* The deallocate-value function. NULL if no cleanup is necessary. */ + splay_tree_delete_value_fn delete_value; +} *splay_tree; + +extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn, + splay_tree_delete_key_fn, + splay_tree_delete_value_fn)); +extern void splay_tree_delete PARAMS((splay_tree)); +extern void splay_tree_insert PARAMS((splay_tree, + splay_tree_key, + splay_tree_value)); +extern splay_tree_node splay_tree_lookup + PARAMS((splay_tree, + splay_tree_key)); +extern int splay_tree_foreach PARAMS((splay_tree, + splay_tree_foreach_fn, + void*)); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _SPLAY_TREE_H */ diff --git a/libiberty/COPYING.LIB b/libiberty/COPYING.LIB new file mode 100755 index 0000000..161a3d1 --- /dev/null +++ b/libiberty/COPYING.LIB @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog new file mode 100755 index 0000000..75307b0 --- /dev/null +++ b/libiberty/ChangeLog @@ -0,0 +1,3132 @@ + +1999-04-01 Jim Blandy <jimb@zwingli.cygnus.com> + + * cplus-dem.c: Attempt to handle overflows in counts with some + semblance of grace. + (consume_count): Detect overflows. Return -1 to indicate errors, + instead of zero. + (demangle_template_value_parm, demangle_template): Handle change + to consume_count's return convention. + +1999-03-16 Stan Shebs <shebs@andros.cygnus.com> + + From Art Haas <ahaas@neosoft.com>: + * cplus-dem.c (demangle_prefix): Don't grab all the '__' strings + when doing arm or hp style. + (demangle_nested_args): Decr forgetting_types field when done. + +Wed Jan 13 07:26:44 1999 H.J. Lu (hjl@gnu.org) + + * cplus-dem.c (mop_up): Set work->previous_argument to NULL after + freeing it. + +Tue Jan 5 15:58:29 1999 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * Makefile.in (CFILES): fix typo, splay-tree.c instead of + splay-tree.o. + +1999-01-04 Jason Molenda (jsm@bugshack.cygnus.com) + + * configure.in: Require autoconf 2.12.1 or higher. + +1998-12-30 Michael Meissner <meissner@cygnus.com> + + * random.c (NULL): Don't redefine NULL if it is already defined. + +Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * argv.c (buildargv): Cast the result of alloca in assignment. + + * choose-temp.c: Include stdlib.h. + + * cplus-dem.c (demangle_arm_pt): Remove unused prototype. + (snarf_numeric_literal): Constify first parameter. + (code_for_qualifier): Avoid a gcc extension, make the parameter an + int, not a char. + (demangle_qualifier): Likewise. + (demangle_signature): Cast the argument of a ctype function to + unsigned char. + (arm_pt): Add parens around assignment used as truth value. + (demangle_arm_hp_template): Constify variable `args'. + (do_hpacc_template_const_value): Cast the argument of a ctype + function to unsigned char. + (do_hpacc_template_literal): Remove unused variable `i'. + (snarf_numeric_literal): Constify parameter `args'. + Cast the argument of a ctype function to unsigned char. + + * floatformat.c (floatformat_to_double): Add explicit braces to + avoid ambiguous `else'. + + * fnmatch.c (fnmatch): Change type of variables `c', `c1', + `cstart' and `cend' to unsigned char. Cast the argument of macro + `FOLD', which uses ctype functions, to unsigned char. + + * objalloc.c (free): Add prototype. + +Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson <hp@axis.se> + + * Makefile.in (CFILES): Fix typo: splay-tree.c, not splay-tree.o + +Fri Dec 18 17:50:18 1998 David Taylor <taylor@texas.cygnus.com> + + * cplus-dem.c (demangle_arm_pt): remove declaration -- function + doesn't exist. + (do_hpacc_template_literal): remove unused variable `i'. + +Fri Dec 18 16:11:43 EST 1998 Andrew MacLeod <amacleod@cygnus.com> + + * cplus-dem.c (demangle_fund_type): Process CV and u codes before + bumping the pointer we read from. Also prepend these codes, + as we do in other places. + +1998-12-18 Nick Clifton <nickc@cygnus.com> + + * cplus-dem.c (demangle_arm_hp_template): Make variable 'args' be + 'const char *' in order to match its usage when calling siblings. + (snarf_numeric_literal): Make first arg 'const char **' in order + to match usage. + + * choose-temp.c: Don't check IN_GCC anymore. + + * floatformat.c (floatformat_from_double): Use `const', not `CONST'. + * memchr.c (memchr): Likewise. + * memcpy.c (memcpy): Likewise. + * memmove.c (memmove): Likewise. + + * mkstemp.c: Don't check IN_GCC anymore. + * pexecute.c: Likewise. + * splay-tree.c: Likewise. + + * strchr.c (strchr): Use `const', not `CONST'. + * strrchr.c (strrchr): Likewise. + * strtol.c (strtol): Likewise. + * strtoul.c (strtoul): Likewise. + +Fri Dec 4 13:51:04 1998 David Taylor <taylor@texas.cygnus.com> + Elena Zannoni <ezannoni@cygnus.com> + Stan Shebs <shebs@cygnus.com> + Edith Epstein <eepstein@cygnus.com> + Andres MacLeod <amacleod@cygnus.com> + Satish Pai <pai@apollo.hp.com> + + * HP aCC demangling support. + * cplus-dem.c + (main): Remove default to HP style demangling, set to EDG + demangling correctly when -edg specified; set the demangling style + when user specifies 'edg'. Set strip_underscore to + prepends_underscore, if not HPUXHPPA. Set + current_demangling_style to hp_demangling if HPUXHPPA. Set + current demangling style correctly if the switch is hp. Read + label correctly also in the HP style case. + (work_stuff): add temp_start field; add field for volatile member + function. + (arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP + style for this case is the same as ARM. + (demangle_args): handle EDG_DEMANGLING style; support HP style. + (demangle_arm_hp_template): new function. (It was + demangle_arm_pt.); check and set value of temp_start field in + multiple places. Also, when ceching for end of template args, + check to see if at end of static member of template class. + (demangle_class): new local variable : save_class_name_end Don't + include template args in string defining class. + (demangle_class_name): use demangel_arm_hp_template. + (demangle_function_name): handle case where demangling style is + HP_DEMANGLING and currently point at an 'X' in the mangled name. + Handle EDG_DEMANGLING style. Handle constructor and destructor + ops for HP style. + (demangle_prefix): handle EDG_DEMANGLING and ARM_DEMANGLING + styles. global destructor and constructor for HP style are same + as for ARM style. Same for local variables. + (demangle_qualified): handle EDG_DEMANGLING style. + (demangle_signature): add case for volatile member function. For + cases '1' - '9' : initialize the temp_start field to -1 and handle + the EDG_DEMANGLING style. for case 'F' : handle EDG_DEMANGLING + and AUTO_DEMANGLING styles. If expecting a function and managed + to demangle the funct args, then handle the LUCID_DEMANGLING, + ARM_DEMANGLING, and EDG_DEMANGLING styles. Add case for local + class name after "Lnnn_ in HP style case. HP style too needs to + forget types. _nnn is OK for HP style, so don't report failure. + (do_hpacc_template_const_value): new function. Handle template's + value param for HP/aCC. + (do_hpacc_template_literal): new function. Handle a template's + literal parameter for HP aCC. + (recursively_demangle): new function + (snarf_numeric_literal): new function. + (usage): add 'edg' to the list of demangling styles; add hp switch + to message. + +Sat Nov 28 17:25:22 1998 Christopher Faylor <cgf@cygnus.com> + + * pexecute.c: Remove obsolete ifdefed cygwin code. + +Fri Nov 27 13:26:06 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * choose-temp.c: Always include libiberty.h. Avoid redundancies. + * cplus-dem.c: Likewise. Conform to libiberty.h. + * pexecute.c: Likewise. + * splay-tree.c: Likewise. + +1998-11-25 Mike Stump <mrs@wrs.com> + + * Makefile.in (splay-tree.o): Add config.h dependency. + +Mon Nov 23 16:59:49 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in: Use AC_PREREQ(2.12.1). + +1998-11-16 Benjamin Kosnik <bkoz@haight.constant.com> + + * cplus-dem.c (demangle_fund_type): Add demangling for C9x types. + +Thu Nov 19 22:15:50 1998 Jeffrey A Law (law@cygnus.com) + + * mpw.c (mpw_access): Add missing parens. + +Thu Nov 19 12:59:21 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in: Call AC_HEADER_SYS_WAIT. + + * pexecute.c: Include sys/wait.h when !IN_GCC. + +Thu Nov 19 14:38:20 1998 Geoffrey Noer <noer@cygnus.com> + + * pexecute.c: revert back to checking old Cygwin + preprocessor symbol until some time has passed. + +Wed Nov 18 08:52:26 1998 Christopher Faylor <cgf@cygnus.com> + + * pexecute.c: Reorganize WIN32 case to accomodate Cygwin + since it will now support similar constructs. + +Fri Nov 13 19:18:05 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in: Check for calloc. + + * calloc.c: New file. + + * xmalloc.c (xcalloc): New function. + +Fri Nov 13 08:51:46 EST 1998 Andrew MacLeod <amacleod@cygnus.com> + + *cplus-dem.c (demangle_prefix): Use the last "__" + in the mangled name when looking for the signature. This allows + template names to begin with "__". + +1998-11-08 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c (type_kind_t): Add tk_reference. + (demangle_template_value_parm): Handle it. + (do_type): Use it for references, instead of tk_pointer. + + * cplus-dem.c (demangle_template_value_parm): Use cplus_demangle, + not internal_cplus_demangle. + +Sat Nov 7 16:02:10 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * choose-temp.c: Don't include gansidecl.h. + * mkstemp.c: Likewise. + * pexecute.c: Likewise. + +Mon Nov 2 15:05:33 1998 Geoffrey Noer <noer@cygnus.com> + + * configure.in: detect cygwin* instead of cygwin32* + * configure: regenerate + +Mon Nov 2 10:22:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * pexecute.c: Check HAVE_CONFIG_H, not IN_GCC, when determining + whether to include config.h. Possibly include unistd.h in the + !IN_GCC case. Define VFORK_STRING as a printable function call + for error messages (either "vfork" or "fork".) If HAVE_VFORK_H is + defined, include vfork.h. If VMS is defined, define vfork() + appropriately. Remove vfork check on USG, we're using autoconf. + (pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking + locally what string to use. + +1998-10-26 Mark Mitchell <mark@markmitchell.com> + + * splay-tree.c: Tweak include directives to make sure declarations of + xmalloc and free are available. + +1998-10-25 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c (gnu_special): Fix handling of virtual tables in + anonymous namespaces. + +1998-10-23 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c (work_stuff): Replace const_type and volatile_type + with type_quals. + (TYPE_UNQUALIFIED): New macro. + (TYPE_QUAL_CONST): Likewise. + (TYPE_QUAL_VOLATILE): Likewise. + (TYPE_QUAL_RESTRICT): Likewise. + (code_for_qualifier): New function. + (qualifier_string): Likewise. + (demangle_qualifier): Likewise. + (internal_cplus_demangle): Use them. + (demangle_signature): Likewise. + (demangle_template_value_parm): Likewise. + (do_type): Likewise. + (demangle_fund_type)): Likewise. + +Thu Oct 22 19:58:43 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * splay-tree.c (splay_tree_foreach_helper): Make definition static + to match prototype. + +1998-10-21 Mark Mitchell <mark@markmitchell.com> + + * splay-tree.c: New file. + * Makefile.in (CFILES): Add it. + (REQUIRED_OFILES): Likewise. + (splay-tree.o): Add dependencies. + +Tue Oct 20 12:29:02 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> + + * cplus-dem.c (demangle_qualified): Fix off-by-one when checking + range of 'K' index. + +Thu Oct 15 18:51:12 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * choose-temp.c: Prototype mkstemps() when IN_GCC. + + * cplus-dem.c (consume_count): Cast argument of ctype macro to + `unsigned char'. + (cplus_demangle_opname): Cast the result of `strlen' to (int) when + comparing against one. + (cplus_mangle_opname): Likewise. + (demangle_integral_value): Cast argument of ctype macro to + `unsigned char'. + (demangle_template_value_parm): Likewise. + (demangle_template): Initialize variable `bindex'. Cast the + result of `strlen' to (int) when comparing against one. Remove + unused variable `start_of_value_parm'. + (demangle_class_name): Cast the result of `strlen' to (int) when + comparing against one. + (demangle_prefix): Cast argument of ctype macro to `unsigned char'. + (gnu_special): Likewise. Cast the result of `strlen' to (int) + when comparing against one. + (demangle_qualified): Cast argument of ctype macro to `unsigned char'. + (get_count): Likewise. + (do_type): Likewise. Cast the result of `strlen' to (int) when + comparing against one. + (demangle_fund_type): Cast argument of ctype macro to `unsigned char'. + (demangle_function_name): Cast the result of `strlen' to (int) + when comparing against one. + + * mkstemp.c (mkstemps): Cast variable `len' to (int) when + comparing against one. + +Tue Oct 13 23:51:51 1998 Jeffrey A Law (law@cygnus.com) + + * mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h + * configure.in (AC_CHECK_HEADERS): Check for sys/time.h too. + * config.in, configure: Rebuilt. + + * getopt.c: Check HAVE_STRINGS_H before including strings.h. + * configure.in (AC_CHECK_HEADERS): Check for strings.h too. + * config.in, configure: Rebuilt. + +Mon Oct 12 19:15:59 1998 Geoffrey Noer <noer@cygnus.com> + + * configure.in: in comment, call AC_EXEEXT instead of AM_EXEEXT + +Sun Oct 11 17:36:06 1998 Michael Tiemann <tiemann@holodeck.cygnus.com> + + * Makefile.in (cplus-dem.o, obstack.o): Depend upon config.h. + +Thu Oct 8 23:42:08 1998 Jeffrey A Law (law@cygnus.com) + + * Merge egcs & devo libiberty. + +1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de> + + * cplus-dem.c (demangle_arm_pt): Demangle anonymous namespaces. + +Mon Sep 7 23:29:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * mkstemp.c: Include config.h even when not IN_GCC. Wrap header + inclusions inside HAVE_*_H macros. Include ansidecl.h when not + IN_GCC. + + * vasprintf.c: Include stdarg.h/varargs.h first. + + * vprintf.c: Likewise. + +Sat Sep 5 03:24:49 1998 Jeffrey A Law (law@cygnus.com) + + * pexecute.c: Updates from gcc. Copy in gcc has been removed. This + is the canonical copy. Define ISSPACE if !IN_GCC. + * alloca.c, vfprintf.c, choose-temp.c, mkstemp.c, getopt.c: Similarly. + * getopt1.c, obstack.c: Similarly. + * Makefile.in: Build mkstemp.o + +Tue Sep 1 23:12:47 1998 Christopher Faylor <cgf@cygnus.com> + + * configure.in: Include asprintf in list of functions known not + to be in newlib. + * configure: Rebuild. + +Wed Aug 19 14:05:01 1998 Mumit Khan <khan@xraylith.wisc.edu> + + * cplus-dem.c (work_stuff): Add dllimported. + (demangled_prefix): Mark symbols imported from PE DLL. + (internal_cplus_demangled): Handle. + +1998-08-17 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (do_type): Fix simple array handling. If we fail, + stay failed. + +Mon Aug 17 10:40:34 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c: Include config.h if it exists. Also, only + prototype malloc/realloc if we can't get stdlib.h. + +Sat Aug 15 16:15:01 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Switch back to checking --with-target-subdir when + deciding whether to check for newlib, undoing part of July 15 + change. + * configure: Rebuild. + +Thu Aug 13 16:47:38 1998 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c (type_kind_t): New type. + (demangle_template_value_parm): Add type_kind_t parameter. Rely + on this paramter, rather than demangling the type again. + (demangle_integral_value): Pass tk_integral. + (demangle_template_: Pass the value returned from do_type. + (do_type): Return a type_kind_t. Pass tk_integral to + demangle_template_value_parm for array bounds. + (demangle_fund_type): Likewise. + + Also incorporate from GCC version: + + Tue Jul 21 13:28:19 1998 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays. + +Thu Aug 13 16:47:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (demangle_nested_args): Make function definition + static to match the prototype. + +Tue Jul 28 11:33:09 1998 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c (type_kind_t): New type. + (demangle_template_value_parm): Add type_kind_t parameter. Rely + on this paramter, rather than demangling the type again. + (demangle_integral_value): Pass tk_integral. + (demangle_template_: Pass the value returned from do_type. + (do_type): Return a type_kind_t. Pass tk_integral to + demangle_template_value_parm for array bounds. + (demangle_fund_type): Likewise. + + Also incorporate from GCC version: + + Tue Jul 21 13:28:19 1998 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays. + +Mon Jul 27 12:16:08 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (ALLOCA): New variable. + ($(TARGETLIB)): Add $(ALLOCA) to library. + (needed-list): Add $(ALLOCA). + ($(ALLOCA)): Depend upon stamp-picdir. + +Sun Jul 19 08:23:17 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (demangle_nested_args): Make function definition + static to match the prototype. + +Wed Jul 15 00:12:58 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Check --with-cross-host rather than + --with-target-subdir when deciding whether build uses a cross + compiler, and when deciding where to install the library. + * configure: Rebuild. + +Sun Jul 12 01:27:05 1998 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (demangle_nested_args): Return a value. + +Sat Jul 11 16:19:48 1998 Mark Mitchell <mark@markmitchell.com> + + * cplus-dem.c (string): Move definition before work_stuff. + (work_stuff): Add volatile_type, forgetting_types, + previous_argument, and nrepeats fields. + (SCOPE_STRING): New macro. + (demangle_template): Add `remember' parameter. Add comment. + Register the `B' code type here, if remembering. Tidy. Fix crash + on NULL tmpl_argvec. Be consistent with use of tname/trawname. + (demangle_nested_args): New function. + (internal_cplus_demangle): Handle volatile-qualified member + functions. + (mop_up): Delete the previous_argument string if present. + (demangle_signature): Tidy. Handle volatile-qualified member + functions. Handle back-references using the `B' code. Use extra + parameter to demangle_template and SCOPE_STRING where appropriate. + (demangle_template_value_parm): Fix thinko; 'B' is not an integral + code. + (demangle_class): Use SCOPE_STRING. + (gnu_special): Pass additional argument to demangle_template. + Use SCOPE_STRING. + (demangle_qualified): Save qualified types for later + back-references. Handle constructors and destructors for template + types correctly. + (do_type): Tidy. Use SCOPE_STRING. Pass extra argument to + demangle_template. Use demangled_nested_args. Don't remember + qualified types here; that's now done in demangle_qualified. + Similarly for templates. + (do_arg): Improve commment. Handle 'n' repeat code. + (remember_type): Check forgetting_types. + (demangle_args): Deal with 'n' repeat codes. Tidy. + +Thu Jul 2 16:26:24 1998 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Only use mh-fbsd21 on *-*-freebsd2.2.[012], not on + *-*-freebsd2.2.*. From Dmitrij Tejblum <tejblum@arc.hq.cti.ru>. + +Mon Jun 15 16:29:01 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in (setobjs): Correct quoting error in cygwin32 case. + From Chris Faylor <cgf@cygnus.com>. + +Mon Jun 1 13:47:55 1998 Jason Molenda (crash@bugshack.cygnus.com) + + * obstack.c: Update to latest FSF version. + +Mon Jun 1 14:17:36 1998 Mike Stump <mrs@wrs.com> + + * Makefile.in: Add a dependency on stamp-picdir for the + objects, so that we can do a parallel build. + +Sat May 30 22:17:13 1998 Mumit Khan <khan@xraylith.wisc.edu> + + * configure.in (checkfuncs): Add missing "'". + +Fri May 29 12:40:41 1998 Jason Molenda (crash@bugshack.cygnus.com) + + * obstack.c (_obstack_memory_used): Elide this function if we're + on a system with GNU libc. + +Tue May 26 18:28:43 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (distclean): Remove config.log. + +Tue May 26 15:01:52 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * Makefile.in (distclean): Don't remove alloca-conf.h. + +Fri May 22 01:38:07 1998 Hans-Peter Nilsson <hp@axis.se> + + * cplus-dem.c (MBUF_SIZE): Bumped from 512 to 32767. + +1998-05-21 Mark Mitchell <mmitchell@usa.net> + + * cplus-dem.c (do_type): Handle volatile qualification. + +1998-05-21 Manfred Hollstein <manfred@s-direktnet.de> + + * configure.in: Check for unistd.h as well. + * configure: Rebuild. + * config.in: Rebuild. + * getpagesize.c (GNU_OUR_PAGESIZE): Use sysconf only if _SC_PAGESIZE + is defined in unistd.h. Reformat conditional block for easier reading. + + * config.table (shared): Default to no if ${enable_shared} + is unset or empty; this logic is used by the toplevel + configure scripts, too. + +Sat May 16 14:01:26 1998 Jeffrey A Law (law@cygnus.com) + + * config.table: Add line to set enable_shared in the Makefile + as needed. + +Wed May 13 14:24:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cplus-dem.c (squangle_mop_up): Change return type to void. + (internal_cplus_demangle): Remove unused parameter `options'. + All callers changed. + (cplus_demangle_opname): Remove function wide variable `int i' and + replace with `size_t i' at each location where it is used. + (cplus_mangle_opname): change type of `i' from int to size_t. + +Wed May 13 13:39:38 1998 Ian Lance Taylor <ian@cygnus.com> + + * alloca-conf.h: Include config.h. Check HAVE_ALLOCA_H rather + than sparc or sun. + * Makefile.in (argv.o): Depend upon config.h and alloca-conf.h. + +Fri May 8 00:23:51 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Set libiberty_topdir correctly when srcdir is + "." and with_target_subdir is not set. + * configure: Rebuild. + +Thu May 7 13:01:44 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Add *-*-mingw32* case. + * configure: Rebuild. + +Wed May 6 11:33:51 1998 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Never use a PIC file for *-*-cygwin32*. + + * Makefile.in (config.status): Depend upon config.table. + + * configure.in: On a cygwin32 host, always compile random, and + don't test for sys_siglist, strsignal, or psignal. + * configure: Rebuild. + + * clock.c: Check HAVE_SYS_PARAM_H rather than NO_SYS_PARAM_H. + * getcwd.c: Likewise. + * getpagesize.c: Likewise. + * getruntime.c: Likewise. + +Tue May 5 18:08:32 1998 Ian Lance Taylor <ian@cygnus.com> + + Use autoconf tests rather than the old dummy.c test: + * configure.in: Add AC_ARG_WITH calls for --with-target-subdir and + --with-newlib. Add AC_CONFIG_HEADER. Use AC_REPLACE_FUNCS for + most functions. Add special cases to handle newlib and VxWorks. + Remove target_makefile_frag. Create stamp-h in AC_OUTPUT if + CONFIG_HEADERS is set. Only call config-ml.in in AC_OUTPUT if + CONFIG_FILES is set; set ac_file before calling it. + * config.table (arm-*-riscix*, *-*-cygwin32): Remove. + (*-*-hpux*, *-*-hiux*, *-*-irix4*, *-*-solaris2*): Remove. + (*-*-sysv4*, *-*-go32, *-*-vxworks5*, *-*-vxworks): Remove + (i[3456]-*-mingw32*): Remove. + * Makefile.in (ERRORS_CC, CONFIG_H, NEEDED_LIST): Remove. + (LIBOBJS): New variable. + (HOST_OFILES, DO_ALSO, STAGESTUFF): Remove. + (all): Depend upon needed-list. Don't check RULE1. + (@target_makefile_frag@): Remove. + (COMPILE.c): Include @DEFS@. + (HFILES): Add alloca-conf.h. + (REQUIRED_OFILES): Remove basename.o. + ($(TARGETLIB)): New target. + (stamp-needed, lneeded-list, needed.awk, stamp-config): Remove. + (lconfig.h, needed2.awk, dummy.o, errors): Remove. + (needed-list, config.h): Rewrite. + (RULE1, $(RULE1), RULE2, $(RULE2)): Remove. + (.always.): Remove. + (Makefile): Set CONFIG_FILES and CONFIG_HEADERS. + (stamp-h): New target. + (atexit.o, clock.o, getcwd.o, getpagesize.o): New targets. + (basename.o): Don't depend upon config.h. + (getruntime.o): Depend upon config.h. + * atexit.c: Include config.h. Check HAVE_ON_EXIT rather than + NEED_on_exit. + * basename.c: Don't include config.h. Don't check NEED_basename. + * clock.c: Include config.h. + * getcwd.c: Likewise. + * getpagesize.c: Likewise. + * getruntime.c: Likewise. Fix checks which set HAVE_GETRUSAGE and + HAVE_TIMES. + * strerror.c: Change uses of NEED_sys_errlist to + HAVE_SYS_ERRLIST. Likewise for NEED_strerror and HAVE_STRERROR. + * strsignal.c: Likewise for NEED_sys_siglist and HAVE_SYS_SIGLIST, + and for NEED_strsignal and HAVE_STRSIGNAL and for NEED_psignal and + HAVE_PSIGNAL. + * acconfig.h: New file. + * dummy.c: Remove. + * functions.def: Remove. + * config/mh-cxux7 (HDEFINES): Remove -DHAVE_SYSCONF. + * config/mh-windows (HDEFINES): Remove. + * config/mh-cygwin32: Remove. + * config/mh-go32: Remove. + * config/mh-irix4: Remove. + * config/mh-riscix: Remove. + * config/mh-sysv4: Remove. + * config/mt-mingw32: Remove. + * config/mt-vxworks5: Remove. + * config.in: New file, generated using autoheader. + * configure: Rebuild. + +Mon May 4 13:00:28 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Rewrite to use autoconf. + * configure: Generate using autoconf. + * config/mh-a68bsd: Remove. + * config/mh-apollo68: Remove. + * config/mh-hpbsd: Remove. + * config/mh-ncr3000: Remove. + * config/mh-sysv: Remove. + * config/mh-aix (RANLIB, INSTALL): Don't define. + * config/mh-cxux7 (RANLIB, INSTALL): Don't define. + * config/mh-irix4 (CC, RANLIB, INSTALL): Don't define. + * config/mh-sysv4 (RANLIB, INSTALL): Don't define. + * config.table: Change config_shell to CONFIG_SHELL, and use + libiberty_topdir to find move-if-change. + (m68k-apollo-bsd*, m68k-apollo-sysv*): Remove. + (i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove. + (*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove. + * Makefile.in (srcdir): Set to @srcdir@. + (VPATH): Likewise. + (prefix, exec_prefix, bindir, libdir): Set to autoconf variables. + (SHELL, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Likewise. + (CC, CFLAGS, RANLIB)): Likewise. + (datadir, man*dir, infodir, includedir, MAKEINFO): Remove. + (target_makefile_frag, host_makefile_frag): Add substitutions. + (INSTALL_DEST): Set to @INSTALL_DEST@. + (Makefile): Depend upon config.status. Don't depend upon + $(host_makefile_frag) or $(target_makefile_frag). + (config.status): New target. + +Sun May 3 17:58:49 1998 Ian Lance Taylor <ian@cygnus.com> + + * config/mt-sunos4: Remove. Should be handled by --with-headers + and --with-libraries options at top level. + * config.table: Never use mt-sunos4. + + * alloca-conf.h: New file, combining alloca-norm.h and + alloca-botch.h. + * alloca-norm.h: Remove. + * alloca-botch.h: Remove. + * configure.in: Set shell variables files and links to empty. + * config.table: Don't set shell variable files. + * configure.bat: Don't create alloca-conf.h. + * makefile.vms: Likewise. + * mpw-config.in: Likewise. + * vmsbuild.com: Likewise. + +Fri May 1 11:41:42 1998 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in ($(HOST_OFILES) $(REQUIRED_OFILES)): Remove old + target depending upon config.h. + (alloca.o): Add target depending upon config.h + (basename.o, choose-temp.o, fnmatch.o): Likewise. + (getopt.o, getopt1.o, pexecute.o, strerror.o): Likewise. + (strsignal.o, xstrerror.o): Likewise. + +Fri May 1 04:26:25 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> + + * cplus-dem.c (cplus_demangle_opname): Initialize work. + +Mon Apr 27 15:53:30 EDT 1998 Andrew MacLeod <amacleod@cygnus.com> + + * cplus-dem.c (demangle_qualified): Replace missing else. + +Sun Apr 26 15:38:50 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * cplus-dem.c (gnu_special): Fix off-by-one bug when checking the + length in the name of a virtual table. + +Wed Apr 22 10:53:49 EDT 1998 Andrew MacLeod <amacleod@cygnus.com> + + * cplus-dem.c (struct work stuff): Add field for B and K mangle codes. + (cplus_demangle_opname): Call mop_up_squangle. + (cplus_demangle): Initialize squangle info, then call + internal_cplus_demangle. (Most code moved there as well) + (internal_cplus_demangle): New function, performs most of what use + to be done in cplus_demangle, but is only called with this file. + (squangle_mop_up): New function to clean up B and K code data. + (mop_up): set pointers to NULL after freeing. + (demangle_signature, demangle_template, demangle_class): Add + switch elements to handle K and B codes. + (demangle_prefix, gnu_special, demangle_qualified): Add + code to handle K and B codes. + (do_type, demangle_fund_type): Handle B and K codes. + (remember_Ktype): New function to store K info. + (register_Btype, remember_Btype): New functions for B codes. + (forget_B_and_K_types): New function to destroy B and K info. + +Fri Apr 10 01:49:10 1998 Jeffrey A Law (law@cygnus.com) + + * COPYING.LIB, choose-temp.c, cplus-dem.c: Sync with egcs & gcc. + +Thu Mar 5 09:23:28 1998 Manfred Hollstein <manfred@s-direktnet.de> + + * config.table: Make locating frag files failsafe even for the + special case if configuring and building in srcdir. + +Mon Feb 23 14:33:15 1998 Ian Lance Taylor <ian@cygnus.com> + + * choose-temp.c: Fix handling of sys/file.h to work in libiberty. + +Sun Feb 22 18:03:23 1998 Jeffrey A Law (law@cygnus.com) + + * choose-temp.c: Sync with copy in gcc. + +Thu Feb 12 16:29:49 1998 Ian Lance Taylor <ian@cygnus.com> + + * getopt.c: Update to latest FSF version. + * getopt1.c: Likewise. + +Tue Feb 10 16:58:33 1998 Stan Shebs <shebs@andros.cygnus.com> + + * cplus-dem.c (gnu_special): Don't get confused by .<digits> + strings that are not actually lengths. + +Fri Feb 6 01:35:17 1998 Manfred Hollstein <manfred@s-direktnet.de> + + * Makefile.in (FLAGS_TO_PASS): Don't pass PICFLAG. + (.c.o): Check value of enable_shared, not PICFLAG. + (stamp-picdir): Dito. + +Thu Feb 5 18:48:56 1998 Geoffrey Noer <noer@cygnus.com> + + * config/mh-cygwin32: remove vasprintf.o from EXTRA_OFILES + since it gets built automatically + +Sun Feb 1 02:52:32 1998 Mike Stump <mrs@wrs.com> + + * config.table (vxworks configs): Default to VxWorks 5.x, as that is + the currently shipping OS. + +Tue Jan 27 16:08:20 1998 Pat Rankin <rankin@eql.caltech.edu> + + * vmsbuild.com [REQUIRE_OFILES]: Synchronized with Makefile.in: + Add fnmatch.o and objalloc.o; remove vasprintf.o. + [config.h]: Define NEED_strsignal. + +Mon Jan 19 12:20:01 1998 Ian Lance Taylor <ian@cygnus.com> + + * functions.def: Correct argument types for strerror and + strsignal. Reported by Alex Gutman <agutman@emc.com>. + +Sun Jan 18 15:57:28 1998 Michael Snyder <msnyder@cleaver.cygnus.com> + + * vasprintf.c (int_vasprintf): Increase buffer size for float/double + values. + +Sat Jan 17 22:28:38 1998 Mumit Khan <khan@xraylith.wisc.edu> + J.J. VanderHeijden <J.J.vanderHeijden@student.utwente.nl> + + Add mingw32 support. + * pexecute.c (pexecute): New function for mingw32. Supports pipes. + (pwait): New function for mingw32. + + * config.table (i[3456]86-*-mingw32*): Support for i386-mingw32. + * config/mt-mingw32: New file. + * xmalloc.c (first_break): Not used for mingw32. + (xmalloc_set_program_name): Don't use sbrk on mingw32. + (xmalloc): Likewise. + (xrealloc): Likewise. + +Sat Jan 17 22:28:05 1998 Jeffrey A Law (law@cygnus.com) + + * choose-temp.c: Sync with gcc version. + +Tue Jan 13 18:34:39 1998 Jim Wilson <wilson@cygnus.com> + + * Makefile.in (install_to_libdir, install_to_tooldir): Add MULTISUBDIR + to all filenames in libdir and tooldir. + (distclean): Do MULTICLEAN before deleting Makefile. + (stamp-needed, stamp-config): Add MULTISRCTOP to + pathname for move-if-change. + +Thu Dec 4 17:25:19 1997 Jeffrey A Law (law@cygnus.com) + + * strsignal.c (sys_nsig): Try NSIG and _NSIG. + +Wed Nov 19 13:37:06 1997 Michael Meissner <meissner@cygnus.com> + + * alloca-norm.h (alloca, GCC case): Don't redefine alloca if it + was already defined previously. + +Mon Nov 10 12:48:03 1997 Philippe De Muyter <phdm@macqel.be> + + * Makefile.in (INSTALL): Use ../install-sh, not install. + +Tue Oct 28 23:41:15 1997 Judy Goldberg <jodyg@idt.net> + + * Makefile.in (CFILES): Add pexecute.c. + +Wed Oct 15 19:13:48 1997 Ian Lance Taylor <ian@cygnus.com> + + * asprintf.c: Consistently use either stdarg or varargs. + +Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net> + + * cplus-dem.c (demangle_signature): Don't look for return types on + constructors. Handle member template constructors. + +Fri Oct 3 17:53:30 1997 Ian Lance Taylor <ian@cygnus.com> + + * README: Fix configuration instructions. + +Mon Sep 29 12:28:41 1997 Ian Lance Taylor <ian@cygnus.com> + + * pexecute.c: Update to current version from /gd/gnu/lib: + + Mon Sep 29 12:27:59 1997 Ian Lance Taylor <ian@cygnus.com> + + * pexecute.c: Use spawn if __CYGWIN32__. + + 1997-08-08 Paul Eggert <eggert@twinsun.com> + + * pexecute.c: Include "config.h" first, as per autoconf manual. + + Fri Jun 27 15:20:29 1997 Scott Christley <scottc@net-community.com> + + * pexecute.c (fix_argv): New function. + (pexecute): Win32 but not Cygwin32 needs its arguments fixed. + Add underscore to cwait function call. + +Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net> + + * cplus-dem.c (demangle_template): Add new parameter. Handle new + template-function mangling. + (consume_count_with_underscores): New function. + (demangle_signature): Handle new name-mangling scheme. + +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. + +Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * vasprintf.c (vasprintf): Allow for _BSD_VA_LIST_. + + * config.table: Add case for FreeBSD 2.1 and 2.2, needs mh-fbsd21. + + * config/mh-fbsd21 (EXTRA_OFILES): Force vasprintf.o + +Wed Sep 10 12:43:10 1997 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (demangle_fund_type): Change "complex" to "__complex". + +Fri Sep 5 16:34:42 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * asprintf.c (asprintf): New file. + * Makefile.in (CFILES): Add asprintf.c + * functions.def: Ditto. + +Thu Aug 28 18:53:34 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * argv.c (dupargv): New function, duplicate an argument vector. + +Tue Aug 19 20:28:45 1997 Geoffrey Noer <noer@cygnus.com> + + * config/mh-cygwin32: also build random.o + +Tue Aug 19 17:10:56 1997 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c: Add 'extern' to prepends_underscore. + +Tue Jul 22 19:05:23 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE> + + * config/mh-go32 (CC, AR, RANLIB): Don't define. + +Tue Jul 22 17:49:54 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (REQUIRED_OFILES): Add pexecute.o. + (pexecute.o): New target. + + * Makefile.in (stamp-needed): New target, replacing needed-list. + (needed-list): Just depend upon stamp-needed. + (stamp-config): New target, replacing config.h. + (config.h): Just depend upon stamp-config. + (mostlyclean): Remove stamp-*. + +Thu Jun 12 11:00:18 1997 Angela Marie Thomas (angela@cygnus.com) + + * Makefile.in (FLAGS_TO_PASS): pass INSTALL, INSTALL_PROGRAM and + INSTALL_DATA for multilibbed installs + +Tue Jun 3 13:21:05 1997 Doug Evans <dje@canuck.cygnus.com> + + Tue Dec 10 09:44:57 1996 Paul Eggert <eggert@twinsun.com> + + * choose-temp.c (choose_temp_base): Don't dump core if TMPDIR is empty. + + * choose-temp.c (try): Insist that temp dir be searchable. + + Wed Oct 23 17:36:39 1996 Doug Rupp (rupp@gnat.com) + + * choose-temp.c (choose_temp_base): On VMS, use proper syntax + for current directory. + + Sat Feb 15 19:03:48 1997 Geoffrey Noer (noer@cygnus.com) + + * pexecute.c: Remove special cases for cygwin32. + (pwait): Remove local definition of `pid'. + + Tue Nov 12 18:26:15 1996 Doug Rupp (rupp@gnat.com) + + * pexecute.c (vfork): Supply new definition for VMS. + (pwait): Use waitpid instead of wait for VMS. + +Tue May 20 14:02:20 1997 Brendan Kehoe <brendan@lisa.cygnus.com> + + * cplus-dem.c (do_type): Handle `J'. + (demangle_fund_type): Print "complex" for it. + +Wed Apr 30 12:15:45 1997 Jason Merrill <jason@yorick.cygnus.com> + + * configure.in: Don't turn on multilib here. + +Mon Apr 28 19:04:31 1997 Michael Snyder <msnyder@cleaver.cygnus.com> + + * obstack.c: move _obstack_memory_used outside of ifdef. Cannot be + elided; needed by gdb and not present in libc. + +Thu Apr 24 19:33:47 1997 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (clean): Remove tmpmulti.out. + +Tue Apr 22 10:25:15 1997 Fred Fish <fnf@cygnus.com> + + * floatformat.c (floatformat_ieee_double_littlebyte_bigword): + Add new floatformat, mainly for ARM doubles. + +Mon Apr 14 12:11:16 1997 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Use ${config_shell} with ${moveifchange}. From + Thomas Graichen <graichen@rzpd.de>. + +Fri Apr 4 03:09:24 1997 Ulrich Drepper <drepper@cygnus.com> + + * configure.in: Enable multilibing by default. + Update multilib template to read config-ml.in. + +Tue Apr 1 16:26:39 1997 Klaus Kaempf <kkaempf@progis.de> + + * makefile.vms: Add objalloc. + +Mon Mar 31 23:57:51 1997 H.J. Lu <hjl@gnu.ai.mit.edu> + + * cplus-dem.c (demangle_it): Add prototype declaration. + (usage, fatal): Likewise. + + * xexit.c (_xexit_cleanup): Add prototype. + + * strerror.c (init_error_tables): Declare. + +Fri Mar 28 11:43:20 1997 H.J. Lu <hjl@lucon.org> + + * functions.def: Add DEF of vasprintf, and DEFFUNC of strsignal. + * strsignal.c: Only define strsignal if NEED_strsignal. + * Makefile.in (REQUIRED_OFILES): Remove vasprintf.o. + * configure.in: Add NEED_strsignal to xconfig.h. Add vasprintf.o + to xneeded-list. + * config/mh-cygwin32 (HDEFINES): Add -DNEED_strsignal. + (EXTRA_OFILES): Define to vasprintf.o. + * config/mh-windows (HDEFINES): Add -DNEED_strsignal. + (EXTRA_OFILES): Add vasprintf.o. + * config/mt-vxworks5 (vxconfig.h): Define NEED_strsignal. + (vxneeded-list): Add vasprintf.o. + +Thu Mar 20 17:02:09 1997 Ian Lance Taylor <ian@cygnus.com> + + * objalloc.c: Include <stdio.h>. + +Mon Mar 17 19:23:11 1997 Ian Lance Taylor <ian@cygnus.com> + + * objalloc.c: New file. + * Makefile.in (CFILES): Add objalloc.c + (REQUIRED_OFILES): Add objalloc.o. + (objalloc.o): New target. + +Sat Mar 15 18:49:41 1997 Ian Lance Taylor <ian@cygnus.com> + + * obstack.c: Update to current FSF version. + +Fri Mar 14 14:18:47 1997 Ian Lance Taylor <ian@cygnus.com> + + * cplus-dem.c: Add prototypes for all static functions. + (mystrstr): Make static. Make arguments and result const. + (cplus_match): Remove; not used. + +Tue Mar 11 14:20:31 1997 Brendan Kehoe <brendan@lisa.cygnus.com> + + * cplus-dem.c (gnu_special): Call demangled_fund_type for other + __t* symbols. + +Tue Mar 11 15:41:21 1997 H.J. Lu <hjl@lucon.org> + + * spaces.c: Declare malloc and free properly. + * strsignal.c (init_signal_tables): Add prototype. + * xatexit.c (_xexit_cleanup): Add parameter declarations. + +Wed Feb 19 15:43:24 1997 Brendan Kehoe <brendan@lisa.cygnus.com> + + * Makefile.in (lneeded-list): If alloca.o is needed, xexit.o is + also required because of xmalloc.o. + +Fri Feb 14 13:43:38 1997 Ian Lance Taylor <ian@cygnus.com> + + * strsignal.c: Unconditionally redefine sys_siglist around the + inclusion of the system header files. + +Thu Feb 13 22:01:04 1997 Klaus Kaempf <kkaempf@progis.de> + + * makefile.vms: Remove 8 bit characters. Update to latest + gcc release. + +Tue Feb 4 11:52:19 1997 Ian Lance Taylor <ian@cygnus.com> + + * strsignal.c: Use NEED_sys_siglist instead of + LOSING_SYS_SIGLIST. + * config.table: Don't use mh-lynxos. + * config/mh-lynxos: Remove. + +Thu Jan 16 14:51:03 1997 Bob Manson <manson@charmed.cygnus.com> + + * cplus-dem.c: Fix indenting; make identical to the copy + in GCC. + (do_type, case 'M'): Check for a template as well as a class. + +Thu Dec 19 13:51:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com> + + * config/mt-vxworks5 (vxneeded-list): Remove sigsetmask.o, since + vxworks 5.[0-3] all have sigsetmask in them; the one provided by + libiberty is incorrect, as well. + +Mon Dec 2 15:03:42 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * alloca.c (alloca): When compiled with an ANSI/ISO compiler, + alloca takes a size_t argument, not just unsigned. + +Mon Nov 18 15:42:08 1996 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c: Note that this file also lives in GCC. + +Mon Nov 18 15:19:00 1996 Dawn Perchik <dawn@critters.cygnus.com> + + * alloca.c: Remove include of libiberty.h for hpux. + * argv.c: Replace defs from libiberty.h. + * spaces.c: Put back externs from removed from libiberty.h. + * vasprintf.c: Remove include of libiberty.h for hpux. + +Mon Nov 18 14:08:00 1996 Dawn Perchik <dawn@critters.cygnus.com> + + * cplus-dem.c: Checking in again; last checkin filed due to sticky tag. + +Wed Nov 13 08:22:00 1996 Dawn Perchik <dawn@critters.cygnus.com> + + * cplus-dem.c: Revert last two commits due to conflicts with + hpux system headers. + +Wed Nov 13 08:22:00 1996 Dawn Perchik <dawn@critters.cygnus.com> + + * alloca.c, argv.c, spaces.c, strcasecmp.c, vasprintf.c, vprintf.c: + Revert last commit due to conflicts with hpux system headers. + +Wed Nov 13 10:36:50 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * cplus-dem.c (x{m,re}alloc): Make declarations compatibile with + libiberty.h when compiled with a standard compiler. + +Tue Nov 12 16:31:00 1996 Dawn Perchik <dawn@critters.cygnus.com> + + * alloca.c: Include libiberty.h for definition of xmalloc. + Don't redefine NULL. + * argv.c: Move prototypes to libiberty.h. + * cplus-dem.c: Include libiberty.h for definition of xmalloc. + Don't redefine NULL. + Use casts to eliminate compiler warnings. + * spaces.c: Remove prototypes for malloc and free which are + already in libibrty.h. + * strcasecmp.c: Use casts to eliminate compiler warnings. + * vasprintf.c: Include libiberty.h for definition of malloc. + Don't redefine NULL. + * vprintf.c: Include stdarg.h if __STDC__. + +Fri Oct 11 15:42:12 1996 Stu Grossman (grossman@critters.cygnus.com) + + * config/mh-windows: Add strcasecmp.o to EXTRA_OFILES. + +Fri Oct 11 11:16:31 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw.c (mpwify_filename): Rewrite to simplify, and to handle + upward components correctly. + +Tue Oct 8 08:55:34 1996 Stu Grossman (grossman@critters.cygnus.com) + + * config.table, config/mh-windows: Add support for building under + MSVC (the Microsoft build environment). + +Mon Oct 7 10:50:27 1996 Ian Lance Taylor <ian@cygnus.com> + + * fnmatch.c: Undef const if not __STDC__. + +Thu Oct 3 13:46:39 1996 Ian Lance Taylor <ian@cygnus.com> + + * fnmatch.c: New file. + * Makefile.in (CFILES): Add fnmatch.c. + (REQUIRED_OFILES): Add fnmatch.o. + (fnmatch.o): New target. + +Wed Sep 18 14:49:13 1996 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (demangle_template): Fix handling of address args. + (gnu_special): Handle type_info stuff. + +Fri Sep 13 17:52:55 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw.c (DebugPI): Make settable from the env var DEBUG_PATHNAMES. + (mpwify_filename): Handle "::/" case. + +Thu Sep 12 13:30:40 1996 Geoffrey Noer <noer@cygnus.com> + + * config/mh-cygwin32: new file (need -DNEED_basename and + -DNEED_sys_siglist for native NT rebuilding) + * config.table (*-*-cygwin32): new entry + * choose-temp.c: bring in sync with gcc (revert Aug 17 change) + +Thu Aug 29 16:48:45 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * config.table (i[345]86-*-*): Recognize i686 for pentium pro. + +Tue Aug 27 13:47:58 1996 Stan Shebs <shebs@andros.cygnus.com> + + * pexecute.c (pexecute) [MPW]: Remove old bogus code that + messed with arguments that included a '/', add escape chars + to double quotes, remove const decl from arg that Mac + compilers don't seem to like. + +Sat Aug 17 04:44:27 1996 Geoffrey Noer <noer@cygnus.com> + + * pexecute.c: Update test for win32 (&& ! cygwin32). + * choose-temp.c: fix WIN32 preprocessor defines + +Thu Aug 15 12:26:48 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-make.sed: Add @DASH_C_FLAG@ and @SEGMENT_FLAG({Default})@ + to editing of default makefile rule. + +Sun Aug 11 21:03:27 1996 Stu Grossman (grossman@critters.cygnus.com) + + * alloca-norm.h: Include <malloc.h> if _WIN32. + * argv.c: Include non-prototyped decls for malloc and string + functions if ! _WIN32 or if __GNUC__. + +Thu Aug 8 12:42:40 1996 Klaus Kaempf <kkaempf@progis.de> + + * config.h-vms: New file. + * makefile.vms: Use it. + +Wed Aug 7 17:16:12 1996 Stu Grossman (grossman@critters.cygnus.com) + + * getopt.c (_getopt_internal): If argc is 0, just return (before + we reference *argv and segfault). + +Mon Aug 5 01:29:08 1996 Jason Merrill <jason@yorick.cygnus.com> + + * Makefile.in (distclean): Add multilib.out. + +Thu Jul 18 17:40:55 1996 Ian Lance Taylor <ian@cygnus.com> + + * alloca-norm.h: Change #ifdef sparc to #if defined (sparc) && + defined (sun). From Andrew Gierth <ANDREWG@microlise.co.uk>. + +Mon Jul 1 13:40:44 1996 Ken Raeburn <raeburn@cygnus.com> + + Tue May 28 15:29:03 1996 Pat Rankin <rankin@eql.caltech.edu> + + * vmsbuild.com (REQUIRD_OFILES): Add choose-temp.o and xstrdup.o. + + Thu Jan 25 18:20:04 1996 Pat Rankin <rankin@eql.caltech.edu> + + * vmsbuild.com: Changes to handle DEFFUNC(on_exit). + (do_ofiles): Allow nonexistent source file in pass 3. + (chk_deffunc): New routine. + +Tue Jun 25 19:24:43 1996 Doug Evans <dje@canuck.cygnus.com> + + * pexecute.c (PEXECUTE_VERBOSE): Define. + (MPW pexecute): Check flags & PEXECUTE_VERBOSE instead of verbose_flag. + +Tue Jun 25 23:11:48 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (docdir): Removed. + +Tue Jun 25 23:01:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (oldincludedir): Removed. + +Tue Jun 25 22:50:07 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (datadir): Set to $(prefix)/share. + +Thu Jun 20 21:17:52 1996 Ian Lance Taylor <ian@cygnus.com> + + * cplus-dem.c (demangle_arm_pt): Reindent. Avoid endless loop by + checking for errors from do_type. + +Tue Jun 18 14:36:19 1996 Klaus Kaempf <kkaempf@progis.de> + + * makefile.vms: New file. + * xmalloc.c: If VMS, include <stdlib.h> and <unixlib.h> rather + than declaring malloc, realloc, and sbrk. + +Mon Jun 10 13:17:17 1996 Doug Evans <dje@canuck.cygnus.com> + + * pexecute.c: New file. + +Wed Jun 5 16:57:45 1996 Richard Henderson <rth@tamu.edu> + + * xmalloc.c: Declare sbrk. + +Sat May 4 05:08:45 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * alloca-norm.h: Add SPARCworks cc compatible __builtin_alloca + declaration. + +Mon Apr 22 18:41:49 1996 Ian Lance Taylor <ian@cygnus.com> + + * xstrerror.c: Include <stdio.h>. + +Sun Apr 21 11:55:12 1996 Doug Evans <dje@canuck.cygnus.com> + + * Makefile.in (CFILES): Add atexit.c. + +Sun Apr 21 09:50:09 1996 Stephen L Moshier (moshier@world.std.com) + + * choose-temp.c: Include sys/types.h before sys/file.h for sco3.2v5. + +Wed Apr 17 11:17:55 1996 Doug Evans <dje@canuck.cygnus.com> + + * choose-temp.c: Don't #include sys/file.h ifdef NO_SYS_FILE_H. + #include <stdio.h> + * config/mt-vxworks5 (HDEFINES): Define NO_SYS_FILE_H. + +Tue Apr 16 11:27:16 1996 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o. + Reverts Feb 8, 1995 change. + +Mon Apr 15 12:53:26 1996 Doug Evans <dje@canuck.cygnus.com> + + * choose-temp.c: New file. + * Makefile.in (CFILES): Add choose-temp.c. + (REQUIRED_OFILES): Add choose-temp.o. + +Sat Apr 13 14:19:30 1996 Stu Grossman (grossman@critters.cygnus.com) + + * floatformat.c (floatformat_to_double): Don't bias exponent when + handling zero's, denorms or NaNs. + +Thu Apr 11 13:36:56 1996 Stu Grossman (grossman@critters.cygnus.com) + + * floatformat.c (floatformat_to_double): Fix bugs with handling + numbers with fractions < 32 bits. + +Mon Apr 8 14:48:34 1996 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Permit --enable-shared to specify a list of + directories. + +Tue Mar 19 22:02:07 1996 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (demangle_template): Fix for non-mangled pointer + arguments. + +Fri Mar 8 17:24:18 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: If srcdir is `.' and with_target_subdir is not + `.', then set MULTISRCTOP before calling config-ml.in. + +Thu Mar 7 13:37:10 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw.c (mpw_open): Add debugging output option. + +Wed Mar 6 17:36:03 1996 Jason Merrill <jason@yorick.cygnus.com> + + * cplus-dem.c (demangle_template): Fix for address-of-extern arguments. + +Tue Feb 27 12:00:50 1996 Raymond Jou <rjou@mexican.cygnus.com> + + * mpw.c (mpwify_filename): Change 6 to 5 in + strncmp (unixname, "/tmp/", 5). + +Tue Feb 20 10:55:53 1996 Ian Lance Taylor <ian@cygnus.com> + + * cplus-dem.c (demangle_template): Initialize is_bool. Correctly + handle 0 as a pointer value parameter. + +Mon Feb 5 16:41:44 1996 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (all): Depend upon required-list. + (required-list): New target. + (clean): Remove required-list. + +Wed Jan 31 10:19:41 1996 Steve Chamberlain <sac@slash.cygnus.com> + + * win32.c: Deleted. + * config.table (i386-*-win32): Deleted. + * config/mh-i386win32: Deleted. + +Thu Jan 18 11:34:17 1996 Ian Lance Taylor <ian@cygnus.com> + + * cplus-dem.c (cplus_demangle_opname): Change opname parameter to + const char *. + (cplus_mangle_opname): Change return type and opname parameter to + const char *. Don't cast return value. + +Tue Jan 16 12:13:11 1996 Stan Shebs <shebs@andros.cygnus.com> + + * mpw.c: Include Timer.h, in order to get m68k Microseconds trap + definition. + +Wed Jan 3 13:15:04 1996 Fred Fish <fnf@cygnus.com> + + * obstack.c: Update copyright to 1996. + (_obstack_memory_used): Define new function. Called via + obstack_memory_used macro. + +Thu Dec 28 11:39:40 1995 Ian Lance Taylor <ian@cygnus.com> + + * xstrdup.c: New file. + * Makefile.in (CFILES): Add xstrdup.c. + (REQUIRED_OFILES): Add xstrdup.o. + (xstrdup.o): New target. + +Mon Dec 11 18:18:52 1995 Mike Stump <mrs@cygnus.com> + + * atexit.c: New stub to provide atexit on systems that have + on_exit, like SunOS 4.1.x systems. + * functions.def (on_exit, atexit): Ditto. + +Mon Dec 11 15:42:14 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw.c (mpw_abort): Remove decl. + (mpw_access): Move debugging printf. + +Sat Dec 2 01:25:23 1995 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Consistently use ${host} rather than ${xhost} or + ${target}. + * configure.in: Don't bother to set ${xhost} before calling + config.table. + +Tue Nov 28 14:16:57 1995 Brendan Kehoe <brendan@lisa.cygnus.com> + + * Makefile.in (.c.o): Use test instead of the left bracket, to + avoid problems with some versions of make. + +Tue Nov 28 11:45:17 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-make.sed: Fix INCDIR edit to work with Nov 14 change. + +Tue Nov 21 11:26:34 1995 Fred Fish <fnf@rtl.cygnus.com> + + * config/mh-hpux: Remove. It was only used to define EXTRA_OFILES, + which was set to just alloca.o, which is now automatically marked + as needed by the autoconfiguration process. + +Tue Nov 21 14:15:06 1995 Ian Lance Taylor <ian@cygnus.com> + + * config.table: Check ${with_cross_host} rather than comparing + ${host} and ${target}. + +Thu Nov 16 14:34:42 1995 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: If with_target_subdir is empty, set xhost to + ${host} rather than ${target} before calling config.table. + +Tue Nov 14 01:38:30 1995 Doug Evans <dje@canuck.cygnus.com> + + * Makefile.in (MULTITOP): Deleted. + (MULTISRCTOP, MULTIBUILDTOP): New. + (FLAGS_TO_PASS): Delete INCDIR. + (INCDIR): Add $(MULTISRCTOP). + (install_to_libdir): Add $(MULTISUBDIR). Call $(MULTIDO). + * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in + instead of cfg-ml-pos.in. + (cross-compile check): Change to test for with_target_subdir. + (EXTRA_LINKS): Delete. + +Sun Nov 12 12:13:04 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-make.sed: Add getpagesize.c.o to needed-list. + * mpw.c [USE_MW_HEADERS]: Conditionalize compiling of + functions that are supplied by Metrowerks libraries. + (fstat): Clean up descriptor->pointer conversion code. + (InstallConsole, etc): Empty definitions, for when linking + with SIOUX. + +Sun Nov 5 19:25:27 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * Makefile.in (FLAGS_TO_PASS): Also pass PICFLAGS. + (.c.o): Stylistic change. + +Thu Nov 2 12:06:29 1995 Ian Lance Taylor <ian@cygnus.com> + + * strtol.c, strtoul.c: Don't include <stdlib.h>. From + phdm@info.ucl.ac.be (Philippe De Muyter). + +Wed Nov 1 11:59:36 1995 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Correct sed call. + +Mon Oct 30 13:03:45 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * configure.in: Clean up / simplify for native. + + * configure.in: Merge in stuff from ../xiberty/configure.in. + * Makefile.in (CC): Add definition (so it can be overrridden + by ../configure). + +Tue Oct 24 17:57:27 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-make.sed: Leave strerror.c.o in standard list of functions. + * mpw.c (R_OK, ENOENT, EACCESS, ENOSYS): Remove. + (link): Remove useless definition with error return. + (last_microseconds, warn_if_spin_delay, record_for_spin_delay): + Use UnsignedWide type for microsecond counts. + +Thu Oct 19 10:52:07 1995 Michael Meissner <meissner@wogglebug.tiac.net> + + * memcmp.c (memcmp): Argument types are const void *, not void + *const. + + * strncasecmp.c (strncasecmp): Include ansidecl.h/stdarg.h, not + sys/types.h. + * strcasecmp.c (strcasecmp): Ditto. + +Tue Oct 10 11:03:24 1995 Fred Fish <fnf@cygnus.com> + + * Makefile.in (BISON): Remove macro. + +Tue Sep 26 15:06:46 1995 Stan Shebs <shebs@andros.cygnus.com> + + * Makefile.in (HFILES): Add default empty definition. + * mpw-config.in (config.h): Only update if changed. + * mpw-make.in: Remove. + * mpw-make.sed: New file, edits Makefile.in into MPW makefile. + * mpw.c: Remove semi-clone of strerror code. + (sys_nerr, sys_errlist): Define here. + (Microseconds): Only define as A-line trap if m68k Mac. + +Wed Sep 20 12:53:32 1995 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (maintainer-clean): New synonym for distclean. + +Mon Aug 28 19:47:52 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * config.table: For host, generalize rs6000-ibm-aix* + to *-ibm-aix* so we also include powerpc. + +Tue Aug 22 03:18:05 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com> + + Fri Jun 16 18:35:40 1995 Pat Rankin (rankin@eql.caltech.edu) + + * xstrerror.c: New file. + * Makefile.in, vmsbuild.com: Compile it. + +Mon Jul 31 12:16:32 1995 steve chamberlain <sac@slash.cygnus.com> + + * config.table (i386-*-win32): New. + +Fri Jul 21 11:35:52 1995 Doug Evans <dje@canuck.cygnus.com> + + * Makefile.in (MULTITOP): New variable. + (MULTIDIRS, MULTISUBDIR, MULTIDO, MULTICLEAN): Likewise. + (all): Add multilib support. + (install_to_tooldir, *clean): Likewise. + +Mon Jul 10 11:47:27 1995 Ken Raeburn <raeburn@cygnus.com> + + * makefile.dos (OBJS): Add hex.o. From DJ Delorie. + +Fri Jun 30 17:28:59 1995 Pat Rankin (rankin@eql.caltech.edu) + + * vmsbuild.com: create "new-lib.olb", build libiberty under that + name, and then make it become "liberty.olb" when done, so that an + incomplete build attempt never leaves behind something which looks + like a complete library. + +Thu Jun 29 00:22:02 1995 Steve Chamberlain <sac@slash.cygnus.com> + + * config/mh-i386pe: New file for PE hosts. + * config.table: Understand PE hosts. + +Wed Jun 28 19:13:23 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * cplus-dem.c: Update from gcc. + + * argv.c, dummy.c: If __STDC__, #include "alloca-conf.h" after + <stddef.h>. + * alloca-norm.h: If __STDC__, declare alloca with its parameter. + +Thu Jun 22 18:57:47 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-make.in (ALL_CFLAGS): Define NEED_basename. + * mpw.c: Only test DebugPI once whenever printing debug info. + (mpwify_filename): If filename is /tmp/foo, change it into :_foo, + also fix to not write on input filename buffer. + (mpw_access): Use stat() instead of open(), works for directories + as well as files. + +Mon Jun 19 00:33:22 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * Makefile.in: Massage broken shells that require 'else true'. + +Sat Jun 17 23:21:58 1995 Fred Fish <fnf@cygnus.com> + + * alloca-norm.h: Declare alloca as type "PTR" to match functions.def. + Declare __builtin_alloca in the sparc case, as argv.c did. + * argv.c: Replace inline version of alloca-norm.h at start of file with + a #include of alloca-conf.h. Precede it with an include of ansidecl.h + because alloca-norm.h needs to declare alloca as "PTR". + +Mon Jun 12 14:24:26 1995 Steve Chamberlain <sac@slash.cygnus.com> + + * win32.c: New file. + +Fri Jun 9 15:16:14 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * dummy.c: #include "alloca-conf.h". + +Wed Jun 7 11:46:23 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * Makefile.in (mostlyclean): Remove stamp-picdir. + (clean): Don't. + +Mon Jun 5 18:46:06 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * config.table (frags): Use toplevel pic frags. + + * Makefile.in (PICFLAG): New macro. + (all): Depend on stamp-picdir. + (needed-list): Ditto. + (.c.o): Also build pic object. + (stamp-picdir): New rule. + (mostlyclean): Remove pic. + (clean): Remove stamp-picdir. + +Fri Mar 24 16:55:48 1995 Pat Rankin (rankin@eql.caltech.edu) + + * vmsbuild.com (config.h): Add `#define NEED_basename'. + +Tue May 23 10:12:46 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * clock.c, getopt.c, strtod.c, vsprintf.c: Change from using LGPL + to libio-style copyright. + * getpagesize.c: Remove FSF copyright. + +Sat May 20 12:30:23 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com> + + Added improved VMS support from Pat Rankin: + + Fri Mar 17 18:40:36 1995 Pat Rankin (rankin@eql.caltech.edu) + + * vmsbuild.com: new file. + + * getpagesize.c (getpagesize): implement for VMS; + * strerror.c (strerror, strerrno, strtoerrno): add rudimentary + support for EVMSERR. + +Thu May 18 17:01:42 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com> + + Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk) + + * floatformat.c (floatformat_arm_ext): Define. + +Tue May 16 13:30:59 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * basename.c, bcmp.c, getcwd.c, insque.c, rename.c, sigsetmask.c, + strerror.c, strsignal.c: Remove FSF copyright. + * sigsetmask.c: #include <sys/types.h> - seems to be needed by ISC. + +Mon May 15 19:53:17 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * bcopy.c, bzero.c, memcmp.c, memcpy.c, memset.c, strchr.c, + strrchr.c, strstr.c, vfork.c: Remove FSF Copyright, because this + might contaminate libstdc++ with the LGPL. (OK'd by RMS 11 Oct 94.) + * strchr.c, strrchr.c: Add cast to suppress const warning. + +Thu May 4 14:36:42 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * cplus-dem.c: Use const instead of CONST. Don't include + ansidecl.h directly. + +Wed Apr 19 01:30:27 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * cplus-dem.c: Don't include libiberty.h. Do declare xmalloc and + xrealloc. + (-DMAIN): Don't rely on an externally-defined version number; + instead, require the version number to be defined as a + preprocessor macro. Handle the RS/6000 leading dot. Define + xmalloc, xrealloc and fatal. Don't strip a leading underscore + if we couldn't demangle the word. + +Tue Apr 4 13:03:51 1995 Stan Shebs <shebs@andros.cygnus.com> + + (Old mpw.c change descriptions retained for informational value.) + * mpw.c (warning_threshold): Default to .4 sec. + (overflow_count, current_progress): New globals. + (warn_if_spin_delay): Include current progress type, + such as program name, in message. + (mpw_start_progress): Set current_progress variable from arg. + (mpw_end_progress): Report spin delays by power-of-two-size + buckets instead of constant-size buckets. + + * mpw.c: Clean up formatting, types, returns, etc. + (ENOSYS): Define. + (mpw_fread, mpw_fwrite): Define. + (sleep): Define correctly. + + * mpw.c: New code to implement cursor spinning support. + (umask): New function. + (mpw_fopen, mpw_fseek, stat, fstat): Call PROGRESS. + + * mpw.c (mpw_basename, mpw_mixed_basename): New functions, find + basenames for MPW and MPW/Unix filenames. + (mpw_special_init): New function, calls Macsbug if desired. + + * mpw.c: Add GPL notice. + (mpwify_filename): Add more transformations. + (mpw_fopen): Call mpwify_filename on file names. + (rename): Remove. + (chdir, getcwd): Add simple definitions. + + * mpw.c: Random cleanups, remove unused code bits. + Added copy of strerror.c for gcc's use. + (stat, fstat, _stat): New versions based on Guido van Rossum code. + + * mpw.c (mpw_fseek): Make it work correctly when doing SEEK_CUR. + + * mpw.c (stat): Remove hack definition, get from sys/stat.h. + (fork, vfork, etc): Print error messages if called. + (getrusage, sbrk, environ, isatty, link, utime, mkdir, rmdir, + rename, chown): Define. + + * mpw-config.in: New file, MPW version of configure.in. + * mpw-make.in: New file, MPW version of Makefile.in. + * mpw.c: New file, MPW compatibility routines. + +Fri Mar 24 14:10:30 1995 Jim Kingdon (kingdon@lioth.cygnus.com) + + * basename.c: Include config.h before checking for NEED_basename. + +Thu Mar 23 19:09:54 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * functions.def: Add DEFFUNC for basename. + + * basename.c: Only define basename if NEED_basename. + +Thu Mar 16 13:36:05 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * config.table: Fix --enable-shared logic for native builds. + +Mon Mar 13 11:05:11 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * cplus-dem.c (demangle_template): Demangle bool literals properly. + +Mon Mar 6 23:57:28 1995 Stu Grossman (grossman@cygnus.com) + + * strtol.c strtoul.c: Replace these with less buggy versions from + NetBSD. (strtoul in particular couldn't handle base 16.) + +Wed Mar 1 15:59:01 1995 Ian Lance Taylor <ian@cygnus.com> + + * config/mt-vxworks5 (HDEFINES): Define NO_SYS_PARAM_H. + + * clock.c: If NO_SYS_PARAM_H is defined, don't include + <sys/param.h>. + * getcwd.c, getpagesize.c, getruntime.c: Likewise. + +Fri Feb 17 15:40:55 1995 Ian Lance Taylor <ian@cygnus.com> + + * getruntime.c (get_run_time): Don't assume that CLOCKS_PER_SEC is + a number; ANSI appears to permit any expression, including a + function call. + + * config.table (*-*-vxworks5*): Use mt-vxworks5 when configuring + xiberty. + * config/mt-vxworks5: New file. + +Thu Feb 9 14:19:45 1995 Ian Lance Taylor <ian@cygnus.com> + + * basename.c (basename): Change argument to be const. + +Wed Feb 8 18:06:52 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * Makefile.in (lneeded-list): Don't worry about xmalloc. + +Sun Jan 15 00:40:36 1995 Jeff Law (law@snake.cs.utah.edu) + + * Makefile.in (distclean): Delete xhost-mkfrag. + +Thu Jan 12 16:54:18 1995 Jason Merrill <jason@phydeaux.cygnus.com> + + * Makefile.in (lneeded-list): If alloca.o is needed, so is xmalloc.o. + +Wed Jan 11 22:39:56 1995 Ken Raeburn <raeburn@cujo.cygnus.com> + + * hex.c: New file. + * Makefile.in (REQUIRED_OFILES, CFILES): List it. + (hex.o): Add dependencies. + + * cplus-dem.c (demangle_prefix): For GNU style constructor and + destructor names, try demangling the remainder of the string. + +Wed Dec 28 00:49:15 1994 Ian Lance Taylor <ian@tweedledumb.cygnus.com> + + * vasprintf.c (int_vasprintf): New static function. + (vasprintf): Use int_vasprintf. Removes assumption that va_list + is assignment compatible. + +Sat Nov 5 19:29:12 1994 Jason Merrill (jason@phydeaux.cygnus.com) + + * Makefile.in (LIBCFLAGS): New variable. + (FLAGS_TO_PASS): Pass it. + (.c.o): Use it. + +Thu Nov 3 19:09:47 1994 Ken Raeburn <raeburn@cujo.cygnus.com> + + * getopt.c, getopt1.c: Do compile these functions under Linux, + since many native versions are based on glibc but are buggy. + +Mon Oct 24 15:16:46 1994 Per Bothner <bothner@kalessin.cygnus.com> + + * vasprintf.c: Make 'format' arg be const, to avoid a mismatch + with prototype in GNU libc. Support stdarg.h as well as varargs.h. + +Tue Oct 11 17:48:27 1994 Jason Merrill (jason@phydeaux.cygnus.com) + + * Makefile.in (REQUIRED_OFILES): Add vasprintf.o. + * functions.def: Remove vasprintf. + +Wed Sep 14 17:04:55 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * xmalloc.c (first_break): New static variable. + (xmalloc_set_program_name): Record sbrk (0) in first_break. + (xmalloc): If memory allocation fails, try to report how much + memory was allocated by the program up to this point. + (xrealloc): Likewise. + +Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org) + + * Makefile.in (ERRORS_CC): New variable, defaulted to $(CC). Use it + when linking dummy. + * config.table: Add host RISCiX Makefile frag. + * config/mh-riscix: New file. + +Thu Aug 25 17:29:44 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * Makefile.in (FLAGS_TO_PASS): Define. + ($(RULE1)): Use $(FLAGS_TO_PASS). + +Wed Aug 24 17:08:47 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * vasprintf.c: Include <string.h>. + (vasprintf): Add casts to void for va_arg to avoid gcc warnings. + * xatexit.c: Declare malloc. + +Fri Aug 19 15:29:12 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle_args): Fix a bug in previous patch (the + one below). + +Thu Aug 18 14:37:14 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle args): Handle ARM repeat encoding where + the type index is greater than 9. + +Wed Aug 17 16:13:49 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle_qualified): accept optional '_' between + qualified name. This is baecause the template name may end with + numeric and can mixed up with the length of next qualified name. + +Wed Aug 3 05:52:14 1994 D. V. Henkel-Wallace (gumby@cygnus.com) + + * config/mt-sunos4: Use our standard location for cross-includes + and cross-libs when the target is also a "host" environment (ie no + newlib; includes and such don't belong to us). This is specific + to the Cygnus Support environment. + +Tue Aug 2 15:25:12 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle_template): demangle as xxx<'Q'> not + xxx<ch=81>. + +Mon Aug 1 17:02:48 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (main): flush stdout to make pipe work. + +Sat Jul 16 12:56:32 1994 Stan Shebs (shebs@andros.cygnus.com) + + * config.table (*-*-cxux7*): Recognize. + * floatformat.c (floatformat_m88110_ext) [HARRIS_FLOAT_FORMAT]: + Harris-specific float format. + * config/mh-cxux7: New file. + +Wed Jun 29 00:26:17 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * cplus-dem.c (demangle_template): Make sure that the result of + consume_count doesn't index beyond the end of the string. + +Mon Jun 20 23:54:37 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * cplus-dem.c (gnu_special): Handle vtable mangling of gcc-2.4.5 and + earlier. Improve test for new vtable mangling. Change output back + to `virtual table'. + +Mon Jun 20 11:37:30 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * obstack.c: Always compile this code, even if using the GNU + library. Avoids problems with relatively recent binary + incompatibility. + +Thu Jun 16 17:54:01 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * cplus-dem.c: Include libiberty.h. + (xmalloc, xrealloc, free): Don't declare. + (strstr): Don't declare parameters. + (xmalloc, xrealloc): Don't define. + (long_options): Add no-strip-underscores. + (main): Call xmalloc_set_program_name. Pass n in short options to + getopt_long. Handle option 'n' to not strip underscores. + (usage): Mention -n and --no-strip-underscores. + +Sun Jun 12 01:37:09 1994 Jason Merrill (jason@deneb.cygnus.com) + + * cplus-dem.c (demangle_template): Separate consecutive >'s with a + space. + (gnu_special): Demangle template and qualified names in a vtable name. + +Fri May 27 12:27:52 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + From gas-2.3 and binutils-2.4 net releases: + + Wed May 11 22:32:00 1994 DJ Delorie (dj@ctron.com) + + * makefile.dos: [new] Makefile for dos/go32 + * configure.bat: update for latest files + * msdos.c: remove some functions now in libc.a + +Fri May 20 18:53:32 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * cplus-dem.c (gnu_special): Recognize thunks, as well as + the new naming style for vtables (when -fvtable-thunks). + +Wed May 18 13:34:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * Makefile.in (XTRAFLAGS): Don't define. + (.c.o, dummy.o): Don't use XTRAFLAGS. + ($(RULE1)): Don't pass XTRAFLAGS down in recursive call. + +Fri May 13 16:02:12 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + + * vasprintf.c: New file. + * Makefile.in, functions.def: Add it. + +Fri May 13 16:20:28 1994 Jason Merrill (jason@deneb.cygnus.com) + + * cplus-dem.c (demangle_fund_type): Grok bool. + +Fri May 6 14:44:21 1994 Steve Chamberlain (sac@cygnus.com) + + * config.table: Add go32 + * config/mh-go32: New template. + +Fri May 6 11:01:59 1994 D. V. Henkel-Wallace (gumby@rtl.cygnus.com) + + * config.table, config/mt-sunos4: config for when sun4 is cross target. + +Mon Apr 11 00:54:33 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) + + * getopt.c [not __GNU_LIBRARY__] [__GCC__] [not __STDC__]: + Declare strlen to return int. Don't include stddef.h. + +Fri Apr 1 00:38:17 1994 Jim Wilson (wilson@mole.gnu.ai.mit.edu) + + * getopt.c: Delete use of IN_GCC to control whether + stddef.h or gstddef.h is included. + +Thu Apr 14 14:00:56 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle_signature): Fix a bug in template function + type numbering. + +Wed Apr 13 17:23:03 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle_signature): Fix template function with arm + style argument type number, Tn. + +Wed Apr 13 17:11:15 1994 Jason Merrill (jason@deneb.cygnus.com) + + * cplus-dem.c (optable): Add new[] and delete[]. + +Fri Apr 8 11:21:42 1994 Jim Kingdon (kingdon@deneb.cygnus.com) + + * argv.c (buildargv): Don't produce empty argument just because + there is trailing whitespace. + +Wed Apr 6 11:42:14 1994 Kung Hsu (kung@mexican.cygnus.com) + + * cplus-dem.c (demangle_template): fix 'Q' qualified name bug. + Handle 'p' same as 'P'. + * cplus-dem.c (do_type): Handle 'p' same as 'P'. + +Sat Mar 26 12:00:13 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * floatformat.c (get_field, put_field): Fix off by one error in + little endian case. + +Thu Mar 24 10:40:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + + * floatformat.c (floatformat_from_double): Pass unsigned char *, + not char *, to put_field. + +Fri Mar 18 12:34:33 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * memmove.c: Re-wrote; placed in public domain. + +Wed Mar 16 10:33:07 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + + * cplus-dem.c (demangle_prefix): If ARM demangling, don't treat + __Q* as a constructor. + +Mon Mar 14 12:26:02 1994 Ian Lance Taylor (ian@cygnus.com) + + * ieee-float.c: Removed; no longer used. + * Makefile.in: Changed accordingly. + +Mon Mar 7 12:28:17 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * floatformat.c (get_field): Removed unused local variable i. + (put_field): Removed unused local variable i. + +Sun Feb 27 21:50:11 1994 Jim Kingdon (kingdon@deneb.cygnus.com) + + * floatformat.c: New file, intended to replace ieee-float.c. + * Makefile.in: Change accordingly. + +Thu Feb 24 11:51:12 1994 David J. Mackenzie (djm@rtl.cygnus.com) + + * getopt.c: Remove #ifdef GETOPT_COMPAT and #if 0 code. + (_getopt_initialize): New function, broken out of _getopt_internal. + (_getopt_internal): + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + +Thu Feb 10 14:44:16 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) + + * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC]: + Test just __STDC__, not emacs. + +Wed Feb 9 00:14:00 1994 Richard Stallman (rms@mole.gnu.ai.mit.edu) + + * getopt.c [not __GNU_LIBRARY__] [__GNUC__] [not IN_GCC] + [emacs] [not __STDC__]: Don't include stddef.h. Don't declare strlen. + +Fri Dec 24 19:43:00 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * getopt.c (_NO_PROTO): Define before config.h is included. + +Mon Sep 20 15:59:03 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * getopt.c, getopt1.c [emacs || CONFIG_BROKETS]: Include + <config.h> only under these, else "config.h". + +Thu Aug 12 18:16:49 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * getopt.c, getopt1.c [HAVE_CONFIG_H]: Include + <config.h> instead of "config.h". + +Sun Feb 20 17:17:01 1994 Ian Lance Taylor (ian@lisa.cygnus.com) + + * concat.c: Check ANSI_PROTOTYPES rather than __STDC__ to decide + whether to use prototypes or not. + * strerror.c (const): Never undefine; let ansidecl.h handle it. + * strsignal.c (const): Likewise. + +Thu Feb 17 13:27:35 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * xatexit.c (_xexit_cleanup): Declare as extern; don't initialize. + Merging common and initialized variables need not be supported by + ANSI C compilers. + (xatexit): Initialize _xexit_cleanup if not already set. + * xexit.c: Comment fix. + +Wed Feb 16 01:15:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * xmalloc.c: Don't declare xexit; it's declared in libiberty.h. + (xrealloc): If oldmem is NULL, allocate with malloc, rather than + assuming that realloc works correctly. + +Tue Feb 15 09:26:16 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * concat.c, ieee-float.c: Replace inclusion of <string.h> + with explicit function declarations, as recommended by Ian Taylor. + +Sat Feb 12 10:31:11 1994 David J. Mackenzie (djm@rtl.cygnus.com) + + * xmalloc.c (xmalloc, xrealloc): Use PTR and size_t throughout. + (malloc, realloc): Declare. + +Thu Feb 10 17:08:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * argv.c, basename.c: Include ansidecl.h and libiberty.h. + * concat.c, fdmatch.c, getruntime.c, spaces.c: Likewise. + * strerror.c, strsignal.c, xatexit.c, xexit.c: Likewise. + * xmalloc.c: Likewise. + * concat.c: Don't declare xmalloc. If __STDC__, use <stdarg.h> + macros, not <varargs.h> macros. + * spaces.c (spaces): Make return type const. Don't crash if + malloc returns NULL. + * strerror.c (struct error_info): Make name and msg fields const. + (error_names): Make const. + (strerrno): Make const. + (strtoerrno): Make argument const. + * strsignal.c (struct signal_info): Make name and msg fields + const. + (signal_names, sys_siglist): Make const. + (strsignal, strsigno): Make const. + (strtosigno): Make argument const. + * xatexit.c: Declare parameter types. + * xmalloc.c (name): Make const. + (xmalloc_set_program_name): Make argument const. + * Makefile.in (INCDIR): Define. + (.c.o): Use $(INCDIR). + (dummy.o): Likewise. + (argv.o, basename.o): New targets; depend on libiberty.h. + (concat.o, fdmatch.o, getruntime.o, spaces.o): Likewise. + (strerror.o, strsignal.o, xatexit.o, xexit.o): Likewise. + (xmalloc.o): Likewise. + (cplus-dem.o): New target; depend on demangle.h. + (getopt.o, getopt1.o): New targets; depend on getopt.h. + (ieee-float.o): New target; depend on ieee-float.h. + (obstack.o): New target; depend on obstack.h. + +Tue Feb 8 05:29:08 1994 David J. Mackenzie (djm@thepub.cygnus.com) + + Handle obstack_chunk_alloc returning NULL. This allows + obstacks to be used by libraries, without forcing them + to call exit or longjmp. + * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk): + If CALL_CHUNKFUN returns NULL, set alloc_failed, else clear it. + (_obstack_begin, _obstack_begin_1): Return 1 if successful, 0 if not. + +Tue Feb 8 00:32:28 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * concat.c, ieee-float.c: Include <string.h>. + +Sun Feb 6 21:28:46 1994 David J. Mackenzie (djm@thepub.cygnus.com) + + * xmalloc.c (xmalloc_set_program_name): New function. + (xmalloc, xrealloc): Include the name in the error message, if set. + + * Replace atexit.c with xatexit.c. + * Makefile.in (CFILES), functions.def: Change references. + +Sat Feb 5 14:02:32 1994 Stan Shebs (shebs@andros.cygnus.com) + + * getruntime.c (get_run_time): Use getrusage or times if + HAVE_GETRUSAGE or HAVE_TIMES are defined. + +Fri Feb 4 15:49:38 1994 David J. Mackenzie (djm@thepub.cygnus.com) + + * atexit.c: New file. + * Makefile.in (CFILES), functions.def: Add it. + * xexit.c: New file. + * Makefile.in (CFILES, REQUIRED_OFILES): Add it. + * xmalloc.c (xmalloc, xrealloc): Call xexit instead of exit. + Change request for 0 bytes into request for 1 byte. + +Wed Feb 2 11:36:49 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * xmalloc.c (xmalloc, xrealloc): Print size using %lu, and cast to + unsigned long, to avoid warnings. + +Fri Jan 28 17:49:06 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * dummy.c: Don't include time.h ever; always define clock_t as + "unsigned long". Until gcc/fixincludes ensures that clock_t + exists, __STDC__ isn't a sufficient test. And if clock() doesn't + exist, clock_t probably doesn't either. + +Mon Jan 24 11:52:31 1994 Stan Shebs (shebs@andros.cygnus.com) + + * clock.c, getruntime.c: New files. + * Makefile.in: Add to file lists. + * functions.def (clock): Add to list. + * dummy.c (time.h): Add if __STDC__. + (clock_t): #define as "unsigned long" if not __STDC__. + +Tue Jan 11 11:27:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * strtod.c: Declare atof. From edler@jan.ultra.nyu.edu (Jan + Edler). + +Tue Dec 28 14:17:30 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * Makefile.in (errors): Use CFLAGS as well as LDFLAGS when + linking. + +Fri Dec 17 12:26:07 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c (demangle_arm_pt): New function. Common code + for ARM template demangling. + * cplus-dem.c (demangle_class_name): Use demangle_arm_pt. + * cplus-dem.c (demangle_prefix): Likewise. + +Tue Nov 30 15:47:48 1993 Jason Merrill (jason@deneb.cygnus.com) + + * cplus-dem.c (cplus_demangle_opname): Add CONST to please gcc. + +Sat Nov 27 11:05:50 1993 Fred Fish (fnf@cygnus.com) + + Merge changes from tom@basil.icce.rug.nl (Tom R.Hageman) + * strerror.c, strsignal.c: As a small space optimization, don't + include messages when they aren't actually used. + + Merge changes from takefive.co.at!joe (Josef Leherbauer) + * cplus-dem.c (demangle_prefix, demangle_function_name, + cplus_demangle_opname): Fixes for systems where cplus_marker + is something other than '$'. + +Fri Nov 26 13:51:11 1993 Per Bothner (bothner@kalessin.cygnus.com) + + * waitpid.c: Simple-minded approcimation to waitpid + using vanilla wait. + * functions.def, Makefile.in: Update accordingly, + +Thu Nov 18 18:01:15 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c(demangle_template): fix bug template instantiation + with value of user defined type. + +Wed Nov 17 18:30:21 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c(cplus_demangle_opname): add the subject new function + to support unified search of operator in class. + +Wed Nov 10 09:47:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + gcc -Wall lint: + * strtoul.c (strtoul): use "(digit = *s) != '\0'" not just + "digit = *s" as condition in while loop. + +Tue Nov 9 15:52:22 1993 Mark Eichin (eichin@cygnus.com) + + * Makefile.in: pass SHELL to recursive make + +Thu Nov 4 12:09:26 1993 Per Bothner (bothner@kalessin.cygnus.com) + + * vfprintf.c, vprintf.c, vsprintf.c: Make format arg + be (const char*), for ANSI (and gcc w/fixproto) consistency. + +Thu Nov 4 08:29:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * config.table: Make *-*-hiux* use mh-hpux. + +Fri Oct 22 07:53:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * config.table: Add * to end of all OS names. + +Tue Oct 19 17:12:01 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) + + * Makefile.in (lneeded-list): ensure that object file names are + not duplicated, as multiple instances of the same object file in + a library causes problems on some machines + +Mon Oct 18 21:59:28 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * strcasecmp.c, strncasecmp.c: Change u_char to unsigned char. + +Fri Oct 15 22:17:11 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) + + * strncasecmp.c: new file, implements strncasecmp + * strcasecmp.c: new file, implement strcasecmp + + * Makefile.in (CFILES): list these two new source files + + * functions.def: add strcasecmp and strncasecmp entries + +Fri Oct 15 14:53:05 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * strtoul.c (strtoul), strtol.c (strtol): Handle overflow + according to ANSI C. + +Thu Oct 14 16:34:19 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c: add support of ARM global constructor/destructor, + and 'G' for passing record or union in parameter. + +Wed Oct 13 13:36:19 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * Makefile.in: Fix comment to clarify that stuff in REQUIRED_OFILES + should not be in functions.def. + +Wed Oct 13 13:13:38 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * functions.def: Removed xmalloc. Stuff in REQUIRED_OFILES should + not be in functions.def. + +Mon Oct 4 18:26:39 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c: change globl constructor/destructor to proper name + +Tue Sep 28 18:11:07 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c: fix bug in constructor/destructor + +Tue Sep 28 16:20:49 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c: support both old and new _vt$... vtbl mangled names + +Fri Sep 24 19:07:16 1993 Jason Merrill (jason@deneb.cygnus.com) + + * cplus-dem.c: Fix demangle_template prototype + +Fri Sep 24 17:32:55 1993 Kung Hsu (kung@cirdan.cygnus.com) + + * cplus-dem.c: fix template demangling + * cplus-dem.c: fix const type demangling + * cplus-dem.c: fix constructor/destructor, virtual table, + qualifier, global constructor/destructor demangling + +Wed Sep 1 23:13:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * strsignal.c, strerror.c: Use fully-bracketed initializer to + keep gcc -Wall happy. + +Fri Aug 27 10:30:09 1993 Jason Merrill (jason@deneb.cygnus.com) + + * cplus-dem.c (do_type): Add CONSTS to make gcc happy with last + patch. + +Fri Aug 27 11:24:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + Patch from Paul Flinders: + * cplus-dem.c (do_type): Deal with arrays. + +Tue Aug 24 14:23:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * cplus-dem.c (demangle_qualified: Deal with GNU format for more + than 9 classes. + +Wed Aug 18 19:50:29 1993 Jason Merrill (jason@deneb.cygnus.com) + + * Makefile.in (dummy.o): Redirect to /dev/null to avoid "variable + not initialized" warnings under HP/UX + +Sun Aug 15 20:42:40 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * strerror.c: Move include of stdio.h after sys_errlist #define. + Also remove NULL definition (stdio.h always defines NULL, so it + never did anything but clutter up the code). + +Sat Aug 14 14:21:49 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) + + * Makefile.in, functions.def: handle xmalloc.c + + * xmalloc.c: provide xmalloc and xrealloc functions + +Thu Aug 12 17:38:57 1993 David J. Mackenzie (djm@thepub.cygnus.com) + + * cplus-dem.c: Fix a comment. + +Sat Aug 7 13:56:35 1993 David J. Mackenzie (djm@thepub.cygnus.com) + + * getopt1.c: Declare const the way getopt.c does. + +Fri Aug 6 17:03:13 1993 David J. Mackenzie (djm@thepub.cygnus.com) + + * obstack.c, alloca.c: Update from FSF. + * getopt.c, getopt1.c: Update to current FSF version, which + doesn't use alloca. + +Tue Jul 27 14:03:57 1993 Brendan Kehoe (brendan@lisa.cygnus.com) + + * Makefile.in (demangle): Add the target with a message saying + where demangle went. + +Mon Jul 26 15:49:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * Makefile.in: Remove obsolete `demangle' target. + +Thu Jul 22 08:31:01 1993 Fred Fish (fnf@deneb.cygnus.com) + + * cplus-dem.c (arm_special): Apply patch from arg@lucid.com to + avoid infinite loop on vtbl symbols with disambiguating "junk" + tacked on the end. + +Mon Jul 19 14:10:37 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com) + + * strsignal.c: work around some systems losing definitions of + sys_siglist + + * config/mh-lynxos: this system has a losing definition of + sys_siglist + + * config.table: use mh-lynxos for *-*-lynxos + +Mon Jul 19 17:08:52 1993 Ken Raeburn (raeburn@rtl.cygnus.com) + + * config.table: Add support for HPPA BSD hosts. + + * config/mh-hpbsd: New file. + +Mon Jul 12 18:00:40 1993 K. Richard Pixley (rich@cygnus.com) + + * Makefile.in (TAGS): make work when srcdir != objdir. + +Sun Jun 27 15:35:31 1993 David J. Mackenzie (djm@thepub.cygnus.com) + + * cplus-dem.c (main): Add long options, including --help and + --version. + (usage): New function from code in main. + +Tue Jun 22 11:37:38 1993 Per Bothner (bothner@deneb.cygnus.com) + + * config.table: New shell scipt, sourced by both ./configure,in + and ../xiberty/configure.in, to avoid maintainance lossages. + * configure.in and ../xiberty/configure.in: Use config.table. + + * configure.in: Don't use mh-aix for AIX 3.2, only for 3.1. + * configure.in: Map *-*-irix* (except irix4) to mh-sysv. + * ../xiberty/configure.in: Update from ./configure.in. + +Tue Jun 15 17:05:31 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * Makefile.in: remove parentdir support + +Wed May 26 12:59:09 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * cplus-dem.c (xrealloc): Match definition with prototype. + +Tue May 25 14:27:51 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * cplus-dem.c (demangle_prefix): Demangle cfront + local variables as an extension to ARM demangling. + +Fri May 21 09:53:57 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * ieee-float.c: Don't require pointers to double to be aligned. + +Tue May 18 17:12:10 1993 Fred Fish (fnf@cygnus.com) + + (merge changes from dlong@cse.ucsc.edu) + * cplus-dem.c (consume_count): Simplify. + * cplus-dem.c (arm_pt, demangle_class_name): New functions. + * cplus-dem.c (various): Calls to arm_pt, demangle_class_name. + + * cplus-dem.c (xmalloc, xrealloc, strstr): Make extern decls into + full prototypes. + * cplus-dem.c (free): Add prototype. + * cplus-dem.c (optable): Fully bracketize initializer. + +Fri May 14 17:13:05 1993 Per Bothner (bothner@cygnus.com) + + * cplus-dem.c: Whether initial underscores are stripped + depends on the external variable prepends_underscore + (which is generated by the binutils Makefile). + +Fri May 14 07:32:20 1993 Ken Raeburn (raeburn@deneb.cygnus.com) + + * cplus-dem.c (mop_up, arm_special): Remove some unused variables. + +Tue May 4 20:31:59 1993 Fred Fish (fnf@cygnus.com) + + * cplus-dem.c (consume_count): Return zero if arg does not + start with digit, and don't consume any input. + +Tue May 4 08:10:28 1993 Jim Kingdon (kingdon@cygnus.com) + + * Makefile.in (demangle): Use ${srcdir} not $^. + + * strtod.c: New file, needed at least for BSD 4.3. + +Sun May 2 11:30:42 1993 Fred Fish (fnf@cygnus.com) + + * strsignal.c (sys_siglist): For ANSI compilations, type is + "const char *const". Also remove conditionalization on __STDC__ + since const is defined away for non-ANSI. + +Wed Apr 28 19:29:55 1993 Ken Raeburn (raeburn@deneb.cygnus.com) + + * configure.in: Recognize *-*-hpux. + * config/mh-hpux: New file. + +Tue Apr 27 15:22:19 1993 Per Bothner (bothner@cygnus.com) + + * tmpnam.c: Added ANSI tmpnam() function. + * functions.def, Makefile.in: Update accordingly. + +Tue Apr 27 13:38:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * cplus-dem.c (demangle_function_name): Get the demangling of + stop__1A right. + +Fri Apr 16 23:48:24 1993 Jim Kingdon (kingdon at calvin) + + * cplus-dem.c: Declare strstr return type. + +Fri Mar 26 12:01:26 1993 Jim Kingdon (kingdon@cygnus.com) + + * strsignal.c: Add some AIX signals. + +Thu Mar 25 15:17:23 1993 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in (MAKEOVERRIDES): Define to be empty. + +Wed Mar 24 01:59:25 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com) + + * Makefile.in: add installcheck & dvi targets + +Thu Mar 18 14:05:44 1993 Per Bothner (bothner@rtl.cygnus.com) + + * ieee-float.c: New file, moved from ../gdb (since it is + needed by ../opcode/m68k-dis.c). + +Tue Mar 2 17:47:31 1993 Fred Fish (fnf@cygnus.com) + + * cplus-dem.c: Replace all references to cfront with ARM. + +Fri Feb 26 00:17:07 1993 Per Bothner (bothner@rtl.cygnus.com) + + * cplus-dem.c: Fix main program (when compiled with -DMAIN) + to be more useful as a filter. + +Sat Feb 20 21:41:39 1993 Brendan Kehoe (brendan@lisa.cygnus.com) + + * Makefile.in (install_to_libdir, install_to_tooldir): Go into the + destination directory before running $(RANLIB), in case that + program tries to create a file in the current directory as part of + its work. + +Thu Feb 18 23:00:19 1993 John Gilmore (gnu@cygnus.com) + + * strsignal.c (sys_siglist): Remove yet another *%^&%&$# "const" + because BSD 4.4 lacks one. Isn't this fun? + +Thu Feb 18 11:24:25 1993 Fred Fish (fnf@cygnus.com) + + * cplus-dem.c (demangle_signature): Set func_done after + demangling a template. + * cplus-dem.c (demangle_template): Fix several small bugs + in demangling GNU style templates. + * cplus-dem.c (demangle_prefix): Fix for templates in GNU + style constructors. + * cplus-dem.c (gnu_special): Fix for templates in GNU style + static data members. + +Tue Feb 16 17:28:35 1993 Fred Fish (fnf@cygnus.com) + + * cplus-dem.c (demangle_signature): Modify to include type + modifiers like static and const in remembered types. + +Thu Feb 11 22:20:47 1993 Fred Fish (fnf@cygnus.com) + + * cplus-dem.c (demangled_qualified): Add new parameter that tells + whether to prepend or append the qualifiers. + * cplus-dem.c (string_prepends): Used now, remove #if 0. + * cplus-dem.c (demangle_signature): Call demangle_qualified + with prepending. + * cplus_dem.c (gnu_special): Recognize static data members that + use qualified names. + * cplus-dem.c (demangle_qualified): Accumulate qualifiers in a + temporary buffer and the prepend or append them to the result, + as specified by the new "append" flag. + * cplus-dem.c (do_type): Call demangled_qualified with + appending. + +Mon Dec 28 10:47:19 1992 Ken Raeburn (raeburn@cygnus.com) + + * strsignal.c (signal_table): Now const. + (init_signal_tables): Variable eip now points to const. + + * strerror.c (error_table): Now const. + (init_error_tables): Variable eip now points to const. + +Tue Dec 15 15:36:50 1992 Per Bothner (bothner@cygnus.com) + + * memchr.c (memchr): New (ANSI standard) function. + * Makefile.in, functions.def: Added memchr. + * Makefile.in (AR_FLAGS): Use rc instad of non-standard cq. + +Wed Dec 2 22:49:10 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * getopt.c: remove use of USG around <alloca.h>, which never meant + anything anyway + + * config/mh-{aix,apollo68,ncr3000,sysv,sysv4}: removed definitions + of USG and USGr4 + +Thu Nov 19 03:09:33 1992 Brendan Kehoe (brendan@lisa.cygnus.com) + + * cplus-dem.c (demangle_fund_type): Recognize `w', a wide character; + it's now a type according to the ANSI X3J16 working paper; output + "wchar_t" for it. + (demangle_template): Accept `w' as an integral type. + (xmalloc, xrealloc): Use `char *', not `PTR'. Cast calls to their + counterparts malloc and realloc to `char *'. + (main): Exit with a 0 status. + * Makefile.in (demangle): Don't expect the user to define + DEMANGLE, instead force to be cplus-dem.c. Look in $(srcdir)/../include + for demangle.h. Pass it any HDEFINES or XTRAFLAGS. + +Wed Nov 18 18:56:20 1992 John Gilmore (gnu@cygnus.com) + + * Makefile.in (AR_FLAGS): Avoid verbosity. + * config/mh-sysv4: Remove AR_FLAGS override, use INSTALL=cp, + replace USGr4 with HAVE_SYSCONF. + * config/mh-solaris: Remove; mh-sysv4 works now. + * getpagesize.c: Replace USGr4 with HAVE_SYSCONF. + * configure.in: Simplify host matching table, remove separate + solaris config file. + +Sun Nov 15 09:35:16 1992 Fred Fish (fnf@cygnus.com) + + * configure.in (i[34]86-*-solaris2*): Add, use mh-sysv4. + +Tue Nov 3 21:27:03 1992 Brendan Kehoe (brendan@cygnus.com) + + * cplus-dem.c (xmalloc, xrealloc): Add decls. + (remember_type): Don't cast xmalloc. + (string_need): Likewise; don't cast xrealloc either. + +Fri Oct 23 08:52:01 1992 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in, functions.defs, rename.c: added simple + implementation of rename, since some binutils programs use it. + +Thu Oct 15 15:18:22 1992 Per Bothner (bothner@cygnus.com) + + * strsignal.c: Add appropriate 'const' to sys_siglist + extern declaration (if __STDC__). (Needed for Linux.) + * strsignal.c (strsignal): Add cast to remove const-ness. + +Fri Oct 9 03:22:55 1992 John Gilmore (gnu@cygnus.com) + + * Makefile.in (needed.awk, needed2.awk): Remove erroneous \'s + before "'s, diagnosed by BSD 4.4 awk. + +Thu Oct 8 15:25:12 1992 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in: create config.h and needed-list through $(CONFIG_H) + and $(NEEDED_LIST), to give some hooks for xiberty. + +Thu Oct 1 23:31:42 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * configure.in: use cpu-vendor-triple instead of nested cases + +Wed Sep 30 11:26:59 1992 Per Bothner (bothner@rtl.cygnus.com) + + * Makefile.in, argv.c, basename.c, bcmp.c, bcopy.c, bzero.c, + concat.c, cplus-dem.c, fdmatch.c, getcwd.c, getopt.c, getopt1.c, + getpagesize.c, insque.c, memcmp.c, memcpy.c, memmove.c, memset.c, + obstack.c, sigsetmask.c, spaces.c, strchr.c, strerror.c, + strrchr.c, strsignal.c, strstr.c, vfork.c, vsprintf.c: + Convert from using GPL to LGPL. + +Sat Sep 26 04:01:30 1992 John Gilmore (gnu@cygnus.com) + + * Makefile.in (errors): Leave dummy.o and dummy around so that + we can see how the needed list was generated (it's sometimes wrong). + (mostlyclean): Remove them. + +Mon Sep 21 14:50:42 1992 Ian Lance Taylor (ian@cygnus.com) + + * getcwd.c: supply a default if MAXPATHLEN is not defined. + + * config/mh-irix4: set EXTRA_OFILES to alloca.o, from WRS. + +Wed Sep 9 12:41:48 1992 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in: Use XTRAFLAGS when compiling, so that xiberty works + when cross-compiling. + +Thu Sep 3 13:29:39 1992 K. Richard Pixley (rich@sendai.cygnus.com) + + * cplus-dem.c: (demangle_prefix): reduction in strength of strstr + as a time optimization. + + * cplus-dem.c (cplus_demangle): remove strpbrk test. Appears to + be more expensive than simply demangling. + + * cplus-dem.c (cplus_match): new function. + +Tue Sep 1 15:24:04 1992 Per Bothner (bothner@rtl.cygnus.com) + + * cplus-dem.c: #include <stdio.h>, to define NULL. + Define current_demangling_style. + +Sun Aug 30 17:58:19 1992 Per Bothner (bothner@rtl.cygnus.com) + + * cplus-dem.c: New file, moved from ../gdb. + * cplus-dem.c (set_cplus_marker_for_demangling): New exported + function, to avoid compiling in target-dependency for CPLUS_MARKER. + * cplus-dem.c (cplus_demangle): Allow demangling style option + to be passed as a parameter, but using the global variable + current_demangling_style as a default. + * Makefile.in: Update for cplus-dem.c + +Sat Aug 29 10:44:09 1992 Fred Fish (fnf@cygnus.com) + + * obstack.c: Merge in comment changes from FSF version. Now + matches the FSF version exactly. + +Fri Aug 28 18:39:08 1992 John Gilmore (gnu@cygnus.com) + + * obstack.c (CALL_FREEFUN): Can't use ?: with void values (at + least on losing DECstations!); use if-then-else instead. + +Wed Aug 19 14:40:34 1992 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in: always create installation directories. + +Mon Aug 10 17:33:40 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * Makefile.in: clean up definition of CFILES, more comments + +Sat Aug 8 23:10:59 1992 Fred Fish (fnf@cygnus.com) + + * getopt.c (my_index): Make first arg const to match strchr, + which it sometimes is remapped to. + +Sat Aug 1 13:48:50 1992 Fred Fish (fnf@cygnus.com) + + * obstack.c (DEFAULT_ALIGNMENT): Update to match FSF version. + * obstack.c (_obstack_begin): Initialize use_extra_arg. + * obstack.c (_obstack_begin_1): New, from FSF version. + +Mon Jul 20 21:07:58 1992 Fred Fish (fnf@cygnus.com) + + * obstack.c (CALL_CHECKFUN, CALL_FREEFUN): Use use_extra_arg and + extra_arg. + * obstack.c (_obstack_begin): Remove area_id and flags arguments + (previously added for mmalloc support, interface has changed). + Also convert flags usage to use use_extra_arg and maybe_empty_object. + +Fri Jul 10 00:41:53 1992 Fred Fish (fnf@cygnus.com) + + * argv.c: Move expandargv inline and eliminate static variables. + Rewrite to always allocate in powers of two. Fix to return an + argv with a single null string arg if passed a null string. + +Fri Jul 3 20:27:29 1992 Fred Fish (fnf@cygnus.com) + + * random.c, sigsetmask.c, strerror.c, strsignal.c: Remove + "(void)" casts from function calls where the return value is + ignored, in accordance with GNU coding standards. + +Mon Jun 29 10:54:19 1992 Fred Fish (fnf at cygnus.com) + + * bcopy.c, strerror.c, strsignal.c: Lint. + +Thu Jun 25 09:18:41 1992 K. Richard Pixley (rich@rtl.cygnus.com) + + * getopt.c: merge changes from make. + +Thu Jun 25 04:43:22 1992 John Gilmore (gnu at cygnus.com) + + * alloca.c: Incorporate fixes from gdb/alloca.c. + FIXME: Eventually move gdb's alloca configuration files here, + and remove gdb/alloca.c and its Makefile.in support. + +Tue Jun 23 21:56:30 1992 Fred Fish (fnf@cygnus.com) + + * dummy.c: Define NOTHING to /*nothing*/, change return type + of main to int and return zero. + * functions.def: Supply NOTHING as the fourth arg to macros + that don't have an explicit arg, to satisfy picky preprocessors. + +Wed Jun 17 18:13:58 1992 Per Bothner (bothner@rtl.cygnus.com) + + * Makefile.in: Clean up *clean rules, as per standards.texi. + +Tue Jun 16 16:11:59 1992 K. Richard Pixley (rich@rtl.cygnus.com) + + * getopt.c, getopt1.c: merged largely gratuitous, mostly + whitespace diffs from other prep distributions. + +Mon Jun 15 12:25:46 1992 Fred Fish (fnf@cygnus.com) + + * config/mh-ncr3000 (INSTALL): Don't use /usr/ucb/install, + it is broken on ncr 3000's. + +Mon Jun 15 01:03:26 1992 John Gilmore (gnu at cygnus.com) + + * sigsetmask.c: Rewrite. Old one was very confused about its + arguments and result. New one can't do much, but at least knows + what it can't do, and it's good enough for GDB's use. + +Sun Jun 14 15:17:40 1992 Stu Grossman (grossman at cygnus.com) + + * functions.def: Use proper prototype for strtoul. + +Fri Jun 12 19:22:40 1992 John Gilmore (gnu at cygnus.com) + + * Makefile.in: Add random.c. + * config/mh-*: Use "true" rather than "echo >/dev/null" for ranlib. + * configure.in: update solaris2 config. + +Wed Jun 10 16:31:29 1992 Fred Fish (fnf@cygnus.com) + + * random.c: Add for random() and srandom(). + * functions.def: Add random + +Tue Jun 9 17:27:18 1992 Fred Fish (fnf@cygnus.com) + + * config/{mh-ncr3000, mh-sysv4}: Add definition for INSTALL + using /usr/ucb/install. + +Mon Jun 1 13:20:17 1992 Per Bothner (bothner@rtl.cygnus.com) + + * strerror.c: Kludge to guard against a conflict with + possible declaration of sys_errlist in errno.h. + +Sun May 31 15:07:47 1992 Mark Eichin (eichin at cygnus.com) + + * configure.in, config/mh-solaris: add solaris2 config support. + +Fri May 29 17:23:23 1992 Per Bothner (bothner@rtl.cygnus.com) + + * sigsetmask.c: #ifdef out sigsetmask if SIG_SETMASK + is not defined (should be defined in signal.h, says Posix.). + +Mon May 18 17:35:04 1992 K. Richard Pixley (rich@cygnus.com) + + * getopt.c: merged changes from make-3.62.11. + +Fri May 8 14:53:07 1992 K. Richard Pixley (rich@cygnus.com) + + * getopt.c: merged changes from bison-1.18. + +Tue May 5 11:51:40 1992 Per Bothner (bothner@rtl.cygnus.com) + + * Makefile.in: Don't have $(EXTRA_OFILES) depend on config.h, + since that introduces a circular dependency. + ($(EXTRA_OFILES) are used to build config.h.) + + * strtoul.c: Fixes to handle non-decimal bases better. + +Wed Apr 22 09:27:51 1992 Fred Fish (fnf@cygnus.com) + + * config/mh-ncr3000: Replace MINUS_G with CFLAGS. + * Makefile.dos: Finish MINUS_G eradication. + * Makefile.in (CFILES): Add strsignal.c. + * Makefile.in (REQUIRED_OFILES): Add strerror.o strsignal.o + * Makefile.in (needed-list): Split creation of errors file to + separate make target. + * Makefile.in (config.h, needed2.awk, errors): New targets. + * Makefile.in (clean): Split to multiple lines, add needed2.awk + and config.h. + * dummy.c (DEFFUNC, DEFVAR): Add defines and undefs. + * functions.def (strerror): Remove from optional list. + * functions.def (sys_nerr, sys_errlist, sys_siglist): DEFVAR's + * functions.def (strerror, psignal): DEFFUNC's + * strerror.c: Rewrite from scratch to use sys_errlist only if + available, add errno_max(), add strerrno(), add strtoerrno(), + add test driver. + * strsignal.c: New file, signal equivalent to strerror.c. + Uses sys_siglist if available, defines signo_max(), strsignal(), + strsigno(), strtosigno(), psignal(), and test driver. + +Mon Apr 20 20:49:32 1992 K. Richard Pixley (rich@cygnus.com) + + * Makefile.in: do not print recursion line. + + * Makefile.in: allow CFLAGS to be passed in from command line. + Removed MINUS_G. Default CFLAGS to -g. + +Mon Apr 20 12:57:46 1992 Per Bothner (bothner@rtl.cygnus.com) + + * config/mh-aix: New. EXTRA_OFILES lists copysign.o, + so libg++ users don't have to be inconvenienced by a + libc.a bug (libc.a needs copysign, but doesn't define it!). + * configure.in: Use config/mh-aix. + * strtoul.c: Handle '-' as required by ANSI. + Clean up radix handling. + * strstr.c: Fix buggy algorithm. + * Makefile.in: Change so that ${EXTRA_OFILES} is + appended to needed-list (which is used by libg++). + +Fri Apr 10 22:51:41 1992 Fred Fish (fnf@cygnus.com) + + * configure.in: Recognize new ncr3000 config. + * config/mh-ncr3000: New config file. + +Wed Apr 1 23:31:43 1992 John Gilmore (gnu at cygnus.com) + + * argv.c, dummy.c: Lint. + +Tue Mar 31 18:46:44 1992 Fred Fish (fnf@cygnus.com) + + * config/mh-sysv4: New config file. + * configure.in (host_makefile_frag): Set to config/mh-sysv4 for + host_os == sysv4. + * getpagesize.c: For SVR4, use sysconf(_SC_PAGESIZE) to get + pagesize. + +Sun Mar 29 12:26:42 1992 John Gilmore (gnu at cygnus.com) + + * getopt.c: Lint. + +Fri Mar 27 08:32:55 1992 Fred Fish (fnf@cygnus.com) + + * functions.def (alloca): Fix return type and args to avoid + type clash with gcc's builtin alloca. + +Tue Mar 24 23:33:42 1992 K. Richard Pixley (rich@cygnus.com) + + * configure.in, config/mh-irix4: irix4 support. + + * Makefile.in, functions.def, alloca.c: added alloca. + +Tue Mar 24 17:34:46 1992 Stu Grossman (grossman at cygnus.com) + + * obstack.c (CALL_FREEFUN): Make it compile on DECstations. + +Thu Mar 19 13:57:42 1992 Fred Fish (fnf@cygnus.com) + + * argv.c: Fix various external function definitions to be + correct in an ANSI compilation environment. + +Sat Mar 14 17:28:17 1992 Fred Fish (fnf@cygnus.com) + + * obstack.c: Changes to support calling mmalloc functions, + which take an additional argument over malloc functions. + +Fri Mar 6 22:01:10 1992 K. Richard Pixley (rich@cygnus.com) + + * added check target. + +Thu Feb 27 22:19:39 1992 Per Bothner (bothner@cygnus.com) + + * argv.c: #include alloca-conf.h (needed by AIX). + +Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com) + + * Makefile.in, configure.in: removed traces of namesubdir, + -subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced + copyrights to '92, changed some from Cygnus to FSF. + +Sat Feb 22 01:09:21 1992 Stu Grossman (grossman at cygnus.com) + + * argv.c: Check in Fred's version which fixes problems with + alloca(). + +Fri Feb 7 21:46:08 1992 Stu Grossman (grossman at cygnus.com) + + * makefile.dos: Remove NUL to keep patch from failing. + +Thu Jan 30 22:48:41 1992 Stu Grossman (grossman at cygnus.com) + + * getopt.c (_getopt_internal): Fix usage of enum has_arg. + +Mon Jan 20 18:53:23 1992 Stu Grossman (grossman at cygnus.com) + + * getopt.c, getopt1.c, ../include/getopt.h: Get latest versions. + +Sat Jan 18 16:53:01 1992 Fred Fish (fnf at cygnus.com) + + * argv.c: New file to build and destroy standard argument + vectors from a command string. + + * Makefile.in: Add argv.c and argv.o to appropriate macros. + +Fri Dec 20 12:12:57 1991 Fred Fish (fnf at cygnus.com) + + * configure.in: Change svr4 references to sysv4. + + * rindex.c: Declare return type of externally used function + strrchr(). + +Thu Dec 19 18:35:03 1991 John Gilmore (gnu at cygnus.com) + + * Makefile.in: Remove "***" in normal output, since Make produces + this on errors, and it's convenient to search for. + +Tue Dec 17 23:21:30 1991 Per Bothner (bothner at cygnus.com) + + * memcmp.c, memcpy.c, memmove.c, memset.c, strchr.c, strrchr.c: + New ANSI functions. The old non-ANSI functions (such as bcopy) + should be avoided. + * bcopy.c: Fix to correctly handle overlapping regions. + * index.c, rindex.c: Re-write in terms of strchr() and strrchr(). + * functions.def: Add the new functions. + * functions.def: Add 4th parameter to DEF macro, + an ansidecl.h-style prototype. + * dummy.c: Use expanded DEF macro to create a dummy function + call, with correct parameter types. (This avoids some + complaints from gcc about predefined builtins.) + + Move the functionality of config/mh-default into Makefile.in. + This avoid duplication, and simplifies things slightly. + * Makefile.in: Tweak so we don't need config/mh-default. + * README: Update. + * configure.in: No longer need config/mh-default. + * config/mh-default: Deleted. + * config/mh-sysv: Remove lines copied from old mh-default. + +Tue Dec 17 05:46:46 1991 John Gilmore (gnu at cygnus.com) + + * fdmatch.c (fdmatch): Don't compare st_rdev, which is for + 'mknod' device numbers. + +Mon Dec 16 12:25:34 1991 Fred Fish (fnf at cygnus.com) + + * fdmatch.c, Makefile.in: Add new function that takes two + open file descriptors and returns nonzero if they refer to + the same file, zero otherwise. (used in gdb) + +Wed Dec 11 17:40:39 1991 Steve Chamberlain (sac at rtl.cygnus.com) + From DJ: + * msdos.c: stub functions for dos. + * makefile.dos, configdj.bat: new. + * getopt.c: Don't include alloca-conf.h in a GO32 world. + + +Tue Dec 10 04:14:49 1991 K. Richard Pixley (rich at rtl.cygnus.com) + + * Makefile.in: infodir belongs in datadir. + +Fri Dec 6 23:26:45 1991 K. Richard Pixley (rich at rtl.cygnus.com) + + * Makefile.in: remove spaces following hyphens because bsd make + can't cope. added standards.text support. install using + INSTALL_DATA. + + * configure.in: remove commontargets as it is no longer a + recognized hook. + +Thu Dec 5 22:46:46 1991 K. Richard Pixley (rich at rtl.cygnus.com) + + * Makefile.in: idestdir and ddestdir go away. Added copyrights + and shift gpl to v2. Added ChangeLog if it didn't exist. docdir + and mandir now keyed off datadir by default. + +Fri Nov 22 19:15:29 1991 John Gilmore (gnu at cygnus.com) + + * Makefile.in: find-needed.awk does not fit in 14 chars. + + * Makefile.in: Suppress error checking when compiling the test + program, because Ultrix make/sh aborts there due to a bug. + +Fri Nov 22 12:23:17 1991 Per Bothner (bothner at cygnus.com) + + * Makefile.in: Re-did how EXTRA_OFILES is used to be more useful. + * README: Explained how the auto-configuration works, + and how to add new files and/or configurations. + +Fri Nov 22 09:45:23 1991 John Gilmore (gnu at cygnus.com) + + * strtoul.c: Avoid defining ULONG_MAX if already defined; + cast a const char * to char * for pedants. + + * getopt.c: Only define "const" after local include files get to, + and only if they haven't defined it. + +Thu Nov 21 16:58:53 1991 John Gilmore (gnu at cygnus.com) + + * getcwd.c (remove getwd.c): GNU code should call getcwd(). We + emulate it with getwd() if available. This avoids callers having + to find a MAXPATHLEN or PATH_MAX value from somewhere. + * Makefile.in, functions.def: getwd->getcwd. + * configure.in: Use generic case for every system. + * config/mh-{delta88,mach,rs6000,svr4}: Remove. + * config/mh-sysv: Use default handling, just add -DUSG. + +Thu Nov 14 10:58:05 1991 Per Bothner (bothner at cygnus.com) + + * Makefile.in, config/mh-default: Re-do make magic + so that for the default ("automatic") mode we only + compile the files we actually need. Do this using + a recursive make: The top-level generates the list + of needed files (loosely, the ones missing in libc), + and then passes that list to the recursive make. + * config/mh-mach: Remove obsolete STRERROR-{C,O} macros. + +Tue Nov 12 19:10:57 1991 John Gilmore (gnu at cygnus.com) + + RS/6000 host support (grumble). + + * configure.in: Build alloca-conf.h file from alloca-norm.h + (everything else) or alloca-botch.h (rs/6000). + * Makefile.in: Include . on the include path. + * getopt.c: Use alloca-conf.h. + * alloca-norm.h: How to declare alloca on reasonable machines. + * alloca-botch.h: How to declare alloca on braindead machines. + +Tue Nov 12 09:21:48 1991 Fred Fish (fnf at cygnus.com) + + * concat.c : New file, like concat() in gdb but can take a + variable number of arguments rather than fixed at 3 args. For + now, client applications must supply an xmalloc(), which is a + front end function to malloc() that deals with out-of-memory + conditions. + + * Makefile.in: Add concat.c and concat.o to appropriate macros. + +Sat Nov 9 13:29:59 1991 Fred Fish (fnf at cygnus.com) + + * config/mh-svr4: Add sigsetmask to list of required functions. + +Sun Nov 3 11:57:56 1991 Per Bothner (bothner at cygnus.com) + + * vsprintf.c: New file. + * functions.def, Makefile.in: Add vsprintf. + +Sun Oct 27 16:31:22 1991 John Gilmore (gnu at cygnus.com) + + * configure.in, config/mh-rs6000: Add rs/6000 host support. + * Makefile.in: Compile with debug info. + +Fri Oct 25 17:01:12 1991 Per Bothner (bothner at cygnus.com) + + * Makefile.in, configure.in, and new files: dummy.c, functions.def, + config/mf-default: Added a default configuration mode, + which includes into libiberty.a functions that are "missing" in libc. + * strdup.c, vprintf.c, vfprintf.c: New files. + +Thu Oct 24 02:29:26 1991 Fred Fish (fnf at cygnus.com) + + * config/hmake-svr4: New file. + + * config/hmake-sysv: Add HOST_CFILES and HOST_OFILES. + + * basename.c, bcmp.c, bcopy.c, bzero.c, getpagesize.c getwd.c, + index.c, insque.c, rindex.c, spaces.c, strstr.c, vfork.c: New + files containing either portable C versions or emulations using + native library calls. + + * strerror.c: Add copyright, internal documentation, etc. + + * strtol.c: Replace hardwired hex constants with some more + portable macros. Remove illegal (according to gcc) cast. + + * strtoul.c: Replace hardwired hex constant with more portable + macro. + + * Makefile.in: Move TARGETLIB and CFLAGS where makefile fragments + can override them. Add new source and object file names to CFILES + and OFILES respectively. + + * configure.in: Add support for SVR4 makefile fragments. + +Tue Oct 22 19:00:23 1991 Steve Chamberlain (steve at cygnus.com) + + * Makefile.in: Move RANLIB, AR and AR_FLAGS to where they can be + over-ridden by config/hmake-* + * configure.in: added m88kcvs to sysv list + +Fri Oct 4 01:29:08 1991 John Gilmore (gnu at cygnus.com) + + * Makefile.in: Most hosts need strerror, but one or two don't, + and they override these definitions in the host-dependent makefile + fragment. + * config/hmake-mach: The odd man out on strerror -- it's supplied. + * strerror.c: New file. + + * strtol.c, strtoul.c: Add strtol to libiberty, since Mach lacks + it and bfd uses it. + * configure.in, Makefile.in, config/hmake-mach: Only configure + strtol & strotoul in on Mach. + +Tue Sep 3 06:36:23 1991 John Gilmore (gnu at cygint.cygnus.com) + + * obstack.c: Merge with latest FSF version. + + +Local Variables: +version-control: never +End: diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in new file mode 100755 index 0000000..fd70644 --- /dev/null +++ b/libiberty/Makefile.in @@ -0,0 +1,246 @@ +# +# Makefile +# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998 +# Free Software Foundation +# +# This file is part of the libiberty library. +# Libiberty is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# Libiberty is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with libiberty; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +# This file was written by K. Richard Pixley <rich@cygnus.com>. + +# +# Makefile for libiberty directory +# + +srcdir = @srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ + +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ + +SHELL = @SHELL@ + +# Multilib support variables. +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +AR = @AR@ +AR_FLAGS = rc + +CC = @CC@ +CFLAGS = @CFLAGS@ +LIBCFLAGS = $(CFLAGS) +RANLIB = @RANLIB@ + +PICFLAG = + +MAKEOVERRIDES = + +TARGETLIB = libiberty.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.) +EXTRA_OFILES = + +# Flags to pass to a recursive make. +FLAGS_TO_PASS = \ + "AR=$(AR)" \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC=$(CC)" \ + "CFLAGS=$(CFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "EXTRA_OFILES=$(EXTRA_OFILES)" \ + "HDEFINES=$(HDEFINES)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LOADLIBES=$(LOADLIBES)" \ + "RANLIB=$(RANLIB)" \ + "SHELL=$(SHELL)" + +all: stamp-picdir $(TARGETLIB) needed-list required-list + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all + +.PHONY: check installcheck +check installcheck: + +@host_makefile_frag@ + +INCDIR=$(srcdir)/$(MULTISRCTOP)../include + +COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) +.c.o: + test x"$(enable_shared)" != xyes || \ + $(COMPILE.c) $(PICFLAG) $< -o pic/$@ + $(COMPILE.c) $< + +info install-info clean-info dvi: + +# Include files that are in this directory. +HFILES = alloca-conf.h + +# NOTE: If you add new files to the library, add them to this list +# (alphabetical), and add them to REQUIRED_OFILES or funcs in +# configure.in. +CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \ + bzero.c choose-temp.c clock.c concat.c fdmatch.c \ + fnmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \ + getruntime.c floatformat.c hex.c index.c insque.c memchr.c \ + memcmp.c memcpy.c memmove.c memset.c mkstemp.c objalloc.c obstack.c \ + pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \ + splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c strerror.c \ + strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \ + tmpnam.c vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \ + waitpid.c xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c + +# These are always included in the library. +REQUIRED_OFILES = argv.o choose-temp.o concat.o \ + fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \ + floatformat.o mkstemp.o objalloc.o obstack.o pexecute.o spaces.o \ + splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \ + xstrdup.o xstrerror.o + +$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA) + rm -f $(TARGETLIB) + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA) + $(RANLIB) $(TARGETLIB) + +INSTALL_DEST = @INSTALL_DEST@ +install: install_to_$(INSTALL_DEST) + +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) + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install + +install_to_tooldir: all + $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n + ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB).n ) + mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB) + @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install + +# needed-list is used by libstdc++. +needed-list: Makefile + f="$(LIBOBJS) $(ALLOCA) $(EXTRA_OFILES)"; \ + case $$f in \ + *alloca.o*) f="$$f xmalloc.o xexit.o" ;; \ + esac; \ + echo $$f > needed-list + +# required-list was used when building a shared bfd/opcodes/libiberty +# library. I don't know if it used by anything currently. +required-list: Makefile + echo $(REQUIRED_OFILES) > required-list + +stamp-picdir: + if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \ + mkdir pic; \ + else true; fi + touch stamp-picdir + +.PHONY: all etags tags ls clean stage1 stage2 + +etags tags: TAGS + +TAGS: $(CFILES) $(HFILES) + etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done` + +# The standalone demangler (c++filt) has been moved to binutils. +demangle: + @echo "The standalone demangler, now named c++filt, is now" + @echo "a part of binutils." + @false + +ls: + @echo Makefile $(HFILES) $(CFILES) + +# Need to deal with profiled libraries, too. + +mostlyclean: + rm -rf *.o pic core errs \#* *.E a.out + rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-* + rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir + @$(MULTICLEAN) multi-clean DO=mostlyclean +clean: mostlyclean + rm -f *.a required-list tmpmulti.out + @$(MULTICLEAN) multi-clean DO=clean +distclean: clean + @$(MULTICLEAN) multi-clean DO=distclean + rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out + rm -f config.log +maintainer-clean realclean: distclean + +force: + +Makefile: $(srcdir)/Makefile.in config.status + CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status + +config.h: stamp-h ; @true +stamp-h: config.in config.status + CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status + +config.status: $(srcdir)/configure $(srcdir)/config.table + $(SHELL) ./config.status --recheck + +$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir + +alloca.o: config.h +atexit.o: config.h +argv.o: config.h alloca-conf.h $(INCDIR)/libiberty.h +basename.o: $(INCDIR)/libiberty.h +choose-temp.o: config.h +clock.o: config.h +concat.o: $(INCDIR)/libiberty.h +fdmatch.o: $(INCDIR)/libiberty.h +fnmatch.o: config.h $(INCDIR)/fnmatch.h +getcwd.o: config.h +getopt.o: config.h $(INCDIR)/getopt.h +getopt1.o: config.h $(INCDIR)/getopt.h +getpagesize.o: config.h +getruntime.o: config.h $(INCDIR)/libiberty.h +hex.o: $(INCDIR)/libiberty.h +floatformat.o: $(INCDIR)/floatformat.h +mkstemp.o: config.h +objalloc.o: $(INCDIR)/objalloc.h +obstack.o: config.h $(INCDIR)/obstack.h +pexecute.o: config.h $(INCDIR)/libiberty.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 +xstrdup.o: $(INCDIR)/libiberty.h +xstrerror.o: config.h $(INCDIR)/libiberty.h diff --git a/libiberty/README b/libiberty/README new file mode 100755 index 0000000..9f5226a --- /dev/null +++ b/libiberty/README @@ -0,0 +1,65 @@ +This directory contains the -liberty library of free software. +It is a collection of subroutines used by various GNU programs. +Current members include: + + getopt -- get options from command line + obstack -- stacks of arbitrarily-sized objects + strerror -- error message strings corresponding to errno + strtol -- string-to-long conversion + strtoul -- string-to-unsigned-long conversion + +We expect many of the GNU subroutines that are floating around to +eventually arrive here. + +The library must be configured from the top source directory. Don't +try to run configure in this directory. Follow the configuration +instructions in ../README. + +Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu". Thank you. + +ADDING A NEW FILE +================= + +There are two sets of files: Those that are "required" will be +included in the library for all configurations, while those +that are "optional" will be included in the library only if "needed." + +To add a new required file, edit Makefile to add the source file +name to CFILES and the object file to REQUIRED_OFILES. + +To add a new optional file, it must provide a single function, and the +name of the function must be the same as the name of the file. + + * Add the source file name to CFILES. + + * Add the function to name to the funcs shell variable in + configure.in. + + * Add the function to the AC_CHECK_FUNCS lists just after the + setting of the funcs shell variable. These AC_CHECK_FUNCS calls + are never executed; they are there to make autoheader work + better. + + * Consider the special cases of building libiberty; as of this + writing, the special cases are newlib and VxWorks. If a + particular special case provides the function, you do not need + to do anything. If it does not provide the function, add the + object file to LIBOBJS, and add the function name to the case + controlling whether to define HAVE_func. + +The optional file you've added (e.g. getcwd.c) should compile and work +on all hosts where it is needed. It does not have to work or even +compile on hosts where it is not needed. + +ADDING A NEW CONFIGURATION +========================== + +On most hosts you should be able to use the scheme for automatically +figuring out which files are needed. In that case, you probably +don't need a special Makefile stub for that configuration. + +If the fully automatic scheme doesn't work, you may be able to get +by with defining EXTRA_OFILES in your Makefile stub. This is +a list of object file names that should be treated as required +for this configuration - they will be included in libiberty.a, +regardless of whatever might be in the C library. diff --git a/libiberty/acconfig.h b/libiberty/acconfig.h new file mode 100755 index 0000000..f7c599d --- /dev/null +++ b/libiberty/acconfig.h @@ -0,0 +1,11 @@ +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST + +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR + +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR diff --git a/libiberty/alloca-conf.h b/libiberty/alloca-conf.h new file mode 100755 index 0000000..4eb87d3 --- /dev/null +++ b/libiberty/alloca-conf.h @@ -0,0 +1,24 @@ +#include "config.h" + +#ifdef __GNUC__ +# ifndef alloca +# define alloca __builtin_alloca +# endif +#else /* ! defined (__GNUC__) */ +# ifdef _AIX + #pragma alloca +# else +# ifdef HAVE_ALLOCA_H +# include <alloca.h> +# else /* ! defined (HAVE_ALLOCA_H) */ +# ifdef __STDC__ +extern PTR alloca (size_t); +# else /* ! defined (__STDC__) */ +extern PTR alloca (); +# endif /* ! defined (__STDC__) */ +# endif /* ! defined (HAVE_ALLOCA_H) */ +# ifdef _WIN32 +# include <malloc.h> +# endif +# endif /* ! defined (_AIX) */ +#endif /* ! defined (__GNUC__) */ diff --git a/libiberty/alloca.c b/libiberty/alloca.c new file mode 100755 index 0000000..0f8a215 --- /dev/null +++ b/libiberty/alloca.c @@ -0,0 +1,505 @@ +/* alloca.c -- allocate automatically reclaimed memory + (Mostly) portable public-domain implementation -- D A Gwyn + + This implementation of the PWB library alloca function, + which is used to allocate space off the run-time stack so + that it is automatically reclaimed upon procedure exit, + was inspired by discussions with J. Q. Johnson of Cornell. + J.Otto Tennant <jot@cray.com> contributed the Cray support. + + There are some preprocessor constants that can + be defined when compiling for your specific system, for + improved efficiency; however, the defaults should be okay. + + The general concept of this implementation is to keep + track of all alloca-allocated blocks, and reclaim any + that are found to be deeper in the stack than the current + invocation. This heuristic does not reclaim storage as + soon as it becomes invalid, but it will do so eventually. + + As a special case, alloca(0) reclaims storage without + allocating any. It is a good idea to use alloca(0) in + your main control loop, etc. to force garbage collection. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef emacs +#include "blockinput.h" +#endif + +/* If compiling with GCC 2, this file's not needed. Except of course if + the C alloca is explicitly requested. */ +#if defined (USE_C_ALLOCA) || !defined (__GNUC__) || __GNUC__ < 2 + +/* If someone has defined alloca as a macro, + there must be some other way alloca is supposed to work. */ +#ifndef alloca + +#ifdef emacs +#ifdef static +/* actually, only want this if static is defined as "" + -- this is for usg, in which emacs must undefine static + in order to make unexec workable + */ +#ifndef STACK_DIRECTION +you +lose +-- must know STACK_DIRECTION at compile-time +#endif /* STACK_DIRECTION undefined */ +#endif /* static */ +#endif /* emacs */ + +/* If your stack is a linked list of frames, you have to + provide an "address metric" ADDRESS_FUNCTION macro. */ + +#if defined (CRAY) && defined (CRAY_STACKSEG_END) +long i00afunc (); +#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) +#else +#define ADDRESS_FUNCTION(arg) &(arg) +#endif + +#if __STDC__ +typedef void *pointer; +#else +typedef char *pointer; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +/* Different portions of Emacs need to call different versions of + malloc. The Emacs executable needs alloca to call xmalloc, because + ordinary malloc isn't protected from input signals. On the other + hand, the utilities in lib-src need alloca to call malloc; some of + them are very simple, and don't have an xmalloc routine. + + Non-Emacs programs expect this to call use xmalloc. + + Callers below should use malloc. */ + +#ifndef emacs +#define malloc xmalloc +#endif +extern pointer malloc (); + +/* Define STACK_DIRECTION 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 */ + +#ifndef STACK_DIRECTION +#define STACK_DIRECTION 0 /* Direction unknown. */ +#endif + +#if STACK_DIRECTION != 0 + +#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ + +#else /* STACK_DIRECTION == 0; need run-time code. */ + +static int stack_dir; /* 1 or -1 once known. */ +#define STACK_DIR stack_dir + +static void +find_stack_direction () +{ + static char *addr = NULL; /* Address of first `dummy', once known. */ + auto char dummy; /* To get stack address. */ + + if (addr == NULL) + { /* Initial entry. */ + addr = ADDRESS_FUNCTION (dummy); + + find_stack_direction (); /* Recurse once. */ + } + else + { + /* Second entry. */ + if (ADDRESS_FUNCTION (dummy) > addr) + stack_dir = 1; /* Stack grew upward. */ + else + stack_dir = -1; /* Stack grew downward. */ + } +} + +#endif /* STACK_DIRECTION == 0 */ + +/* An "alloca header" is used to: + (a) chain together all alloca'ed blocks; + (b) keep track of stack depth. + + It is very important that sizeof(header) agree with malloc + alignment chunk size. The following default should work okay. */ + +#ifndef ALIGN_SIZE +#define ALIGN_SIZE sizeof(double) +#endif + +typedef union hdr +{ + char align[ALIGN_SIZE]; /* To force sizeof(header). */ + struct + { + union hdr *next; /* For chaining headers. */ + char *deep; /* For stack depth measure. */ + } h; +} header; + +static header *last_alloca_header = NULL; /* -> last alloca header. */ + +/* Return a pointer to at least SIZE bytes of storage, + which will be automatically reclaimed upon exit from + the procedure that called alloca. Originally, this space + was supposed to be taken from the current stack frame of the + caller, but that method cannot be made to work for some + implementations of C, for example under Gould's UTX/32. */ + +pointer +alloca (size) + unsigned size; +{ + auto char probe; /* Probes stack depth: */ + register char *depth = ADDRESS_FUNCTION (probe); + +#if STACK_DIRECTION == 0 + if (STACK_DIR == 0) /* Unknown growth direction. */ + find_stack_direction (); +#endif + + /* Reclaim garbage, defined as all alloca'd storage that + was allocated from deeper in the stack than currently. */ + + { + register header *hp; /* Traverses linked list. */ + +#ifdef emacs + BLOCK_INPUT; +#endif + + for (hp = last_alloca_header; hp != NULL;) + if ((STACK_DIR > 0 && hp->h.deep > depth) + || (STACK_DIR < 0 && hp->h.deep < depth)) + { + register header *np = hp->h.next; + + free ((pointer) hp); /* Collect garbage. */ + + hp = np; /* -> next header. */ + } + else + break; /* Rest are not deeper. */ + + last_alloca_header = hp; /* -> last valid storage. */ + +#ifdef emacs + UNBLOCK_INPUT; +#endif + } + + if (size == 0) + return NULL; /* No allocation required. */ + + /* Allocate combined header + user data storage. */ + + { + register pointer new = malloc (sizeof (header) + size); + /* Address of header. */ + + if (new == 0) + abort(); + + ((header *) new)->h.next = last_alloca_header; + ((header *) new)->h.deep = depth; + + last_alloca_header = (header *) new; + + /* User storage begins just after header. */ + + return (pointer) ((char *) new + sizeof (header)); + } +} + +#if defined (CRAY) && defined (CRAY_STACKSEG_END) + +#ifdef DEBUG_I00AFUNC +#include <stdio.h> +#endif + +#ifndef CRAY_STACK +#define CRAY_STACK +#ifndef CRAY2 +/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ +struct stack_control_header + { + long shgrow:32; /* Number of times stack has grown. */ + long shaseg:32; /* Size of increments to stack. */ + long shhwm:32; /* High water mark of stack. */ + long shsize:32; /* Current size of stack (all segments). */ + }; + +/* The stack segment linkage control information occurs at + the high-address end of a stack segment. (The stack + grows from low addresses to high addresses.) The initial + part of the stack segment linkage control information is + 0200 (octal) words. This provides for register storage + for the routine which overflows the stack. */ + +struct stack_segment_linkage + { + long ss[0200]; /* 0200 overflow words. */ + long sssize:32; /* Number of words in this segment. */ + long ssbase:32; /* Offset to stack base. */ + long:32; + long sspseg:32; /* Offset to linkage control of previous + segment of stack. */ + long:32; + long sstcpt:32; /* Pointer to task common address block. */ + long sscsnm; /* Private control structure number for + microtasking. */ + long ssusr1; /* Reserved for user. */ + long ssusr2; /* Reserved for user. */ + long sstpid; /* Process ID for pid based multi-tasking. */ + long ssgvup; /* Pointer to multitasking thread giveup. */ + long sscray[7]; /* Reserved for Cray Research. */ + long ssa0; + long ssa1; + long ssa2; + long ssa3; + long ssa4; + long ssa5; + long ssa6; + long ssa7; + long sss0; + long sss1; + long sss2; + long sss3; + long sss4; + long sss5; + long sss6; + long sss7; + }; + +#else /* CRAY2 */ +/* The following structure defines the vector of words + returned by the STKSTAT library routine. */ +struct stk_stat + { + long now; /* Current total stack size. */ + long maxc; /* Amount of contiguous space which would + be required to satisfy the maximum + stack demand to date. */ + long high_water; /* Stack high-water mark. */ + long overflows; /* Number of stack overflow ($STKOFEN) calls. */ + long hits; /* Number of internal buffer hits. */ + long extends; /* Number of block extensions. */ + long stko_mallocs; /* Block allocations by $STKOFEN. */ + long underflows; /* Number of stack underflow calls ($STKRETN). */ + long stko_free; /* Number of deallocations by $STKRETN. */ + long stkm_free; /* Number of deallocations by $STKMRET. */ + long segments; /* Current number of stack segments. */ + long maxs; /* Maximum number of stack segments so far. */ + long pad_size; /* Stack pad size. */ + long current_address; /* Current stack segment address. */ + long current_size; /* Current stack segment size. This + number is actually corrupted by STKSTAT to + include the fifteen word trailer area. */ + long initial_address; /* Address of initial segment. */ + long initial_size; /* Size of initial segment. */ + }; + +/* The following structure describes the data structure which trails + any stack segment. I think that the description in 'asdef' is + out of date. I only describe the parts that I am sure about. */ + +struct stk_trailer + { + long this_address; /* Address of this block. */ + long this_size; /* Size of this block (does not include + this trailer). */ + long unknown2; + long unknown3; + long link; /* Address of trailer block of previous + segment. */ + long unknown5; + long unknown6; + long unknown7; + long unknown8; + long unknown9; + long unknown10; + long unknown11; + long unknown12; + long unknown13; + long unknown14; + }; + +#endif /* CRAY2 */ +#endif /* not CRAY_STACK */ + +#ifdef CRAY2 +/* Determine a "stack measure" for an arbitrary ADDRESS. + I doubt that "lint" will like this much. */ + +static long +i00afunc (long *address) +{ + struct stk_stat status; + struct stk_trailer *trailer; + long *block, size; + long result = 0; + + /* We want to iterate through all of the segments. The first + step is to get the stack status structure. We could do this + more quickly and more directly, perhaps, by referencing the + $LM00 common block, but I know that this works. */ + + STKSTAT (&status); + + /* Set up the iteration. */ + + trailer = (struct stk_trailer *) (status.current_address + + status.current_size + - 15); + + /* There must be at least one stack segment. Therefore it is + a fatal error if "trailer" is null. */ + + if (trailer == 0) + abort (); + + /* Discard segments that do not contain our argument address. */ + + while (trailer != 0) + { + block = (long *) trailer->this_address; + size = trailer->this_size; + if (block == 0 || size == 0) + abort (); + trailer = (struct stk_trailer *) trailer->link; + if ((block <= address) && (address < (block + size))) + break; + } + + /* Set the result to the offset in this segment and add the sizes + of all predecessor segments. */ + + result = address - block; + + if (trailer == 0) + { + return result; + } + + do + { + if (trailer->this_size <= 0) + abort (); + result += trailer->this_size; + trailer = (struct stk_trailer *) trailer->link; + } + while (trailer != 0); + + /* We are done. Note that if you present a bogus address (one + not in any segment), you will get a different number back, formed + from subtracting the address of the first block. This is probably + not what you want. */ + + return (result); +} + +#else /* not CRAY2 */ +/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. + Determine the number of the cell within the stack, + given the address of the cell. The purpose of this + routine is to linearize, in some sense, stack addresses + for alloca. */ + +static long +i00afunc (long address) +{ + long stkl = 0; + + long size, pseg, this_segment, stack; + long result = 0; + + struct stack_segment_linkage *ssptr; + + /* Register B67 contains the address of the end of the + current stack segment. If you (as a subprogram) store + your registers on the stack and find that you are past + the contents of B67, you have overflowed the segment. + + B67 also points to the stack segment linkage control + area, which is what we are really interested in. */ + + stkl = CRAY_STACKSEG_END (); + ssptr = (struct stack_segment_linkage *) stkl; + + /* If one subtracts 'size' from the end of the segment, + one has the address of the first word of the segment. + + If this is not the first segment, 'pseg' will be + nonzero. */ + + pseg = ssptr->sspseg; + size = ssptr->sssize; + + this_segment = stkl - size; + + /* It is possible that calling this routine itself caused + a stack overflow. Discard stack segments which do not + contain the target address. */ + + while (!(this_segment <= address && address <= stkl)) + { +#ifdef DEBUG_I00AFUNC + fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); +#endif + if (pseg == 0) + break; + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; + pseg = ssptr->sspseg; + this_segment = stkl - size; + } + + result = address - this_segment; + + /* If you subtract pseg from the current end of the stack, + you get the address of the previous stack segment's end. + This seems a little convoluted to me, but I'll bet you save + a cycle somewhere. */ + + while (pseg != 0) + { +#ifdef DEBUG_I00AFUNC + fprintf (stderr, "%011o %011o\n", pseg, size); +#endif + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; + pseg = ssptr->sspseg; + result += size; + } + return (result); +} + +#endif /* not CRAY2 */ +#endif /* CRAY */ + +#endif /* no alloca */ +#endif /* not GCC version 2 */ diff --git a/libiberty/argv.c b/libiberty/argv.c new file mode 100755 index 0000000..85c17e9 --- /dev/null +++ b/libiberty/argv.c @@ -0,0 +1,390 @@ +/* Create and destroy argument vectors (argv's) + Copyright (C) 1992 Free Software Foundation, Inc. + Written by Fred Fish @ Cygnus Support + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +/* Create and destroy argument vectors. An argument vector is simply an + array of string pointers, terminated by a NULL pointer. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#ifdef isspace +#undef isspace +#endif +#define isspace(ch) ((ch) == ' ' || (ch) == '\t') + +/* Routines imported from standard C runtime libraries. */ + +#ifdef __STDC__ + +#include <stddef.h> +extern void *memcpy (void *s1, const void *s2, size_t n); /* 4.11.2.1 */ +extern size_t strlen (const char *s); /* 4.11.6.3 */ +extern void *malloc (size_t size); /* 4.10.3.3 */ +extern void *realloc (void *ptr, size_t size); /* 4.10.3.4 */ +extern void free (void *ptr); /* 4.10.3.2 */ +extern char *strdup (const char *s); /* Non-ANSI */ + +#else /* !__STDC__ */ + +#if !defined _WIN32 || defined __GNUC__ +extern char *memcpy (); /* Copy memory region */ +extern int strlen (); /* Count length of string */ +extern char *malloc (); /* Standard memory allocater */ +extern char *realloc (); /* Standard memory reallocator */ +extern void free (); /* Free malloc'd memory */ +extern char *strdup (); /* Duplicate a string */ +#endif + +#endif /* __STDC__ */ + +#include "alloca-conf.h" + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef EOS +#define EOS '\0' +#endif + +#define INITIAL_MAXARGC 8 /* Number of args + NULL in initial argv */ + + +/* + +NAME + + dupargv -- duplicate an 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. + +*/ + +char ** +dupargv (argv) + char **argv; +{ + int argc; + char **copy; + + if (argv == NULL) + return NULL; + + /* the vector */ + for (argc = 0; argv[argc] != NULL; argc++); + copy = (char **) malloc ((argc + 1) * sizeof (char *)); + if (copy == NULL) + return NULL; + + /* the strings */ + for (argc = 0; argv[argc] != NULL; argc++) + { + int len = strlen (argv[argc]); + copy[argc] = malloc (sizeof (char *) * (len + 1)); + if (copy[argc] == NULL) + { + freeargv (copy); + return NULL; + } + strcpy (copy[argc], argv[argc]); + } + copy[argc] = NULL; + return copy; +} + +/* + +NAME + + freeargv -- free an argument vector + +SYNOPSIS + + void freeargv (vector) + char **vector; + +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. + +*/ + +void freeargv (vector) +char **vector; +{ + register char **scan; + + if (vector != NULL) + { + for (scan = vector; *scan != NULL; scan++) + { + free (*scan); + } + free (vector); + } +} + +/* + +NAME + + buildargv -- build an argument vector from a string + +SYNOPSIS + + char **buildargv (sp) + char *sp; + +DESCRIPTION + + 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. + + 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. + + The memory for the argv array is dynamically expanded as necessary. + +RETURNS + + 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. + +NOTES + + 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. + + 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; +{ + char *arg; + char *copybuf; + int squote = 0; + int dquote = 0; + int bsquote = 0; + int argc = 0; + int maxargc = 0; + char **argv = NULL; + char **nargv; + + if (input != NULL) + { + copybuf = (char *) alloca (strlen (input) + 1); + /* Is a do{}while to always execute the loop once. Always return an + argv, even for null strings. See NOTES above, test case below. */ + do + { + /* Pick off argv[argc] */ + while (isspace (*input)) + { + input++; + } + if ((maxargc == 0) || (argc >= (maxargc - 1))) + { + /* argv needs initialization, or expansion */ + if (argv == NULL) + { + maxargc = INITIAL_MAXARGC; + nargv = (char **) malloc (maxargc * sizeof (char *)); + } + else + { + maxargc *= 2; + nargv = (char **) realloc (argv, maxargc * sizeof (char *)); + } + if (nargv == NULL) + { + if (argv != NULL) + { + freeargv (argv); + argv = NULL; + } + break; + } + argv = nargv; + argv[argc] = NULL; + } + /* Begin scanning arg */ + arg = copybuf; + while (*input != EOS) + { + if (isspace (*input) && !squote && !dquote && !bsquote) + { + break; + } + else + { + if (bsquote) + { + bsquote = 0; + *arg++ = *input; + } + else if (*input == '\\') + { + bsquote = 1; + } + else if (squote) + { + if (*input == '\'') + { + squote = 0; + } + else + { + *arg++ = *input; + } + } + else if (dquote) + { + if (*input == '"') + { + dquote = 0; + } + else + { + *arg++ = *input; + } + } + else + { + if (*input == '\'') + { + squote = 1; + } + else if (*input == '"') + { + dquote = 1; + } + else + { + *arg++ = *input; + } + } + input++; + } + } + *arg = EOS; + argv[argc] = strdup (copybuf); + if (argv[argc] == NULL) + { + freeargv (argv); + argv = NULL; + break; + } + argc++; + argv[argc] = NULL; + + while (isspace (*input)) + { + input++; + } + } + while (*input != EOS); + } + return (argv); +} + +#ifdef MAIN + +/* Simple little test driver. */ + +static char *tests[] = +{ + "a simple command line", + "arg 'foo' is single quoted", + "arg \"bar\" is double quoted", + "arg \"foo bar\" has embedded whitespace", + "arg 'Jack said \\'hi\\'' has single quotes", + "arg 'Jack said \\\"hi\\\"' has double quotes", + "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9", + + /* This should be expanded into only one argument. */ + "trailing-whitespace ", + + "", + NULL +}; + +main () +{ + char **argv; + char **test; + char **targs; + + for (test = tests; *test != NULL; test++) + { + printf ("buildargv(\"%s\")\n", *test); + if ((argv = buildargv (*test)) == NULL) + { + printf ("failed!\n\n"); + } + else + { + for (targs = argv; *targs != NULL; targs++) + { + printf ("\t\"%s\"\n", *targs); + } + printf ("\n"); + } + freeargv (argv); + } + +} + +#endif /* MAIN */ diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c new file mode 100755 index 0000000..5aaf320 --- /dev/null +++ b/libiberty/asprintf.c @@ -0,0 +1,57 @@ +/* Like sprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1997 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#if defined (ANSI_PROTOTYPES) || defined (ALMOST_STDC) +#define USE_STDARG +#endif + +#ifdef USE_STDARG +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +/* VARARGS */ +#ifdef USE_STDARG +int +asprintf (char **buf, const char *fmt, ...) +#else +int +asprintf (buf, fmt, va_alist) + char **buf; + const char *fmt; + va_dcl +#endif +{ + int status; + va_list ap; +#ifdef USE_STDARG + va_start (ap, fmt); +#else + va_start (ap); +#endif + status = vasprintf (buf, fmt, ap); + va_end (ap); + return status; +} diff --git a/libiberty/atexit.c b/libiberty/atexit.c new file mode 100755 index 0000000..137d985 --- /dev/null +++ b/libiberty/atexit.c @@ -0,0 +1,18 @@ +/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ +/* This function is in the public domain. --Mike Stump. */ + +#include "config.h" + +#ifdef HAVE_ON_EXIT + +int +atexit(f) + void (*f)(); +{ + /* If the system doesn't provide a definition for atexit, use on_exit + if the system provides that. */ + on_exit (f, 0); + return 0; +} + +#endif diff --git a/libiberty/basename.c b/libiberty/basename.c new file mode 100755 index 0000000..f544c85 --- /dev/null +++ b/libiberty/basename.c @@ -0,0 +1,37 @@ +/* Return the basename of a pathname. + This file is in the public domain. */ + +/* +NAME + basename -- return pointer to last component of a pathname + +SYNOPSIS + char *basename (const char *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). + +BUGS + Presumes a UNIX style path with UNIX style separators. +*/ + +#include "ansidecl.h" +#include "libiberty.h" + +char * +basename (name) + const char *name; +{ + const char *base = name; + + while (*name) + { + if (*name++ == '/') + { + base = name; + } + } + return (char *) base; +} diff --git a/libiberty/bcmp.c b/libiberty/bcmp.c new file mode 100755 index 0000000..11e4417 --- /dev/null +++ b/libiberty/bcmp.c @@ -0,0 +1,49 @@ +/* bcmp + This function is in the public domain. */ + +/* + +NAME + + bcmp -- compare two memory regions + +SYNOPSIS + + int bcmp (char *from, char *to, int count) + +DESCRIPTION + + Compare two memory regions and return zero if they are identical, + non-zero otherwise. If count is zero, return zero. + +NOTES + + No guarantee is made about the non-zero returned value. In + particular, the results may be signficantly different than + strcmp(), where the return value is guaranteed to be less than, + equal to, or greater than zero, according to lexicographical + sorting of the compared regions. + +BUGS + +*/ + + +int +bcmp (from, to, count) + char *from, *to; + int count; +{ + int rtnval = 0; + + while (count-- > 0) + { + if (*from++ != *to++) + { + rtnval = 1; + break; + } + } + return (rtnval); +} + diff --git a/libiberty/bcopy.c b/libiberty/bcopy.c new file mode 100755 index 0000000..b655363 --- /dev/null +++ b/libiberty/bcopy.c @@ -0,0 +1,35 @@ +/* bcopy -- copy memory regions of arbitary length + +NAME + bcopy -- copy memory regions of arbitrary length + +SYNOPSIS + void bcopy (char *in, char *out, int length) + +DESCRIPTION + Copy LENGTH bytes from memory region pointed to by IN to memory + region pointed to by OUT. + +BUGS + Significant speed improvements can be made in some cases by + implementing copies of multiple bytes simultaneously, or unrolling + the copy loop. + +*/ + +void +bcopy (src, dest, len) + register char *src, *dest; + int len; +{ + if (dest < src) + while (len--) + *dest++ = *src++; + else + { + char *lasts = src + (len-1); + char *lastd = dest + (len-1); + while (len--) + *(char *)lastd-- = *(char *)lasts--; + } +} diff --git a/libiberty/bzero.c b/libiberty/bzero.c new file mode 100755 index 0000000..d01644b --- /dev/null +++ b/libiberty/bzero.c @@ -0,0 +1,31 @@ +/* Portable version of bzero for systems without it. + This function is in the public domain. */ + +/* +NAME + bzero -- zero the contents of a specified memory region + +SYNOPSIS + void bzero (char *to, int count) + +DESCRIPTION + Zero COUNT bytes of memory pointed to by TO. + +BUGS + Significant speed enhancements may be made in some environments + by zeroing more than a single byte at a time, or by unrolling the + loop. + +*/ + + +void +bzero (to, count) + char *to; + int count; +{ + while (count-- > 0) + { + *to++ = 0; + } +} diff --git a/libiberty/calloc.c b/libiberty/calloc.c new file mode 100755 index 0000000..c8c0a78 --- /dev/null +++ b/libiberty/calloc.c @@ -0,0 +1,26 @@ +#include "ansidecl.h" +#include "libiberty.h" + +#ifdef ANSI_PROTOTYPES +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +/* For systems with larger pointers than ints, this must be declared. */ +PTR malloc PARAMS ((size_t)); + +PTR +calloc (nelem, elsize) + size_t nelem, elsize; +{ + register PTR ptr; + + if (nelem == 0 || elsize == 0) + nelem = elsize = 1; + + ptr = malloc (nelem * elsize); + if (ptr) bzero (ptr, nelem * elsize); + + return ptr; +} diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c new file mode 100755 index 0000000..49c7386 --- /dev/null +++ b/libiberty/choose-temp.c @@ -0,0 +1,203 @@ +/* Utility to pick a temporary filename prefix. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* This file exports two functions: choose_temp_base and make_temp_file. */ + +/* This file lives in at least two places: libiberty and gcc. + Don't change one without the other. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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_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) +#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 + +/* Name of temporary file. + mktemp requires 6 trailing X's. */ +#define TEMP_FILE "ccXXXXXX" + +/* 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; +} + +/* 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. + + This function is provided for backwards compatability only. It use + is not recommended. */ + +char * +choose_temp_base () +{ + char *base = 0; + 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); + 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); + if (strlen (temp_filename) == 0) + abort (); + return temp_filename; +} +/* Return a temporary file name (as a string) or NULL if unable to create + one. */ + +char * +make_temp_file (suffix) + 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/libiberty/clock.c b/libiberty/clock.c new file mode 100755 index 0000000..b204566 --- /dev/null +++ b/libiberty/clock.c @@ -0,0 +1,75 @@ +/* ANSI-compatible clock function. + Copyright (C) 1994, 1995 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 +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 library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +the resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why +the executable file might be covered by the GNU General Public License. */ + +#include "config.h" + +#ifdef HAVE_GETRUSAGE +#include <sys/time.h> +#include <sys/resource.h> +#endif + +#ifdef HAVE_TIMES +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <sys/times.h> +#endif + +/* FIXME: should be able to declare as clock_t. */ + +long +clock () +{ +#ifdef HAVE_GETRUSAGE + struct rusage rusage; + + getrusage (0, &rusage); + return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec + + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); +#else +#ifdef HAVE_TIMES + struct tms tms; + + times (&tms); + return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ); +#else +#ifdef VMS + struct + { + int proc_user_time; + int proc_system_time; + int child_user_time; + int child_system_time; + } vms_times; + + times (&vms_times); + return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000; +#else + /* A fallback, if nothing else available. */ + return 0; +#endif /* VMS */ +#endif /* HAVE_TIMES */ +#endif /* HAVE_GETRUSAGE */ +} + diff --git a/libiberty/concat.c b/libiberty/concat.c new file mode 100755 index 0000000..5b132c8 --- /dev/null +++ b/libiberty/concat.c @@ -0,0 +1,167 @@ +/* Concatenate variable number of strings. + Copyright (C) 1991, 1994 Free Software Foundation, Inc. + Written by Fred Fish @ Cygnus Support + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +/* + +NAME + + concat -- concatenate a variable number of strings + +SYNOPSIS + + #include <varargs.h> + + char *concat (s1, s2, s3, ..., NULL) + +DESCRIPTION + + Concatenate a variable number of strings and return the result + in freshly malloc'd memory. + + Returns NULL if insufficient memory is available. The argument + list is terminated by the first NULL pointer encountered. Pointers + to empty strings are ignored. + +NOTES + + This function uses xmalloc() which is expected to be a front end + function to malloc() that deals with low memory situations. In + typical use, if malloc() returns NULL then xmalloc() diverts to an + error handler routine which never returns, and thus xmalloc will + never return a NULL pointer. If the client application wishes to + deal with low memory situations itself, it should supply an xmalloc + that just directly invokes malloc and blindly returns whatever + malloc returns. +*/ + + +#include "ansidecl.h" +#include "libiberty.h" + +#ifdef ANSI_PROTOTYPES +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +#ifdef __STDC__ +#include <stddef.h> +extern size_t strlen (const char *s); +#else +extern int strlen (); +#endif + +#define NULLP (char *)0 + +/* VARARGS */ +#ifdef ANSI_PROTOTYPES +char * +concat (const char *first, ...) +#else +char * +concat (va_alist) + va_dcl +#endif +{ + register int length; + register char *newstr; + register char *end; + register const char *arg; + va_list args; +#ifndef ANSI_PROTOTYPES + const char *first; +#endif + + /* First compute the size of the result and get sufficient memory. */ + +#ifdef ANSI_PROTOTYPES + va_start (args, first); +#else + va_start (args); + first = va_arg (args, const char *); +#endif + + if (first == NULLP) + length = 0; + else + { + length = strlen (first); + while ((arg = va_arg (args, const char *)) != NULLP) + { + length += strlen (arg); + } + } + newstr = (char *) xmalloc (length + 1); + va_end (args); + + /* Now copy the individual pieces to the result string. */ + + if (newstr != NULLP) + { +#ifdef ANSI_PROTOTYPES + va_start (args, first); +#else + va_start (args); + first = va_arg (args, const char *); +#endif + end = newstr; + if (first != NULLP) + { + arg = first; + while (*arg) + { + *end++ = *arg++; + } + while ((arg = va_arg (args, const char *)) != NULLP) + { + while (*arg) + { + *end++ = *arg++; + } + } + } + *end = '\000'; + va_end (args); + } + + return (newstr); +} + +#ifdef MAIN + +/* Simple little test driver. */ + +#include <stdio.h> + +int +main () +{ + printf ("\"\" = \"%s\"\n", concat (NULLP)); + printf ("\"a\" = \"%s\"\n", concat ("a", NULLP)); + printf ("\"ab\" = \"%s\"\n", concat ("a", "b", NULLP)); + printf ("\"abc\" = \"%s\"\n", concat ("a", "b", "c", NULLP)); + printf ("\"abcd\" = \"%s\"\n", concat ("ab", "cd", NULLP)); + printf ("\"abcde\" = \"%s\"\n", concat ("ab", "c", "de", NULLP)); + printf ("\"abcdef\" = \"%s\"\n", concat ("", "a", "", "bcd", "ef", NULLP)); + return 0; +} + +#endif diff --git a/libiberty/config.h-vms b/libiberty/config.h-vms new file mode 100755 index 0000000..ccac6a2 --- /dev/null +++ b/libiberty/config.h-vms @@ -0,0 +1,13 @@ +#ifndef NEED_strerror +#define NEED_strerror +#endif +#ifndef NEED_basename +#define NEED_basename +#endif +#ifndef NEED_psignal +#define NEED_psignal +#endif +#ifndef NEED_on_exit +#define NEED_on_exit +#endif + diff --git a/libiberty/config.in b/libiberty/config.in new file mode 100755 index 0000000..ba72d86 --- /dev/null +++ b/libiberty/config.in @@ -0,0 +1,203 @@ +/* config.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if you have <vfork.h>. */ +#undef HAVE_VFORK_H + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef pid_t + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define vfork as fork if vfork does not work. */ +#undef vfork + +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST + +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR + +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the asprintf function. */ +#undef HAVE_ASPRINTF + +/* Define if you have the atexit function. */ +#undef HAVE_ATEXIT + +/* Define if you have the basename function. */ +#undef HAVE_BASENAME + +/* Define if you have the bcmp function. */ +#undef HAVE_BCMP + +/* Define if you have the bcopy function. */ +#undef HAVE_BCOPY + +/* Define if you have the bzero function. */ +#undef HAVE_BZERO + +/* Define if you have the calloc function. */ +#undef HAVE_CALLOC + +/* Define if you have the clock function. */ +#undef HAVE_CLOCK + +/* Define if you have the getcwd function. */ +#undef HAVE_GETCWD + +/* Define if you have the getpagesize function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the getrusage function. */ +#undef HAVE_GETRUSAGE + +/* Define if you have the index function. */ +#undef HAVE_INDEX + +/* Define if you have the insque function. */ +#undef HAVE_INSQUE + +/* Define if you have the memchr function. */ +#undef HAVE_MEMCHR + +/* Define if you have the memcmp function. */ +#undef HAVE_MEMCMP + +/* Define if you have the memcpy function. */ +#undef HAVE_MEMCPY + +/* Define if you have the memmove function. */ +#undef HAVE_MEMMOVE + +/* Define if you have the memset function. */ +#undef HAVE_MEMSET + +/* Define if you have the on_exit function. */ +#undef HAVE_ON_EXIT + +/* Define if you have the psignal function. */ +#undef HAVE_PSIGNAL + +/* Define if you have the random function. */ +#undef HAVE_RANDOM + +/* Define if you have the rename function. */ +#undef HAVE_RENAME + +/* Define if you have the rindex function. */ +#undef HAVE_RINDEX + +/* Define if you have the sigsetmask function. */ +#undef HAVE_SIGSETMASK + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the strncasecmp function. */ +#undef HAVE_STRNCASECMP + +/* Define if you have the strrchr function. */ +#undef HAVE_STRRCHR + +/* Define if you have the strsignal function. */ +#undef HAVE_STRSIGNAL + +/* Define if you have the strstr function. */ +#undef HAVE_STRSTR + +/* Define if you have the strtod function. */ +#undef HAVE_STRTOD + +/* Define if you have the strtol function. */ +#undef HAVE_STRTOL + +/* Define if you have the strtoul function. */ +#undef HAVE_STRTOUL + +/* Define if you have the sysconf function. */ +#undef HAVE_SYSCONF + +/* Define if you have the times function. */ +#undef HAVE_TIMES + +/* Define if you have the tmpnam function. */ +#undef HAVE_TMPNAM + +/* Define if you have the vasprintf function. */ +#undef HAVE_VASPRINTF + +/* Define if you have the vfprintf function. */ +#undef HAVE_VFPRINTF + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if you have the vsprintf function. */ +#undef HAVE_VSPRINTF + +/* Define if you have the waitpid function. */ +#undef HAVE_WAITPID + +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the <sys/file.h> header file. */ +#undef HAVE_SYS_FILE_H + +/* Define if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H diff --git a/libiberty/config.table b/libiberty/config.table new file mode 100755 index 0000000..00944f3 --- /dev/null +++ b/libiberty/config.table @@ -0,0 +1,55 @@ +case "${host}" in + rs6000-ibm-aix3.1 | rs6000-ibm-aix) + frag=mh-aix ;; + *-*-cxux7*) frag=mh-cxux7 ;; + *-*-freebsd2.1.*) frag=mh-fbsd21 ;; + *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;; + i[345]86-*-windows*) frag=mh-windows ;; +esac + +frags=$frag + +# If they didn't specify --enable-shared, don't generate shared libs. +case "${enable_shared}" in + yes) shared=yes ;; + no) shared=no ;; + "") shared=no ;; + *) shared=yes ;; +esac +if [ "${shared}" = "yes" ]; then + case "${host}" in + *-*-cygwin32*) ;; + hppa*-*-*) frags="${frags} ../../config/mh-papic" ;; + i[3456]86-*-*) frags="${frags} ../../config/mh-x86pic" ;; + *-*-*) frags="${frags} ../../config/mh-${host_cpu}pic" ;; + esac +fi + +echo "# Warning: this fragment is automatically generated" > temp-frag + +for frag in ${frags}; do + case ${frag} in + ../* ) + if [ ${srcdir} = . ]; then + [ -n "${with_target_subdir}" ] && frag=../${frag} + [ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag} + fi + ;; + esac + frag=${srcdir}/${xsrcdir}config/$frag + if [ -f ${frag} ]; then + echo "Appending ${frag} to xhost-mkfrag" + echo "# Following fragment copied from ${frag}" >> temp-frag + cat ${frag} >> temp-frag + fi +done + +# record if we want to build shared libs. +if [ "${shared}" = "yes" ]; then + echo enable_shared = yes >> temp-frag +else + echo enable_shared = no >> temp-frag +fi + +frag=xhost-mkfrag +${CONFIG_SHELL} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag diff --git a/libiberty/config/mh-aix b/libiberty/config/mh-aix new file mode 100755 index 0000000..6b64505 --- /dev/null +++ b/libiberty/config/mh-aix @@ -0,0 +1,9 @@ +# This file is only needed by AIX 3.1. +HDEFINES = -D__IEEE_BIG_ENDIAN + +# Most releases of AIX 3.1 include an incorrect internal version of copysign +# in libc.a for use by some libc public functions including modf. The public +# version of copysign in libm.a is usable. For the sake of libg++ (which +# uses modf), we add copysign here. Supposedly, this problem is fixed in AIX +# 3.1.8 and above, including all releases of AIX 3.2. +EXTRA_OFILES = copysign.o diff --git a/libiberty/config/mh-cxux7 b/libiberty/config/mh-cxux7 new file mode 100755 index 0000000..a924b08 --- /dev/null +++ b/libiberty/config/mh-cxux7 @@ -0,0 +1 @@ +HDEFINES = -DHARRIS_FLOAT_FORMAT diff --git a/libiberty/config/mh-fbsd21 b/libiberty/config/mh-fbsd21 new file mode 100755 index 0000000..1375a78 --- /dev/null +++ b/libiberty/config/mh-fbsd21 @@ -0,0 +1 @@ +EXTRA_OFILES=vasprintf.o diff --git a/libiberty/config/mh-windows b/libiberty/config/mh-windows new file mode 100755 index 0000000..3ff5f79 --- /dev/null +++ b/libiberty/config/mh-windows @@ -0,0 +1 @@ +EXTRA_OFILES=asprintf.o strcasecmp.o strncasecmp.o vasprintf.o diff --git a/libiberty/configure b/libiberty/configure new file mode 100755 index 0000000..2eac6f3 --- /dev/null +++ b/libiberty/configure @@ -0,0 +1,2799 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-target-subdir=SUBDIR Configuring in a subdirectory" +ac_help="$ac_help + --with-cross-host=HOST Configuring with a cross compiler" +ac_help="$ac_help + --with-newlib Configuring with newlib" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=pexecute.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# Check whether --with-target-subdir or --without-target-subdir was given. +if test "${with_target_subdir+set}" = set; then + withval="$with_target_subdir" + : +fi + +# Check whether --with-cross-host or --without-cross-host was given. +if test "${with_cross_host+set}" = set; then + withval="$with_cross_host" + : +fi + +# Check whether --with-newlib or --without-newlib was given. +if test "${with_newlib+set}" = set; then + withval="$with_newlib" + : +fi + + +if test "${srcdir}" = "."; then + if test -z "${with_target_subdir}"; then + libiberty_topdir="${srcdir}/.." + else + if test "${with_target_subdir}" != "."; then + libiberty_topdir="${srcdir}/${with_multisrctop}../.." + else + libiberty_topdir="${srcdir}/${with_multisrctop}.." + fi + fi +else + libiberty_topdir="${srcdir}/.." +fi +ac_aux_dir= +for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:589: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:612: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:638: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:669: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:700: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:744: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:773: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:821: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:845: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:874: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + + + + + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:912: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +. ${srcdir}/config.table +host_makefile_frag=${frag} + + +# It's OK to check for header files. Although the compiler may not be +# able to link anything, it had better be able to at least compile +# something. +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:971: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 986 "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:992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 1003 "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:1009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1035: 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 1040 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1072: 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 1077 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:1093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + + +# This is the list of functions which libiberty will provide if they +# are not available on the host. + +funcs="asprintf" +funcs="$funcs atexit" +funcs="$funcs basename" +funcs="$funcs bcmp" +funcs="$funcs bcopy" +funcs="$funcs bzero" +funcs="$funcs calloc" +funcs="$funcs clock" +funcs="$funcs getcwd" +funcs="$funcs getpagesize" +funcs="$funcs index" +funcs="$funcs insque" +funcs="$funcs memchr" +funcs="$funcs memcmp" +funcs="$funcs memcpy" +funcs="$funcs memmove" +funcs="$funcs memset" +funcs="$funcs random" +funcs="$funcs rename" +funcs="$funcs rindex" +funcs="$funcs sigsetmask" +funcs="$funcs strcasecmp" +funcs="$funcs strchr" +funcs="$funcs strdup" +funcs="$funcs strncasecmp" +funcs="$funcs strrchr" +funcs="$funcs strstr" +funcs="$funcs strtod" +funcs="$funcs strtol" +funcs="$funcs strtoul" +funcs="$funcs tmpnam" +funcs="$funcs vasprintf" +funcs="$funcs vfprintf" +funcs="$funcs vprintf" +funcs="$funcs vsprintf" +funcs="$funcs waitpid" + +# Also in the old function.def file: alloca, vfork, getopt. + +vars="sys_errlist sys_nerr sys_siglist" + +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times" + +# These are neither executed nor required, but they help keep +# autoheader happy without adding a bunch of text to acconfig.h. +if test "x" = "y"; then + for ac_func in asprintf atexit basename bcmp bcopy bzero calloc clock getcwd +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1166: 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 1171 "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:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_func in getpagesize index insque memchr memcmp memcpy memmove +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1221: 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 1226 "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:1249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_func in memset random rename rindex sigsetmask strcasecmp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1276: 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 1281 "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:1304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_func in strchr strdup strncasecmp strrchr strstr strtod strtol +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1331: 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 1336 "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:1359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_func in strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1386: 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 1391 "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:1414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_SIGLIST 1 +EOF + + for ac_func in getrusage on_exit psignal strerror strsignal sysconf times +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1453: 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 1458 "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:1481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +fi + +# For each of these functions, if the host does not provide the +# function we want to put FN.o in LIBOBJS, and if the host does +# provide the function, we want to define HAVE_FN in config.h. Also, +# if the host does not provide alloca, we set ALLOCA to alloca.o + +setobjs= +if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS + # may not work correctly, because the compiler may not be able to + # link executables. Note that we may still be being configured + # native. + + # If we are being configured for newlib, we know which functions + # newlib provide and which ones we will be expected to provide. + + if test "x${with_newlib}" = "xyes"; then + ALLOCA="alloca.o" + LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o" + + for f in $funcs; do + case "$f" in + asprintf | basename | insque | random | strdup | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $n 1 +EOF + + ;; + esac + done + + # newlib doesnt provide any of the variables in $vars, so we + # dont have to check them here. + + # Of the functions in $checkfuncs, newlib only has strerror. + cat >> confdefs.h <<\EOF +#define HAVE_STRERROR 1 +EOF + + + setobjs=yes + + fi +fi + +if test -z "${setobjs}"; then + case "${host}" in + + *-*-vxworks*) + # Handle VxWorks configuration specially, since on VxWorks the + # libraries are actually on the target board, not in the file + # system. + LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o" + LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o" + for f in $funcs; do + case "$f" in + basename | getpagesize | insque | random | strcasecmp) + ;; + strncasecmp | strdup | vfork | waitpid | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $n 1 +EOF + + ;; + esac + done + + # VxWorks doesn't provide any of the variables in $vars, so we + # don't have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + cat >> confdefs.h <<\EOF +#define HAVE_STRERROR 1 +EOF + + + setobjs=yes + ;; + + esac +fi + +if test -z "${setobjs}"; then + + case "${host}" in + + *-*-cygwin*) + # The Cygwin library actually uses a couple of files from + # libiberty when it is built. If we are building a native + # Cygwin, and we run the tests, we will appear to have these + # files. However, when we go on to build winsup, we will wind up + # with a library which does not have the files, since they should + # have come from libiberty. + + # We handle this by removing the functions the winsup library + # provides from our shell variables, so that they appear to be + # missing. + + funcs="`echo $funcs | sed -e 's/random//'`" + LIBOBJS="$LIBOBJS random.o" + vars="`echo $vars | sed -e 's/sys_siglist//'`" + checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" + ;; + + *-*-mingw32*) + # Under mingw32, sys_nerr and sys_errlist exist, but they are + # macros, so the test below won't find them. + vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`" + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + + ;; + + esac + + # We haven't set the list of objects yet. Use the standard autoconf + # tests. This will only work if the compiler works. + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1636: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <<EOF +#line 1646 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1670: 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:1677: 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 1682 "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:1705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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}.o" +fi +done + + + # 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:1734: 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 1739 "configure" +#include "confdefs.h" +#include <alloca.h> +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:1746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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:1767: 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 1772 "configure" +#include "confdefs.h" + +#ifdef __GNUC__ +# define alloca __builtin_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 + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:1795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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.o + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1827: 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 1832 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1857: 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 1862 "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:1885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<EOF +#define CRAY_STACKSEG_END $ac_func +EOF + + break +else + echo "$ac_t""no" 1>&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:1912: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext <<EOF +#line 1920 "configure" +#include "confdefs.h" +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:1939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1961: 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 1966 "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:1974: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +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 1991 "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 2009 "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 2030 "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:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./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:2065: 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 2070 "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 "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 +echo "configure:2099: 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 2104 "configure" +#include "confdefs.h" +#include <vfork.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VFORK_H 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for working vfork""... $ac_c" 1>&6 +echo "configure:2134: 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:2140: 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 2145 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vfork(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vfork(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vfork) || defined (__stub___vfork) +choke me +#else +vfork(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_vfork=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vfork=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + +ac_cv_func_vfork_works=$ac_cv_func_vfork +else + cat > conftest.$ac_ext <<EOF +#line 2190 "configure" +#include "confdefs.h" +/* Thanks to Paul Eggert for this test. */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_VFORK_H +#include <vfork.h> +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. + The compiler is told about this with #include <vfork.h>, + but some compilers (e.g. gcc -O) don't grok <vfork.h>. + Test for this by using a static variable whose address + is put into a register that is clobbered by the vfork. */ +static +#ifdef __cplusplus +sparc_address_test (int arg) +#else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} +main() { + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. + This test uses lots of local variables, at least + as many local variables as main has allocated so far + including compiler temporaries. 4 locals are enough for + gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. + A buggy compiler should reuse the register of parent + for one of the local variables, since it will think that + parent can't possibly be used any more in this routine. + Assigning to the local variable will thus munge parent + in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), + vfork doesn't separate parent from child file descriptors. + If the child closes a descriptor before it execs or exits, + this munges the parent's descriptor as well. + Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +EOF +if { (eval echo configure:2285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_vfork_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_vfork_works=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 +if test $ac_cv_func_vfork_works = no; then + cat >> confdefs.h <<\EOF +#define vfork fork +EOF + +fi + + if test $ac_cv_func_vfork_works = no; then + LIBOBJS="$LIBOBJS vfork.o" + fi + for v in $vars; do + echo $ac_n "checking for $v""... $ac_c" 1>&6 +echo "configure:2312: 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 2317 "configure" +#include "confdefs.h" +int *p; +int main() { +extern int $v; p = &$v; +; return 0; } +EOF +if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "libiberty_cv_var_$v=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "libiberty_cv_var_$v=no" +fi +rm -f conftest* +fi + + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then + echo "$ac_t""yes" 1>&6 + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $n 1 +EOF + + else + echo "$ac_t""no" 1>&6 + fi + done + for ac_func in $checkfuncs +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2350: 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 2355 "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:2378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +fi + +# Install a library built with a cross compiler in $(tooldir) rather +# than $(libdir). +if test -z "${with_cross_host}"; then + INSTALL_DEST=libdir +else + INSTALL_DEST=tooldir +fi + + +# We need multilib support, but only if configuring for the target. +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@CPP@%$CPP%g +s%@LIBOBJS@%$LIBOBJS%g +s%@ALLOCA@%$ALLOCA%g +s%@INSTALL_DEST@%$INSTALL_DEST%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="config.h:config.in" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +host=${host} +target=${target} +with_target_subdir=${with_target_subdir} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libiberty_topdir=${libiberty_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +if test -n "$CONFIG_FILES"; then + if test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + . ${libiberty_topdir}/config-ml.in + fi +fi +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libiberty/configure.bat b/libiberty/configure.bat new file mode 100755 index 0000000..8a31b53 --- /dev/null +++ b/libiberty/configure.bat @@ -0,0 +1,14 @@ +@echo off +if "%1" == "h8/300" goto h8300 + +echo Configuring libiberty for go32 +copy Makefile.dos Makefile +echo #define NEED_sys_siglist 1 >> config.h +echo #define NEED_psignal 1 >> config.h +goto exit + +:h8300 +echo Configuring libiberty for H8/300 +copy Makefile.dos Makefile + +:exit diff --git a/libiberty/configure.in b/libiberty/configure.in new file mode 100755 index 0000000..a189b07 --- /dev/null +++ b/libiberty/configure.in @@ -0,0 +1,333 @@ +dnl Process this file with autoconf to produce a configure script + +AC_PREREQ(2.12.1) +AC_INIT(pexecute.c) + +dnl We use these options to decide which functions to include. +AC_ARG_WITH(target-subdir, +[ --with-target-subdir=SUBDIR Configuring in a subdirectory]) +AC_ARG_WITH(cross-host, +[ --with-cross-host=HOST Configuring with a cross compiler]) +AC_ARG_WITH(newlib, +[ --with-newlib Configuring with newlib]) + +if test "${srcdir}" = "."; then + if test -z "${with_target_subdir}"; then + libiberty_topdir="${srcdir}/.." + else + if test "${with_target_subdir}" != "."; then + libiberty_topdir="${srcdir}/${with_multisrctop}../.." + else + libiberty_topdir="${srcdir}/${with_multisrctop}.." + fi + fi +else + libiberty_topdir="${srcdir}/.." +fi +AC_CONFIG_AUX_DIR($libiberty_topdir) + +AC_CANONICAL_HOST + +dnl When we start using automake: +dnl AM_INIT_AUTOMAKE(libiberty, 1.0) + +dnl These must be called before AM_PROG_LIBTOOL, because it may want +dnl to call AC_CHECK_PROG. +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_PROVIDE([AC_PROG_CC]) +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AC_ISC_POSIX + +dnl When we start using libtool: +dnl Default to a non shared library. This may be overridden by the +dnl configure option --enable-shared. +dnl AM_DISABLE_SHARED + +dnl When we start using libtool: +dnl AM_PROG_LIBTOOL + +dnl When we start using automake: +dnl AM_CONFIG_HEADER(config.h:config.in) +AC_CONFIG_HEADER(config.h:config.in) + +dnl When we start using automake: +dnl AM_MAINTAINER_MODE +dnl AC_EXEEXT + +dnl When we start using automake: +dnl AM_PROG_INSTALL +AC_PROG_INSTALL + +. ${srcdir}/config.table +host_makefile_frag=${frag} +AC_SUBST_FILE(host_makefile_frag) + +# It's OK to check for header files. Although the compiler may not be +# able to link anything, it had better be able to at least compile +# something. +AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h) +AC_HEADER_SYS_WAIT + +# This is the list of functions which libiberty will provide if they +# are not available on the host. + +funcs="asprintf" +funcs="$funcs atexit" +funcs="$funcs basename" +funcs="$funcs bcmp" +funcs="$funcs bcopy" +funcs="$funcs bzero" +funcs="$funcs calloc" +funcs="$funcs clock" +funcs="$funcs getcwd" +funcs="$funcs getpagesize" +funcs="$funcs index" +funcs="$funcs insque" +funcs="$funcs memchr" +funcs="$funcs memcmp" +funcs="$funcs memcpy" +funcs="$funcs memmove" +funcs="$funcs memset" +funcs="$funcs random" +funcs="$funcs rename" +funcs="$funcs rindex" +funcs="$funcs sigsetmask" +funcs="$funcs strcasecmp" +funcs="$funcs strchr" +funcs="$funcs strdup" +funcs="$funcs strncasecmp" +funcs="$funcs strrchr" +funcs="$funcs strstr" +funcs="$funcs strtod" +funcs="$funcs strtol" +funcs="$funcs strtoul" +funcs="$funcs tmpnam" +funcs="$funcs vasprintf" +funcs="$funcs vfprintf" +funcs="$funcs vprintf" +funcs="$funcs vsprintf" +funcs="$funcs waitpid" + +# Also in the old function.def file: alloca, vfork, getopt. + +vars="sys_errlist sys_nerr sys_siglist" + +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times" + +# 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 memchr memcmp memcpy memmove) + AC_CHECK_FUNCS(memset random rename rindex sigsetmask strcasecmp) + AC_CHECK_FUNCS(strchr strdup strncasecmp strrchr strstr strtod strtol) + AC_CHECK_FUNCS(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) +fi + +# For each of these functions, if the host does not provide the +# function we want to put FN.o in LIBOBJS, and if the host does +# provide the function, we want to define HAVE_FN in config.h. Also, +# if the host does not provide alloca, we set ALLOCA to alloca.o + +setobjs= +if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS + # may not work correctly, because the compiler may not be able to + # link executables. Note that we may still be being configured + # native. + + # If we are being configured for newlib, we know which functions + # newlib provide and which ones we will be expected to provide. + + if test "x${with_newlib}" = "xyes"; then + ALLOCA="alloca.o" + LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o" + + for f in $funcs; do + case "$f" in + asprintf | basename | insque | random | strdup | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + ;; + esac + done + + # newlib doesnt provide any of the variables in $vars, so we + # dont have to check them here. + + # Of the functions in $checkfuncs, newlib only has strerror. + AC_DEFINE(HAVE_STRERROR) + + setobjs=yes + + fi +fi + +if test -z "${setobjs}"; then + case "${host}" in + + *-*-vxworks*) + # Handle VxWorks configuration specially, since on VxWorks the + # libraries are actually on the target board, not in the file + # system. + LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o" + LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o" + for f in $funcs; do + case "$f" in + basename | getpagesize | insque | random | strcasecmp) + ;; + strncasecmp | strdup | vfork | waitpid | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + ;; + esac + done + + # VxWorks doesn't provide any of the variables in $vars, so we + # don't have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + AC_DEFINE(HAVE_STRERROR) + + setobjs=yes + ;; + + esac +fi + +if test -z "${setobjs}"; then + + case "${host}" in + + *-*-cygwin*) + # The Cygwin library actually uses a couple of files from + # libiberty when it is built. If we are building a native + # Cygwin, and we run the tests, we will appear to have these + # files. However, when we go on to build winsup, we will wind up + # with a library which does not have the files, since they should + # have come from libiberty. + + # We handle this by removing the functions the winsup library + # provides from our shell variables, so that they appear to be + # missing. + + funcs="`echo $funcs | sed -e 's/random//'`" + LIBOBJS="$LIBOBJS random.o" + vars="`echo $vars | sed -e 's/sys_siglist//'`" + checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" + ;; + + *-*-mingw32*) + # Under mingw32, sys_nerr and sys_errlist exist, but they are + # macros, so the test below won't find them. + vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`" + AC_DEFINE(HAVE_SYS_NERR) + AC_DEFINE(HAVE_SYS_ERRLIST) + ;; + + esac + + # We haven't set the list of objects yet. Use the standard autoconf + # tests. This will only work if the compiler works. + AC_PROG_CC_WORKS + AC_REPLACE_FUNCS($funcs) + AC_FUNC_ALLOCA + AC_FUNC_VFORK + if test $ac_cv_func_vfork_works = no; then + LIBOBJS="$LIBOBJS vfork.o" + fi + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(libiberty_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;], + [eval "libiberty_cv_var_$v=yes"], + [eval "libiberty_cv_var_$v=no"])]) + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + AC_CHECK_FUNCS($checkfuncs) +fi + +# Install a library built with a cross compiler in $(tooldir) rather +# than $(libdir). +if test -z "${with_cross_host}"; then + INSTALL_DEST=libdir +else + INSTALL_DEST=tooldir +fi +AC_SUBST(INSTALL_DEST) + +# We need multilib support, but only if configuring for the target. +AC_OUTPUT(Makefile, +[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +if test -n "$CONFIG_FILES"; then + if test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + . ${libiberty_topdir}/config-ml.in + fi +fi], +srcdir=${srcdir} +host=${host} +target=${target} +with_target_subdir=${with_target_subdir} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libiberty_topdir=${libiberty_topdir} +) diff --git a/libiberty/copysign.c b/libiberty/copysign.c new file mode 100755 index 0000000..0b5f8c3 --- /dev/null +++ b/libiberty/copysign.c @@ -0,0 +1,140 @@ +#include <ansidecl.h> + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + double value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int fraction0:4; + unsigned int fraction1:16; + unsigned int fraction2:16; + unsigned int fraction3:16; + + } number; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int quiet:1; + unsigned int function0:3; + unsigned int function1:16; + unsigned int function2:16; + unsigned int function3:16; + } nan; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; + long aslong[2]; +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + double value; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int fraction3:16; + unsigned int fraction2:16; + unsigned int fraction1:16; + unsigned int fraction0: 4; +#else + unsigned int fraction1:32; + unsigned int fraction0:20; +#endif + unsigned int exponent :11; + unsigned int sign : 1; + } number; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int function3:16; + unsigned int function2:16; + unsigned int function1:16; + unsigned int function0:3; +#else + unsigned int function1:32; + unsigned int function0:19; +#endif + unsigned int quiet:1; + unsigned int exponent: 11; + unsigned int sign : 1; + } nan; + struct + { + unsigned long lsw; + unsigned long msw; + } parts; + + long aslong[2]; + +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_BIG_ENDIAN +typedef union +{ + float value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 8; + unsigned int fraction0: 7; + unsigned int fraction1: 16; + } number; + struct + { + unsigned int sign:1; + unsigned int exponent:8; + unsigned int quiet:1; + unsigned int function0:6; + unsigned int function1:16; + } nan; + long p1; + +} __ieee_float_shape_type; +#endif + +#ifdef __IEEE_LITTLE_ENDIAN +typedef union +{ + float value; + struct + { + unsigned int fraction0: 7; + unsigned int fraction1: 16; + unsigned int exponent: 8; + unsigned int sign : 1; + } number; + struct + { + unsigned int function1:16; + unsigned int function0:6; + unsigned int quiet:1; + unsigned int exponent:8; + unsigned int sign:1; + } nan; + long p1; + +} __ieee_float_shape_type; +#endif + + +double DEFUN(copysign, (x, y), double x AND double y) +{ + __ieee_double_shape_type a,b; + b.value = y; + a.value = x; + a.number.sign =b.number.sign; + return a.value; +} diff --git a/libiberty/fdmatch.c b/libiberty/fdmatch.c new file mode 100755 index 0000000..7af039f --- /dev/null +++ b/libiberty/fdmatch.c @@ -0,0 +1,73 @@ +/* Compare two open file descriptors to see if they refer to the same file. + Copyright (C) 1991 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +/* + +NAME + + fdmatch -- see if two file descriptors refer to same file + +SYNOPSIS + + int fdmatch (int fd1, int fd2) + +DESCRIPTION + + Check to see if two open file descriptors refer to the same file. + This is useful, for example, when we have an open file descriptor + for an unnamed file, and the name of a file that we believe to + correspond to that fd. This can happen when we are exec'd with + an already open file (stdout for example) or from the SVR4 /proc + calls that return open file descriptors for mapped address spaces. + All we have to do is open the file by name and check the two file + descriptors for a match, which is done by comparing major&minor + device numbers and inode numbers. + +BUGS + + (FIXME: does this work for networks?) + It works for NFS, which assigns a device number to each mount. + +*/ + +#include "ansidecl.h" +#include "libiberty.h" +#include <sys/types.h> +#include <sys/stat.h> + +int fdmatch (fd1, fd2) + int fd1; + int fd2; +{ + struct stat sbuf1; + struct stat sbuf2; + + if ((fstat (fd1, &sbuf1) == 0) && + (fstat (fd2, &sbuf2) == 0) && + (sbuf1.st_dev == sbuf2.st_dev) && + (sbuf1.st_ino == sbuf2.st_ino)) + { + return (1); + } + else + { + return (0); + } +} diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c new file mode 100755 index 0000000..c4f21e4 --- /dev/null +++ b/libiberty/floatformat.c @@ -0,0 +1,403 @@ +/* IEEE floating point support routines, for GDB, the GNU Debugger. + Copyright (C) 1991, 1994 Free Software Foundation, Inc. + +This file is part of GDB. + +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 of the License, 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. */ + +#include "floatformat.h" +#include <math.h> /* ldexp */ +#ifdef __STDC__ +#include <stddef.h> +extern void *memcpy (void *s1, const void *s2, size_t n); +extern void *memset (void *s, int c, size_t n); +#else +extern char *memcpy (); +extern char *memset (); +#endif + +/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not + going to bother with trying to muck around with whether it is defined in + a system header, what we do if not, etc. */ +#define FLOATFORMAT_CHAR_BIT 8 + +/* 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 +}; +const struct floatformat floatformat_ieee_single_little = +{ + floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23, floatformat_intbit_no +}; +const struct floatformat floatformat_ieee_double_big = +{ + floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no +}; +const struct floatformat floatformat_ieee_double_little = +{ + floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no +}; + +/* floatformat for IEEE double, little endian byte order, with big endian word + ordering, as on the ARM. */ + +const struct floatformat floatformat_ieee_double_littlebyte_bigword = +{ + floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52, floatformat_intbit_no +}; + +const struct floatformat floatformat_i387_ext = +{ + floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, + floatformat_intbit_yes +}; +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 +}; +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 +}; +const struct floatformat floatformat_m88110_ext = +{ +#ifdef HARRIS_FLOAT_FORMAT + /* 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 */ +}; +const struct floatformat floatformat_arm_ext = +{ + /* Bits 1 to 16 are unused. */ + floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, + floatformat_intbit_yes +}; + +static unsigned long get_field PARAMS ((unsigned char *, + enum floatformat_byteorders, + unsigned int, + unsigned int, + unsigned int)); + +/* Extract a field which starts at START and is LEN bytes long. DATA and + TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ +static unsigned long +get_field (data, order, total_len, start, len) + unsigned char *data; + enum floatformat_byteorders order; + unsigned int total_len; + unsigned int start; + unsigned int len; +{ + unsigned long result; + unsigned int cur_byte; + int cur_bitshift; + + /* Start at the least significant part of the field. */ + cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; + if (order == floatformat_little) + cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; + cur_bitshift = + ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; + result = *(data + cur_byte) >> (-cur_bitshift); + cur_bitshift += FLOATFORMAT_CHAR_BIT; + if (order == floatformat_little) + ++cur_byte; + else + --cur_byte; + + /* Move towards the most significant part of the field. */ + while (cur_bitshift < len) + { + if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) + /* This is the last byte; zero out the bits which are not part of + this field. */ + result |= + (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1)) + << cur_bitshift; + else + result |= *(data + cur_byte) << cur_bitshift; + cur_bitshift += FLOATFORMAT_CHAR_BIT; + if (order == floatformat_little) + ++cur_byte; + else + --cur_byte; + } + return result; +} + +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +/* Convert from FMT to a double. + FROM is the address of the extended float. + Store the double in *TO. */ + +void +floatformat_to_double (fmt, from, to) + const struct floatformat *fmt; + char *from; + double *to; +{ + unsigned char *ufrom = (unsigned char *)from; + double dto; + long exponent; + unsigned long mant; + unsigned int mant_bits, mant_off; + int mant_bits_left; + int special_exponent; /* It's a NaN, denorm or zero */ + + exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, + fmt->exp_start, fmt->exp_len); + /* Note that if exponent indicates a NaN, we can't really do anything useful + (not knowing if the host has NaN's, or how to build one). So it will + end up as an infinity or something close; that is OK. */ + + mant_bits_left = fmt->man_len; + mant_off = fmt->man_start; + dto = 0.0; + + special_exponent = exponent == 0 || exponent == fmt->exp_nan; + + /* Don't bias zero's, denorms or NaNs. */ + if (!special_exponent) + exponent -= fmt->exp_bias; + + /* Build the result algebraically. Might go infinite, underflow, etc; + who cares. */ + + /* If this format uses a hidden bit, explicitly add it in now. Otherwise, + increment the exponent by one to account for the integer bit. */ + + if (!special_exponent) + { + if (fmt->intbit == floatformat_intbit_no) + dto = ldexp (1.0, exponent); + else + exponent++; + } + + while (mant_bits_left > 0) + { + mant_bits = min (mant_bits_left, 32); + + mant = get_field (ufrom, fmt->byteorder, fmt->totalsize, + mant_off, mant_bits); + + dto += ldexp ((double)mant, exponent - mant_bits); + exponent -= mant_bits; + mant_off += mant_bits; + mant_bits_left -= mant_bits; + } + + /* Negate it if negative. */ + if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) + dto = -dto; + *to = dto; +} + +static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders, + unsigned int, + unsigned int, + unsigned int, + unsigned long)); + +/* Set a field which starts at START and is LEN bytes long. DATA and + TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ +static void +put_field (data, order, total_len, start, len, stuff_to_put) + unsigned char *data; + enum floatformat_byteorders order; + unsigned int total_len; + unsigned int start; + unsigned int len; + unsigned long stuff_to_put; +{ + unsigned int cur_byte; + int cur_bitshift; + + /* Start at the least significant part of the field. */ + cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; + if (order == floatformat_little) + cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; + cur_bitshift = + ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; + *(data + cur_byte) &= + ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1) << (-cur_bitshift)); + *(data + cur_byte) |= + (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1)) << (-cur_bitshift); + cur_bitshift += FLOATFORMAT_CHAR_BIT; + if (order == floatformat_little) + ++cur_byte; + else + --cur_byte; + + /* Move towards the most significant part of the field. */ + while (cur_bitshift < len) + { + if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) + { + /* This is the last byte. */ + *(data + cur_byte) &= + ~((1 << (len - cur_bitshift)) - 1); + *(data + cur_byte) |= (stuff_to_put >> cur_bitshift); + } + else + *(data + cur_byte) = ((stuff_to_put >> cur_bitshift) + & ((1 << FLOATFORMAT_CHAR_BIT) - 1)); + cur_bitshift += FLOATFORMAT_CHAR_BIT; + if (order == floatformat_little) + ++cur_byte; + else + --cur_byte; + } +} + +/* The converse: convert the double *FROM to an extended float + and store where TO points. Neither FROM nor TO have any alignment + restrictions. */ + +void +floatformat_from_double (fmt, from, to) + const struct floatformat *fmt; + double *from; + char *to; +{ + double dfrom; + int exponent; + double mant; + unsigned int mant_bits, mant_off; + int mant_bits_left; + unsigned char *uto = (unsigned char *)to; + + memcpy (&dfrom, from, sizeof (dfrom)); + memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT); + if (dfrom == 0) + return; /* Result is zero */ + if (dfrom != dfrom) + { + /* From is NaN */ + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, + fmt->exp_len, fmt->exp_nan); + /* Be sure it's not infinity, but NaN value is irrel */ + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start, + 32, 1); + return; + } + + /* If negative, set the sign bit. */ + if (dfrom < 0) + { + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1); + dfrom = -dfrom; + } + + /* How to tell an infinity from an ordinary number? FIXME-someday */ + + mant = frexp (dfrom, &exponent); + put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len, + exponent + fmt->exp_bias - 1); + + mant_bits_left = fmt->man_len; + mant_off = fmt->man_start; + while (mant_bits_left > 0) + { + unsigned long mant_long; + mant_bits = mant_bits_left < 32 ? mant_bits_left : 32; + + mant *= 4294967296.0; + mant_long = (unsigned long)mant; + mant -= mant_long; + + /* If the integer bit is implicit, then we need to discard it. + If we are discarding a zero, we should be (but are not) creating + a denormalized number which means adjusting the exponent + (I think). */ + if (mant_bits_left == fmt->man_len + && fmt->intbit == floatformat_intbit_no) + { + mant_long &= 0x7fffffff; + mant_bits -= 1; + } + else if (mant_bits < 32) + { + /* The bits we want are in the most significant MANT_BITS bits of + mant_long. Move them to the least significant. */ + mant_long >>= 32 - mant_bits; + } + + put_field (uto, fmt->byteorder, fmt->totalsize, + mant_off, mant_bits, mant_long); + mant_off += mant_bits; + mant_bits_left -= mant_bits; + } +} + + +#ifdef IEEE_DEBUG + +/* This is to be run on a host which uses IEEE floating point. */ + +void +ieee_test (n) + double n; +{ + double result; + char exten[16]; + + floatformat_to_double (&floatformat_ieee_double_big, &n, &result); + if (n != result) + printf ("Differ(to): %.20g -> %.20g\n", n, result); + floatformat_from_double (&floatformat_ieee_double_big, &n, &result); + if (n != result) + printf ("Differ(from): %.20g -> %.20g\n", n, result); + + floatformat_from_double (&floatformat_m68881_ext, &n, exten); + floatformat_to_double (&floatformat_m68881_ext, exten, &result); + if (n != result) + printf ("Differ(to+from): %.20g -> %.20g\n", n, result); + +#if IEEE_DEBUG > 1 + /* This is to be run on a host which uses 68881 format. */ + { + long double ex = *(long double *)exten; + if (ex != n) + printf ("Differ(from vs. extended): %.20g\n", n); + } +#endif +} + +int +main () +{ + ieee_test (0.5); + ieee_test (256.0); + ieee_test (0.12345); + ieee_test (234235.78907234); + ieee_test (-512.0); + ieee_test (-0.004321); + return 0; +} +#endif diff --git a/libiberty/fnmatch.c b/libiberty/fnmatch.c new file mode 100755 index 0000000..0a9bfe6 --- /dev/null +++ b/libiberty/fnmatch.c @@ -0,0 +1,225 @@ +/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@prep.ai.mit.edu. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#if defined (CONFIG_BROKETS) +/* We use <config.h> instead of "config.h" so that a compilation + using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h + (which it would do because it found this file in $srcdir). */ +#include <config.h> +#else +#include "config.h" +#endif +#endif + + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +/* This code to undef const added in libiberty. */ +#ifndef __STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <errno.h> +#include <fnmatch.h> +#include <ctype.h> + + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS) +extern int errno; +#endif + +/* Match STRING against the filename pattern PATTERN, returning zero if + it matches, nonzero if not. */ +int +fnmatch (pattern, string, flags) + const char *pattern; + const char *string; + int flags; +{ + register const char *p = pattern, *n = string; + register unsigned char c; + +/* Note that this evalutes C many times. */ +#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) + + while ((c = *p++) != '\0') + { + c = FOLD (c); + + switch (c) + { + case '?': + if (*n == '\0') + return FNM_NOMATCH; + else if ((flags & FNM_FILE_NAME) && *n == '/') + return FNM_NOMATCH; + else if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + break; + + case '\\': + if (!(flags & FNM_NOESCAPE)) + { + c = *p++; + c = FOLD (c); + } + if (FOLD ((unsigned char)*n) != c) + return FNM_NOMATCH; + break; + + case '*': + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + + for (c = *p++; c == '?' || c == '*'; c = *p++, ++n) + if (((flags & FNM_FILE_NAME) && *n == '/') || + (c == '?' && *n == '\0')) + return FNM_NOMATCH; + + if (c == '\0') + return 0; + + { + unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + c1 = FOLD (c1); + for (--p; *n != '\0'; ++n) + if ((c == '[' || FOLD ((unsigned char)*n) == c1) && + fnmatch (p, n, flags & ~FNM_PERIOD) == 0) + return 0; + return FNM_NOMATCH; + } + + case '[': + { + /* Nonzero if the sense of the character class is inverted. */ + register int not; + + if (*n == '\0') + return FNM_NOMATCH; + + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + + not = (*p == '!' || *p == '^'); + if (not) + ++p; + + c = *p++; + for (;;) + { + register unsigned char cstart = c, cend = c; + + if (!(flags & FNM_NOESCAPE) && c == '\\') + cstart = cend = *p++; + + cstart = cend = FOLD (cstart); + + if (c == '\0') + /* [ (unterminated) loses. */ + return FNM_NOMATCH; + + c = *p++; + c = FOLD (c); + + if ((flags & FNM_FILE_NAME) && c == '/') + /* [/] can never match. */ + return FNM_NOMATCH; + + if (c == '-' && *p != ']') + { + cend = *p++; + if (!(flags & FNM_NOESCAPE) && cend == '\\') + cend = *p++; + if (cend == '\0') + return FNM_NOMATCH; + cend = FOLD (cend); + + c = *p++; + } + + if (FOLD ((unsigned char)*n) >= cstart + && FOLD ((unsigned char)*n) <= cend) + goto matched; + + if (c == ']') + break; + } + if (!not) + return FNM_NOMATCH; + break; + + matched:; + /* Skip the rest of the [...] that already matched. */ + while (c != ']') + { + if (c == '\0') + /* [... (unterminated) loses. */ + return FNM_NOMATCH; + + c = *p++; + if (!(flags & FNM_NOESCAPE) && c == '\\') + /* XXX 1003.2d11 is unclear if this is right. */ + ++p; + } + if (not) + return FNM_NOMATCH; + } + break; + + default: + if (c != FOLD ((unsigned char)*n)) + return FNM_NOMATCH; + } + + ++n; + } + + if (*n == '\0') + return 0; + + if ((flags & FNM_LEADING_DIR) && *n == '/') + /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ + return 0; + + return FNM_NOMATCH; +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/libiberty/getcwd.c b/libiberty/getcwd.c new file mode 100755 index 0000000..06d55c0 --- /dev/null +++ b/libiberty/getcwd.c @@ -0,0 +1,54 @@ +/* Emulate getcwd using getwd. + This function is in the public domain. */ + +/* +NAME + getcwd -- get absolute pathname for current working directory + +SYNOPSIS + char *getcwd (char pathname[len], 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. + +BUGS + Emulated via the getwd() call, which is reasonable for most + systems that do not have getcwd(). + +*/ + +#include "config.h" + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <errno.h> + +extern char *getwd (); +extern int errno; + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +char * +getcwd (buf, len) + char *buf; + int len; +{ + char ourbuf[MAXPATHLEN]; + char *result; + + result = getwd (ourbuf); + if (result) { + if (strlen (ourbuf) >= len) { + errno = ERANGE; + return 0; + } + strcpy (buf, ourbuf); + } + return buf; +} diff --git a/libiberty/getopt.c b/libiberty/getopt.c new file mode 100755 index 0000000..ec5dc43 --- /dev/null +++ b/libiberty/getopt.c @@ -0,0 +1,1049 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 + Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + 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. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. + Ditto for AIX 3.2 and <stdlib.h>. */ +#ifndef _NO_PROTO +# define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +# ifndef const +# define const +# endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include <gnu-versions.h> +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +# include <stdlib.h> +# include <unistd.h> +#endif /* GNU C library. */ + +#ifdef VMS +# include <unixlib.h> +# if HAVE_STRING_H - 0 +# include <string.h> +# endif +#endif + +#ifndef _ +#define _(msgid) (msgid) +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +# include <string.h> +# define my_index strchr +#else + +# if HAVE_STRING_H +# include <string.h> +# else +# if HAVE_STRINGS_H +# include <strings.h> +# endif +# endif + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +#ifndef getenv +extern char *getenv (); +#endif + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +# if (!defined __STDC__ || !__STDC__) && !defined strlen +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +# endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +# ifdef text_set_element +text_set_element (__libc_subinit, store_args_and_env); +# endif /* text_set_element */ + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined __STDC__ && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), + '\0', top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined __STDC__ && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/libiberty/getopt1.c b/libiberty/getopt1.c new file mode 100755 index 0000000..ff25737 --- /dev/null +++ b/libiberty/getopt1.c @@ -0,0 +1,190 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "getopt.h" + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include <gnu-versions.h> +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include <stdlib.h> +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include <stdio.h> + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/libiberty/getpagesize.c b/libiberty/getpagesize.c new file mode 100755 index 0000000..564d6c0 --- /dev/null +++ b/libiberty/getpagesize.c @@ -0,0 +1,96 @@ +/* Emulation of getpagesize() for systems that need it. */ + +/* + +NAME + + getpagesize -- return the number of bytes in page of memory + +SYNOPSIS + + int getpagesize (void) + +DESCRIPTION + + Returns the number of bytes in a page of memory. This is the + granularity of many of the system memory management routines. + No guarantee is made as to whether or not it is the same as the + basic memory management hardware page size. + +BUGS + + Is intended as a reasonable replacement for systems where this + is not provided as a system call. The value of 4096 may or may + not be correct for the systems where it is returned as the default + value. + +*/ + +#ifndef VMS + +#include "config.h" + +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +#undef GNU_OUR_PAGESIZE +#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H) +#include <unistd.h> +#ifdef _SC_PAGESIZE +#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE) +#endif +#endif + +#ifndef GNU_OUR_PAGESIZE +# ifdef PAGESIZE +# define GNU_OUR_PAGESIZE PAGESIZE +# else /* no PAGESIZE */ +# ifdef EXEC_PAGESIZE +# define GNU_OUR_PAGESIZE EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define GNU_OUR_PAGESIZE (NBPG * CLSIZE) +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define GNU_OUR_PAGESIZE NBPC +# else /* no NBPC */ +# define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */ +# endif /* NBPC */ +# endif /* NBPG */ +# endif /* EXEC_PAGESIZE */ +# endif /* PAGESIZE */ +#endif /* GNU_OUR_PAGESIZE */ + +int +getpagesize () +{ + return (GNU_OUR_PAGESIZE); +} + +#else /* VMS */ + +#if 0 /* older distributions of gcc-vms are missing <syidef.h> */ +#include <syidef.h> +#endif +#ifndef SYI$_PAGE_SIZE /* VMS V5.4 and earlier didn't have this yet */ +#define SYI$_PAGE_SIZE 4452 +#endif +extern unsigned long lib$getsyi(const unsigned short *,...); + +int getpagesize () +{ + long pagsiz = 0L; + unsigned short itmcod = SYI$_PAGE_SIZE; + + (void) lib$getsyi (&itmcod, (void *) &pagsiz); + if (pagsiz == 0L) + pagsiz = 512L; /* VAX default */ + return (int) pagsiz; +} + +#endif /* VMS */ diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c new file mode 100755 index 0000000..8616222 --- /dev/null +++ b/libiberty/getruntime.c @@ -0,0 +1,74 @@ +/* Return time used so far, in microseconds. + Copyright (C) 1994 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" + +#include "ansidecl.h" +#include "libiberty.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. */ + +#include <time.h> + +#ifdef HAVE_GETRUSAGE +#include <sys/time.h> +#include <sys/resource.h> +#endif + +#ifdef HAVE_TIMES +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <sys/times.h> +#endif + +/* This is a fallback; if wrong, it will likely make obviously wrong + results. */ + +#ifndef CLOCKS_PER_SEC +#define CLOCKS_PER_SEC 1 +#endif + +long +get_run_time () +{ +#ifdef HAVE_GETRUSAGE + struct rusage rusage; + + getrusage (0, &rusage); + return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec + + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec); +#else /* ! HAVE_GETRUSAGE */ +#ifdef HAVE_TIMES + struct tms tms; + + times (&tms); + return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ); +#else /* ! HAVE_TIMES */ + /* Fall back on clock and hope it's correctly implemented. */ + const long clocks_per_sec = CLOCKS_PER_SEC; + if (clocks_per_sec <= 1000000) + return clock () * (1000000 / clocks_per_sec); + else + return clock () / clocks_per_sec; +#endif /* HAVE_TIMES */ +#endif /* HAVE_GETRUSAGE */ +} diff --git a/libiberty/hex.c b/libiberty/hex.c new file mode 100755 index 0000000..3a2eef0 --- /dev/null +++ b/libiberty/hex.c @@ -0,0 +1,33 @@ +/* Hex character manipulation support. + Copyright (C) 1995 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "libiberty.h" + +char _hex_value[_hex_array_size]; + +void hex_init () +{ + int i; + for (i = 0; i < _hex_array_size; i++) + _hex_value[i] = _hex_bad; + for (i = 0; i < 10; i++) + _hex_value['0' + i] = i; + for (i = 0; i < 6; i++) + _hex_value['a' + i] = _hex_value['A' + i] = 10 + i; +} diff --git a/libiberty/index.c b/libiberty/index.c new file mode 100755 index 0000000..e5a00f5 --- /dev/null +++ b/libiberty/index.c @@ -0,0 +1,11 @@ +/* Stub implementation of (obsolete) index(). */ + +extern char * strchr(); + +char * +index (s, c) + char *s; + int c; +{ + return strchr (s, c); +} diff --git a/libiberty/insque.c b/libiberty/insque.c new file mode 100755 index 0000000..775019f --- /dev/null +++ b/libiberty/insque.c @@ -0,0 +1,50 @@ +/* insque(3C) routines + This file is in the public domain. */ + +/* +NAME + insque, remque -- insert, remove an element from a queue + +SYNOPSIS + struct qelem { + struct qelem *q_forw; + struct qelem *q_back; + char q_data[]; + }; + + void insque (struct qelem *elem, struct qelem *pred) + + void remque (struct qelem *elem) + +DESCRIPTION + Routines to manipulate queues built from doubly linked lists. + The insque routine inserts ELEM in the queue immediately after + PRED. The remque routine removes ELEM from its containing queue. +*/ + + +struct qelem { + struct qelem *q_forw; + struct qelem *q_back; +}; + + +void +insque (elem, pred) + struct qelem *elem; + struct qelem *pred; +{ + elem -> q_forw = pred -> q_forw; + pred -> q_forw -> q_back = elem; + elem -> q_back = pred; + pred -> q_forw = elem; +} + + +void +remque (elem) + struct qelem *elem; +{ + elem -> q_forw -> q_back = elem -> q_back; + elem -> q_back -> q_forw = elem -> q_forw; +} diff --git a/libiberty/makefile.dos b/libiberty/makefile.dos new file mode 100755 index 0000000..7eba62c --- /dev/null +++ b/libiberty/makefile.dos @@ -0,0 +1,29 @@ +CFLAGS=-O2 + +OBJS = \ + argv.o \ + basename.o \ + concat.o \ + cplus-dem.o \ + fdmatch.o \ + floatformat.o \ + getopt.o \ + getopt1.o \ + getruntime.o \ + hex.o \ + msdos.o \ + obstack.o \ + spaces.o \ + strerror.o \ + strsignal.o \ + xatexit.o \ + xexit.o \ + xmalloc.o \ + $E + +.c.o: + gcc -I../include $(CFLAGS) -c $< + +libiberty.a : $(OBJS) + -rm libiberty.a + ar rvs libiberty.a $(OBJS) diff --git a/libiberty/makefile.vms b/libiberty/makefile.vms new file mode 100755 index 0000000..b61b512 --- /dev/null +++ b/libiberty/makefile.vms @@ -0,0 +1,33 @@ +# +# Makefile for libiberty under openVMS/Alpha +# +# For use with gnu-make for vms +# +# Created by Klaus K"ampf, kkaempf@progis.de +# +# + +OBJS=bcopy.obj,bcmp.obj,getopt.obj,obstack.obj,xexit.obj,xmalloc.obj,hex.obj,\ + getopt1.obj,cplus-dem.obj,strncasecmp.obj,strcasecmp.obj,strdup.obj,\ + concat.obj,getruntime.obj,getpagesize.obj,alloca.obj,xstrerror.obj,\ + xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,objalloc.obj + +ifeq ($(CC),gcc) +CFLAGS=/include=([],[-.include]) +else +# assume dec c +CFLAGS=/noopt/debug/include=([],[-.include])/define=("const=")/warnings=disable=(missingreturn,implicitfunc) +endif + +libiberty.olb: config.h alloca-conf.h $(OBJS) + purge + lib/create libiberty *.obj + +config.h: config.h-vms + $(CP) $< $@ + +clean: + $$ purge + $(RM) config.h; + $(RM) *.obj; + $(RM) libiberty.olb; diff --git a/libiberty/memchr.c b/libiberty/memchr.c new file mode 100755 index 0000000..cce3003 --- /dev/null +++ b/libiberty/memchr.c @@ -0,0 +1,60 @@ +/* +FUNCTION + <<memchr>>---find character in memory + +INDEX + memchr + +ANSI_SYNOPSIS + #include <string.h> + void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>); + +TRAD_SYNOPSIS + #include <string.h> + void *memchr(<[src]>, <[c]>, <[length]>) + void *<[src]>; + void *<[c]>; + size_t <[length]>; + +DESCRIPTION + This function searches memory starting at <<*<[src]>>> for the + character <[c]>. The search only ends with the first + occurrence of <[c]>, or after <[length]> characters; in + particular, <<NULL>> does not terminate the search. + +RETURNS + If the character <[c]> is found within <[length]> characters + of <<*<[src]>>>, a pointer to the character is returned. If + <[c]> is not found, then <<NULL>> is returned. + +PORTABILITY +<<memchr>> requires no supporting OS subroutines. + +QUICKREF + memchr ansi pure + +*/ + +#include <ansidecl.h> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +PTR +memchr (src_void, c, length) + register const PTR src_void; + int c; + size_t length; +{ + const unsigned char *src = (const unsigned char *)src_void; + + while (--length >= 0) + { + if (*src == c) + return (PTR)src; + src++; + } + return NULL; +} diff --git a/libiberty/memcmp.c b/libiberty/memcmp.c new file mode 100755 index 0000000..127ae0c --- /dev/null +++ b/libiberty/memcmp.c @@ -0,0 +1,38 @@ +/* memcmp -- compare two memory regions. + 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) + +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> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +int +DEFUN(memcmp, (str1, str2, count), + const PTR str1 AND const PTR str2 AND size_t count) +{ + register unsigned char *s1 = (unsigned char*)str1; + register unsigned char *s2 = (unsigned char*)str2; + + while (count-- > 0) + { + if (*s1++ != *s2++) + return s1[-1] < s2[-1] ? -1 : 1; + } + return 0; +} + diff --git a/libiberty/memcpy.c b/libiberty/memcpy.c new file mode 100755 index 0000000..707a9f5 --- /dev/null +++ b/libiberty/memcpy.c @@ -0,0 +1,28 @@ +/* memcpy (the standard C function) + This function is in the public domain. */ + +/* +NAME + memcpy -- copy memory regions of arbitary length + +SYNOPSIS + void* memcpy (void *out, const void *in, size_t n); + +DESCRIPTION + Copy LENGTH bytes from memory region pointed to by IN to memory + region pointed to by OUT. +*/ + +#include <ansidecl.h> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +PTR +DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length) +{ + bcopy(in, out, length); + return out; +} diff --git a/libiberty/memmove.c b/libiberty/memmove.c new file mode 100755 index 0000000..176c326 --- /dev/null +++ b/libiberty/memmove.c @@ -0,0 +1,18 @@ +/* Wrapper to implement ANSI C's memmove using BSD's bcopy. */ +/* This function is in the public domain. --Per Bothner. */ +#include <ansidecl.h> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +PTR +memmove (s1, s2, n) + PTR s1; + const PTR s2; + size_t n; +{ + bcopy (s2, s1, n); + return s1; +} diff --git a/libiberty/memset.c b/libiberty/memset.c new file mode 100755 index 0000000..5f54831 --- /dev/null +++ b/libiberty/memset.c @@ -0,0 +1,19 @@ +/* memset + This implementation is in the public domain. */ + +#include <ansidecl.h> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +PTR +DEFUN(memset, (dest, val, len), + PTR dest AND register int val AND register size_t len) +{ + register unsigned char *ptr = (unsigned char*)dest; + while (len-- > 0) + *ptr++ = val; + return dest; +} diff --git a/libiberty/mkstemp.c b/libiberty/mkstemp.c new file mode 100755 index 0000000..16c16a2 --- /dev/null +++ b/libiberty/mkstemp.c @@ -0,0 +1,128 @@ +/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc. + This file is derived from mkstemp.c from the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif +#include <errno.h> +#include <stdio.h> +#include <fcntl.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#include "ansidecl.h" + +/* We need to provide a type for gcc_uint64_t. */ +#ifdef __GNUC__ +typedef unsigned long long gcc_uint64_t; +#else +typedef unsigned long gcc_uint64_t; +#endif + +#ifndef TMP_MAX +#define TMP_MAX 16384 +#endif + +/* Generate a unique temporary file name from TEMPLATE. + + TEMPLATE has the form: + + <path>/ccXXXXXX<suffix> + + SUFFIX_LEN tells us how long <suffix> is (it can be zero length). + + The last six characters of TEMPLATE before <suffix> must be "XXXXXX"; + they are replaced with a string that makes the filename unique. + + Returns a file descriptor open on the file for reading and writing. */ +int +mkstemps (template, suffix_len) + char *template; + int suffix_len; +{ + static const char letters[] + = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + static gcc_uint64_t value; +#ifdef HAVE_GETTIMEOFDAY + struct timeval tv; +#endif + char *XXXXXX; + size_t len; + int count; + + len = strlen (template); + + if ((int) len < 6 + suffix_len + || strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6)) + { + return -1; + } + + XXXXXX = &template[len - 6 - suffix_len]; + +#ifdef HAVE_GETTIMEOFDAY + /* Get some more or less random data. */ + gettimeofday (&tv, NULL); + value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid (); +#else + value += getpid (); +#endif + + for (count = 0; count < TMP_MAX; ++count) + { + gcc_uint64_t v = value; + int fd; + + /* Fill in the random bits. */ + XXXXXX[0] = letters[v % 62]; + v /= 62; + XXXXXX[1] = letters[v % 62]; + v /= 62; + XXXXXX[2] = letters[v % 62]; + v /= 62; + XXXXXX[3] = letters[v % 62]; + v /= 62; + XXXXXX[4] = letters[v % 62]; + v /= 62; + XXXXXX[5] = letters[v % 62]; + + fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600); + if (fd >= 0) + /* The file does not exist. */ + return fd; + + /* This is a random value. It is only necessary that the next + TMP_MAX values generated by adding 7777 to VALUE are different + with (module 2^32). */ + value += 7777; + } + + /* We return the null string if we can't find a unique file name. */ + template[0] = '\0'; + return -1; +} diff --git a/libiberty/mpw-config.in b/libiberty/mpw-config.in new file mode 100755 index 0000000..2a21802 --- /dev/null +++ b/libiberty/mpw-config.in @@ -0,0 +1,7 @@ +# MPW configuration fragment for libiberty. + +Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new + +MoveIfChange "{o}"config.new "{o}"config.h + + diff --git a/libiberty/mpw-make.sed b/libiberty/mpw-make.sed new file mode 100755 index 0000000..6f2a5e7 --- /dev/null +++ b/libiberty/mpw-make.sed @@ -0,0 +1,51 @@ +# Sed commands to finish translating libiberty's Unix makefile to MPW syntax. + +# Comment out a useless thing. +/^\.always\./s/^/#/ + +# Replace the auto-generated list with the list of what we know we need. +s/`cat needed-list`/"{o}"alloca.c.o "{o}"bcopy.c.o "{o}"getpagesize.c.o "{o}"insque.c.o "{o}"mpw.c.o "{o}"strcasecmp.c.o "{o}"strdup.c.o "{o}"strncasecmp.c.o/ + +# Paste in some desirable definitions. +# The default rule here completely replaces the tricky stuff in the Unix +# Makefile.in. +/^###$/a\ +\ +HDEFINES = -d NEED_sys_siglist -d NEED_sys_errlist -d NEED_basename -d NEED_strcasecmp -d NEED_strncasecmp\ +INCLUDES = -i : -i {INCDIR}: -i {INCDIR}:mpw: -i ::extra-include: -i "{s}"\ +\ +.c.o \\Option-f .c\ + {CC} @DASH_C_FLAG@ {DepDir}{Default}.c {LIBCFLAGS} {INCLUDES} {HDEFINES} @SEGMENT_FLAG({Default})@ -o {TargDir}{Default}.c.o\ + +# Remove dependency on needed-list, which we don't use. +/DO_ALSO =/s/needed-list// + +/INCDIR=/s/"{srcdir}"{MULTISRCTOP}::/"{topsrcdir}"/ + +# Whack out the COMPILE.c trickiness. +/^COMPILE.c /,/^$/d + +# Remove the multido trickiness from the "all" target. +/^all \\Option-f/,/^$/c\ +all \\Option-f {TARGETLIB}\ + + +# Remove the RULE1/RULE2 crud. +/if \[/,/fi/d +/^RULE1 =/,/RULE2 =/d +/RULE2/s/RULE2/TARGETLIB/ + +# Don't want fdmatch ever. +s/ "{o}"fdmatch.c.o// + +# Fix paths to generated files. +/config.h/s/"{s}"config.h/"{o}"config.h/ + +# Whack out config rebuild rules. +/^"{o}"config.h \\Option-f/,/^$/d + + + + + + diff --git a/libiberty/mpw.c b/libiberty/mpw.c new file mode 100755 index 0000000..ca3ae41 --- /dev/null +++ b/libiberty/mpw.c @@ -0,0 +1,1010 @@ +/* MPW-Unix compatibility library. + Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* This should only be compiled and linked under MPW. */ + +#include "mpw.h" + +#include <stdlib.h> + +#ifndef USE_MW_HEADERS +#include <sys/time.h> +#include <sys/resource.h> +#endif + +#include <Types.h> +#include <Files.h> + +#include <Timer.h> + +/* Initialize to 0 at first, then set to errno_max() later. */ + +int sys_nerr = 0; + +/* Debug flag for pathname hacking. Set this to one and rebuild. */ + +int DebugPI = -1; + +void +mpwify_filename(char *unixname, char *macname) +{ + int i, j; + + /* (should truncate 255 chars from end of name, not beginning) */ + if (strlen (unixname) > 255) + { + fprintf (stderr, "Pathname \"%s\" is too long for Macs, truncating\n", + unixname); + } + j = 0; + /* If you're going to end up with one or more colons in the middle of a + path after an all-Unix relative path is translated, you must add a + colon on the front, so that the first component is not thought to be + a disk name. */ + if (unixname[0] != '/' && ! strchr (unixname, ':') && strchr (unixname, '/')) + { + macname[j++] = ':'; + } + for (i = 0; unixname[i] != '\0' && i < 255; ++i) + { + if (i == 0 && unixname[i] == '/') + { + if (strncmp (unixname, "/tmp/", 5) == 0) + { + /* A temporary name, make a more Mac-flavored tmpname. */ + /* A better choice would be {Boot}Trash:foo, but + that would require being able to identify the + boot disk's and trashcan's name. Another option + would be to have an env var, so user can point it + at a ramdisk. */ + macname[j++] = ':'; + macname[j++] = 't'; + macname[j++] = 'm'; + macname[j++] = 'p'; + macname[j++] = '_'; + i += 4; + } + else + { + /* Don't copy the leading slash. */ + } + } + else if (unixname[i] == ':' && unixname[i+1] == '/') + { + macname[j++] = ':'; + i += 1; + } + else if (unixname[i] == '.' && unixname[i+1] == '/') + { + macname[j++] = ':'; + i += 1; + } + else if (unixname[i] == '.' && unixname[i+1] == '.' && unixname[i+2] == '/') + { + macname[j++] = ':'; + macname[j++] = ':'; + i += 2; + } + else if (unixname[i] == '/') + { + macname[j++] = ':'; + } + else + { + macname[j++] = unixname[i]; + } + } + macname[j] = '\0'; + /* Allow for getting the debug flag from an env var; quite useful. */ + if (DebugPI < 0) + DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0); + if (DebugPI) + { + fprintf (stderr, "# Made \"%s\"\n", unixname); + fprintf (stderr, "# into \"%s\"\n", macname); + } +} + +/* MPW-flavored basename finder. */ + +char * +mpw_basename (name) + char *name; +{ + char *base = name; + + while (*name) + { + if (*name++ == ':') + { + base = name; + } + } + return base; +} + +/* Mixed MPW/Unix basename finder. This can be led astray by + filenames with slashes in them and come up with a basename that + either corresponds to no file or (worse) to some other file, so + should only be tried if other methods of finding a file via a + basename have failed. */ + +char * +mpw_mixed_basename (name) + char *name; +{ + char *base = name; + + while (*name) + { + if (*name == '/' || *name == ':') + { + base = name + 1; + } + ++name; + } + return base; +} + +/* This function is fopen() modified to create files that are type TEXT + or 'BIN ', and always of type 'MPS '. */ + +FILE * +mpw_fopen (char *name, char *mode) +{ +#undef fopen + int errnum; + FILE *fp; + char tmpname[256]; + + mpwify_filename (name, tmpname); + PROGRESS (1); + fp = fopen (tmpname, mode); + errnum = errno; + + /* If writing, need to set type and creator usefully. */ + if (strchr (mode, 'w')) + { + char *pname = (char *) malloc (strlen (tmpname) + 2); + OSErr e; + struct FInfo fi; + + pname[0] = strlen (tmpname); + strcpy (pname+1, tmpname); + + e = GetFInfo ((ConstStr255Param) pname, 0, &fi); + /* should do spiffier error handling */ + if (e != 0) + fprintf(stderr, "GetFInfo returns %d\n", e); + if (strchr (mode, 'b')) + { + fi.fdType = (OSType) 'BIN '; + } + else + { + fi.fdType = (OSType) 'TEXT'; + } + fi.fdCreator = (OSType) 'MPS '; + e = SetFInfo ((ConstStr255Param) pname, 0, &fi); + if (e != 0) + fprintf(stderr, "SetFInfo returns %d\n", e); + free (pname); + } + if (fp == NULL) + errno = errnum; + return fp; +} + +/* This is a version of fseek() modified to fill the file with zeros + if seeking past the end of it. */ + +#define ZEROBLKSIZE 4096 + +char zeros[ZEROBLKSIZE]; + +int +mpw_fseek (FILE *fp, int offset, int whence) +{ +#undef fseek + int cursize, numleft; + + PROGRESS (1); + if (whence == SEEK_SET) + { + fseek (fp, 0, SEEK_END); + cursize = ftell (fp); + if (offset > cursize) + { + numleft = offset - cursize; + while (numleft > ZEROBLKSIZE) + { + /* This might fail, should check for that. */ + PROGRESS (1); + fwrite (zeros, 1, ZEROBLKSIZE, fp); + numleft -= ZEROBLKSIZE; + } + PROGRESS (1); + fwrite (zeros, 1, numleft, fp); + fflush (fp); + } + } + return fseek (fp, offset, whence); +} + +int +mpw_fread (char *ptr, int size, int nitems, FILE *stream) +{ +#undef fread + int rslt; + + PROGRESS (1); + rslt = fread (ptr, size, nitems, stream); + PROGRESS (1); + return rslt; +} + +int +mpw_fwrite (char *ptr, int size, int nitems, FILE *stream) +{ +#undef fwrite + int rslt; + + PROGRESS (1); + rslt = fwrite (ptr, size, nitems, stream); + PROGRESS (1); + return rslt; +} + +int +link () +{ + fprintf (stderr, "link not available!\n"); + mpw_abort (); +} + +int +fork () +{ + fprintf (stderr, "fork not available!\n"); + mpw_abort (); +} + +int +vfork () +{ + fprintf (stderr, "vfork not available!\n"); + mpw_abort (); + return (-1); +} + +int +pipe (int *fd) +{ + fprintf (stderr, "pipe not available!\n"); + mpw_abort (); + return (-1); +} + +#ifndef USE_MW_HEADERS +int +execvp (char *file, char **argv) +{ + fprintf (stderr, "execvp not available!\n"); + mpw_abort (); + return (-1); +} + +int +execv (char *path, char **argv) +{ + fprintf (stderr, "execv not available!\n"); + mpw_abort (); + return (-1); +} +#endif + +int +kill (int pid, int sig) +{ + fprintf (stderr, "kill not available!\n"); + mpw_abort (); + return (-1); +} + +int +wait (int *status) +{ + *status = 0; + return 0; +} + +#ifndef USE_MW_HEADERS +int +sleep (int seconds) +{ + unsigned long start_time, now; + + time (&start_time); + + while (1) + { + PROGRESS (1); + time (&now); + if (now > start_time + seconds) + return 0; + } +} +#endif + +void +putenv (char *str) +{ + /* The GCC driver calls this to do things for collect2, but we + don't care about collect2. */ +} + +int +chmod (char *path, int mode) +{ + /* Pretend it was all OK. */ + return 0; +} + +#ifndef USE_MW_HEADERS +int +getuid () +{ + /* One value is as good as another... */ + return 0; +} + +int +getgid () +{ + /* One value is as good as another... */ + return 0; +} +#endif + +/* Instead of coredumping, which is not a normal Mac facility, we + drop into Macsbug. If we then "g" from Macsbug, the program will + exit cleanly. */ + +void +mpw_abort () +{ + /* Make sure no output still buffered up, then zap into MacsBug. */ + fflush(stdout); + fflush(stderr); + printf("## Abort! ##\n"); +#ifdef MPW_SADE + SysError(8005); +#else + Debugger(); +#endif + /* "g" in MacsBug will then cause a regular error exit. */ + exit (1); +} + +/* Imitation getrusage based on the ANSI clock() function. */ + +int +getrusage (int who, struct rusage *rusage) +{ + int clk = clock (); + +#if 0 + rusage->ru_utime.tv_sec = clk / CLOCKS_PER_SEC; + rusage->ru_utime.tv_usec = ((clk * 1000) / CLOCKS_PER_SEC) * 1000; + rusage->ru_stime.tv_sec = 0; + rusage->ru_stime.tv_usec = 0; +#endif +} + +int +sbrk () +{ + return 0; +} + +#ifndef USE_MW_HEADERS +int +isatty (int fd) +{ + return 0; +} + +/* This is inherited from Timothy Murray's Posix library. */ + +#include "utime.h" + +int +utime (char *filename, struct utimbuf *times) +{ + CInfoPBRec cipbr; + HFileInfo *fpb = (HFileInfo *) &cipbr; + DirInfo *dpb = (DirInfo *) &cipbr; + unsigned char pname[256]; + short err; + + strcpy ((char *) pname, filename); + c2pstr (pname); + + dpb->ioDrDirID = 0L; + fpb->ioNamePtr = pname; + fpb->ioVRefNum = 0; + fpb->ioFDirIndex = 0; + fpb->ioFVersNum = 0; + err = PBGetCatInfo (&cipbr, 0); + if (err != noErr) { + errno = ENOENT; + return -1; + } + dpb->ioDrDirID = 0L; + fpb->ioFlMdDat = times->modtime; + fpb->ioFlCrDat = times->actime; + err = PBSetCatInfo (&cipbr, 0); + if (err != noErr) { + errno = EACCES; + return -1; + } + return 0; +} + +int +mkdir (char *path, int mode) +{ + errno = ENOSYS; + return -1; +} + +int +rmdir () +{ + errno = ENOSYS; + return -1; +} +#endif + +chown () +{ + errno = ENOSYS; + return -1; +} + +char *myenviron[] = {NULL}; + +char **environ = myenviron; + +#ifndef USE_MW_HEADERS + +/* Minimal 'stat' emulation: tells directories from files and + gives length and mtime. + + Derived from code written by Guido van Rossum, CWI, Amsterdam + and placed by him in the public domain. */ + +extern int __uid, __gid; + +int __uid = 0; +int __gid = 0; + +/* Bits in ioFlAttrib: */ +#define LOCKBIT (1<<0) /* File locked */ +#define DIRBIT (1<<4) /* It's a directory */ + +/* Macified "stat" in which filename is given relative to a directory, + specified by long DirID. */ + +static int +_stat (char *name, long dirid, struct stat *buf) +{ + CInfoPBRec cipbr; + HFileInfo *fpb = (HFileInfo*) &cipbr; + DirInfo *dpb = (DirInfo*) &cipbr; + Str255 pname; + short err; + + /* Make a temp copy of the name and pascalize. */ + strcpy ((char *) pname, name); + c2pstr (pname); + + cipbr.dirInfo.ioDrDirID = dirid; + cipbr.hFileInfo.ioNamePtr = pname; + cipbr.hFileInfo.ioVRefNum = 0; + cipbr.hFileInfo.ioFDirIndex = 0; + cipbr.hFileInfo.ioFVersNum = 0; + err = PBGetCatInfo (&cipbr, 0); + if (err != noErr) + { + errno = ENOENT; + return -1; + } + /* Mac files are readable if they can be accessed at all. */ + buf->st_mode = 0444; + /* Mark unlocked files as writeable. */ + if (!(fpb->ioFlAttrib & LOCKBIT)) + buf->st_mode |= 0222; + if (fpb->ioFlAttrib & DIRBIT) + { + /* Mark directories as "executable". */ + buf->st_mode |= 0111 | S_IFDIR; + buf->st_size = dpb->ioDrNmFls; + buf->st_rsize = 0; + } + else + { + buf->st_mode |= S_IFREG; + /* Mark apps as "executable". */ + if (fpb->ioFlFndrInfo.fdType == 'APPL') + buf->st_mode |= 0111; + /* Fill in the sizes of data and resource forks. */ + buf->st_size = fpb->ioFlLgLen; + buf->st_rsize = fpb->ioFlRLgLen; + } + /* Fill in various times. */ + buf->st_atime = fpb->ioFlCrDat; + buf->st_mtime = fpb->ioFlMdDat; + buf->st_ctime = fpb->ioFlCrDat; + /* Set up an imitation inode number. */ + buf->st_ino = (unsigned short) fpb->ioDirID; + /* Set up an imitation device. */ + GetVRefNum (buf->st_ino, &buf->st_dev); + buf->st_uid = __uid; + buf->st_gid = __gid; +/* buf->st_FlFndrInfo = fpb->ioFlFndrInfo; */ + return 0; +} + +/* stat() sets up an empty dirid. */ + +int +stat (char *path, struct stat *buf) +{ + long rslt, errnum; + char tmpname[256]; + + mpwify_filename (path, tmpname); + if (DebugPI) + fprintf (stderr, "# stat (%s, %x)", tmpname, buf); + PROGRESS (1); + rslt = _stat (tmpname, 0L, buf); + errnum = errno; + if (DebugPI) + { + fprintf (stderr, " -> %d", rslt); + if (rslt != 0) + fprintf (stderr, " (errno is %d)", errnum); + fprintf (stderr, "\n"); + fflush (stderr); + } + if (rslt != 0) + errno = errnum; + return rslt; +} + +int +fstat (int fd, struct stat *buf) +{ + FCBPBRec fcb; + FILE *fp; + Str255 pathname; + long dirid = 0L, temp; + long rslt, errnum; + short err; + + if (DebugPI < 0) + DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0); + if (DebugPI) + fprintf (stderr, "# fstat (%d, %x)", fd, buf); + PROGRESS (1); + pathname[0] = 0; +#ifdef FIOFNAME + /* Use an MPW-specific ioctl to get the pathname associated with + the file descriptor. */ + ioctl (fd, FIOFNAME, (long *) pathname); +#else + you lose +#endif + if (DebugPI) + fprintf (stderr, " (name is %s)", pathname); + dirid = 0L /* fcb.ioFCBParID */ ; + rslt = _stat ((char *) pathname, dirid, buf); + errnum = errno; + if (DebugPI) + { + fprintf (stderr, " -> %d", rslt); + if (rslt != 0) + fprintf (stderr, " (errno is %d)", errnum); + fprintf (stderr, "\n"); + fflush (stderr); + } + if (rslt != 0) + errno = errnum; + return rslt; +} + +#endif /* n USE_MW_HEADERS */ + +chdir () +{ + errno = ENOSYS; + return (-1); +} + +char * +getcwd (char *buf, int size) +{ + if (buf == NULL) + buf = (char *) malloc (size); + strcpy(buf, ":"); + return buf; +} + +/* This should probably be more elaborate for MPW. */ + +char * +getpwd () +{ + return ":"; +} + +int +mpw_open (char *filename, int arg2, int arg3) +{ +#undef open + int fd, errnum = 0; + char tmpname[256]; + + mpwify_filename (filename, tmpname); + fd = open (tmpname, arg2); + errnum = errno; + + if (DebugPI) + { + fprintf (stderr, "# open (%s, %d, %d)", tmpname, arg2, arg3); + fprintf (stderr, " -> %d", fd); + if (fd == -1) + fprintf (stderr, " (errno is %d)", errnum); + fprintf (stderr, "\n"); + } + if (fd == -1) + errno = errnum; + return fd; +} + +int +mpw_access (char *filename, unsigned int cmd) +{ +#undef access + + int rslt, errnum = 0; + struct stat st; + char tmpname[256]; + + mpwify_filename (filename, tmpname); + if (cmd & R_OK || cmd & X_OK) + { + rslt = stat (tmpname, &st); + errnum = errno; + if (rslt >= 0) + { + if ((((st.st_mode & 004) == 0) && (cmd & R_OK)) + || (((st.st_mode & 002) == 0) && (cmd & W_OK)) + || (((st.st_mode & 001) == 0) && (cmd & X_OK))) + { + rslt = -1; + errnum = EACCES; + } + } + } + if (DebugPI) + { + fprintf (stderr, "# mpw_access (%s, %d)", tmpname, cmd); + fprintf (stderr, " -> %d", rslt); + if (rslt != 0) + fprintf (stderr, " (errno is %d)", errnum); + fprintf (stderr, "\n"); + } + if (rslt != 0) + errno = errnum; + return rslt; +} + +/* The MPW library creat() has no mode argument. */ + +int +mpw_creat (char *path, /* mode_t */ int mode) +{ +#undef creat + +#ifdef USE_MW_HEADERS + return creat (path, mode); +#else + return creat (path); +#endif +} + +/* This is a hack to get control in an MPW tool before it crashes the + machine. */ + +mpw_special_init (name) + char *name; +{ + if (strstr (name, "DEBUG")) + DebugStr("\pat beginning of program"); +} + +static int current_umask; + +int +umask(int mask) +{ + int oldmask = current_umask; + + current_umask = mask; + return oldmask; +} + +/* Cursor-spinning stuff that includes metering of spin rate and delays. */ + +/* Nonzero when cursor spinning has been set up properly. */ + +int cursor_inited; + +/* Nonzero if spin should be measured and excessive delays reported. */ + +int measure_spin; + +/* Nonzero if spin histogram and rate data should be written out. */ + +int dump_spin_data; + +long warning_threshold = 400000; + +long bucket_size = 1024; + +long bucket_power = 10; + +long numbuckets = 300; + +int *delay_counts; + +int overflow_count; + +char *current_progress; + +static UnsignedWide last_microseconds; + +static char *last_spin_file = ""; + +static int last_spin_line; + +void +warn_if_spin_delay (char *file, int line) +{ + long diff, ix; + UnsignedWide now; + + Microseconds(&now); + + diff = now.lo - last_microseconds.lo; + + if (diff > warning_threshold) + fprintf (stderr, "# %s: %ld.%06ld sec delay getting from %s:%d to %s:%d\n", + (current_progress ? current_progress : ""), + diff / 1000000, diff % 1000000, + last_spin_file, last_spin_line, file, line); + if (dump_spin_data) + { + if (diff >= 0) + { + ix = diff >> bucket_power; + if (ix >= 0 && ix < numbuckets && delay_counts != NULL) + ++delay_counts[ix]; + else + ++overflow_count; + } + else + fprintf (stderr, "raw diff is %ld (?)\n", diff); + } +} + +void +record_for_spin_delay (char *file, int line) +{ + Microseconds (&last_microseconds); + last_spin_file = file; + last_spin_line = line; +} + +void +mpw_start_progress (char *str, int n, char *file, int line) +{ + int i; + char *measure, *threshold; + + if (!cursor_inited) + { + InitCursorCtl (nil); + cursor_inited = 1; + record_for_spin_delay (file, line); + measure = getenv ("MEASURE_SPIN"); + if (measure != NULL && measure[0] != '\0') + { + measure_spin = 1; + if (strcmp (measure, "all") == 0) + dump_spin_data = 1; + } + threshold = getenv ("SPIN_WARN_THRESHOLD"); + if (threshold != NULL && threshold[0] != '\0') + warning_threshold = atol (threshold); + if (dump_spin_data) + { + if (delay_counts == NULL) + delay_counts = (int *) malloc (numbuckets * sizeof (int)); + for (i = 0; i < numbuckets; ++i) + delay_counts[i] = 0; + overflow_count = 0; + } + } + current_progress = str; + + sys_nerr = errno_max (); + + mpw_special_init (str); +} + +void +mpw_progress (int n) +{ + SpinCursor (32); +} + +void +mpw_progress_measured (int n, char *file, int line) +{ + if (measure_spin) + warn_if_spin_delay (file, line); + SpinCursor (32); + if (measure_spin) + record_for_spin_delay (file, line); +} + +void +mpw_end_progress (char *str, char *file, int line) +{ + long i, delay, count = 0, sum = 0, avgdelay, spinrate; + long curpower = 0, curgroup = 0; + + /* Warn if it's been a while since the last spin. */ + if (measure_spin) + warn_if_spin_delay (file, line); + + /* Dump all the nonzero delay counts and an approximation of the delay. */ + if (dump_spin_data && delay_counts != NULL) + { + for (i = 0; i < numbuckets; ++i) + { + delay = (i + 1) * bucket_size; + sum += delay_counts[i] * (i + 1); + count += delay_counts[i]; + if (delay <= (1 << curpower)) + { + curgroup += delay_counts[i]; + } + else + { + if (curgroup > 0) + fprintf (stderr, + "# %s: %d delays between %ld.%06ld and %ld.%06ld sec\n", + (str ? str : ""), + curgroup, + (1 << curpower) / 1000000, + (1 << curpower) % 1000000, + (1 << (curpower + 1)) / 1000000, + (1 << (curpower + 1)) % 1000000); + ++curpower; + curgroup = 0; + } + } + if (count > 0) + { + avgdelay = (sum * bucket_size) / count; + spinrate = 1000000 / avgdelay; + fprintf (stderr, "# %s: Average spin rate is %d times/sec\n", + (str ? str : ""), spinrate); + } + } +} + +#ifdef PROGRESS_TEST + +/* Test program. */ + +main () +{ + int i, j; + double x = 1.0, y = 2.4; + long start = Microseconds (), tm; FIXME + + START_PROGRESS ("hi", 0); + + for (i = 0; i < 1000; ++i) + { + PROGRESS (1); + + for (j = 0; j < (i * 100); ++j) + { + x += (x * y) / j; + } + } + + END_PROGRESS ("hi"); + + tm = Microseconds () - start; + + printf ("Total time is %d.%d secs\n", tm / 1000000, tm % 1000000); +} + +#endif + +#ifdef USE_MW_HEADERS +/* Empty definitions for Metrowerks' SIOUX console library. */ + +#ifndef __CONSOLE__ +#include <console.h> +#endif + +short +InstallConsole(short fd) +{ +#pragma unused (fd) + return 0; +} + +void +RemoveConsole(void) +{ +} + +long +WriteCharsToConsole(char *buf, long n) +{ +#pragma unused (buf, n) + return 0; +} + +long ReadCharsFromConsole(char *buf, long n) +{ +#pragma unused (buf, n) + return 0; +} + +extern char * +__ttyname(long fd) +{ + static char *__devicename = "null device"; + + if (fd >= 0 && fd <= 2) + return (__devicename); + return NULL; +} + +#endif diff --git a/libiberty/msdos.c b/libiberty/msdos.c new file mode 100755 index 0000000..923e64d --- /dev/null +++ b/libiberty/msdos.c @@ -0,0 +1,15 @@ +char msg[] = "No vfork available - aborting\n"; +vfork() +{ + write(1, msg, sizeof(msg)); +} + +sigsetmask() +{ + /* no signals support in go32 (yet) */ +} + +waitpid() +{ + return -1; +} diff --git a/libiberty/objalloc.c b/libiberty/objalloc.c new file mode 100755 index 0000000..57754a8 --- /dev/null +++ b/libiberty/objalloc.c @@ -0,0 +1,291 @@ +/* objalloc.c -- routines to allocate memory for objects + Copyright 1997 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Solutions. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "ansidecl.h" +#include "objalloc.h" + +/* Get a definition for NULL. */ +#include <stdio.h> + +#if VMS +#include <stdlib.h> +#include <unixlib.h> +#else + +#ifdef ANSI_PROTOTYPES +/* Get a definition for size_t. */ +#include <stddef.h> +#endif + +/* For systems with larger pointers than ints, this must be declared. */ +extern PTR malloc PARAMS ((size_t)); +extern void free PARAMS ((PTR)); +#endif + +/* These routines allocate space for an object. Freeing allocated + space may or may not free all more recently allocated space. + + We handle large and small allocation requests differently. If we + don't have enough space in the current block, and the allocation + request is for more than 512 bytes, we simply pass it through to + malloc. */ + +/* The objalloc structure is defined in objalloc.h. */ + +/* This structure appears at the start of each chunk. */ + +struct objalloc_chunk +{ + /* Next chunk. */ + struct objalloc_chunk *next; + /* If this chunk contains large objects, this is the value of + current_ptr when this chunk was allocated. If this chunk + contains small objects, this is NULL. */ + char *current_ptr; +}; + +/* The aligned size of objalloc_chunk. */ + +#define CHUNK_HEADER_SIZE \ + ((sizeof (struct objalloc_chunk) + OBJALLOC_ALIGN - 1) \ + &~ (OBJALLOC_ALIGN - 1)) + +/* We ask for this much memory each time we create a chunk which is to + hold small objects. */ + +#define CHUNK_SIZE (4096 - 32) + +/* A request for this amount or more is just passed through to malloc. */ + +#define BIG_REQUEST (512) + +/* Create an objalloc structure. */ + +struct objalloc * +objalloc_create () +{ + struct objalloc *ret; + struct objalloc_chunk *chunk; + + ret = (struct objalloc *) malloc (sizeof *ret); + if (ret == NULL) + return NULL; + + ret->chunks = (PTR) malloc (CHUNK_SIZE); + if (ret->chunks == NULL) + { + free (ret); + return NULL; + } + + chunk = (struct objalloc_chunk *) ret->chunks; + chunk->next = NULL; + chunk->current_ptr = NULL; + + ret->current_ptr = (char *) chunk + CHUNK_HEADER_SIZE; + ret->current_space = CHUNK_SIZE - CHUNK_HEADER_SIZE; + + return ret; +} + +/* Allocate space from an objalloc structure. */ + +PTR +_objalloc_alloc (o, len) + struct objalloc *o; + unsigned long len; +{ + /* We avoid confusion from zero sized objects by always allocating + at least 1 byte. */ + if (len == 0) + len = 1; + + len = (len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1); + + if (len <= o->current_space) + { + o->current_ptr += len; + o->current_space -= len; + return (PTR) (o->current_ptr - len); + } + + if (len >= BIG_REQUEST) + { + char *ret; + struct objalloc_chunk *chunk; + + ret = (char *) malloc (CHUNK_HEADER_SIZE + len); + if (ret == NULL) + return NULL; + + chunk = (struct objalloc_chunk *) ret; + chunk->next = (struct objalloc_chunk *) o->chunks; + chunk->current_ptr = o->current_ptr; + + o->chunks = (PTR) chunk; + + return (PTR) (ret + CHUNK_HEADER_SIZE); + } + else + { + struct objalloc_chunk *chunk; + + chunk = (struct objalloc_chunk *) malloc (CHUNK_SIZE); + if (chunk == NULL) + return NULL; + chunk->next = (struct objalloc_chunk *) o->chunks; + chunk->current_ptr = NULL; + + o->current_ptr = (char *) chunk + CHUNK_HEADER_SIZE; + o->current_space = CHUNK_SIZE - CHUNK_HEADER_SIZE; + + o->chunks = (PTR) chunk; + + return objalloc_alloc (o, len); + } +} + +/* Free an entire objalloc structure. */ + +void +objalloc_free (o) + struct objalloc *o; +{ + struct objalloc_chunk *l; + + l = (struct objalloc_chunk *) o->chunks; + while (l != NULL) + { + struct objalloc_chunk *next; + + next = l->next; + free (l); + l = next; + } + + free (o); +} + +/* Free a block from an objalloc structure. This also frees all more + recently allocated blocks. */ + +void +objalloc_free_block (o, block) + struct objalloc *o; + PTR block; +{ + struct objalloc_chunk *p, *small; + char *b = (char *) block; + + /* First set P to the chunk which contains the block we are freeing, + and set Q to the last small object chunk we see before P. */ + small = NULL; + for (p = (struct objalloc_chunk *) o->chunks; p != NULL; p = p->next) + { + if (p->current_ptr == NULL) + { + if (b > (char *) p && b < (char *) p + CHUNK_SIZE) + break; + small = p; + } + else + { + if (b == (char *) p + CHUNK_HEADER_SIZE) + break; + } + } + + /* If we can't find the chunk, the caller has made a mistake. */ + if (p == NULL) + abort (); + + if (p->current_ptr == NULL) + { + struct objalloc_chunk *q; + struct objalloc_chunk *first; + + /* The block is in a chunk containing small objects. We can + free every chunk through SMALL, because they have certainly + been allocated more recently. After SMALL, we will not see + any chunks containing small objects; we can free any big + chunk if the current_ptr is greater than or equal to B. We + can then reset the new current_ptr to B. */ + + first = NULL; + q = (struct objalloc_chunk *) o->chunks; + while (q != p) + { + struct objalloc_chunk *next; + + next = q->next; + if (small != NULL) + { + if (small == q) + small = NULL; + free (q); + } + else if (q->current_ptr > b) + free (q); + else if (first == NULL) + first = q; + + q = next; + } + + if (first == NULL) + first = p; + o->chunks = (PTR) first; + + /* Now start allocating from this small block again. */ + o->current_ptr = b; + o->current_space = ((char *) p + CHUNK_SIZE) - b; + } + else + { + struct objalloc_chunk *q; + char *current_ptr; + + /* This block is in a large chunk by itself. We can free + everything on the list up to and including this block. We + then start allocating from the next chunk containing small + objects, setting current_ptr from the value stored with the + large chunk we are freeing. */ + + current_ptr = p->current_ptr; + p = p->next; + + q = (struct objalloc_chunk *) o->chunks; + while (q != p) + { + struct objalloc_chunk *next; + + next = q->next; + free (q); + q = next; + } + + o->chunks = (PTR) p; + + while (p->current_ptr != NULL) + p = p->next; + + o->current_ptr = current_ptr; + o->current_space = ((char *) p + CHUNK_SIZE) - current_ptr; + } +} diff --git a/libiberty/obstack.c b/libiberty/obstack.c new file mode 100755 index 0000000..f2fbb25 --- /dev/null +++ b/libiberty/obstack.c @@ -0,0 +1,586 @@ +/* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. + + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "obstack.h" + +/* NOTE BEFORE MODIFYING THIS FILE: This version number must be + incremented whenever callers compiled using an old obstack.h can no + longer properly call the functions in this obstack.c. */ +#define OBSTACK_INTERFACE_VERSION 1 + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself, and the installed library + supports the same library interface we do. This code is part of the GNU + C Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object + files, it is simpler to just do this in the source for each such file. */ + +#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */ +#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 +#include <gnu-versions.h> +#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + + +#ifndef ELIDE_CODE + + +#if defined (__STDC__) && __STDC__ +#define POINTER void * +#else +#define POINTER char * +#endif + +/* Determine default alignment. */ +struct fooalign {char x; double d;}; +#define DEFAULT_ALIGNMENT \ + ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0)) +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. */ +union fooround {long x; double d;}; +#define DEFAULT_ROUNDING (sizeof (union fooround)) + +/* When we copy a long block of data, this is the unit to do it with. + On some machines, copying successive ints does not work; + in such a case, redefine COPYING_UNIT to `long' (if that works) + or `char' as a last resort. */ +#ifndef COPYING_UNIT +#define COPYING_UNIT int +#endif + + +/* The functions allocating more room by calling `obstack_chunk_alloc' + jump to the handler pointed to by `obstack_alloc_failed_handler'. + This variable by default points to the internal function + `print_and_abort'. */ +#if defined (__STDC__) && __STDC__ +static void print_and_abort (void); +void (*obstack_alloc_failed_handler) (void) = print_and_abort; +#else +static void print_and_abort (); +void (*obstack_alloc_failed_handler) () = print_and_abort; +#endif + +/* Exit value used when `print_and_abort' is used. */ +#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H +#include <stdlib.h> +#endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +int obstack_exit_failure = EXIT_FAILURE; + +/* The non-GNU-C macros copy the obstack into this global variable + to avoid multiple evaluation. */ + +struct obstack *_obstack; + +/* Define a macro that either calls functions with the traditional malloc/free + calling interface, or calls functions with the mmalloc/mfree interface + (that adds an extra first argument), based on the state of use_extra_arg. + For free, do not use ?:, since some compilers, like the MIPS compilers, + do not allow (expr) ? void : void. */ + +#if defined (__STDC__) && __STDC__ +#define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ + : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) + +#define CALL_FREEFUN(h, old_chunk) \ + do { \ + if ((h) -> use_extra_arg) \ + (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ + else \ + (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ + } while (0) +#else +#define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ + : (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size))) + +#define CALL_FREEFUN(h, old_chunk) \ + do { \ + if ((h) -> use_extra_arg) \ + (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ + else \ + (*(void (*) ()) (h)->freefun) ((old_chunk)); \ + } while (0) +#endif + + +/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). + Objects start on multiples of ALIGNMENT (0 means use default). + CHUNKFUN is the function to use to allocate chunks, + and FREEFUN the function to free them. + + Return nonzero if successful, zero if out of memory. + To recover from an out of memory error, + free up some memory, then call this again. */ + +int +_obstack_begin (h, size, alignment, chunkfun, freefun) + struct obstack *h; + int size; + int alignment; +#if defined (__STDC__) && __STDC__ + POINTER (*chunkfun) (long); + void (*freefun) (void *); +#else + POINTER (*chunkfun) (); + void (*freefun) (); +#endif +{ + register struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = (int) DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + +#if defined (__STDC__) && __STDC__ + h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; + h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; +#else + h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; + h->freefun = freefun; +#endif + h->chunk_size = size; + h->alignment_mask = alignment - 1; + h->use_extra_arg = 0; + + chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = chunk->contents; + h->chunk_limit = chunk->limit + = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +int +_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg) + struct obstack *h; + int size; + int alignment; +#if defined (__STDC__) && __STDC__ + POINTER (*chunkfun) (POINTER, long); + void (*freefun) (POINTER, POINTER); +#else + POINTER (*chunkfun) (); + void (*freefun) (); +#endif + POINTER arg; +{ + register struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = (int) DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + +#if defined(__STDC__) && __STDC__ + h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; + h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; +#else + h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; + h->freefun = freefun; +#endif + h->chunk_size = size; + h->alignment_mask = alignment - 1; + h->extra_arg = arg; + h->use_extra_arg = 1; + + chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = chunk->contents; + h->chunk_limit = chunk->limit + = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +/* Allocate a new current chunk for the obstack *H + on the assumption that LENGTH bytes need to be added + to the current object, or a new object of length LENGTH allocated. + Copies any partial object from the end of the old chunk + to the beginning of the new one. */ + +void +_obstack_newchunk (h, length) + struct obstack *h; + int length; +{ + register struct _obstack_chunk *old_chunk = h->chunk; + register struct _obstack_chunk *new_chunk; + register long new_size; + register long obj_size = h->next_free - h->object_base; + register long i; + long already; + + /* Compute size for new chunk. */ + new_size = (obj_size + length) + (obj_size >> 3) + 100; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + /* Allocate and initialize the new chunk. */ + new_chunk = CALL_CHUNKFUN (h, new_size); + if (!new_chunk) + (*obstack_alloc_failed_handler) (); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + /* Move the existing object to the new chunk. + Word at a time is fast and is safe if the object + is sufficiently aligned. */ + if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) + { + for (i = obj_size / sizeof (COPYING_UNIT) - 1; + i >= 0; i--) + ((COPYING_UNIT *)new_chunk->contents)[i] + = ((COPYING_UNIT *)h->object_base)[i]; + /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, + but that can cross a page boundary on a machine + which does not do strict alignment for COPYING_UNITS. */ + already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); + } + else + already = 0; + /* Copy remaining bytes one by one. */ + for (i = already; i < obj_size; i++) + new_chunk->contents[i] = h->object_base[i]; + + /* If the object just copied was the only data in OLD_CHUNK, + free that chunk and remove it from the chain. + But not if that chunk might contain an empty object. */ + if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + { + new_chunk->prev = old_chunk->prev; + CALL_FREEFUN (h, old_chunk); + } + + h->object_base = new_chunk->contents; + h->next_free = h->object_base + obj_size; + /* The new chunk certainly contains no empty object yet. */ + h->maybe_empty_object = 0; +} + +/* Return nonzero if object OBJ has been allocated from obstack H. + This is here for debugging. + If you use it in a program, you are probably losing. */ + +#if defined (__STDC__) && __STDC__ +/* Suppress -Wmissing-prototypes warning. We don't want to declare this in + obstack.h because it is just for debugging. */ +int _obstack_allocated_p (struct obstack *h, POINTER obj); +#endif + +int +_obstack_allocated_p (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = (h)->chunk; + /* We use >= rather than > since the object cannot be exactly at + the beginning of the chunk but might be an empty object exactly + at the end of an adjacent chunk. */ + while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + { + plp = lp->prev; + lp = plp; + } + return lp != 0; +} + +/* Free objects in obstack H, including OBJ and everything allocate + more recently than OBJ. If OBJ is zero, free everything in H. */ + +#undef obstack_free + +/* This function has two names with identical definitions. + This is the first one, called from non-ANSI code. */ + +void +_obstack_free (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + { + plp = lp->prev; + CALL_FREEFUN (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +/* This function is used from ANSI code. */ + +void +obstack_free (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + { + plp = lp->prev; + CALL_FREEFUN (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +int +_obstack_memory_used (h) + struct obstack *h; +{ + register struct _obstack_chunk* lp; + register int nbytes = 0; + + for (lp = h->chunk; lp != 0; lp = lp->prev) + { + nbytes += lp->limit - (char *) lp; + } + return nbytes; +} + +/* Define the error handler. */ +#ifndef _ +#define _(Str) (Str) +#endif + +static void +print_and_abort () +{ + fputs (_("memory exhausted\n"), stderr); + exit (obstack_exit_failure); +} + +#if 0 +/* These are now turned off because the applications do not use it + and it uses bcopy via obstack_grow, which causes trouble on sysV. */ + +/* Now define the functional versions of the obstack macros. + Define them to simply use the corresponding macros to do the job. */ + +#if defined (__STDC__) && __STDC__ +/* These function definitions do not work with non-ANSI preprocessors; + they won't pass through the macro names in parentheses. */ + +/* The function names appear in parentheses in order to prevent + the macro-definitions of the names from being expanded there. */ + +POINTER (obstack_base) (obstack) + struct obstack *obstack; +{ + return obstack_base (obstack); +} + +POINTER (obstack_next_free) (obstack) + struct obstack *obstack; +{ + return obstack_next_free (obstack); +} + +int (obstack_object_size) (obstack) + struct obstack *obstack; +{ + return obstack_object_size (obstack); +} + +int (obstack_room) (obstack) + struct obstack *obstack; +{ + return obstack_room (obstack); +} + +int (obstack_make_room) (obstack, length) + struct obstack *obstack; + int length; +{ + return obstack_make_room (obstack, length); +} + +void (obstack_grow) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + obstack_grow (obstack, pointer, length); +} + +void (obstack_grow0) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + obstack_grow0 (obstack, pointer, length); +} + +void (obstack_1grow) (obstack, character) + struct obstack *obstack; + int character; +{ + obstack_1grow (obstack, character); +} + +void (obstack_blank) (obstack, length) + struct obstack *obstack; + int length; +{ + obstack_blank (obstack, length); +} + +void (obstack_1grow_fast) (obstack, character) + struct obstack *obstack; + int character; +{ + obstack_1grow_fast (obstack, character); +} + +void (obstack_blank_fast) (obstack, length) + struct obstack *obstack; + int length; +{ + obstack_blank_fast (obstack, length); +} + +POINTER (obstack_finish) (obstack) + struct obstack *obstack; +{ + return obstack_finish (obstack); +} + +POINTER (obstack_alloc) (obstack, length) + struct obstack *obstack; + int length; +{ + return obstack_alloc (obstack, length); +} + +POINTER (obstack_copy) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + return obstack_copy (obstack, pointer, length); +} + +POINTER (obstack_copy0) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + return obstack_copy0 (obstack, pointer, length); +} + +#endif /* __STDC__ */ + +#endif /* 0 */ + +#endif /* !ELIDE_CODE */ diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c new file mode 100755 index 0000000..0ead566 --- /dev/null +++ b/libiberty/pexecute.c @@ -0,0 +1,734 @@ +/* Utilities to execute a program in a subprocess (possibly linked by pipes + with other subprocesses), and wait for it. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* This file exports two functions: pexecute and pwait. */ + +/* This file lives in at least two places: libiberty and gcc. + Don't change one without the other. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <errno.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#define ISSPACE (x) isspace(x) +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif + +#ifdef vfork /* Autoconf may define this to fork for us. */ +# define VFORK_STRING "fork" +#else +# define VFORK_STRING "vfork" +#endif +#ifdef HAVE_VFORK_H +#include <vfork.h> +#endif +#ifdef VMS +#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \ + lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1) +#endif /* VMS */ + +#include "libiberty.h" + +/* stdin file number. */ +#define STDIN_FILE_NO 0 + +/* stdout file number. */ +#define STDOUT_FILE_NO 1 + +/* value of `pipe': port index for reading. */ +#define READ_PORT 0 + +/* value of `pipe': port index for writing. */ +#define WRITE_PORT 1 + +static char *install_error_msg = "installation problem, cannot exec `%s'"; + +/* pexecute: execute a program. + + PROGRAM and ARGV are the arguments to execv/execvp. + + THIS_PNAME is name of the calling program (i.e. argv[0]). + + 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. + + (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. + + 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. + + The result is the WEXITSTATUS on systems like MSDOS where we spawn and wait + for the child here. + + 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. + + pwait: cover function for wait. + + 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. + + The result is the pid of the child reaped, + or -1 for failure (errno says why). + + 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. + + pfinish: finish generation of script + + pfinish is necessary for systems like MPW where a script is generated that + runs the requested programs. +*/ + +#ifdef __MSDOS__ + +/* MSDOS doesn't multitask, but for the sake of a consistent interface + the code behaves like it does. pexecute runs the program, tucks the + exit code away, and returns a "pid". pwait must be called to fetch the + exit code. */ + +#include <process.h> + +/* For communicating information from pexecute to pwait. */ +static int last_pid = 0; +static int last_status = 0; +static int last_reaped = 0; + +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + int rc; + + last_pid++; + if (last_pid < 0) + last_pid = 1; + + if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) + abort (); + +#ifdef __GO32__ + /* ??? What are the possible return values from spawnv? */ + rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv); +#else + char *scmd, *rf; + FILE *argfile; + int i, el = flags & PEXECUTE_SEARCH ? 4 : 0; + + scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el); + rf = scmd + strlen(program) + 2 + el; + sprintf (scmd, "%s%s @%s.gp", program, + (flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base); + argfile = fopen (rf, "w"); + if (argfile == 0) + { + int errno_save = errno; + free (scmd); + errno = errno_save; + *errmsg_fmt = "cannot open `%s.gp'"; + *errmsg_arg = temp_base; + return -1; + } + + for (i=1; argv[i]; i++) + { + char *cp; + for (cp = argv[i]; *cp; cp++) + { + if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp)) + fputc ('\\', argfile); + fputc (*cp, argfile); + } + fputc ('\n', argfile); + } + fclose (argfile); + + rc = system (scmd); + + { + int errno_save = errno; + remove (rf); + free (scmd); + errno = errno_save; + } +#endif + + if (rc == -1) + { + *errmsg_fmt = install_error_msg; + *errmsg_arg = program; + return -1; + } + + /* Tuck the status away for pwait, and return a "pid". */ + last_status = rc << 8; + return last_pid; +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + /* On MSDOS each pexecute must be followed by it's associated pwait. */ + if (pid != last_pid + /* Called twice for the same child? */ + || pid == last_reaped) + { + /* ??? ECHILD would be a better choice. Can we use it here? */ + errno = EINVAL; + return -1; + } + /* ??? Here's an opportunity to canonicalize the values in STATUS. + Needed? */ + *status = last_status; + last_reaped = last_pid; + return last_pid; +} + +#endif /* MSDOS */ + +#if defined (_WIN32) + +#include <process.h> + +#ifdef __CYGWIN32__ + +#define fix_argv(argvec) (argvec) + +extern int _spawnv (); +extern int _spawnvp (); + +#else /* ! __CYGWIN32__ */ + +/* 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 * +fix_argv (argvec) + char **argvec; +{ + int i; + + for (i = 1; argvec[i] != 0; i++) + { + int len, j; + char *temp, *newtemp; + + temp = argvec[i]; + len = strlen (temp); + for (j = 0; j < len; j++) + { + if (temp[j] == '"') + { + newtemp = xmalloc (len + 2); + strncpy (newtemp, temp, j); + newtemp [j] = '\\'; + strncpy (&newtemp [j+1], &temp [j], len-j); + newtemp [len+1] = 0; + temp = newtemp; + len++; + j++; + } + } + + argvec[i] = temp; + } + + return (const char * const *) argvec; +} +#endif /* __CYGWIN32__ */ + +#include <io.h> +#include <fcntl.h> +#include <signal.h> + +/* mingw32 headers may not define the following. */ + +#ifndef _P_WAIT +# define _P_WAIT 0 +# define _P_NOWAIT 1 +# define _P_OVERLAY 2 +# define _P_NOWAITO 3 +# define _P_DETACH 4 + +# define WAIT_CHILD 0 +# define WAIT_GRANDCHILD 1 +#endif + +/* Win32 supports pipes */ +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + int pid; + int pdes[2], org_stdin, org_stdout; + int input_desc, output_desc; + int retries, sleep_interval; + + /* Pipe waiting from last process, to be used as input for the next one. + Value is STDIN_FILE_NO if no pipe is waiting + (i.e. the next command is the first of a group). */ + static int last_pipe_input; + + /* If this is the first process, initialize. */ + if (flags & PEXECUTE_FIRST) + last_pipe_input = STDIN_FILE_NO; + + input_desc = last_pipe_input; + + /* If this isn't the last process, make a pipe for its output, + and record it as waiting to be the input to the next process. */ + if (! (flags & PEXECUTE_LAST)) + { + if (_pipe (pdes, 256, O_BINARY) < 0) + { + *errmsg_fmt = "pipe"; + *errmsg_arg = NULL; + return -1; + } + output_desc = pdes[WRITE_PORT]; + last_pipe_input = pdes[READ_PORT]; + } + else + { + /* Last process. */ + output_desc = STDOUT_FILE_NO; + last_pipe_input = STDIN_FILE_NO; + } + + if (input_desc != STDIN_FILE_NO) + { + org_stdin = dup (STDIN_FILE_NO); + dup2 (input_desc, STDIN_FILE_NO); + close (input_desc); + } + + if (output_desc != STDOUT_FILE_NO) + { + org_stdout = dup (STDOUT_FILE_NO); + dup2 (output_desc, STDOUT_FILE_NO); + close (output_desc); + } + + pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) + (_P_NOWAIT, program, fix_argv(argv)); + + if (input_desc != STDIN_FILE_NO) + { + dup2 (org_stdin, STDIN_FILE_NO); + close (org_stdin); + } + + if (output_desc != STDOUT_FILE_NO) + { + dup2 (org_stdout, STDOUT_FILE_NO); + close (org_stdout); + } + + if (pid == -1) + { + *errmsg_fmt = install_error_msg; + *errmsg_arg = program; + return -1; + } + + return pid; +} + +/* MS CRTDLL doesn't return enough information in status to decide if the + child exited due to a signal or not, rather it simply returns an + integer with the exit code of the child; eg., if the child exited with + an abort() call and didn't have a handler for SIGABRT, it simply returns + with status = 3. We fix the status code to conform to the usual WIF* + macros. Note that WIFSIGNALED will never be true under CRTDLL. */ + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ +#ifdef __CYGWIN32__ + return wait (status); +#else + int termstat; + + pid = _cwait (&termstat, pid, WAIT_CHILD); + + /* ??? Here's an opportunity to canonicalize the values in STATUS. + Needed? */ + + /* cwait returns the child process exit code in termstat. + A value of 3 indicates that the child caught a signal, but not + which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we + report SIGABRT. */ + if (termstat == 3) + *status = SIGABRT; + else + *status = (((termstat) & 0xff) << 8); + + return pid; +#endif /* __CYGWIN32__ */ +} + +#endif /* _WIN32 */ + +#ifdef OS2 + +/* ??? Does OS2 have process.h? */ +extern int spawnv (); +extern int spawnvp (); + +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + int pid; + + if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) + abort (); + /* ??? Presumably 1 == _P_NOWAIT. */ + pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv); + if (pid == -1) + { + *errmsg_fmt = install_error_msg; + *errmsg_arg = program; + return -1; + } + return pid; +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + /* ??? Here's an opportunity to canonicalize the values in STATUS. + Needed? */ + int pid = wait (status); + return pid; +} + +#endif /* OS2 */ + +#ifdef MPW + +/* MPW pexecute doesn't actually run anything; instead, it writes out + script commands that, when run, will do the actual executing. + + For example, in GCC's case, GCC will write out several script commands: + + cpp ... + cc1 ... + as ... + ld ... + + and then exit. None of the above programs will have run yet. The task + that called GCC will then execute the script and cause cpp,etc. to run. + The caller must invoke pfinish before calling exit. This adds + the finishing touches to the generated script. */ + +static int first_time = 1; + +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + char tmpprogram[255]; + char *cp, *tmpname; + int i; + + mpwify_filename (program, tmpprogram); + if (first_time) + { + printf ("Set Failed 0\n"); + first_time = 0; + } + + fputs ("If {Failed} == 0\n", stdout); + /* If being verbose, output a copy of the command. It should be + accurate enough and escaped enough to be "clickable". */ + if (flags & PEXECUTE_VERBOSE) + { + fputs ("\tEcho ", stdout); + fputc ('\'', stdout); + fputs (tmpprogram, stdout); + fputc ('\'', stdout); + fputc (' ', stdout); + for (i=1; argv[i]; i++) + { + fputc ('\'', stdout); + /* See if we have an argument that needs fixing. */ + if (strchr(argv[i], '/')) + { + tmpname = (char *) xmalloc (256); + mpwify_filename (argv[i], tmpname); + argv[i] = tmpname; + } + for (cp = argv[i]; *cp; cp++) + { + /* Write an Option-d escape char in front of special chars. */ + if (strchr("'+", *cp)) + fputc ('\266', stdout); + fputc (*cp, stdout); + } + fputc ('\'', stdout); + fputc (' ', stdout); + } + fputs ("\n", stdout); + } + fputs ("\t", stdout); + fputs (tmpprogram, stdout); + fputc (' ', stdout); + + for (i=1; argv[i]; i++) + { + /* See if we have an argument that needs fixing. */ + if (strchr(argv[i], '/')) + { + tmpname = (char *) xmalloc (256); + mpwify_filename (argv[i], tmpname); + argv[i] = tmpname; + } + if (strchr (argv[i], ' ')) + fputc ('\'', stdout); + for (cp = argv[i]; *cp; cp++) + { + /* Write an Option-d escape char in front of special chars. */ + if (strchr("'+", *cp)) + fputc ('\266', stdout); + fputc (*cp, stdout); + } + if (strchr (argv[i], ' ')) + fputc ('\'', stdout); + fputc (' ', stdout); + } + + fputs ("\n", stdout); + + /* Output commands that arrange to clean up and exit if a failure occurs. + We have to be careful to collect the status from the program that was + run, rather than some other script command. Also, we don't exit + immediately, since necessary cleanups are at the end of the script. */ + fputs ("\tSet TmpStatus {Status}\n", stdout); + fputs ("\tIf {TmpStatus} != 0\n", stdout); + fputs ("\t\tSet Failed {TmpStatus}\n", stdout); + fputs ("\tEnd\n", stdout); + fputs ("End\n", stdout); + + /* We're just composing a script, can't fail here. */ + return 0; +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + *status = 0; + return 0; +} + +/* Write out commands that will exit with the correct error code + if something in the script failed. */ + +void +pfinish () +{ + printf ("\tExit \"{Failed}\"\n"); +} + +#endif /* MPW */ + +/* include for Unix-like environments but not for Dos-like environments */ +#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \ + && ! defined (_WIN32) + +extern int execv (); +extern int execvp (); + +int +pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) + const char *program; + char * const *argv; + const char *this_pname; + const char *temp_base; + char **errmsg_fmt, **errmsg_arg; + int flags; +{ + int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv); + int pid; + int pdes[2]; + int input_desc, output_desc; + int retries, sleep_interval; + /* Pipe waiting from last process, to be used as input for the next one. + Value is STDIN_FILE_NO if no pipe is waiting + (i.e. the next command is the first of a group). */ + static int last_pipe_input; + + /* If this is the first process, initialize. */ + if (flags & PEXECUTE_FIRST) + last_pipe_input = STDIN_FILE_NO; + + input_desc = last_pipe_input; + + /* If this isn't the last process, make a pipe for its output, + and record it as waiting to be the input to the next process. */ + if (! (flags & PEXECUTE_LAST)) + { + if (pipe (pdes) < 0) + { + *errmsg_fmt = "pipe"; + *errmsg_arg = NULL; + return -1; + } + output_desc = pdes[WRITE_PORT]; + last_pipe_input = pdes[READ_PORT]; + } + else + { + /* Last process. */ + output_desc = STDOUT_FILE_NO; + last_pipe_input = STDIN_FILE_NO; + } + + /* Fork a subprocess; wait and retry if it fails. */ + sleep_interval = 1; + for (retries = 0; retries < 4; retries++) + { + pid = vfork (); + if (pid >= 0) + break; + sleep (sleep_interval); + sleep_interval *= 2; + } + + switch (pid) + { + case -1: + { + *errmsg_fmt = VFORK_STRING; + *errmsg_arg = NULL; + return -1; + } + + case 0: /* child */ + /* Move the input and output pipes into place, if necessary. */ + if (input_desc != STDIN_FILE_NO) + { + close (STDIN_FILE_NO); + dup (input_desc); + close (input_desc); + } + if (output_desc != STDOUT_FILE_NO) + { + close (STDOUT_FILE_NO); + dup (output_desc); + close (output_desc); + } + + /* Close the parent's descs that aren't wanted here. */ + if (last_pipe_input != STDIN_FILE_NO) + close (last_pipe_input); + + /* Exec the program. */ + (*func) (program, argv); + + /* Note: Calling fprintf and exit here doesn't seem right for vfork. */ + fprintf (stderr, "%s: ", this_pname); + fprintf (stderr, install_error_msg, program); + fprintf (stderr, ": %s\n", xstrerror (errno)); + exit (-1); + /* NOTREACHED */ + return 0; + + default: + /* In the parent, after forking. + Close the descriptors that we made for this child. */ + if (input_desc != STDIN_FILE_NO) + close (input_desc); + if (output_desc != STDOUT_FILE_NO) + close (output_desc); + + /* Return child's process number. */ + return pid; + } +} + +int +pwait (pid, status, flags) + int pid; + int *status; + int flags; +{ + /* ??? Here's an opportunity to canonicalize the values in STATUS. + Needed? */ +#ifdef VMS + pid = waitpid (-1, status, 0); +#else + pid = wait (status); +#endif + return pid; +} + +#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */ diff --git a/libiberty/random.c b/libiberty/random.c new file mode 100755 index 0000000..0a95070 --- /dev/null +++ b/libiberty/random.c @@ -0,0 +1,377 @@ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* + * This is derived from the Berkeley source: + * @(#)random.c 5.5 (Berkeley) 7/6/88 + * It was reworked for the GNU C Library by Roland McGrath. + */ + +#include <errno.h> + +#if 0 + +#include <ansidecl.h> +#include <limits.h> +#include <stddef.h> +#include <stdlib.h> + +#else + +#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */ +#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits*/ + +#ifdef __STDC__ +# define PTR void * +# ifndef NULL +# define NULL (void *) 0 +# endif +#else +# define PTR char * +# ifndef NULL +# define NULL (void *) 0 +# endif +#endif + +#endif + +long int random (); + +/* An improved random number generation package. In addition to the standard + rand()/srand() like interface, this package also has a special state info + interface. The initstate() routine is called with a seed, an array of + bytes, and a count of how many bytes are being passed in; this array is + then initialized to contain information for random number generation with + that much state information. Good sizes for the amount of state + information are 32, 64, 128, and 256 bytes. The state can be switched by + calling the setstate() function with the same array as was initiallized + with initstate(). By default, the package runs with 128 bytes of state + information and generates far better random numbers than a linear + congruential generator. If the amount of state information is less than + 32 bytes, a simple linear congruential R.N.G. is used. Internally, the + state information is treated as an array of longs; the zeroeth element of + the array is the type of R.N.G. being used (small integer); the remainder + of the array is the state information for the R.N.G. Thus, 32 bytes of + state information will give 7 longs worth of state information, which will + allow a degree seven polynomial. (Note: The zeroeth word of state + information also has some other information stored in it; see setstate + for details). The random number generation technique is a linear feedback + shift register approach, employing trinomials (since there are fewer terms + to sum up that way). In this approach, the least significant bit of all + the numbers in the state table will act as a linear feedback shift register, + and will have period 2^deg - 1 (where deg is the degree of the polynomial + being used, assuming that the polynomial is irreducible and primitive). + The higher order bits will have longer periods, since their values are + also influenced by pseudo-random carries out of the lower bits. The + total period of the generator is approximately deg*(2**deg - 1); thus + doubling the amount of state information has a vast influence on the + period of the generator. Note: The deg*(2**deg - 1) is an approximation + only good for large deg, when the period of the shift register is the + dominant factor. With deg equal to seven, the period is actually much + longer than the 7*(2**7 - 1) predicted by this formula. */ + + + +/* For each of the currently supported random number generators, we have a + break value on the amount of state information (you need at least thi + bytes of state info to support this random number generator), a degree for + the polynomial (actually a trinomial) that the R.N.G. is based on, and + separation between the two lower order coefficients of the trinomial. */ + +/* Linear congruential. */ +#define TYPE_0 0 +#define BREAK_0 8 +#define DEG_0 0 +#define SEP_0 0 + +/* x**7 + x**3 + 1. */ +#define TYPE_1 1 +#define BREAK_1 32 +#define DEG_1 7 +#define SEP_1 3 + +/* x**15 + x + 1. */ +#define TYPE_2 2 +#define BREAK_2 64 +#define DEG_2 15 +#define SEP_2 1 + +/* x**31 + x**3 + 1. */ +#define TYPE_3 3 +#define BREAK_3 128 +#define DEG_3 31 +#define SEP_3 3 + +/* x**63 + x + 1. */ +#define TYPE_4 4 +#define BREAK_4 256 +#define DEG_4 63 +#define SEP_4 1 + + +/* Array versions of the above information to make code run faster. + Relies on fact that TYPE_i == i. */ + +#define MAX_TYPES 5 /* Max number of types above. */ + +static int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; +static int seps[MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; + + + +/* Initially, everything is set up as if from: + initstate(1, randtbl, 128); + Note that this initialization takes advantage of the fact that srandom + advances the front and rear pointers 10*rand_deg times, and hence the + rear pointer which starts at 0 will also end up at zero; thus the zeroeth + element of the state information, which contains info about the current + position of the rear pointer is just + (MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3. */ + +static long int randtbl[DEG_3 + 1] = + { TYPE_3, + 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, + 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb, + 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd, + 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, + 0xda672e2a, 0x1588ca88, 0xe369735d, 0x904f35f7, + 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc, + 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, + 0xf5ad9d0e, 0x8999220b, 0x27fb47b9 + }; + +/* FPTR and RPTR are two pointers into the state info, a front and a rear + pointer. These two pointers are always rand_sep places aparts, as they + cycle through the state information. (Yes, this does mean we could get + away with just one pointer, but the code for random is more efficient + this way). The pointers are left positioned as they would be from the call: + initstate(1, randtbl, 128); + (The position of the rear pointer, rptr, is really 0 (as explained above + in the initialization of randtbl) because the state table pointer is set + to point to randtbl[1] (as explained below).) */ + +static long int *fptr = &randtbl[SEP_3 + 1]; +static long int *rptr = &randtbl[1]; + + + +/* The following things are the pointer to the state information table, + the type of the current generator, the degree of the current polynomial + being used, and the separation between the two pointers. + Note that for efficiency of random, we remember the first location of + the state information, not the zeroeth. Hence it is valid to access + state[-1], which is used to store the type of the R.N.G. + Also, we remember the last location, since this is more efficient than + indexing every time to find the address of the last element to see if + the front and rear pointers have wrapped. */ + +static long int *state = &randtbl[1]; + +static int rand_type = TYPE_3; +static int rand_deg = DEG_3; +static int rand_sep = SEP_3; + +static long int *end_ptr = &randtbl[sizeof(randtbl) / sizeof(randtbl[0])]; + +/* Initialize the random number generator based on the given seed. If the + type is the trivial no-state-information type, just remember the seed. + Otherwise, initializes state[] based on the given "seed" via a linear + congruential generator. Then, the pointers are set to known locations + that are exactly rand_sep places apart. Lastly, it cycles the state + information a given number of times to get rid of any initial dependencies + introduced by the L.C.R.N.G. Note that the initialization of randtbl[] + for default usage relies on values produced by this routine. */ +void +srandom (x) + unsigned int x; +{ + state[0] = x; + if (rand_type != TYPE_0) + { + register long int i; + for (i = 1; i < rand_deg; ++i) + state[i] = (1103515145 * state[i - 1]) + 12345; + fptr = &state[rand_sep]; + rptr = &state[0]; + for (i = 0; i < 10 * rand_deg; ++i) + random(); + } +} + +/* Initialize the state information in the given array of N bytes for + future random number generation. Based on the number of bytes we + are given, and the break values for the different R.N.G.'s, we choose + the best (largest) one we can and set things up for it. srandom is + then called to initialize the state information. Note that on return + from srandom, we set state[-1] to be the type multiplexed with the current + value of the rear pointer; this is so successive calls to initstate won't + lose this information and will be able to restart with setstate. + Note: The first thing we do is save the current state, if any, just like + setstate so that it doesn't matter when initstate is called. + Returns a pointer to the old state. */ +PTR +initstate (seed, arg_state, n) + unsigned int seed; + PTR arg_state; + unsigned long n; +{ + PTR ostate = (PTR) &state[-1]; + + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = (MAX_TYPES * (rptr - state)) + rand_type; + if (n < BREAK_1) + { + if (n < BREAK_0) + { + errno = EINVAL; + return NULL; + } + rand_type = TYPE_0; + rand_deg = DEG_0; + rand_sep = SEP_0; + } + else if (n < BREAK_2) + { + rand_type = TYPE_1; + rand_deg = DEG_1; + rand_sep = SEP_1; + } + else if (n < BREAK_3) + { + rand_type = TYPE_2; + rand_deg = DEG_2; + rand_sep = SEP_2; + } + else if (n < BREAK_4) + { + rand_type = TYPE_3; + rand_deg = DEG_3; + rand_sep = SEP_3; + } + else + { + rand_type = TYPE_4; + rand_deg = DEG_4; + rand_sep = SEP_4; + } + + state = &((long int *) arg_state)[1]; /* First location. */ + /* Must set END_PTR before srandom. */ + end_ptr = &state[rand_deg]; + srandom(seed); + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = (MAX_TYPES * (rptr - state)) + rand_type; + + return ostate; +} + +/* Restore the state from the given state array. + Note: It is important that we also remember the locations of the pointers + in the current state information, and restore the locations of the pointers + from the old state information. This is done by multiplexing the pointer + location into the zeroeth word of the state information. Note that due + to the order in which things are done, it is OK to call setstate with the + same state as the current state + Returns a pointer to the old state information. */ + +PTR +setstate (arg_state) + PTR arg_state; +{ + register long int *new_state = (long int *) arg_state; + register int type = new_state[0] % MAX_TYPES; + register int rear = new_state[0] / MAX_TYPES; + PTR ostate = (PTR) &state[-1]; + + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = (MAX_TYPES * (rptr - state)) + rand_type; + + switch (type) + { + case TYPE_0: + case TYPE_1: + case TYPE_2: + case TYPE_3: + case TYPE_4: + rand_type = type; + rand_deg = degrees[type]; + rand_sep = seps[type]; + break; + default: + /* State info munged. */ + errno = EINVAL; + return NULL; + } + + state = &new_state[1]; + if (rand_type != TYPE_0) + { + rptr = &state[rear]; + fptr = &state[(rear + rand_sep) % rand_deg]; + } + /* Set end_ptr too. */ + end_ptr = &state[rand_deg]; + + return ostate; +} + +/* If we are using the trivial TYPE_0 R.N.G., just do the old linear + congruential bit. Otherwise, we do our fancy trinomial stuff, which is the + same in all ther other cases due to all the global variables that have been + set up. The basic operation is to add the number at the rear pointer into + the one at the front pointer. Then both pointers are advanced to the next + location cyclically in the table. The value returned is the sum generated, + reduced to 31 bits by throwing away the "least random" low bit. + Note: The code takes advantage of the fact that both the front and + rear pointers can't wrap on the same call by not testing the rear + pointer if the front one has wrapped. Returns a 31-bit random number. */ + +long int +random () +{ + if (rand_type == TYPE_0) + { + state[0] = ((state[0] * 1103515245) + 12345) & LONG_MAX; + return state[0]; + } + else + { + long int i; + *fptr += *rptr; + /* Chucking least random bit. */ + i = (*fptr >> 1) & LONG_MAX; + ++fptr; + if (fptr >= end_ptr) + { + fptr = state; + ++rptr; + } + else + { + ++rptr; + if (rptr >= end_ptr) + rptr = state; + } + return i; + } +} diff --git a/libiberty/rename.c b/libiberty/rename.c new file mode 100755 index 0000000..ae26e2d --- /dev/null +++ b/libiberty/rename.c @@ -0,0 +1,22 @@ +/* rename -- rename a file + This function is in the public domain. */ + +/* Rename a file. */ + +#include <errno.h> + +int +rename (zfrom, zto) + char *zfrom; + char *zto; +{ + if (link (zfrom, zto) < 0) + { + if (errno != EEXIST) + return -1; + if (unlink (zto) < 0 + || link (zfrom, zto) < 0) + return -1; + } + return unlink (zfrom); +} diff --git a/libiberty/rindex.c b/libiberty/rindex.c new file mode 100755 index 0000000..061d126 --- /dev/null +++ b/libiberty/rindex.c @@ -0,0 +1,11 @@ +/* Stub implementation of (obsolete) rindex(). */ + +extern char *strrchr (); + +char * +rindex (s, c) + char *s; + int c; +{ + return strrchr (s, c); +} diff --git a/libiberty/sigsetmask.c b/libiberty/sigsetmask.c new file mode 100755 index 0000000..2a09e6a --- /dev/null +++ b/libiberty/sigsetmask.c @@ -0,0 +1,30 @@ +/* Version of sigsetmask.c + Written by Steve Chamberlain (sac@cygnus.com). + 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 */ + +#define _POSIX_SOURCE +#include <ansidecl.h> +/* Including <sys/types.h> seems to be needed by ISC. */ +#include <sys/types.h> +#include <signal.h> + +#ifdef SIG_SETMASK +int +DEFUN(sigsetmask,(set), + int set) +{ + sigset_t new; + sigset_t old; + + sigemptyset (&new); + if (set != 0) { + abort(); /* FIXME, we don't know how to translate old mask to new */ + } + sigprocmask(SIG_SETMASK, &new, &old); + return 1; /* FIXME, we always return 1 as old value. */ +} +#endif diff --git a/libiberty/spaces.c b/libiberty/spaces.c new file mode 100755 index 0000000..ea92571 --- /dev/null +++ b/libiberty/spaces.c @@ -0,0 +1,78 @@ +/* Allocate memory region filled with spaces. + Copyright (C) 1991 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* + +NAME + + spaces -- return a pointer to a buffer full of spaces + +SYNOPSIS + + char *spaces (int count) + +DESCRIPTION + + Returns a pointer to a memory region filled with the specified + number of spaces and null terminated. The returned pointer is + valid until at least the next call. + +BUGS + +*/ + +#include "ansidecl.h" +#include "libiberty.h" + +#if VMS +#include <stdlib.h> +#include <unixlib.h> +#else +/* For systems with larger pointers than ints, these must be declared. */ +extern PTR malloc PARAMS ((size_t)); +extern void free PARAMS ((PTR)); +#endif + +const char * +spaces (count) + int count; +{ + register char *t; + static char *buf; + static int maxsize; + + if (count > maxsize) + { + if (buf) + { + free (buf); + } + buf = malloc (count + 1); + if (buf == (char *) 0) + return 0; + for (t = buf + count ; t != buf ; ) + { + *--t = ' '; + } + maxsize = count; + buf[count] = '\0'; + } + return (const char *) (buf + maxsize - count); +} + diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c new file mode 100755 index 0000000..db5feda --- /dev/null +++ b/libiberty/splay-tree.c @@ -0,0 +1,337 @@ +/* A splay-tree datatype. + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Mark Mitchell (mark@markmitchell.com). + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* For an easily readable description of splay-trees, see: + + Lewis, Harry R. and Denenberg, Larry. Data Structures and Their + Algorithms. Harper-Collins, Inc. 1991. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#include "libiberty.h" +#include "splay-tree.h" + +static void splay_tree_delete_helper PARAMS((splay_tree, + splay_tree_node)); +static void splay_tree_splay PARAMS((splay_tree, + splay_tree_key)); +static splay_tree_node splay_tree_splay_helper + PARAMS((splay_tree, + splay_tree_key, + splay_tree_node*, + splay_tree_node*, + splay_tree_node*)); +static int splay_tree_foreach_helper PARAMS((splay_tree, + splay_tree_node, + splay_tree_foreach_fn, + void*)); + +/* Deallocate NODE (a member of SP), and all its sub-trees. */ + +static void +splay_tree_delete_helper (sp, node) + splay_tree sp; + splay_tree_node node; +{ + if (!node) + return; + + splay_tree_delete_helper (sp, node->left); + splay_tree_delete_helper (sp, node->right); + + if (sp->delete_key) + (*sp->delete_key)(node->key); + if (sp->delete_value) + (*sp->delete_value)(node->value); + + free ((char*) node); +} + +/* Help splay SP around KEY. PARENT and GRANDPARENT are the parent + and grandparent, respectively, of NODE. */ + +static splay_tree_node +splay_tree_splay_helper (sp, key, node, parent, grandparent) + splay_tree sp; + splay_tree_key key; + splay_tree_node *node; + splay_tree_node *parent; + splay_tree_node *grandparent; +{ + splay_tree_node *next; + splay_tree_node n; + int comparison; + + n = *node; + + if (!n) + return *parent; + + comparison = (*sp->comp) (key, n->key); + + if (comparison == 0) + /* We've found the target. */ + next = 0; + else if (comparison < 0) + /* The target is to the left. */ + next = &n->left; + else + /* The target is to the right. */ + next = &n->right; + + if (next) + { + /* Continue down the tree. */ + n = splay_tree_splay_helper (sp, key, next, node, parent); + + /* The recursive call will change the place to which NODE + points. */ + if (*node != n) + return n; + } + + if (!parent) + /* NODE is the root. We are done. */ + return n; + + /* First, handle the case where there is no grandparent (i.e., + *PARENT is the root of the tree.) */ + if (!grandparent) + { + if (n == (*parent)->left) + { + *node = n->right; + n->right = *parent; + } + else + { + *node = n->left; + n->left = *parent; + } + *parent = n; + return n; + } + + /* Next handle the cases where both N and *PARENT are left children, + or where both are right children. */ + if (n == (*parent)->left && *parent == (*grandparent)->left) + { + splay_tree_node p = *parent; + + (*grandparent)->left = p->right; + p->right = *grandparent; + p->left = n->right; + n->right = p; + *grandparent = n; + return n; + } + else if (n == (*parent)->right && *parent == (*grandparent)->right) + { + splay_tree_node p = *parent; + + (*grandparent)->right = p->left; + p->left = *grandparent; + p->right = n->left; + n->left = p; + *grandparent = n; + return n; + } + + /* Finally, deal with the case where N is a left child, but *PARENT + is a right child, or vice versa. */ + if (n == (*parent)->left) + { + (*parent)->left = n->right; + n->right = *parent; + (*grandparent)->right = n->left; + n->left = *grandparent; + *grandparent = n; + return n; + } + else + { + (*parent)->right = n->left; + n->left = *parent; + (*grandparent)->left = n->right; + n->right = *grandparent; + *grandparent = n; + return n; + } +} + +/* Splay SP around KEY. */ + +static void +splay_tree_splay (sp, key) + splay_tree sp; + splay_tree_key key; +{ + if (sp->root == 0) + return; + + splay_tree_splay_helper (sp, key, &sp->root, + /*grandparent=*/0, /*parent=*/0); +} + +/* Call FN, passing it the DATA, for every node below NODE, all of + which are from SP, following an in-order traversal. If FN every + returns a non-zero value, the iteration ceases immediately, and the + value is returned. Otherwise, this function returns 0. */ + +static int +splay_tree_foreach_helper (sp, node, fn, data) + splay_tree sp; + splay_tree_node node; + splay_tree_foreach_fn fn; + void* data; +{ + int val; + + if (!node) + return 0; + + val = splay_tree_foreach_helper (sp, node->left, fn, data); + if (val) + return val; + + val = (*fn)(node, data); + if (val) + return val; + + return splay_tree_foreach_helper (sp, node->right, fn, data); +} + +/* Allocate a new splay tree, using COMPARE_FN to compare nodes, + DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate + values. */ + +splay_tree +splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) + splay_tree_compare_fn compare_fn; + splay_tree_delete_key_fn delete_key_fn; + splay_tree_delete_value_fn delete_value_fn; +{ + splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree)); + sp->root = 0; + sp->comp = compare_fn; + sp->delete_key = delete_key_fn; + sp->delete_value = delete_value_fn; + + return sp; +} + +/* Deallocate SP. */ + +void +splay_tree_delete (sp) + splay_tree sp; +{ + splay_tree_delete_helper (sp, sp->root); + free ((char*) sp); +} + +/* Insert a new node (associating KEY with DATA) into SP. If a + previous node with the indicated KEY exists, its data is replaced + with the new value. */ + +void +splay_tree_insert (sp, key, value) + splay_tree sp; + splay_tree_key key; + splay_tree_value value; +{ + int comparison; + + splay_tree_splay (sp, key); + + if (sp->root) + comparison = (*sp->comp)(sp->root->key, key); + + if (sp->root && comparison == 0) + { + /* If the root of the tree already has the indicated KEY, just + replace the value with VALUE. */ + if (sp->delete_value) + (*sp->delete_value)(sp->root->value); + sp->root->value = value; + } + else + { + /* Create a new node, and insert it at the root. */ + splay_tree_node node; + + node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node)); + node->key = key; + node->value = value; + + if (!sp->root) + node->left = node->right = 0; + else if (comparison < 0) + { + node->left = sp->root; + node->right = node->left->right; + node->left->right = 0; + } + else + { + node->right = sp->root; + node->left = node->right->left; + node->right->left = 0; + } + + sp->root = node; + } +} + +/* Lookup KEY in SP, returning VALUE if present, and NULL + otherwise. */ + +splay_tree_node +splay_tree_lookup (sp, key) + splay_tree sp; + splay_tree_key key; +{ + splay_tree_splay (sp, key); + + if (sp->root && (*sp->comp)(sp->root->key, key) == 0) + return sp->root; + else + return 0; +} + +/* Call FN, passing it the DATA, for every node in SP, following an + in-order traversal. If FN every returns a non-zero value, the + iteration ceases immediately, and the value is returned. + Otherwise, this function returns 0. */ + +int +splay_tree_foreach (sp, fn, data) + splay_tree sp; + splay_tree_foreach_fn fn; + void *data; +{ + return splay_tree_foreach_helper (sp, sp->root, fn, data); +} diff --git a/libiberty/strcasecmp.c b/libiberty/strcasecmp.c new file mode 100755 index 0000000..3aa930b --- /dev/null +++ b/libiberty/strcasecmp.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific written prior permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; +#endif /* LIBC_SCCS and not lint */ + +#include <ansidecl.h> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +typedef unsigned char uc; +static unsigned char charmap[] = { + (uc)'\000',(uc)'\001',(uc)'\002',(uc)'\003',(uc)'\004',(uc)'\005',(uc)'\006',(uc)'\007', + (uc)'\010',(uc)'\011',(uc)'\012',(uc)'\013',(uc)'\014',(uc)'\015',(uc)'\016',(uc)'\017', + (uc)'\020',(uc)'\021',(uc)'\022',(uc)'\023',(uc)'\024',(uc)'\025',(uc)'\026',(uc)'\027', + (uc)'\030',(uc)'\031',(uc)'\032',(uc)'\033',(uc)'\034',(uc)'\035',(uc)'\036',(uc)'\037', + (uc)'\040',(uc)'\041',(uc)'\042',(uc)'\043',(uc)'\044',(uc)'\045',(uc)'\046',(uc)'\047', + (uc)'\050',(uc)'\051',(uc)'\052',(uc)'\053',(uc)'\054',(uc)'\055',(uc)'\056',(uc)'\057', + (uc)'\060',(uc)'\061',(uc)'\062',(uc)'\063',(uc)'\064',(uc)'\065',(uc)'\066',(uc)'\067', + (uc)'\070',(uc)'\071',(uc)'\072',(uc)'\073',(uc)'\074',(uc)'\075',(uc)'\076',(uc)'\077', + (uc)'\100',(uc)'\141',(uc)'\142',(uc)'\143',(uc)'\144',(uc)'\145',(uc)'\146',(uc)'\147', + (uc)'\150',(uc)'\151',(uc)'\152',(uc)'\153',(uc)'\154',(uc)'\155',(uc)'\156',(uc)'\157', + (uc)'\160',(uc)'\161',(uc)'\162',(uc)'\163',(uc)'\164',(uc)'\165',(uc)'\166',(uc)'\167', + (uc)'\170',(uc)'\171',(uc)'\172',(uc)'\133',(uc)'\134',(uc)'\135',(uc)'\136',(uc)'\137', + (uc)'\140',(uc)'\141',(uc)'\142',(uc)'\143',(uc)'\144',(uc)'\145',(uc)'\146',(uc)'\147', + (uc)'\150',(uc)'\151',(uc)'\152',(uc)'\153',(uc)'\154',(uc)'\155',(uc)'\156',(uc)'\157', + (uc)'\160',(uc)'\161',(uc)'\162',(uc)'\163',(uc)'\164',(uc)'\165',(uc)'\166',(uc)'\167', + (uc)'\170',(uc)'\171',(uc)'\172',(uc)'\173',(uc)'\174',(uc)'\175',(uc)'\176',(uc)'\177', + (uc)'\200',(uc)'\201',(uc)'\202',(uc)'\203',(uc)'\204',(uc)'\205',(uc)'\206',(uc)'\207', + (uc)'\210',(uc)'\211',(uc)'\212',(uc)'\213',(uc)'\214',(uc)'\215',(uc)'\216',(uc)'\217', + (uc)'\220',(uc)'\221',(uc)'\222',(uc)'\223',(uc)'\224',(uc)'\225',(uc)'\226',(uc)'\227', + (uc)'\230',(uc)'\231',(uc)'\232',(uc)'\233',(uc)'\234',(uc)'\235',(uc)'\236',(uc)'\237', + (uc)'\240',(uc)'\241',(uc)'\242',(uc)'\243',(uc)'\244',(uc)'\245',(uc)'\246',(uc)'\247', + (uc)'\250',(uc)'\251',(uc)'\252',(uc)'\253',(uc)'\254',(uc)'\255',(uc)'\256',(uc)'\257', + (uc)'\260',(uc)'\261',(uc)'\262',(uc)'\263',(uc)'\264',(uc)'\265',(uc)'\266',(uc)'\267', + (uc)'\270',(uc)'\271',(uc)'\272',(uc)'\273',(uc)'\274',(uc)'\275',(uc)'\276',(uc)'\277', + (uc)'\300',(uc)'\341',(uc)'\342',(uc)'\343',(uc)'\344',(uc)'\345',(uc)'\346',(uc)'\347', + (uc)'\350',(uc)'\351',(uc)'\352',(uc)'\353',(uc)'\354',(uc)'\355',(uc)'\356',(uc)'\357', + (uc)'\360',(uc)'\361',(uc)'\362',(uc)'\363',(uc)'\364',(uc)'\365',(uc)'\366',(uc)'\367', + (uc)'\370',(uc)'\371',(uc)'\372',(uc)'\333',(uc)'\334',(uc)'\335',(uc)'\336',(uc)'\337', + (uc)'\340',(uc)'\341',(uc)'\342',(uc)'\343',(uc)'\344',(uc)'\345',(uc)'\346',(uc)'\347', + (uc)'\350',(uc)'\351',(uc)'\352',(uc)'\353',(uc)'\354',(uc)'\355',(uc)'\356',(uc)'\357', + (uc)'\360',(uc)'\361',(uc)'\362',(uc)'\363',(uc)'\364',(uc)'\365',(uc)'\366',(uc)'\367', + (uc)'\370',(uc)'\371',(uc)'\372',(uc)'\373',(uc)'\374',(uc)'\375',(uc)'\376',(uc)'\377', +}; + +int +strcasecmp(s1, s2) + const char *s1, *s2; +{ + register unsigned char u1, u2; + + for (;;) { + u1 = (unsigned char) *s1++; + u2 = (unsigned char) *s2++; + if (charmap[u1] != charmap[u2]) { + return charmap[u1] - charmap[u2]; + } + if (u1 == '\0') { + return 0; + } + } +} + diff --git a/libiberty/strchr.c b/libiberty/strchr.c new file mode 100755 index 0000000..550480f --- /dev/null +++ b/libiberty/strchr.c @@ -0,0 +1,34 @@ +/* Portable version of strchr() + This function is in the public domain. */ + +/* +NAME + strchr -- return pointer to first occurance of a character + +SYNOPSIS + char *strchr (const char *s, int c) + +DESCRIPTION + Returns a pointer to the first occurance of character C in + string S, or a NULL pointer if no occurance is found. + +BUGS + Behavior when character is the null character is implementation + dependent. +*/ + +#include <ansidecl.h> + +char * +strchr (s, c) + register const char *s; + int c; +{ + do { + if (*s == c) + { + return (char*)s; + } + } while (*s++); + return (0); +} diff --git a/libiberty/strdup.c b/libiberty/strdup.c new file mode 100755 index 0000000..1785b34 --- /dev/null +++ b/libiberty/strdup.c @@ -0,0 +1,10 @@ +char * +strdup(s) + char *s; +{ + char *result = (char*)malloc(strlen(s) + 1); + if (result == (char*)0) + return (char*)0; + strcpy(result, s); + return result; +} diff --git a/libiberty/strerror.c b/libiberty/strerror.c new file mode 100755 index 0000000..644cc75 --- /dev/null +++ b/libiberty/strerror.c @@ -0,0 +1,831 @@ +/* Extended support for using errno values. + Written by Fred Fish. fnf@cygnus.com + This file is in the public domain. --Per Bothner. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#include "config.h" + +#ifdef HAVE_SYS_ERRLIST +/* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least) + might declare sys_errlist in a way that the compiler might consider + incompatible with our later declaration, perhaps by using const + attributes. So we hide the declaration in errno.h (if any) using a + macro. */ +#define sys_errlist sys_errlist__ +#endif + +#include <stdio.h> +#include <errno.h> + +#ifdef HAVE_SYS_ERRLIST +#undef sys_errlist +#endif + +/* Routines imported from standard C runtime libraries. */ + +#ifdef __STDC__ +#include <stddef.h> +extern void *malloc (size_t size); /* 4.10.3.3 */ +extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */ +#else /* !__STDC__ */ +extern char *malloc (); /* Standard memory allocater */ +extern char *memset (); +#endif /* __STDC__ */ + +#ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +static void init_error_tables PARAMS ((void)); + +/* Translation table for errno values. See intro(2) in most UNIX systems + Programmers Reference Manuals. + + Note that this table is generally only accessed when it is used at runtime + to initialize errno name and message tables that are indexed by errno + value. + + Not all of these errnos will exist on all systems. This table is the only + thing that should have to be updated as new error numbers are introduced. + It's sort of ugly, but at least its portable. */ + +struct error_info +{ + int value; /* The numeric value from <errno.h> */ + const char *name; /* The equivalent symbolic value */ +#ifndef HAVE_SYS_ERRLIST + const char *msg; /* Short message about this value */ +#endif +}; + +#ifndef HAVE_SYS_ERRLIST +# define ENTRY(value, name, msg) {value, name, msg} +#else +# define ENTRY(value, name, msg) {value, name} +#endif + +static const struct error_info error_table[] = +{ +#if defined (EPERM) + ENTRY(EPERM, "EPERM", "Not owner"), +#endif +#if defined (ENOENT) + ENTRY(ENOENT, "ENOENT", "No such file or directory"), +#endif +#if defined (ESRCH) + ENTRY(ESRCH, "ESRCH", "No such process"), +#endif +#if defined (EINTR) + ENTRY(EINTR, "EINTR", "Interrupted system call"), +#endif +#if defined (EIO) + ENTRY(EIO, "EIO", "I/O error"), +#endif +#if defined (ENXIO) + ENTRY(ENXIO, "ENXIO", "No such device or address"), +#endif +#if defined (E2BIG) + ENTRY(E2BIG, "E2BIG", "Arg list too long"), +#endif +#if defined (ENOEXEC) + ENTRY(ENOEXEC, "ENOEXEC", "Exec format error"), +#endif +#if defined (EBADF) + ENTRY(EBADF, "EBADF", "Bad file number"), +#endif +#if defined (ECHILD) + ENTRY(ECHILD, "ECHILD", "No child processes"), +#endif +#if defined (EWOULDBLOCK) /* Put before EAGAIN, sometimes aliased */ + ENTRY(EWOULDBLOCK, "EWOULDBLOCK", "Operation would block"), +#endif +#if defined (EAGAIN) + ENTRY(EAGAIN, "EAGAIN", "No more processes"), +#endif +#if defined (ENOMEM) + ENTRY(ENOMEM, "ENOMEM", "Not enough space"), +#endif +#if defined (EACCES) + ENTRY(EACCES, "EACCES", "Permission denied"), +#endif +#if defined (EFAULT) + ENTRY(EFAULT, "EFAULT", "Bad address"), +#endif +#if defined (ENOTBLK) + ENTRY(ENOTBLK, "ENOTBLK", "Block device required"), +#endif +#if defined (EBUSY) + ENTRY(EBUSY, "EBUSY", "Device busy"), +#endif +#if defined (EEXIST) + ENTRY(EEXIST, "EEXIST", "File exists"), +#endif +#if defined (EXDEV) + ENTRY(EXDEV, "EXDEV", "Cross-device link"), +#endif +#if defined (ENODEV) + ENTRY(ENODEV, "ENODEV", "No such device"), +#endif +#if defined (ENOTDIR) + ENTRY(ENOTDIR, "ENOTDIR", "Not a directory"), +#endif +#if defined (EISDIR) + ENTRY(EISDIR, "EISDIR", "Is a directory"), +#endif +#if defined (EINVAL) + ENTRY(EINVAL, "EINVAL", "Invalid argument"), +#endif +#if defined (ENFILE) + ENTRY(ENFILE, "ENFILE", "File table overflow"), +#endif +#if defined (EMFILE) + ENTRY(EMFILE, "EMFILE", "Too many open files"), +#endif +#if defined (ENOTTY) + ENTRY(ENOTTY, "ENOTTY", "Not a typewriter"), +#endif +#if defined (ETXTBSY) + ENTRY(ETXTBSY, "ETXTBSY", "Text file busy"), +#endif +#if defined (EFBIG) + ENTRY(EFBIG, "EFBIG", "File too large"), +#endif +#if defined (ENOSPC) + ENTRY(ENOSPC, "ENOSPC", "No space left on device"), +#endif +#if defined (ESPIPE) + ENTRY(ESPIPE, "ESPIPE", "Illegal seek"), +#endif +#if defined (EROFS) + ENTRY(EROFS, "EROFS", "Read-only file system"), +#endif +#if defined (EMLINK) + ENTRY(EMLINK, "EMLINK", "Too many links"), +#endif +#if defined (EPIPE) + ENTRY(EPIPE, "EPIPE", "Broken pipe"), +#endif +#if defined (EDOM) + ENTRY(EDOM, "EDOM", "Math argument out of domain of func"), +#endif +#if defined (ERANGE) + ENTRY(ERANGE, "ERANGE", "Math result not representable"), +#endif +#if defined (ENOMSG) + ENTRY(ENOMSG, "ENOMSG", "No message of desired type"), +#endif +#if defined (EIDRM) + ENTRY(EIDRM, "EIDRM", "Identifier removed"), +#endif +#if defined (ECHRNG) + ENTRY(ECHRNG, "ECHRNG", "Channel number out of range"), +#endif +#if defined (EL2NSYNC) + ENTRY(EL2NSYNC, "EL2NSYNC", "Level 2 not synchronized"), +#endif +#if defined (EL3HLT) + ENTRY(EL3HLT, "EL3HLT", "Level 3 halted"), +#endif +#if defined (EL3RST) + ENTRY(EL3RST, "EL3RST", "Level 3 reset"), +#endif +#if defined (ELNRNG) + ENTRY(ELNRNG, "ELNRNG", "Link number out of range"), +#endif +#if defined (EUNATCH) + ENTRY(EUNATCH, "EUNATCH", "Protocol driver not attached"), +#endif +#if defined (ENOCSI) + ENTRY(ENOCSI, "ENOCSI", "No CSI structure available"), +#endif +#if defined (EL2HLT) + ENTRY(EL2HLT, "EL2HLT", "Level 2 halted"), +#endif +#if defined (EDEADLK) + ENTRY(EDEADLK, "EDEADLK", "Deadlock condition"), +#endif +#if defined (ENOLCK) + ENTRY(ENOLCK, "ENOLCK", "No record locks available"), +#endif +#if defined (EBADE) + ENTRY(EBADE, "EBADE", "Invalid exchange"), +#endif +#if defined (EBADR) + ENTRY(EBADR, "EBADR", "Invalid request descriptor"), +#endif +#if defined (EXFULL) + ENTRY(EXFULL, "EXFULL", "Exchange full"), +#endif +#if defined (ENOANO) + ENTRY(ENOANO, "ENOANO", "No anode"), +#endif +#if defined (EBADRQC) + ENTRY(EBADRQC, "EBADRQC", "Invalid request code"), +#endif +#if defined (EBADSLT) + ENTRY(EBADSLT, "EBADSLT", "Invalid slot"), +#endif +#if defined (EDEADLOCK) + ENTRY(EDEADLOCK, "EDEADLOCK", "File locking deadlock error"), +#endif +#if defined (EBFONT) + ENTRY(EBFONT, "EBFONT", "Bad font file format"), +#endif +#if defined (ENOSTR) + ENTRY(ENOSTR, "ENOSTR", "Device not a stream"), +#endif +#if defined (ENODATA) + ENTRY(ENODATA, "ENODATA", "No data available"), +#endif +#if defined (ETIME) + ENTRY(ETIME, "ETIME", "Timer expired"), +#endif +#if defined (ENOSR) + ENTRY(ENOSR, "ENOSR", "Out of streams resources"), +#endif +#if defined (ENONET) + ENTRY(ENONET, "ENONET", "Machine is not on the network"), +#endif +#if defined (ENOPKG) + ENTRY(ENOPKG, "ENOPKG", "Package not installed"), +#endif +#if defined (EREMOTE) + ENTRY(EREMOTE, "EREMOTE", "Object is remote"), +#endif +#if defined (ENOLINK) + ENTRY(ENOLINK, "ENOLINK", "Link has been severed"), +#endif +#if defined (EADV) + ENTRY(EADV, "EADV", "Advertise error"), +#endif +#if defined (ESRMNT) + ENTRY(ESRMNT, "ESRMNT", "Srmount error"), +#endif +#if defined (ECOMM) + ENTRY(ECOMM, "ECOMM", "Communication error on send"), +#endif +#if defined (EPROTO) + ENTRY(EPROTO, "EPROTO", "Protocol error"), +#endif +#if defined (EMULTIHOP) + ENTRY(EMULTIHOP, "EMULTIHOP", "Multihop attempted"), +#endif +#if defined (EDOTDOT) + ENTRY(EDOTDOT, "EDOTDOT", "RFS specific error"), +#endif +#if defined (EBADMSG) + ENTRY(EBADMSG, "EBADMSG", "Not a data message"), +#endif +#if defined (ENAMETOOLONG) + ENTRY(ENAMETOOLONG, "ENAMETOOLONG", "File name too long"), +#endif +#if defined (EOVERFLOW) + ENTRY(EOVERFLOW, "EOVERFLOW", "Value too large for defined data type"), +#endif +#if defined (ENOTUNIQ) + ENTRY(ENOTUNIQ, "ENOTUNIQ", "Name not unique on network"), +#endif +#if defined (EBADFD) + ENTRY(EBADFD, "EBADFD", "File descriptor in bad state"), +#endif +#if defined (EREMCHG) + ENTRY(EREMCHG, "EREMCHG", "Remote address changed"), +#endif +#if defined (ELIBACC) + ENTRY(ELIBACC, "ELIBACC", "Can not access a needed shared library"), +#endif +#if defined (ELIBBAD) + ENTRY(ELIBBAD, "ELIBBAD", "Accessing a corrupted shared library"), +#endif +#if defined (ELIBSCN) + ENTRY(ELIBSCN, "ELIBSCN", ".lib section in a.out corrupted"), +#endif +#if defined (ELIBMAX) + ENTRY(ELIBMAX, "ELIBMAX", "Attempting to link in too many shared libraries"), +#endif +#if defined (ELIBEXEC) + ENTRY(ELIBEXEC, "ELIBEXEC", "Cannot exec a shared library directly"), +#endif +#if defined (EILSEQ) + ENTRY(EILSEQ, "EILSEQ", "Illegal byte sequence"), +#endif +#if defined (ENOSYS) + ENTRY(ENOSYS, "ENOSYS", "Operation not applicable"), +#endif +#if defined (ELOOP) + ENTRY(ELOOP, "ELOOP", "Too many symbolic links encountered"), +#endif +#if defined (ERESTART) + ENTRY(ERESTART, "ERESTART", "Interrupted system call should be restarted"), +#endif +#if defined (ESTRPIPE) + ENTRY(ESTRPIPE, "ESTRPIPE", "Streams pipe error"), +#endif +#if defined (ENOTEMPTY) + ENTRY(ENOTEMPTY, "ENOTEMPTY", "Directory not empty"), +#endif +#if defined (EUSERS) + ENTRY(EUSERS, "EUSERS", "Too many users"), +#endif +#if defined (ENOTSOCK) + ENTRY(ENOTSOCK, "ENOTSOCK", "Socket operation on non-socket"), +#endif +#if defined (EDESTADDRREQ) + ENTRY(EDESTADDRREQ, "EDESTADDRREQ", "Destination address required"), +#endif +#if defined (EMSGSIZE) + ENTRY(EMSGSIZE, "EMSGSIZE", "Message too long"), +#endif +#if defined (EPROTOTYPE) + ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"), +#endif +#if defined (ENOPROTOOPT) + ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"), +#endif +#if defined (EPROTONOSUPPORT) + ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"), +#endif +#if defined (ESOCKTNOSUPPORT) + ENTRY(ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "Socket type not supported"), +#endif +#if defined (EOPNOTSUPP) + ENTRY(EOPNOTSUPP, "EOPNOTSUPP", "Operation not supported on transport endpoint"), +#endif +#if defined (EPFNOSUPPORT) + ENTRY(EPFNOSUPPORT, "EPFNOSUPPORT", "Protocol family not supported"), +#endif +#if defined (EAFNOSUPPORT) + ENTRY(EAFNOSUPPORT, "EAFNOSUPPORT", "Address family not supported by protocol"), +#endif +#if defined (EADDRINUSE) + ENTRY(EADDRINUSE, "EADDRINUSE", "Address already in use"), +#endif +#if defined (EADDRNOTAVAIL) + ENTRY(EADDRNOTAVAIL, "EADDRNOTAVAIL","Cannot assign requested address"), +#endif +#if defined (ENETDOWN) + ENTRY(ENETDOWN, "ENETDOWN", "Network is down"), +#endif +#if defined (ENETUNREACH) + ENTRY(ENETUNREACH, "ENETUNREACH", "Network is unreachable"), +#endif +#if defined (ENETRESET) + ENTRY(ENETRESET, "ENETRESET", "Network dropped connection because of reset"), +#endif +#if defined (ECONNABORTED) + ENTRY(ECONNABORTED, "ECONNABORTED", "Software caused connection abort"), +#endif +#if defined (ECONNRESET) + ENTRY(ECONNRESET, "ECONNRESET", "Connection reset by peer"), +#endif +#if defined (ENOBUFS) + ENTRY(ENOBUFS, "ENOBUFS", "No buffer space available"), +#endif +#if defined (EISCONN) + ENTRY(EISCONN, "EISCONN", "Transport endpoint is already connected"), +#endif +#if defined (ENOTCONN) + ENTRY(ENOTCONN, "ENOTCONN", "Transport endpoint is not connected"), +#endif +#if defined (ESHUTDOWN) + ENTRY(ESHUTDOWN, "ESHUTDOWN", "Cannot send after transport endpoint shutdown"), +#endif +#if defined (ETOOMANYREFS) + ENTRY(ETOOMANYREFS, "ETOOMANYREFS", "Too many references: cannot splice"), +#endif +#if defined (ETIMEDOUT) + ENTRY(ETIMEDOUT, "ETIMEDOUT", "Connection timed out"), +#endif +#if defined (ECONNREFUSED) + ENTRY(ECONNREFUSED, "ECONNREFUSED", "Connection refused"), +#endif +#if defined (EHOSTDOWN) + ENTRY(EHOSTDOWN, "EHOSTDOWN", "Host is down"), +#endif +#if defined (EHOSTUNREACH) + ENTRY(EHOSTUNREACH, "EHOSTUNREACH", "No route to host"), +#endif +#if defined (EALREADY) + ENTRY(EALREADY, "EALREADY", "Operation already in progress"), +#endif +#if defined (EINPROGRESS) + ENTRY(EINPROGRESS, "EINPROGRESS", "Operation now in progress"), +#endif +#if defined (ESTALE) + ENTRY(ESTALE, "ESTALE", "Stale NFS file handle"), +#endif +#if defined (EUCLEAN) + ENTRY(EUCLEAN, "EUCLEAN", "Structure needs cleaning"), +#endif +#if defined (ENOTNAM) + ENTRY(ENOTNAM, "ENOTNAM", "Not a XENIX named type file"), +#endif +#if defined (ENAVAIL) + ENTRY(ENAVAIL, "ENAVAIL", "No XENIX semaphores available"), +#endif +#if defined (EISNAM) + ENTRY(EISNAM, "EISNAM", "Is a named type file"), +#endif +#if defined (EREMOTEIO) + ENTRY(EREMOTEIO, "EREMOTEIO", "Remote I/O error"), +#endif + ENTRY(0, NULL, NULL) +}; + +#ifdef EVMSERR +/* This is not in the table, because the numeric value of EVMSERR (32767) + lies outside the range of sys_errlist[]. */ +static struct { int value; const char *name, *msg; } + evmserr = { EVMSERR, "EVMSERR", "VMS-specific error" }; +#endif + +/* Translation table allocated and initialized at runtime. Indexed by the + errno value to find the equivalent symbolic value. */ + +static const char **error_names; +static int num_error_names = 0; + +/* Translation table allocated and initialized at runtime, if it does not + already exist in the host environment. Indexed by the errno value to find + the descriptive string. + + We don't export it for use in other modules because even though it has the + same name, it differs from other implementations in that it is dynamically + initialized rather than statically initialized. */ + +#ifndef HAVE_SYS_ERRLIST + +static int sys_nerr; +static const char **sys_errlist; + +#else + +extern int sys_nerr; +extern char *sys_errlist[]; + +#endif + + +/* + +NAME + + init_error_tables -- initialize the name and message tables + +SYNOPSIS + + static void init_error_tables (); + +DESCRIPTION + + Using the error_table, which is initialized at compile time, generate + the error_names and the sys_errlist (if needed) tables, which are + indexed at runtime by a specific errno value. + +BUGS + + The initialization of the tables may fail under low memory conditions, + in which case we don't do anything particularly useful, but we don't + bomb either. Who knows, it might succeed at a later point if we free + some memory in the meantime. In any case, the other routines know + how to deal with lack of a table after trying to initialize it. This + may or may not be considered to be a bug, that we don't specifically + warn about this particular failure mode. + +*/ + +static void +init_error_tables () +{ + const struct error_info *eip; + int nbytes; + + /* If we haven't already scanned the error_table once to find the maximum + errno value, then go find it now. */ + + if (num_error_names == 0) + { + for (eip = error_table; eip -> name != NULL; eip++) + { + if (eip -> value >= num_error_names) + { + num_error_names = eip -> value + 1; + } + } + } + + /* Now attempt to allocate the error_names table, zero it out, and then + initialize it from the statically initialized error_table. */ + + if (error_names == NULL) + { + nbytes = num_error_names * sizeof (char *); + if ((error_names = (const char **) malloc (nbytes)) != NULL) + { + memset (error_names, 0, nbytes); + for (eip = error_table; eip -> name != NULL; eip++) + { + error_names[eip -> value] = eip -> name; + } + } + } + +#ifndef HAVE_SYS_ERRLIST + + /* Now attempt to allocate the sys_errlist table, zero it out, and then + initialize it from the statically initialized error_table. */ + + if (sys_errlist == NULL) + { + nbytes = num_error_names * sizeof (char *); + if ((sys_errlist = (const char **) malloc (nbytes)) != NULL) + { + memset (sys_errlist, 0, nbytes); + sys_nerr = num_error_names; + for (eip = error_table; eip -> name != NULL; eip++) + { + sys_errlist[eip -> value] = eip -> msg; + } + } + } + +#endif + +} + +/* + +NAME + + errno_max -- return the max errno value + +SYNOPSIS + + int errno_max (); + +DESCRIPTION + + 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. + +*/ + +int +errno_max () +{ + int maxsize; + + if (error_names == NULL) + { + init_error_tables (); + } + maxsize = MAX (sys_nerr, num_error_names); + return (maxsize - 1); +} + +#ifndef HAVE_STRERROR + +/* + +NAME + + strerror -- map an error number to an error message string + +SYNOPSIS + + char *strerror (int errnoval) + +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. + + 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. + +*/ + +char * +strerror (errnoval) + int errnoval; +{ + char *msg; + static char buf[32]; + +#ifndef HAVE_SYS_ERRLIST + + if (error_names == NULL) + { + init_error_tables (); + } + +#endif + + if ((errnoval < 0) || (errnoval >= sys_nerr)) + { +#ifdef EVMSERR + if (errnoval == evmserr.value) + msg = evmserr.msg; + else +#endif + /* Out of range, just return NULL */ + msg = NULL; + } + else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL)) + { + /* In range, but no sys_errlist or no entry at this index. */ + sprintf (buf, "Error %d", errnoval); + msg = buf; + } + else + { + /* In range, and a valid message. Just return the message. */ + msg = (char *) sys_errlist[errnoval]; + } + + return (msg); +} + +#endif /* ! HAVE_STRERROR */ + + +/* + +NAME + + strerrno -- map an error number to a symbolic name string + +SYNOPSIS + + const char *strerrno (int errnoval) + +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 strerrno. + +*/ + +const char * +strerrno (errnoval) + int errnoval; +{ + const char *name; + static char buf[32]; + + if (error_names == NULL) + { + init_error_tables (); + } + + if ((errnoval < 0) || (errnoval >= num_error_names)) + { +#ifdef EVMSERR + if (errnoval == evmserr.value) + name = evmserr.name; + else +#endif + /* Out of range, just return NULL */ + name = NULL; + } + else if ((error_names == NULL) || (error_names[errnoval] == NULL)) + { + /* In range, but no error_names or no entry at this index. */ + sprintf (buf, "Error %d", errnoval); + name = (const char *) buf; + } + else + { + /* In range, and a valid name. Just return the name. */ + name = error_names[errnoval]; + } + + return (name); +} + +/* + +NAME + + strtoerrno -- map a symbolic errno name to a numeric value + +SYNOPSIS + + int strtoerrno (char *name) + +DESCRIPTION + + Given the symbolic name of a error number, map it to an errno value. + If no translation is found, returns 0. + +*/ + +int +strtoerrno (name) + const char *name; +{ + int errnoval = 0; + + if (name != NULL) + { + if (error_names == NULL) + { + init_error_tables (); + } + for (errnoval = 0; errnoval < num_error_names; errnoval++) + { + if ((error_names[errnoval] != NULL) && + (strcmp (name, error_names[errnoval]) == 0)) + { + break; + } + } + if (errnoval == num_error_names) + { +#ifdef EVMSERR + if (strcmp (name, evmserr.name) == 0) + errnoval = evmserr.value; + else +#endif + errnoval = 0; + } + } + return (errnoval); +} + + +/* A simple little main that does nothing but print all the errno translations + if MAIN is defined and this file is compiled and linked. */ + +#ifdef MAIN + +#include <stdio.h> + +int +main () +{ + int errn; + int errnmax; + const char *name; + char *msg; + char *strerror (); + + errnmax = errno_max (); + printf ("%d entries in names table.\n", num_error_names); + printf ("%d entries in messages table.\n", sys_nerr); + printf ("%d is max useful index.\n", errnmax); + + /* Keep printing values until we get to the end of *both* tables, not + *either* table. Note that knowing the maximum useful index does *not* + relieve us of the responsibility of testing the return pointer for + NULL. */ + + for (errn = 0; errn <= errnmax; errn++) + { + name = strerrno (errn); + name = (name == NULL) ? "<NULL>" : name; + msg = strerror (errn); + msg = (msg == NULL) ? "<NULL>" : msg; + printf ("%-4d%-18s%s\n", errn, name, msg); + } + + return 0; +} + +#endif diff --git a/libiberty/strncasecmp.c b/libiberty/strncasecmp.c new file mode 100755 index 0000000..4485cac --- /dev/null +++ b/libiberty/strncasecmp.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific written prior permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; +#endif /* LIBC_SCCS and not lint */ + +#include <ansidecl.h> +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +static unsigned char charmap[] = { + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', +}; + +int +strncasecmp(s1, s2, n) + const char *s1, *s2; + register size_t n; +{ + register unsigned char u1, u2; + + for (; n != 0; --n) { + u1 = (unsigned char) *s1++; + u2 = (unsigned char) *s2++; + if (charmap[u1] != charmap[u2]) { + return charmap[u1] - charmap[u2]; + } + if (u1 == '\0') { + return 0; + } + } + return 0; +} diff --git a/libiberty/strrchr.c b/libiberty/strrchr.c new file mode 100755 index 0000000..8c05bcb --- /dev/null +++ b/libiberty/strrchr.c @@ -0,0 +1,34 @@ +/* Portable version of strrchr(). + This function is in the public domain. */ + +/* +NAME + strrchr -- return pointer to last occurance of a character + +SYNOPSIS + char *strrchr (const char *s, int c) + +DESCRIPTION + Returns a pointer to the last occurance of character C in + string S, or a NULL pointer if no occurance is found. + +BUGS + Behavior when character is the null character is implementation + dependent. +*/ + +#include <ansidecl.h> + +char * +strrchr (s, c) + register const char *s; + int c; +{ + char *rtnval = 0; + + do { + if (*s == c) + rtnval = (char*) s; + } while (*s++); + return (rtnval); +} diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c new file mode 100755 index 0000000..c7bb10c --- /dev/null +++ b/libiberty/strsignal.c @@ -0,0 +1,644 @@ +/* Extended support for using signal values. + Written by Fred Fish. fnf@cygnus.com + This file is in the public domain. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#include "config.h" + +/* We need to declare sys_siglist, because even if the system provides + it we can't assume that it is declared in <signal.h> (for example, + SunOS provides sys_siglist, but it does not declare it in any + header file). fHowever, we can't declare sys_siglist portably, + because on some systems it is declared with const and on some + systems it is declared without const. If we were using autoconf, + we could work out the right declaration. Until, then we just + 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 + +#include <stdio.h> +#include <signal.h> + +/* Routines imported from standard C runtime libraries. */ + +#ifdef __STDC__ +#include <stddef.h> +extern void *malloc (size_t size); /* 4.10.3.3 */ +extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */ +#else /* !__STDC__ */ +extern char *malloc (); /* Standard memory allocater */ +extern char *memset (); +#endif /* __STDC__ */ + +/* Undefine the macro we used to hide the definition of sys_siglist + found in the system header files. */ +#undef sys_siglist + +#ifndef NULL +# ifdef __STDC__ +# define NULL (void *) 0 +# else +# define NULL 0 +# endif +#endif + +#ifndef MAX +# define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +static void init_signal_tables PARAMS ((void)); + +/* Translation table for signal values. + + Note that this table is generally only accessed when it is used at runtime + to initialize signal name and message tables that are indexed by signal + value. + + Not all of these signals will exist on all systems. This table is the only + thing that should have to be updated as new signal numbers are introduced. + It's sort of ugly, but at least its portable. */ + +struct signal_info +{ + int value; /* The numeric value from <signal.h> */ + const char *name; /* The equivalent symbolic value */ +#ifndef HAVE_SYS_SIGLIST + const char *msg; /* Short message about this value */ +#endif +}; + +#ifndef HAVE_SYS_SIGLIST +# define ENTRY(value, name, msg) {value, name, msg} +#else +# define ENTRY(value, name, msg) {value, name} +#endif + +static const struct signal_info signal_table[] = +{ +#if defined (SIGHUP) + ENTRY(SIGHUP, "SIGHUP", "Hangup"), +#endif +#if defined (SIGINT) + ENTRY(SIGINT, "SIGINT", "Interrupt"), +#endif +#if defined (SIGQUIT) + ENTRY(SIGQUIT, "SIGQUIT", "Quit"), +#endif +#if defined (SIGILL) + ENTRY(SIGILL, "SIGILL", "Illegal instruction"), +#endif +#if defined (SIGTRAP) + ENTRY(SIGTRAP, "SIGTRAP", "Trace/breakpoint trap"), +#endif +/* Put SIGIOT before SIGABRT, so that if SIGIOT==SIGABRT then SIGABRT + overrides SIGIOT. SIGABRT is in ANSI and POSIX.1, and SIGIOT isn't. */ +#if defined (SIGIOT) + ENTRY(SIGIOT, "SIGIOT", "IOT trap"), +#endif +#if defined (SIGABRT) + ENTRY(SIGABRT, "SIGABRT", "Aborted"), +#endif +#if defined (SIGEMT) + ENTRY(SIGEMT, "SIGEMT", "Emulation trap"), +#endif +#if defined (SIGFPE) + ENTRY(SIGFPE, "SIGFPE", "Arithmetic exception"), +#endif +#if defined (SIGKILL) + ENTRY(SIGKILL, "SIGKILL", "Killed"), +#endif +#if defined (SIGBUS) + ENTRY(SIGBUS, "SIGBUS", "Bus error"), +#endif +#if defined (SIGSEGV) + ENTRY(SIGSEGV, "SIGSEGV", "Segmentation fault"), +#endif +#if defined (SIGSYS) + ENTRY(SIGSYS, "SIGSYS", "Bad system call"), +#endif +#if defined (SIGPIPE) + ENTRY(SIGPIPE, "SIGPIPE", "Broken pipe"), +#endif +#if defined (SIGALRM) + ENTRY(SIGALRM, "SIGALRM", "Alarm clock"), +#endif +#if defined (SIGTERM) + ENTRY(SIGTERM, "SIGTERM", "Terminated"), +#endif +#if defined (SIGUSR1) + ENTRY(SIGUSR1, "SIGUSR1", "User defined signal 1"), +#endif +#if defined (SIGUSR2) + ENTRY(SIGUSR2, "SIGUSR2", "User defined signal 2"), +#endif +/* Put SIGCLD before SIGCHLD, so that if SIGCLD==SIGCHLD then SIGCHLD + overrides SIGCLD. SIGCHLD is in POXIX.1 */ +#if defined (SIGCLD) + ENTRY(SIGCLD, "SIGCLD", "Child status changed"), +#endif +#if defined (SIGCHLD) + ENTRY(SIGCHLD, "SIGCHLD", "Child status changed"), +#endif +#if defined (SIGPWR) + ENTRY(SIGPWR, "SIGPWR", "Power fail/restart"), +#endif +#if defined (SIGWINCH) + ENTRY(SIGWINCH, "SIGWINCH", "Window size changed"), +#endif +#if defined (SIGURG) + ENTRY(SIGURG, "SIGURG", "Urgent I/O condition"), +#endif +#if defined (SIGIO) + /* "I/O pending" has also been suggested, but is misleading since the + signal only happens when the process has asked for it, not everytime + I/O is pending. */ + ENTRY(SIGIO, "SIGIO", "I/O possible"), +#endif +#if defined (SIGPOLL) + ENTRY(SIGPOLL, "SIGPOLL", "Pollable event occurred"), +#endif +#if defined (SIGSTOP) + ENTRY(SIGSTOP, "SIGSTOP", "Stopped (signal)"), +#endif +#if defined (SIGTSTP) + ENTRY(SIGTSTP, "SIGTSTP", "Stopped (user)"), +#endif +#if defined (SIGCONT) + ENTRY(SIGCONT, "SIGCONT", "Continued"), +#endif +#if defined (SIGTTIN) + ENTRY(SIGTTIN, "SIGTTIN", "Stopped (tty input)"), +#endif +#if defined (SIGTTOU) + ENTRY(SIGTTOU, "SIGTTOU", "Stopped (tty output)"), +#endif +#if defined (SIGVTALRM) + ENTRY(SIGVTALRM, "SIGVTALRM", "Virtual timer expired"), +#endif +#if defined (SIGPROF) + ENTRY(SIGPROF, "SIGPROF", "Profiling timer expired"), +#endif +#if defined (SIGXCPU) + ENTRY(SIGXCPU, "SIGXCPU", "CPU time limit exceeded"), +#endif +#if defined (SIGXFSZ) + ENTRY(SIGXFSZ, "SIGXFSZ", "File size limit exceeded"), +#endif +#if defined (SIGWIND) + ENTRY(SIGWIND, "SIGWIND", "SIGWIND"), +#endif +#if defined (SIGPHONE) + ENTRY(SIGPHONE, "SIGPHONE", "SIGPHONE"), +#endif +#if defined (SIGLOST) + ENTRY(SIGLOST, "SIGLOST", "Resource lost"), +#endif +#if defined (SIGWAITING) + ENTRY(SIGWAITING, "SIGWAITING", "Process's LWPs are blocked"), +#endif +#if defined (SIGLWP) + ENTRY(SIGLWP, "SIGLWP", "Signal LWP"), +#endif +#if defined (SIGDANGER) + ENTRY(SIGDANGER, "SIGDANGER", "Swap space dangerously low"), +#endif +#if defined (SIGGRANT) + ENTRY(SIGGRANT, "SIGGRANT", "Monitor mode granted"), +#endif +#if defined (SIGRETRACT) + ENTRY(SIGRETRACT, "SIGRETRACT", "Need to relinguish monitor mode"), +#endif +#if defined (SIGMSG) + ENTRY(SIGMSG, "SIGMSG", "Monitor mode data available"), +#endif +#if defined (SIGSOUND) + ENTRY(SIGSOUND, "SIGSOUND", "Sound completed"), +#endif +#if defined (SIGSAK) + ENTRY(SIGSAK, "SIGSAK", "Secure attention"), +#endif + ENTRY(0, NULL, NULL) +}; + +/* Translation table allocated and initialized at runtime. Indexed by the + signal value to find the equivalent symbolic value. */ + +static const char **signal_names; +static int num_signal_names = 0; + +/* Translation table allocated and initialized at runtime, if it does not + already exist in the host environment. Indexed by the signal value to find + the descriptive string. + + We don't export it for use in other modules because even though it has the + same name, it differs from other implementations in that it is dynamically + initialized rather than statically initialized. */ + +#ifndef HAVE_SYS_SIGLIST + +static int sys_nsig; +static const char **sys_siglist; + +#else + +#ifdef NSIG +static int sys_nsig = NSIG; +#else +#ifdef _NSIG +static int sys_nsig = _NSIG; +#endif +#endif +extern const char * const sys_siglist[]; + +#endif + + +/* + +NAME + + init_signal_tables -- initialize the name and message tables + +SYNOPSIS + + static void init_signal_tables (); + +DESCRIPTION + + Using the signal_table, which is initialized at compile time, generate + the signal_names and the sys_siglist (if needed) tables, which are + indexed at runtime by a specific signal value. + +BUGS + + The initialization of the tables may fail under low memory conditions, + in which case we don't do anything particularly useful, but we don't + bomb either. Who knows, it might succeed at a later point if we free + some memory in the meantime. In any case, the other routines know + how to deal with lack of a table after trying to initialize it. This + may or may not be considered to be a bug, that we don't specifically + warn about this particular failure mode. + +*/ + +static void +init_signal_tables () +{ + const struct signal_info *eip; + int nbytes; + + /* If we haven't already scanned the signal_table once to find the maximum + signal value, then go find it now. */ + + if (num_signal_names == 0) + { + for (eip = signal_table; eip -> name != NULL; eip++) + { + if (eip -> value >= num_signal_names) + { + num_signal_names = eip -> value + 1; + } + } + } + + /* Now attempt to allocate the signal_names table, zero it out, and then + initialize it from the statically initialized signal_table. */ + + if (signal_names == NULL) + { + nbytes = num_signal_names * sizeof (char *); + if ((signal_names = (const char **) malloc (nbytes)) != NULL) + { + memset (signal_names, 0, nbytes); + for (eip = signal_table; eip -> name != NULL; eip++) + { + signal_names[eip -> value] = eip -> name; + } + } + } + +#ifndef HAVE_SYS_SIGLIST + + /* Now attempt to allocate the sys_siglist table, zero it out, and then + initialize it from the statically initialized signal_table. */ + + if (sys_siglist == NULL) + { + nbytes = num_signal_names * sizeof (char *); + if ((sys_siglist = (const char **) malloc (nbytes)) != NULL) + { + memset (sys_siglist, 0, nbytes); + sys_nsig = num_signal_names; + for (eip = signal_table; eip -> name != NULL; eip++) + { + sys_siglist[eip -> value] = eip -> msg; + } + } + } + +#endif + +} + + +/* + +NAME + + signo_max -- return the max signo value + +SYNOPSIS + + int signo_max (); + +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. + +*/ + +int +signo_max () +{ + int maxsize; + + if (signal_names == NULL) + { + init_signal_tables (); + } + maxsize = MAX (sys_nsig, num_signal_names); + return (maxsize - 1); +} + + +/* + +NAME + + strsignal -- map a signal number to a signal message string + +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 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 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 sys_siglist, + returns NULL. + + The returned string is only guaranteed to be valid only until the + next call to strsignal. + +*/ + +#ifndef HAVE_STRSIGNAL + +const char * +strsignal (signo) + int signo; +{ + const char *msg; + static char buf[32]; + +#ifndef HAVE_SYS_SIGLIST + + if (signal_names == NULL) + { + init_signal_tables (); + } + +#endif + + if ((signo < 0) || (signo >= sys_nsig)) + { + /* Out of range, just return NULL */ + msg = NULL; + } + else if ((sys_siglist == NULL) || (sys_siglist[signo] == NULL)) + { + /* In range, but no sys_siglist or no entry at this index. */ + sprintf (buf, "Signal %d", signo); + msg = (const char *) buf; + } + else + { + /* In range, and a valid message. Just return the message. */ + msg = (const char *) sys_siglist[signo]; + } + + return (msg); +} + +#endif /* ! HAVE_STRSIGNAL */ + +/* + +NAME + + strsigno -- map an signal number to a symbolic name string + +SYNOPSIS + + const char *strsigno (int signo) + +DESCRIPTION + + Given an signal number, returns a pointer to a string containing + the symbolic name of that signal number, as found in <signal.h>. + + 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. + +*/ + +const char * +strsigno (signo) + int signo; +{ + const char *name; + static char buf[32]; + + if (signal_names == NULL) + { + init_signal_tables (); + } + + if ((signo < 0) || (signo >= num_signal_names)) + { + /* Out of range, just return NULL */ + name = NULL; + } + else if ((signal_names == NULL) || (signal_names[signo] == NULL)) + { + /* In range, but no signal_names or no entry at this index. */ + sprintf (buf, "Signal %d", signo); + name = (const char *) buf; + } + else + { + /* In range, and a valid name. Just return the name. */ + name = signal_names[signo]; + } + + return (name); +} + + +/* + +NAME + + strtosigno -- map a symbolic signal name to a numeric value + +SYNOPSIS + + 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. + +*/ + +int +strtosigno (name) + const char *name; +{ + int signo = 0; + + if (name != NULL) + { + if (signal_names == NULL) + { + init_signal_tables (); + } + for (signo = 0; signo < num_signal_names; signo++) + { + if ((signal_names[signo] != NULL) && + (strcmp (name, signal_names[signo]) == 0)) + { + break; + } + } + if (signo == num_signal_names) + { + signo = 0; + } + } + return (signo); +} + + +/* + +NAME + + psignal -- print message about signal to stderr + +SYNOPSIS + + void psignal (unsigned signo, char *message); + +DESCRIPTION + + 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 + +void +psignal (signo, message) + unsigned signo; + char *message; +{ + if (signal_names == NULL) + { + init_signal_tables (); + } + if ((signo <= 0) || (signo >= sys_nsig)) + { + fprintf (stderr, "%s: unknown signal\n", message); + } + else + { + fprintf (stderr, "%s: %s\n", message, sys_siglist[signo]); + } +} + +#endif /* ! HAVE_PSIGNAL */ + + +/* A simple little main that does nothing but print all the signal translations + if MAIN is defined and this file is compiled and linked. */ + +#ifdef MAIN + +#include <stdio.h> + +int +main () +{ + int signo; + int maxsigno; + const char *name; + const char *msg; + + maxsigno = signo_max (); + printf ("%d entries in names table.\n", num_signal_names); + printf ("%d entries in messages table.\n", sys_nsig); + printf ("%d is max useful index.\n", maxsigno); + + /* Keep printing values until we get to the end of *both* tables, not + *either* table. Note that knowing the maximum useful index does *not* + relieve us of the responsibility of testing the return pointer for + NULL. */ + + for (signo = 0; signo <= maxsigno; signo++) + { + name = strsigno (signo); + name = (name == NULL) ? "<NULL>" : name; + msg = strsignal (signo); + msg = (msg == NULL) ? "<NULL>" : msg; + printf ("%-4d%-18s%s\n", signo, name, msg); + } + + return 0; +} + +#endif diff --git a/libiberty/strstr.c b/libiberty/strstr.c new file mode 100755 index 0000000..fab36e3 --- /dev/null +++ b/libiberty/strstr.c @@ -0,0 +1,51 @@ +/* Simple implementation of strstr for systems without it. + This function is in the public domain. */ + +/* + +NAME + + strstr -- locate first occurance of a substring + +SYNOPSIS + + #include <string.h> + + char *strstr (char *s1, char *s2) + +DESCRIPTION + + Locates the first occurance in the string pointed to by S1 of + the string pointed to by S2. Returns a pointer to the substring + found, or a NULL pointer if not found. If S2 points to a string + with zero length, the function returns S1. + +BUGS + +*/ + + +/* FIXME: The above description is ANSI compiliant. This routine has not + been validated to comply with it. -fnf */ + +char * +strstr (s1, s2) + char *s1, *s2; +{ + register char *p = s1; + extern char *strchr (); + extern int strncmp (); +#if __GNUC__==2 + extern __SIZE_TYPE__ strlen (); +#endif + register int len = strlen (s2); + + for (; (p = strchr (p, *s2)) != 0; p++) + { + if (strncmp (p, s2, len) == 0) + { + return (p); + } + } + return (0); +} diff --git a/libiberty/strtod.c b/libiberty/strtod.c new file mode 100755 index 0000000..c86c73d --- /dev/null +++ b/libiberty/strtod.c @@ -0,0 +1,122 @@ +/* Implementation of strtod for systems with atof. + Copyright (C) 1991, 1995 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 +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 library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +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> + +extern double atof (); + +/* Disclaimer: this is currently just used by CHILL in GDB and therefore + has not been tested well. It may have been tested for nothing except + that it compiles. */ + +double +strtod (str, ptr) + char *str; + char **ptr; +{ + char *p; + + if (ptr == (char **)0) + return atof (str); + + p = str; + + while (isspace (*p)) + ++p; + + if (*p == '+' || *p == '-') + ++p; + + /* INF or INFINITY. */ + if ((p[0] == 'i' || p[0] == 'I') + && (p[1] == 'n' || p[1] == 'N') + && (p[2] == 'f' || p[2] == 'F')) + { + if ((p[3] == 'i' || p[3] == 'I') + && (p[4] == 'n' || p[4] == 'N') + && (p[5] == 'i' || p[5] == 'I') + && (p[6] == 't' || p[6] == 'T') + && (p[7] == 'y' || p[7] == 'Y')) + { + *ptr = p + 7; + return atof (str); + } + else + { + *ptr = p + 3; + return atof (str); + } + } + + /* NAN or NAN(foo). */ + if ((p[0] == 'n' || p[0] == 'N') + && (p[1] == 'a' || p[1] == 'A') + && (p[2] == 'n' || p[2] == 'N')) + { + p += 3; + if (*p == '(') + { + ++p; + while (*p != '\0' && *p != ')') + ++p; + if (*p == ')') + ++p; + } + *ptr = p; + return atof (str); + } + + /* digits, with 0 or 1 periods in it. */ + if (isdigit (*p) || *p == '.') + { + int got_dot = 0; + while (isdigit (*p) || (!got_dot && *p == '.')) + { + if (*p == '.') + got_dot = 1; + ++p; + } + + /* Exponent. */ + if (*p == 'e' || *p == 'E') + { + int i; + i = 1; + if (p[i] == '+' || p[i] == '-') + ++i; + if (isdigit (p[i])) + { + while (isdigit (p[i])) + ++i; + *ptr = p + i; + return atof (str); + } + } + *ptr = p; + return atof (str); + } + /* Didn't find any digits. Doesn't look like a number. */ + *ptr = str; + return 0.0; +} diff --git a/libiberty/strtol.c b/libiberty/strtol.c new file mode 100755 index 0000000..37d1706 --- /dev/null +++ b/libiberty/strtol.c @@ -0,0 +1,143 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <limits.h> +#include <ctype.h> +#include <errno.h> +#if 0 +#include <stdlib.h> +#endif +#include "ansidecl.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 + constants. */ + +#ifndef ULONG_MAX +#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */ +#endif + +#ifndef LONG_MAX +#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF */ +#endif + +#ifndef LONG_MIN +#define LONG_MIN ((long)(~LONG_MAX)) /* 0x80000000 */ +#endif + +/* + * Convert a string to a long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +long +strtol(nptr, endptr, base) + const char *nptr; + char **endptr; + register int base; +{ + register const char *s = nptr; + register unsigned long acc; + register int c; + register unsigned long cutoff; + register int neg = 0, any, cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutlim = cutoff % (unsigned long)base; + cutoff /= (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? LONG_MIN : LONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} diff --git a/libiberty/strtoul.c b/libiberty/strtoul.c new file mode 100755 index 0000000..ff6f2d6 --- /dev/null +++ b/libiberty/strtoul.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <limits.h> +#include <ctype.h> +#include <errno.h> +#if 0 +#include <stdlib.h> +#endif +#include "ansidecl.h" + +#ifndef ULONG_MAX +#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */ +#endif + +/* + * Convert a string to an unsigned long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +unsigned long +strtoul(nptr, endptr, base) + const char *nptr; + char **endptr; + register int base; +{ + register const char *s = nptr; + register unsigned long acc; + register int c; + register unsigned long cutoff; + register int neg = 0, any, cutlim; + + /* + * See strtol for comments as to the logic used. + */ + do { + c = *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; + cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = ULONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} diff --git a/libiberty/tmpnam.c b/libiberty/tmpnam.c new file mode 100755 index 0000000..c061467 --- /dev/null +++ b/libiberty/tmpnam.c @@ -0,0 +1,39 @@ +#include <stdio.h> + +#ifndef L_tmpnam +#define L_tmpname 100 +#endif +#ifndef P_tmpdir +#define P_tmpdir "/usr/tmp" +#endif + +static char tmpnam_buffer[L_tmpnam]; +static int tmpnam_counter; + +extern int getpid (); + +char * +tmpnam (s) + char *s; +{ + int pid = getpid (); + + if (s == NULL) + s = tmpnam_buffer; + + /* Generate the filename and make sure that there isn't one called + it already. */ + + while (1) + { + FILE *f; + sprintf (s, "%s/%s%x.%x", P_tmpdir, "t", pid, tmpnam_counter); + f = fopen (s, "r"); + if (f == NULL) + break; + tmpnam_counter++; + fclose (f); + } + + return s; +} diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c new file mode 100755 index 0000000..eeb80e6 --- /dev/null +++ b/libiberty/vasprintf.c @@ -0,0 +1,172 @@ +/* Like vsprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1994 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdio.h> +#include <string.h> +#include <ansidecl.h> + +#ifdef TEST +int global_total_width; +#endif + +unsigned long strtoul (); +char *malloc (); + +static int +int_vasprintf (result, format, args) + char **result; + const char *format; + va_list *args; +{ + const char *p = format; + /* Add one to make sure that it is never zero, which might cause malloc + to return NULL. */ + int total_width = strlen (format) + 1; + va_list ap; + + memcpy ((PTR) &ap, (PTR) args, sizeof (va_list)); + + while (*p != '\0') + { + if (*p++ == '%') + { + while (strchr ("-+ #0", *p)) + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, &p, 10); + if (*p == '.') + { + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, &p, 10); + } + while (strchr ("hlL", *p)) + ++p; + /* Should be big enough for any format specifier except %s and floats. */ + total_width += 30; + switch (*p) + { + case 'd': + case 'i': + case 'o': + case 'u': + case 'x': + case 'X': + case 'c': + (void) va_arg (ap, int); + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + (void) va_arg (ap, double); + /* Since an ieee double can have an exponent of 307, we'll + make the buffer wide enough to cover the gross case. */ + total_width += 307; + break; + case 's': + total_width += strlen (va_arg (ap, char *)); + break; + case 'p': + case 'n': + (void) va_arg (ap, char *); + break; + } + } + } +#ifdef TEST + global_total_width = total_width; +#endif + *result = malloc (total_width); + if (*result != NULL) + return vsprintf (*result, format, *args); + else + return 0; +} + +int +vasprintf (result, format, args) + char **result; + const char *format; +#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__) + _BSD_VA_LIST_ args; +#else + va_list args; +#endif +{ + return int_vasprintf (result, format, &args); +} + +#ifdef TEST +void +checkit +#ifdef __STDC__ + (const char* format, ...) +#else + (va_alist) + va_dcl +#endif +{ + va_list args; + char *result; + +#ifdef __STDC__ + va_start (args, format); +#else + char *format; + va_start (args); + format = va_arg (args, char *); +#endif + vasprintf (&result, format, args); + if (strlen (result) < global_total_width) + printf ("PASS: "); + else + printf ("FAIL: "); + printf ("%d %s\n", global_total_width, result); +} + +int +main () +{ + checkit ("%d", 0x12345678); + checkit ("%200d", 5); + checkit ("%.300d", 6); + checkit ("%100.150d", 7); + checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ +777777777777777777333333333333366666666666622222222222777777777777733333"); + checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); +} +#endif /* TEST */ diff --git a/libiberty/vfork.c b/libiberty/vfork.c new file mode 100755 index 0000000..86c4591 --- /dev/null +++ b/libiberty/vfork.c @@ -0,0 +1,8 @@ +/* Emulate vfork using just plain fork, for systems without a real vfork. + This function is in the public domain. */ + +int +vfork () +{ + return (fork ()); +} diff --git a/libiberty/vfprintf.c b/libiberty/vfprintf.c new file mode 100755 index 0000000..db7b2ff --- /dev/null +++ b/libiberty/vfprintf.c @@ -0,0 +1,21 @@ +/* Provide a version vfprintf in terms of _doprnt. + By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98 + Copyright (C) 1998 Free Software Foundation, Inc. + */ + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdio.h> +#undef vfprintf + +int +vfprintf (stream, format, ap) + FILE * stream; + const char * format; + va_list ap; +{ + return _doprnt (format, ap, stream); +} diff --git a/libiberty/vmsbuild.com b/libiberty/vmsbuild.com new file mode 100755 index 0000000..4fede38 --- /dev/null +++ b/libiberty/vmsbuild.com @@ -0,0 +1,165 @@ +$! libiberty/vmsbuild.com -- build liberty.olb for VMS host, VMS target +$! +$ CC = "gcc /noVerbose/Debug/Incl=([],[-.include])" +$ LIBR = "library /Obj" +$ LINK = "link" +$ DELETE= "delete /noConfirm" +$ SEARCH= "search /Exact" +$ ECHO = "write sys$output" +$ ABORT = "exit %x002C" +$! +$ LIB_NAME = "liberty.olb" !this is what we're going to construct +$ WORK_LIB = "new-lib.olb" !used to guard against an incomplete build +$ +$! manually copied from Makefile.in +$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "- + + "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "- + + "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "- + + "xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o" +$! anything not caught by link+search of dummy.* should be added here +$ EXTRA_OFILES = "" +$! +$! move to the directory which contains this command procedure +$ old_dir = f$environ("DEFAULT") +$ new_dir = f$parse("_._;",f$environ("PROCEDURE")) - "_._;" +$ set default 'new_dir' +$ +$ ECHO "Starting libiberty build..." +$ create config.h +/* libiberty config.h for VMS */ +#define NEED_sys_siglist +#define NEED_strsignal +#define NEED_psignal +#define NEED_basename +$ LIBR 'WORK_LIB' /Create +$ +$! first pass: compile "required" modules +$ ofiles = REQUIRED_OFILES + " " + EXTRA_OFILES +$ pass = 1 +$ gosub do_ofiles +$ +$! second pass: process dummy.c, using the first pass' results +$ ECHO " now checking run-time library for missing functionality" +$ if f$search("dummy.obj").nes."" then DELETE dummy.obj;* +$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc +$ define/noLog sys$output _NL: ! driver's use of multiple image activation +$ on error then continue +$ 'CC' dummy.c +$ deassign sys$error !restore, more or less +$ deassign sys$output +$ if f$search("dummy.obj").eqs."" then goto pass2_failure1 +$! link dummy.obj, capturing full linker feedback in dummy.map +$ oldmsg = f$environ("MESSAGE") +$ set message /Facility/Severity/Identification/Text +$ define/User sys$output _NL: +$ define/User sys$error _NL: +$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- + gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr +$ set message 'oldmsg' +$ if f$search("dummy.map").eqs."" then goto pass2_failure2 +$ DELETE dummy.obj;* +$ SEARCH dummy.map "%LINK-I-UDFSYM" /Output=dummy.list +$ DELETE dummy.map;* +$ ECHO " check completed" +$! we now have a file with one entry per line of unresolvable symbols +$ ofiles = "" +$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ +$ open/Read ifile$ dummy.list +$iloop: read/End=idone ifile$ iline +$ iline = f$edit(iline,"COMPRESS,TRIM,LOWERCASE") +$ ofiles = ofiles + " " + f$element(1," ",iline) + ".o" +$ goto iloop +$idone: close ifile$ +$ DELETE dummy.list;* +$ on error then ABORT +$ +$! third pass: compile "missing" modules collected in pass 2 +$ pass = 3 +$ gosub do_ofiles +$ +$! finish up +$ LIBR 'WORK_LIB' /Compress /Output='LIB_NAME' !new-lib.olb -> liberty.olb +$ DELETE 'WORK_LIB';* +$ +$! all done +$ ECHO "Completed libiberty build." +$ type sys$input: + + You many wish to do + $ COPY LIBERTY.OLB GNU_CC:[000000] + so that this run-time library resides in the same location as gcc's + support library. When building gas, be sure to leave the original + copy of liberty.olb here so that gas's build procedure can find it. + +$ set default 'old_dir' +$ exit +$ +$! +$! compile each element of the space-delimited list 'ofiles' +$! +$do_ofiles: +$ ofiles = f$edit(ofiles,"COMPRESS,TRIM") +$ i = 0 +$oloop: +$ f = f$element(i," ",ofiles) +$ if f.eqs." " then goto odone +$ f = f - ".o" !strip dummy suffix +$ ECHO " ''f'" +$ skip_f = 0 +$ if pass.eq.3 .and. f$search("''f'.c").eqs."" then gosub chk_deffunc +$ if .not.skip_f +$ then +$ 'CC' 'f'.c +$ LIBR 'WORK_LIB' 'f'.obj /Insert +$ DELETE 'f'.obj;* +$ endif +$ i = i + 1 +$ goto oloop +$odone: +$ return +$ +$! +$! check functions.def for a DEFFUNC() entry corresponding to missing file 'f'.c +$! +$chk_deffunc: +$ define/User sys$output _NL: +$ define/User sys$error _NL: +$ SEARCH functions.def "DEFFUNC","''f'" /Match=AND +$ if (($status.and.%x7FFFFFFF) .eq. 1) +$ then +$ skip_f = 1 +$ open/Append config_h config.h +$ write config_h "#define NEED_''f'" +$ close config_h +$ endif +$ return +$ +$! +$pass2_failure1: +$! if we reach here, dummy.c failed to compile and we're really stuck +$ type sys$input: + + Cannot compile the library contents checker (dummy.c + functions.def), + so cannot continue! + +$! attempt the compile again, without suppressing diagnostic messages this time +$ on error then ABORT +0*f$verify(v) +$ v = f$verify(1) +$ 'CC' dummy.c +$ ABORT +0*f$verify(v) !'f$verify(0)' +$! +$pass2_failure2: +$! should never reach here.. +$ type sys$input: + + Cannot link the library contents checker (dummy.obj), so cannot continue! + +$! attempt the link again, without suppressing diagnostic messages this time +$ on error then ABORT +0*f$verify(v) +$ v = f$verify(1) +$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- + gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr +$ ABORT +0*f$verify(v) !'f$verify(0)' +$ +$! not reached +$ exit diff --git a/libiberty/vprintf.c b/libiberty/vprintf.c new file mode 100755 index 0000000..65b425a --- /dev/null +++ b/libiberty/vprintf.c @@ -0,0 +1,15 @@ +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdio.h> +#include <ansidecl.h> +#undef vprintf +int +vprintf (format, ap) + const char *format; + va_list ap; +{ + return vfprintf (stdout, format, ap); +} diff --git a/libiberty/vsprintf.c b/libiberty/vsprintf.c new file mode 100755 index 0000000..bf0760c --- /dev/null +++ b/libiberty/vsprintf.c @@ -0,0 +1,55 @@ +/* Simple implementation of vsprintf for systems without it. + Highly system-dependent, but should work on most "traditional" + implementations of stdio; newer ones should already have vsprintf. + Written by Per Bothner of Cygnus Support. + Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu). + Copyright (C) 1991, 1995 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 +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 library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +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 <varargs.h> +#include <stdio.h> +#include <ansidecl.h> +#undef vsprintf + +int +vsprintf (buf, format, ap) + char *buf; + const char *format; + va_list ap; +{ + FILE b; + int ret; +#ifdef VMS + b->_flag = _IOWRT|_IOSTRG; + b->_ptr = buf; + b->_cnt = 12000; +#else + b._flag = _IOWRT|_IOSTRG; + b._ptr = buf; + b._cnt = 12000; +#endif + ret = _doprnt(format, ap, &b); + putc('\0', &b); + return ret; + +} diff --git a/libiberty/waitpid.c b/libiberty/waitpid.c new file mode 100755 index 0000000..23db0b9 --- /dev/null +++ b/libiberty/waitpid.c @@ -0,0 +1,11 @@ +int +waitpid (pid, stat_loc, options) + int pid, *stat_loc, options; +{ + for (;;) + { + int wpid = wait(stat_loc); + if (wpid == pid || wpid == -1) + return wpid; + } +} diff --git a/libiberty/xatexit.c b/libiberty/xatexit.c new file mode 100755 index 0000000..31476c2 --- /dev/null +++ b/libiberty/xatexit.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * %sccs.include.redist.c% + */ + +/* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. + If you use xatexit, you must call xexit instead of exit. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#include <stdio.h> + +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +/* For systems with larger pointers than ints, this must be declared. */ +PTR malloc PARAMS ((size_t)); + +static void xatexit_cleanup PARAMS ((void)); + +/* Pointer to function run by xexit. */ +extern void (*_xexit_cleanup) PARAMS ((void)); + +#define XATEXIT_SIZE 32 + +struct xatexit { + struct xatexit *next; /* next in list */ + int ind; /* next index in this table */ + void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */ +}; + +/* Allocate one struct statically to guarantee that we can register + at least a few handlers. */ +static struct xatexit xatexit_first; + +/* Points to head of LIFO stack. */ +static struct xatexit *xatexit_head = &xatexit_first; + +/* Register function FN to be run by xexit. + Return 0 if successful, -1 if not. */ + +int +xatexit (fn) + void (*fn) PARAMS ((void)); +{ + register struct xatexit *p; + + /* Tell xexit to call xatexit_cleanup. */ + if (!_xexit_cleanup) + _xexit_cleanup = xatexit_cleanup; + + p = xatexit_head; + if (p->ind >= XATEXIT_SIZE) + { + if ((p = (struct xatexit *) malloc (sizeof *p)) == NULL) + return -1; + p->ind = 0; + p->next = xatexit_head; + xatexit_head = p; + } + p->fns[p->ind++] = fn; + return 0; +} + +/* Call any cleanup functions. */ + +static void +xatexit_cleanup () +{ + register struct xatexit *p; + register int n; + + for (p = xatexit_head; p; p = p->next) + for (n = p->ind; --n >= 0;) + (*p->fns[n]) (); +} diff --git a/libiberty/xexit.c b/libiberty/xexit.c new file mode 100755 index 0000000..431bbe0 --- /dev/null +++ b/libiberty/xexit.c @@ -0,0 +1,36 @@ +/* xexit.c -- Run any exit handlers, then exit. + Copyright (C) 1994, 95, 1997 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If not, write +to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#include <stdio.h> + +/* This variable is set by xatexit if it is called. This way, xmalloc + doesn't drag xatexit into the link. */ +void (*_xexit_cleanup) PARAMS ((void)); + +void +xexit (code) + int code; +{ + if (_xexit_cleanup != NULL) + (*_xexit_cleanup) (); + exit (code); +} diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c new file mode 100755 index 0000000..4f39014 --- /dev/null +++ b/libiberty/xmalloc.c @@ -0,0 +1,169 @@ +/* memory allocation routines with error checking. + Copyright 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "ansidecl.h" +#include "libiberty.h" + +#include <stdio.h> + +#ifdef __STDC__ +#include <stddef.h> +#else +#define size_t unsigned long +#define ptrdiff_t long +#endif + +#if VMS +#include <stdlib.h> +#include <unixlib.h> +#else +/* For systems with larger pointers than ints, these must be declared. */ +PTR malloc PARAMS ((size_t)); +PTR realloc PARAMS ((PTR, size_t)); +PTR calloc PARAMS ((size_t, size_t)); +PTR sbrk PARAMS ((ptrdiff_t)); +#endif + +/* The program name if set. */ +static const char *name = ""; + +#if ! defined (_WIN32) || defined (__CYGWIN32__) +/* The initial sbrk, set when the program name is set. Not used for win32 + ports other than cygwin32. */ +static char *first_break = NULL; +#endif + +void +xmalloc_set_program_name (s) + const char *s; +{ + name = s; +#if ! defined (_WIN32) || defined (__CYGWIN32__) + /* Win32 ports other than cygwin32 don't have brk() */ + if (first_break == NULL) + first_break = (char *) sbrk (0); +#endif /* ! _WIN32 || __CYGWIN32 __ */ +} + +PTR +xmalloc (size) + size_t size; +{ + PTR newmem; + + if (size == 0) + size = 1; + newmem = malloc (size); + if (!newmem) + { +#if ! defined (_WIN32) || defined (__CYGWIN32__) + 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%sCan not allocate %lu bytes after allocating %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not allocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* ! _WIN32 || __CYGWIN32 __ */ + xexit (1); + } + return (newmem); +} + +PTR +xcalloc (nelem, elsize) + size_t nelem, elsize; +{ + PTR newmem; + + if (nelem == 0 || elsize == 0) + nelem = elsize = 1; + + newmem = calloc (nelem, elsize); + if (!newmem) + { +#if ! defined (_WIN32) || defined (__CYGWIN32__) + 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%sCan not allocate %lu bytes after allocating %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) (nelem * elsize), (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not allocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) (nelem * elsize)); +#endif /* ! _WIN32 || __CYGWIN32 __ */ + xexit (1); + } + return (newmem); +} + +PTR +xrealloc (oldmem, size) + PTR oldmem; + size_t size; +{ + PTR newmem; + + if (size == 0) + size = 1; + if (!oldmem) + newmem = malloc (size); + else + newmem = realloc (oldmem, size); + if (!newmem) + { +#ifndef __MINGW32__ + 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%sCan not reallocate %lu bytes after allocating %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size, (unsigned long) allocated); +#else + fprintf (stderr, + "\n%s%sCan not reallocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* __MINGW32__ */ + xexit (1); + } + return (newmem); +} diff --git a/libiberty/xstrdup.c b/libiberty/xstrdup.c new file mode 100755 index 0000000..9d08bc7 --- /dev/null +++ b/libiberty/xstrdup.c @@ -0,0 +1,17 @@ +/* xstrdup.c -- Duplicate a string in memory, using xmalloc. + This trivial function is in the public domain. + Ian Lance Taylor, Cygnus Support, December 1995. */ + +#include "ansidecl.h" +#include "libiberty.h" + +char * +xstrdup (s) + const char *s; +{ + char *ret; + + ret = xmalloc (strlen (s) + 1); + strcpy (ret, s); + return ret; +} diff --git a/libiberty/xstrerror.c b/libiberty/xstrerror.c new file mode 100755 index 0000000..770b653 --- /dev/null +++ b/libiberty/xstrerror.c @@ -0,0 +1,56 @@ +/* xstrerror.c -- jacket routine for more robust strerror() usage. + Fri Jun 16 18:30:00 1995 Pat Rankin <rankin@eql.caltech.edu> + This code is in the public domain. */ + +#include <stdio.h> + +#include "libiberty.h" +#include "config.h" + +#ifdef VMS +#include <errno.h> +#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES) +extern char *strerror PARAMS ((int,...)); +#define DONT_DECLARE_STRERROR +#endif +#endif /* VMS */ + +#ifndef DONT_DECLARE_STRERROR +extern char *strerror PARAMS ((int)); +#endif + +/* If strerror returns NULL, we'll format the number into a static buffer. */ + +#define ERRSTR_FMT "undocumented error #%d" +static char xstrerror_buf[sizeof ERRSTR_FMT + 20]; + +/* Like strerror, but result is never a null pointer. */ + +char * +xstrerror (errnum) + int errnum; +{ + char *errstr; +#ifdef VMS + char *(*vmslib_strerror) PARAMS ((int,...)); + + /* Override any possibly-conflicting declaration from system header. */ + vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror; + /* Second argument matters iff first is EVMSERR, but it's simpler to + pass it unconditionally. `vaxc$errno' is declared in <errno.h> + and maintained by the run-time library in parallel to `errno'. + We assume that `errnum' corresponds to the last value assigned to + errno by the run-time library, hence vaxc$errno will be relevant. */ + errstr = (*vmslib_strerror) (errnum, vaxc$errno); +#else + errstr = strerror (errnum); +#endif + + /* If `errnum' is out of range, result might be NULL. We'll fix that. */ + if (!errstr) + { + sprintf (xstrerror_buf, ERRSTR_FMT, errnum); + errstr = xstrerror_buf; + } + return errstr; +} |