Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

Location:
branches/GNU/src/binutils/libiberty
Files:
81 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/libiberty/COPYING.LIB

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1                   GNU LIBRARY GENERAL PUBLIC LICENSE
    2                        Version 2, June 1991
    3 
    4  Copyright (C) 1991 Free Software Foundation, Inc.
    5  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
     1                  GNU LESSER GENERAL PUBLIC LICENSE
     2                       Version 2.1, February 1999
     3
     4 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
     5     59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    66 Everyone is permitted to copy and distribute verbatim copies
    77 of this license document, but changing it is not allowed.
    88
    9 [This is the first released version of the library GPL.  It is
    10  numbered 2 because it goes with version 2 of the ordinary GPL.]
     9[This is the first released version of the Lesser GPL.  It also counts
     10 as the successor of the GNU Library Public License, version 2, hence
     11 the version number 2.1.]
    1112
    1213                            Preamble
     
    1718free software--to make sure the software is free for all its users.
    1819
    19   This license, the Library General Public License, applies to some
    20 specially designated Free Software Foundation software, and to any
    21 other libraries whose authors decide to use it.  You can use it for
    22 your libraries, too.
    23 
    24   When we speak of free software, we are referring to freedom, not
    25 price.  Our General Public Licenses are designed to make sure that you
    26 have the freedom to distribute copies of free software (and charge for
    27 this service if you wish), that you receive source code or can get it
    28 if you want it, that you can change the software or use pieces of it
    29 in new free programs; and that you know you can do these things.
     20  This license, the Lesser General Public License, applies to some
     21specially designated software packages--typically libraries--of the
     22Free Software Foundation and other authors who decide to use it.  You
     23can use it too, but we suggest you first think carefully about whether
     24this license or the ordinary General Public License is the better
     25strategy to use in any particular case, based on the explanations below.
     26
     27  When we speak of free software, we are referring to freedom of use,
     28not price.  Our General Public Licenses are designed to make sure that
     29you have the freedom to distribute copies of free software (and charge
     30for this service if you wish); that you receive source code or can get
     31it if you want it; that you can change the software and use pieces of
     32it in new free programs; and that you are informed that you can do
     33these things.
    3034
    3135  To protect your rights, we need to make restrictions that forbid
    32 anyone to deny you these rights or to ask you to surrender the rights.
    33 These restrictions translate to certain responsibilities for you if
    34 you distribute copies of the library, or if you modify it.
     36distributors to deny you these rights or to ask you to surrender these
     37rights.  These restrictions translate to certain responsibilities for
     38you if you distribute copies of the library or if you modify it.
    3539
    3640  For example, if you distribute copies of the library, whether gratis
    3741or for a fee, you must give the recipients all the rights that we gave
    3842you.  You must make sure that they, too, receive or can get the source
    39 code.  If you link a program with the library, you must provide
    40 complete object files to the recipients so that they can relink them
    41 with the library, after making changes to the library and recompiling
     43code.  If you link other code with the library, you must provide
     44complete object files to the recipients, so that they can relink them
     45with the library after making changes to the library and recompiling
    4246it.  And you must show them these terms so they know their rights.
    4347
    44   Our method of protecting your rights has two steps: (1) copyright
    45 the library, and (2) offer you this license which gives you legal
     48  We protect your rights with a two-step method: (1) we copyright the
     49library, and (2) we offer you this license, which gives you legal
    4650permission to copy, distribute and/or modify the library.
    4751
    48   Also, for each distributor's protection, we want to make certain
    49 that everyone understands that there is no warranty for this free
    50 library.  If the library is modified by someone else and passed on, we
    51 want its recipients to know that what they have is not the original
    52 version, so that any problems introduced by others will not reflect on
    53 the original authors' reputations.
    54 
    55 
    56   Finally, any free program is threatened constantly by software
    57 patents.  We wish to avoid the danger that companies distributing free
    58 software will individually obtain patent licenses, thus in effect
    59 transforming the program into proprietary software.  To prevent this,
    60 we have made it clear that any patent must be licensed for everyone's
    61 free use or not licensed at all.
    62 
    63   Most GNU software, including some libraries, is covered by the ordinary
    64 GNU General Public License, which was designed for utility programs.  This
    65 license, the GNU Library General Public License, applies to certain
    66 designated libraries.  This license is quite different from the ordinary
    67 one; be sure to read it in full, and don't assume that anything in it is
    68 the same as in the ordinary license.
    69 
    70   The reason we have a separate public license for some libraries is that
    71 they blur the distinction we usually make between modifying or adding to a
    72 program and simply using it.  Linking a program with a library, without
    73 changing the library, is in some sense simply using the library, and is
    74 analogous to running a utility program or application program.  However, in
    75 a textual and legal sense, the linked executable is a combined work, a
    76 derivative of the original library, and the ordinary General Public License
    77 treats it as such.
    78 
    79   Because of this blurred distinction, using the ordinary General
    80 Public License for libraries did not effectively promote software
    81 sharing, because most developers did not use the libraries.  We
    82 concluded that weaker conditions might promote sharing better.
    83 
    84   However, unrestricted linking of non-free programs would deprive the
    85 users of those programs of all benefit from the free status of the
    86 libraries themselves.  This Library General Public License is intended to
    87 permit developers of non-free programs to use free libraries, while
    88 preserving your freedom as a user of such programs to change the free
    89 libraries that are incorporated in them.  (We have not seen how to achieve
    90 this as regards changes in header files, but we have achieved it as regards
    91 changes in the actual functions of the Library.)  The hope is that this
    92 will lead to faster development of free libraries.
     52  To protect each distributor, we want to make it very clear that
     53there is no warranty for the free library.  Also, if the library is
     54modified by someone else and passed on, the recipients should know
     55that what they have is not the original version, so that the original
     56author's reputation will not be affected by problems that might be
     57introduced by others.
     58
     59
     60  Finally, software patents pose a constant threat to the existence of
     61any free program.  We wish to make sure that a company cannot
     62effectively restrict the users of a free program by obtaining a
     63restrictive license from a patent holder.  Therefore, we insist that
     64any patent license obtained for a version of the library must be
     65consistent with the full freedom of use specified in this license.
     66
     67  Most GNU software, including some libraries, is covered by the
     68ordinary GNU General Public License.  This license, the GNU Lesser
     69General Public License, applies to certain designated libraries, and
     70is quite different from the ordinary General Public License.  We use
     71this license for certain libraries in order to permit linking those
     72libraries into non-free programs.
     73
     74  When a program is linked with a library, whether statically or using
     75a shared library, the combination of the two is legally speaking a
     76combined work, a derivative of the original library.  The ordinary
     77General Public License therefore permits such linking only if the
     78entire combination fits its criteria of freedom.  The Lesser General
     79Public License permits more lax criteria for linking other code with
     80the library.
     81
     82  We call this license the "Lesser" General Public License because it
     83does Less to protect the user's freedom than the ordinary General
     84Public License.  It also provides other free software developers Less
     85of an advantage over competing non-free programs.  These disadvantages
     86are the reason we use the ordinary General Public License for many
     87libraries.  However, the Lesser license provides advantages in certain
     88special circumstances.
     89
     90  For example, on rare occasions, there may be a special need to
     91encourage the widest possible use of a certain library, so that it becomes
     92a de-facto standard.  To achieve this, non-free programs must be
     93allowed to use the library.  A more frequent case is that a free
     94library does the same job as widely used non-free libraries.  In this
     95case, there is little to gain by limiting the free library to free
     96software only, so we use the Lesser General Public License.
     97
     98  In other cases, permission to use a particular library in non-free
     99programs enables a greater number of people to use a large body of
     100free software.  For example, permission to use the GNU C Library in
     101non-free programs enables many more people to use the whole GNU
     102operating system, as well as its variant, the GNU/Linux operating
     103system.
     104
     105  Although the Lesser General Public License is Less protective of the
     106users' freedom, it does ensure that the user of a program that is
     107linked with the Library has the freedom and the wherewithal to run
     108that program using a modified version of the Library.
    93109
    94110  The precise terms and conditions for copying, distribution and
    95111modification follow.  Pay close attention to the difference between a
    96112"work based on the library" and a "work that uses the library".  The
    97 former contains code derived from the library, while the latter only
    98 works together with the library.
    99 
    100   Note that it is possible for a library to be covered by the ordinary
    101 General Public License rather than by this special one.
    102 
    103 
    104                   GNU LIBRARY GENERAL PUBLIC LICENSE
     113former contains code derived from the library, whereas the latter must
     114be combined with the library in order to run.
     115
     116
     117                  GNU LESSER GENERAL PUBLIC LICENSE
    105118   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    106119
    107   0. This License Agreement applies to any software library which
    108 contains a notice placed by the copyright holder or other authorized
    109 party saying it may be distributed under the terms of this Library
    110 General Public License (also called "this License").  Each licensee is
    111 addressed as "you".
     120  0. This License Agreement applies to any software library or other
     121program which contains a notice placed by the copyright holder or
     122other authorized party saying it may be distributed under the terms of
     123this Lesser General Public License (also called "this License").
     124Each licensee is addressed as "you".
    112125
    113126  A "library" means a collection of software functions and/or data
     
    261274
    262275
    263   6. As an exception to the Sections above, you may also compile or
     276  6. As an exception to the Sections above, you may also combine or
    264277link a "work that uses the Library" with the Library to produce a
    265278work containing portions of the Library, and distribute that work
     
    288301    to use the modified definitions.)
    289302
    290     b) Accompany the work with a written offer, valid for at
     303    b) Use a suitable shared library mechanism for linking with the
     304    Library.  A suitable mechanism is one that (1) uses at run time a
     305    copy of the library already present on the user's computer system,
     306    rather than copying library functions into the executable, and (2)
     307    will operate properly with a modified version of the library, if
     308    the user installs one, as long as the modified version is
     309    interface-compatible with the version that the work was made with.
     310
     311    c) Accompany the work with a written offer, valid for at
    291312    least three years, to give the same user the materials
    292313    specified in Subsection 6a, above, for a charge no more
    293314    than the cost of performing this distribution.
    294315
    295     c) If distribution of the work is made by offering access to copy
     316    d) If distribution of the work is made by offering access to copy
    296317    from a designated place, offer equivalent access to copy the above
    297318    specified materials from the same place.
    298319
    299     d) Verify that the user has already received a copy of these
     320    e) Verify that the user has already received a copy of these
    300321    materials or that you have already sent this user a copy.
    301322
     
    303324Library" must include any data and utility programs needed for
    304325reproducing the executable from it.  However, as a special exception,
    305 the source code distributed need not include anything that is normally
    306 distributed (in either source or binary form) with the major
     326the materials to be distributed need not include anything that is
     327normally distributed (in either source or binary form) with the major
    307328components (compiler, kernel, and so on) of the operating system on
    308329which the executable runs, unless that component itself accompanies
     
    354375subject to these terms and conditions.  You may not impose any further
    355376restrictions on the recipients' exercise of the rights granted herein.
    356 You are not responsible for enforcing compliance by third parties to
     377You are not responsible for enforcing compliance by third parties with
    357378this License.
    358379
     
    398419
    399420  13. The Free Software Foundation may publish revised and/or new
    400 versions of the Library General Public License from time to time.
     421versions of the Lesser General Public License from time to time.
    401422Such new versions will be similar in spirit to the present version,
    402423but may differ in detail to address new problems or concerns.
     
    446467
    447468
    448      Appendix: How to Apply These Terms to Your New Libraries
     469           How to Apply These Terms to Your New Libraries
    449470
    450471  If you develop a new library, and you want it to be of the greatest
     
    463484
    464485    This library is free software; you can redistribute it and/or
    465     modify it under the terms of the GNU Library General Public
     486    modify it under the terms of the GNU Lesser General Public
    466487    License as published by the Free Software Foundation; either
    467     version 2 of the License, or (at your option) any later version.
     488    version 2.1 of the License, or (at your option) any later version.
    468489
    469490    This library is distributed in the hope that it will be useful,
    470491    but WITHOUT ANY WARRANTY; without even the implied warranty of
    471492    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    472     Library General Public License for more details.
    473 
    474     You should have received a copy of the GNU Library General Public
    475     License along with this library; if not, write to the Free
    476     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
    477     MA 02111-1307, USA
     493    Lesser General Public License for more details.
     494
     495    You should have received a copy of the GNU Lesser General Public
     496    License along with this library; if not, write to the Free Software
     497    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    478498
    479499Also add information on how to contact you by electronic and paper mail.
     
    490510
    491511That's all there is to it!
     512
     513
  • branches/GNU/src/binutils/libiberty/ChangeLog

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     12003-04-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     2
     3        * vsnprintf.c (vsnprintf): Don't pad string with extra nulls.
     4        (main): Test that we don't write too much data.
     5
     62003-04-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     7
     8        * configure.in (funcs, AC_CHECK_FUNCS): Add snprintf and
     9        vsnprintf.
     10        * snprintf.c, vsnprintf.c: New files.
     11        * Makefile.in (CFILES): Add snprintf.c and vsnprintf.c.
     12        (CONFIGURED_OFILES): Add snprintf.o and vsnprintf.o.
     13        Regenerate dependencies.
     14
     15        * functions.texi, configure, config.in: Regenerated.
     16
     172003-04-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     18
     19        * mempcpy.c, stpcpy.c, stpncpy.c: New files.
     20        * configure.in (funcs, AC_CHECK_FUNCS): Add mempcpy, stpcpy
     21        and stpncpy.
     22        * Makefile.in (CFILES): Add mempcpy.c, stpcpy.c and stpncpy.c.
     23        (CONFIGURED_OFILES): Add mempcpy.o, stpcpy.o and stpncpy.o.
     24        Regenerate dependencies.
     25
     26        * functions.texi, configure, config.in: Regenerated.
     27
     282003-04-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     29
     30        * argv.c: Fix comments.
     31        * calloc.c: Don't unnecessarily include "libiberty.h".
     32        (bzero): Add prototype.
     33        * floatformat.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES.
     34        * getcwd.c (getcwd): Use standard definition to avoid conflicts
     35        with system headers.
     36        * hashtab.c (htab_traverse): Delete unused variables.
     37        * rename.c: Include "ansidecl.h".
     38        (rename): Use standard definition to avoid conflicts with system
     39        headers.
     40        * strsignal.c: Rely on ANSI_PROTOTYPES.
     41        * strstr.c: Check GNUC >= 2, not GNUC == 2.
     42        * vfprintf.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES.
     43        * vprintf.c: Include "ansidecl.h" earlier, rely on
     44        ANSI_PROTOTYPES.
     45        * vsprintf.c: Include "ansidecl.h" earlier, rely on
     46        ANSI_PROTOTYPES and possibly include <stdarg.h>.
     47       
     48        * Makefile.in: Regenerate dependencies.
     49
     502003-04-15  DJ Delorie  <dj@redhat.com>
     51
     52        * maint-tool (deps): Scan for headers in $srcdir also.
     53
     542003-04-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     55
     56        PR target/10338
     57        PR bootstrap/10198
     58        PR bootstrap/10140
     59        * getopt.c (exchange, _getopt_initialize): Use mempcpy not
     60        __mempcpy.
     61        * regex.c (regerror): Likewise.
     62
     632003-04-14  Roger Sayle  <roger@eyesopen.com>
     64
     65        * argv.c: Use ANSI_PROTOTYPES instead of __STDC__.
     66        * memchr.c: Likewise.
     67        * strcasecmp.c: Likewise.
     68        * strncasecmp.c: Likewise.
     69        * strncmp.c: Likewise.
     70        * xatexit.c: Likewise.
     71        * xmalloc.c: Likewise.
     72
     73        * copysign.c: Use traditional function declaration instead of DEFUN.
     74        * sigsetmask.c: Likewise.
     75
     76        * memcmp.c: Both of the above, ANSI_PROTOTYPES and DEFUN.
     77        * memset.c: Likewise.
     78
     79        * memcpy.c: ANSI_PROTOTYPES, DEFUN and prototype bcopy.
     80        * memmove.c: Likewise.
     81
     822003-04-14  Roger Sayle  <roger@eyesopen.com>
     83
     84        * strdup.c (strdup): Tweak implementation to use memcpy.
     85
     862003-04-14  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     87
     88        * configure.in (HAVE_UINTPTR_T): Always define.
     89        * configure: Regenerated.
     90
     912003-03-23  Alexandre Oliva  <aoliva@redhat.com>
     92
     93        * Makefile.in (MULTIOSDIR): New macro.  Use $(CC) $(LIBCFLAGS)
     94        instead of $$CC alone.
     95        (install_to_tooldir): Use it.
     96
     972003-17-03  Jan Hubicka  <jh@suse.cz>
     98
     99        * hashtab.c (htab_traverse_noresize): Break out from ...
     100        * hashtab.c (htab_traverse): ... here.
     101
     1022003-12-03  Jan Hubicka  <jh@suse.cz>
     103
     104        * hashtab.c (htab_expand): Fix warning.
     105
     106        * hashtab.c (htab_expand): Compute the size of hashtable based
     107        on the number of elements actually used.
     108        (htab_traverse):  Call htab_expand when table is too empty.
     109
     1102003-03-11  Carlo Wood  <carlo@gnu.org>
     111
     112        * cplus-dem.c (demangle_integral_value): Correction to reflect
     113        patch of 2002-01-10 in order to also make negative multi-digits
     114        without leading underscore work.
     115
     1162003-03-03  Mark Mitchell  <mark@codesourcery.com>
     117
     118        * cplus-dem.c: Add license exception to copyright notice.
     119
     1202003-02-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     121
     122        * physmem.c: Formatting changes from upstream.
     123
     1242003-02-24  Danny Smith  <dannysmith@users.source.forge.net>
     125
     126        * physmem.c (physmem_total): Add _WIN32 support.
     127        (physmem_available): Likewise.
     128
     1292003-02-24  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
     130
     131        * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Test for
     132        GSI_PHYSMEM.
     133        (physmem_available) [HAVE_TABLE]: Test for TBL_VMSTATS.
     134
     1352003-02-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     136
     137        * configure.in: Check for sys/systemcfg.h and
     138        _system_configuration.
     139        * physmem.c: Add support for AIX.  Tweek formatting as per
     140        upstream coreutils beta.
     141
     1422003-02-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     143            Richard Earnshaw  <rearnsha@arm.com>
     144            Geoffrey Keating  <geoffk@apple.com>
     145       
     146        * configure.in: Check for sys/sysctl.h and sysctl.
     147        * physmem.c: Add support for *bsd and darwin.
     148        * Makefile.in: Generate depedency for physmem.o.
     149
     1502003-02-21  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
     151
     152        * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Use getsysinfo on
     153        Tru64 UNIX.
     154        (physmem_available) [HAVE_TABLE && HAVE_SYS_TABLE_H]: Use table on
     155        Tru64 UNIX.
     156
     157        * configure.in (AC_CHECK_HEADERS): Check for sys/sysinfo.h,
     158        machine/hal_sysinfo.h, sys/table.h.
     159        (checkfuncs, AC_CHECKFUNCS): Check for getsysinfo, table.
     160        * configure, config.in: Regenerate.
     161
     1622003-02-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     163
     164        * configure.in: Check for sys/sysmp.h and sysmp.
     165        * physmem.c: Pull upstream copy, add support for irix6.
     166
     167        * config.in, configure: Regenerated.
     168
     1692003-02-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     170
     171        * physmem.c (physmem_total, physmem_available): De-ANSI-fy.
     172        * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and
     173        pstat_getdynamic.
     174       
     1752003-02-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     176
     177        * Makefile.in (CFILES): Add physmem.c.
     178        (REQUIRED_OFILES): Add physmem.o.
     179        * configure.in: Check for sys/pstat.h.
     180        (checkfuncs): Add pstat_getstatic and pstat_getdynamic.
     181        * physmem.c: New file, copied from textutils.
     182
     183        * config.in, configure: Regenerated.
     184
     1852003-02-20  Daniel Jacobowitz  <drow@mvista.com>
     186
     187        * Makefile.in (CFILES): Add lrealpath.c.
     188        (REQUIRED_OFILES): Add lrealpath.o.
     189        (lrealpath.o): Add rule.
     190        * aclocal.m4 (libiberty_NEED_DECLARATION): Add.
     191        * configure.in: Add realpath and canonicalize_file_name to
     192        checkfuncs and AC_CHECK_FUNCS.  Use libiberty_NEED_DECLARATION
     193        for canonicalize_file_name.
     194        * lrealpath.c: New file.
     195        * make-relative-prefix.c: Update documentation.
     196        (make_relative_prefix): Simplify.  Use lbasename and lrealpath.
     197        * config.in: Regenerated.
     198        * configure: Regenerated.
     199        * functions.texi: Regenerated.
     200
     2012003-02-20  jmc  <jmc@prioris.mini.pw.edu.pl>
     202
     203        * cplus_dem.c: Fix typo: intializes -> initializes.
     204
     2052003-02-20  Alexandre Oliva  <aoliva@redhat.com>
     206
     207        * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
     208        config.status.
     209        * configure: Rebuilt.
     210
     2112003-02-13  Daniel Jacobowitz  <drow@mvista.com>
     212
     213        Fix PR c++/7612.
     214        * cplus-dem.c (demangle_signature): Call string_delete.
     215        Remove extra string_init.
     216        (demangle_arm_hp_template): Call string_delete instead of
     217        string_clear.  Add missing string_delete call.
     218        (demangle_qualified): Add missing string_delete call.
     219        (do_type): Remove unused variable btype.  Add missing string_delete
     220        call.  Call string_delete instead of string_clear.
     221        (demangle_fund_type): Move variable btype inside of the switch
     222        statement.  Add missing string_delete call.
     223        (do_arg): Call string_delete instead of string_clear.  Remove extra
     224        string_init.
     225        (demangle_nested_args): Free work->previous_argument.
     226
     2272003-02-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     228
     229        * acconfig.h: New file.  Add uintptr_t.
     230        * config.in: Regenerated.
     231
     2322003-02-04  Joseph S. Myers  <jsm@polyomino.org.uk>
     233
     234        * libiberty.texi: Update to GFDL 1.2.
     235
     2362003-01-30  Christian Cornelssen  <ccorn@cs.tu-berlin.de>
     237
     238        * Makefile.in (libiberty_topdir): New subst.
     239        (mkinstalldirs): Redefine in terms of the above.
     240        * configure.in: AC_SUBST it.
     241        * configure: Regenerate.
     242
     2432003-01-28  Christian Cornelssen  <ccorn@cs.tu-berlin.de>
     244
     245        * Makefile.in (all-subdir, check-subdir, installcheck-subdir)
     246        (info-subdir, install-info-subdir, clean-info-subdir)
     247        (dvi-subdir, install-subdir, etags-subdir, mostlyclean-subdir)
     248        (clean-subdir, distclean-subdir, maintainer-clean-subdir):
     249        Pass $(FLAGS_TO_PASS).
     250
     2512003-01-27  Alexandre Oliva  <aoliva@redhat.com>
     252
     253        * Makefile.in (install_to_tooldir): Instead of $(MULTISUBDIR), use
     254        /`$$CC -print-multi-os-directory`.
     255
     2562003-01-26  Daniel Jacobowitz  <drow@mvista.com>
     257
     258        * hashtab.c (htab_create_alloc_ex): New function.
     259        (hatab_set_functions_ex): New function.
     260        (htab_delete, htab_expand): Support alternate allocation functions.
     261
     2622003-01-24  Christopher Faylor  <cgf@redhat.com>
     263
     264        * configure.in: Remove special pex-cygwin consideration.
     265        * configure: Regenerate.
     266        * pex-cygwin.c: Remove.
     267        * Makefile.in: Remove pex-cygwin.[co] lines.
     268
     2692003-01-24  Zack Weinberg  <zack@codesourcery.com>
     270
     271        * Makefile.in (CFILES): Add pex-*.c.
     272        (REQUIRED_OFILES): Change pexecute.o to @pexecute@
     273        (CONFIGURED_OFILES): Add pex-*.o.
     274        (TEXIFILES): Add pexecute.txh.
     275        (pexecute.o): Delete rule.
     276        (pex-cygwin.o, pex-djgpp.o, pex-mpw.o, pex-msdos.o, pex-os2.o,
     277        pex-unix.o, pex-win32.o): New rules.
     278        * configure.in: Change AC_INIT argument to xmalloc.c.
     279        Compute appropriate pexecute implementation and substitute it
     280        as @pexecute@.
     281
     282        * pexecute.c: Split up into...
     283        * pex-cygwin.c, pex-djgpp.c, pex-mpw.c, pex-msdos.c, pex-os2.c,
     284        pex-unix.c, pex-win32.c, pex-common.h, pexecute.txh: ... these
     285        new files.
     286
     287        * functions.texi: Regenerate.
     288        * configure: Regenerate.
     289
     2902003-01-20  Josef Zlomek  <zlomekj@suse.cz>
     291
     292        * hashtab.c (htab_expand): Fix allocation of new entries.
     293
     2942003-01-09  Christian Cornelssen  <ccorn@cs.tu-berlin.de>
     295
     296        * Makefile.in (FLAGS_TO_PASS): Also pass DESTDIR.
     297
     298        * Makefile.in (install_to_libdir, install_to_tooldir): Add a
     299        mkinstalldirs command.
     300
     3012002-12-04  Danny Smith  <dannysmith@users.sourceforge.net>
     302
     303        * make-relative-prefix.c (HAVE_HOST_EXECUTABLE_SUFFIX):
     304        Define for hosts with HOST_EXECUTABLE_SUFFIX.
     305
     3062002-11-24  Nick Clifton  <nickc@redhat.com>
     307
     308        * make-relative-prefix.c (make_relative_prefix): Ensure return
     309        string is empty before using strcat to construct it.
     310
     3112002-11-22  Daniel Jacobowitz  <drow@mvista.com>
     312
     313        * Makefile.in: Add make-relative-prefix.c.
     314        * make-relative-prefix.c: New file.
     315        * functions.texi: Rebuilt.
     316
     3172002-11-16  Jakub Jelinek  <jakub@redhat.com>
     318
     319        * md5.c (md5_process_block): Avoid `function-like macro "F{G,H,I}" must be
     320        used with arguments in traditional C' warnings.
     321
     3222002-10-16  Jakub Jelinek  <jakub@redhat.com>
     323
     324        * config.table: Use mh-s390pic for s390x too.
     325
     3262002-10-06  Andreas Jaeger  <aj@suse.de>
     327
     328        * libiberty/cplus-dem.c (ada_demangle): Get rid of unneeded
     329        variable and of strict-aliasing warning.
     330        (grow_vect): Use char as first parameter.
     331
     3322002-09-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     333
     334        * Makefile.in (all): Fix multilib parallel build.
     335
     3362002-09-19  John David Anglin  <dave@hiuly1.hia.nrc.ca>
     337
     338        * cp-demangle.c (demangling_new): Cast 0 to enum.
     339        (demangle_char): Cast return of strdup to char *.
     340        (is_gnu_v3_mangled_ctor): Cast 0 to enum.
     341        (is_gnu_v3_mangled_dtor): Likewise.
     342        * cplus-dem.c (grow_vect): Cast return of xrealloc to void *.
     343        (work_stuff_copy_to_from): Cast return of xmalloc to char **.
     344        * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t.
     345        * md5.c (md5_process_bytes): Cast results back to const void *.
     346        (md5_process_block): Add cast to const md5_uint32 *.
     347        * regex.c (re_compile_fastmap): Cast enum to UCHAR_T.
     348        * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to
     349        unsigned short.
     350        * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc
     351        to void *.
     352        * vasprintf.c (int_vasprintf): Cast return of malloc to char *.
     353
     3542002-09-19  Nick Clifton  <nickc@redhat.com>
     355
     356        * README: Update email addresses for bugs and patches.
     357
     3582002-09-10  Mike Stump  <mrs@apple.com>
     359
     360        * splay-tree.c (splay_tree_successor): Fix comments.
     361
     3622002-09-11  Zack Weinberg  <zack@codesourcery.com>
     363
     364        * cplus-dem.c: Code under #ifdef MAIN moved to gcc/cp/cxxfilt.c.
     365        * testsuite/Makefile.in: Adjust for test-demangle.
     366        * testsuite/regress-demangle: Deleted.
     367        * testsuite/test-demangle.c: New file.
     368        * testsuite/demangle-expected: Change \$ to $ throughout, now that
     369        this file is not being read by a shell script.
     370
     3712002-09-05  Roger Sayle  <roger@eyesopen.com>
     372
     373        * regex.c: Only use "#pragma alloca" on AIX when not using gcc.
     374
     3752002-08-07  DJ Delorie  <dj@redhat.com>
     376
     377        * regex.c (re_error_msgid): Just use a simple array of strings.
     378        (re_compile_pattern): Compensate.
     379        (re_comp): Likewise.
     380        (re_comp): Likewise.
     381        (regerror): Likewise.
     382
     3832002-07-29  Neil Booth  <neil@daikokuya.co.uk>
     384
     385        * cplus-dem.c (PREPEND_BLANK): Remove.
     386
     3872002-07-10  Jason Merrill  <jason@redhat.com>
     388
     389        * cp-demangle.c (demangle_identifier): Support extended Unicode
     390        characters.
     391
     3922002-07-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     393
     394        * cp-demangle.c (demangle_v3_with_details): Wrap in
     395        !defined IN_GLIBCPP_V3.
     396
     3972002-07-01  Mark Mitchell  <mark@codesourcery.com>
     398
     399        * cp-demangle.c (demangle_operator_name): Add type_arg parameter.
     400        Set it for the "st" operator.
     401        (demangle_expression): Handle expressions with types as arguments.
     402
     4032002-06-30  Douglas Rupp  <rupp@gnat.com>
     404
     405        * configure.in (OUTPUT_OPTION,NO_MINUS_C_MINUS_O): Configure.
     406        * Makefile.in (OUTPUT_OPTION): Use.
     407
     4082002-06-22  Peter Breitenlohner <peb@mppmu.mpg.de>
     409
     410        * Makefile.in (install_to_libdir): Add $(DESTDIR).
     411        (install_to_tooldir): Likewise.
     412
     4132002-06-17  Douglas Rupp  <rupp@gnat.com>
     414
     415        * lbasename.c: Add 2002 to copyright.
     416        (IS_DIR_SEPARATOR): Remove VMS junk.
     417
     4182002-06-05  Geoffrey Keating  <geoffk@redhat.com>
     419
     420        * hashtab.c (htab_create): New stub function for backward
     421        compatibility.
     422        (htab_try_create): Likewise.
     423
     4242002-06-03  Geoffrey Keating  <geoffk@redhat.com>
     425
     426        * hashtab.c (htab_create): Delete.
     427        (htab_try_create): Delete.
     428        (htab_create_alloc): New.
     429        (htab_delete): Support user-specified memory allocation.
     430        (htab_expand): Likewise.
     431
     4322002-05-22  Roman Lechtchinsky  <rl@cs.tu-berlin.de>
     433
     434        * configure.in: Fix typo in the code checking for sys_errlist.
     435        * configure: Regenerated.
     436
     4372002-05-13  Andreas Schwab  <schwab@suse.de>
     438
     439        * config.table: Use mh-x86pic also for x86-64.
     440
     4412002-05-08  Alexandre Oliva  <aoliva@redhat.com>
     442
     443        * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at
     444        script entry, and set LD to it when configuring multilibs.
     445        * configure: Rebuilt.
     446
     4472002-05-07  Mark Mitchell  <mark@codesourcery.com>
     448
     449        * configure.in (AC_TYPE_PID_T): Use it.
     450        * configure: Regenerated.
     451        * getruntime.c: Include <sys/types.h>.
     452        * waitpid.c: Likewise.  Use pid_t, not int, as the type of "pid".
     453
     4542002-04-09  Richard Henderson  <rth@redhat.com>
     455
     456        * hashtab.c (higher_prime_number): Use 7 as minimum.
     457        (find_empty_slot_for_expand): Don't compute hash2 unless needed.
     458        (htab_find_slot_with_hash): Likewise.
     459
     4602002-04-01  Phil Edwards  <pme@gcc.gnu.org>
     461
     462        * cp-demangle.c (__cxa_demangle):  Also protect with IN_GLIBCPP_V3.
     463        (is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_ctor):  Conditionally
     464        not compile if IN_GLIBCPP_V3 defined.
     465        * dyn-string.c:  Also allow IN_GLIBCPP_V3 to change allocation scheme.
     466
     4672002-03-30  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
     468
     469        * cp-demangle.c (java_demangle_v3): Don't try to release "demangled"
     470        if it is NULL.
     471
     4722002-03-27  DJ Delorie  <dj@redhat.com>
     473
     474        * hex.c: Add documentation.
     475        (_hex_value): Provide non-ASCII empty table.
     476        (hex_init): Initialize the non-ASCII table.
     477        * functions.texi: Regenerate.
     478
     4792002-03-27  Mark Mitchell  <mark@codesourcery.com>
     480
     481        * dyn-string.c: Add libgcc exception to copyright notice.
     482
     4832002-03-26  H.J. Lu  (hjl@gnu.org)
     484
     485        * config.table: Support --with-build-subdir.
     486        * configure.in: Likewise.
     487        * configure: Rebuild.
     488
     4892002-03-18  Stuart Griffith  <Stuart_Griffith@credence.com>
     490
     491        * strtod.c (strtod): Increment 8 chars, not 7, when `infinity'
     492        seen.
     493
     4942002-03-12  Mark Mitchell  <mark@codesourcery.com>
     495
     496        * cp-demangle.c: Add libgcc exception to cp-demangle.c copyright
     497        notice.
     498
     4992002-03-11  Douglas B Rupp  <rupp@gnat.com>
     500
     501        * xatexit.c [VMS]: Include stdlib.h and unixlib.h.
     502
     5032002-03-06  Jim Blandy  <jimb@redhat.com>
     504
     505        * splay-tree.c (splay_tree_xmalloc_allocate,
     506        splay_tree_xmalloc_deallocate): Use K&R-style definitions, not
     507        prototyped definitions.  Mark `data' arguments as unused.
     508
     5092002-03-06  Andrew Cagney  <ac131313@redhat.com>
     510
     511        * floatformat.c (floatformat_arm_ext_big): Delete definition.
     512
     5132002-03-04  Phil Edwards  <pme@gcc.gnu.org>
     514
     515        * configure.in:  Add --enable-install-libiberty option.
     516        * Makefile.in (INSTALLED_HEADERS):  New variable.
     517        (install_to_libdir):  Possibly also copy headers.
     518        * configure:  Regenerated.
     519
     5202002-03-04  Neil Booth  <neil@daikokuya.demon.co.uk>
     521
     522        * xmalloc.c (xmalloc_fail): Clarify error message further.
     523
     5242002-03-03  Neil Booth  <neil@daikokuya.demon.co.uk>
     525
     526        * xmalloc.c (xmalloc_fail): Clarify error message.
     527
     5282002-02-22  Jim Blandy  <jimb@redhat.com>
     529
     530        * splay-tree.c (splay_tree_xmalloc_allocate,
     531        splay_tree_xmalloc_deallocate): New functions.
     532        (splay_tree_new): Call splay_tree_new_with_allocator, passing the
     533        above functions and a dummy data pointer.
     534        (splay_tree_new_with_allocator): New function.
     535        (splay_tree_delete_helper, splay_tree_delete, splay_tree_insert,
     536        splay_tree_remove): Use the splay tree's allocation and
     537        deallocation functions.
     538
     5392002-02-19  Scott Snyder  <snyder@fnal.gov>
     540
     541        * testsuite/demangle-expected: Add test case for infinite loop in
     542        demangler.
     543        * cplus-dem.c (demangle_arm_hp_template): Stop trying to demangle
     544        if do_type() doesn't make any progress --- prevents an infinite
     545        loop.
     546
     5472002-02-18  Carlo Wood  <carlo@gnu.org>
     548
     549        PR c++/5390
     550        * cplus-dem.c (demangle_integral_value): Accept multi-digit
     551        numbers that do not start with an underscore; This is needed
     552        for integer template parameters. This doesn't break anything
     553        because multi-digit numbers are never followed by a digit.
     554        * testsuite/demangle-expected: Corrected all mangled test
     555        cases with multi-digit template parameters: g++ 2.95.x does
     556        not generate underscores around these parameters.
     557
     5582002-02-05  Jason Merrill  <jason@redhat.com>
     559
     560        * cplus-dem.c (flags): Add DMGL_VERBOSE
     561        (cplus_demangle_v3_p): Remove.
     562        (demangle_it): Add DMGL_TYPES to passed flags.
     563        * cp-demangle.c (cplus_demangle_v3_all): Remove.
     564        (cplus_demangle_v3_type): Remove.
     565        (cplus_demangle_v3): Add options parm.
     566
     5672002-02-02  H.J. Lu  (hjl@gnu.org)
     568
     569        * cp-demangle.c (cp_demangle_type): Do not protect with
     570        IN_LIBGCC2.
     571        (cplus_demangle_v3_all): New.
     572        (cplus_demangle_v3): Call cplus_demangle_v3_all.
     573        (cplus_demangle_v3_type): Call cplus_demangle_v3_all.
     574
     575        * cplus-dem.c (cplus_demangle_v3_p): New function pointer.
     576        Initialized to cplus_demangle_v3.
     577        (cplus_demangle_with_style): Call cplus_demangle_v3_p instead
     578        of cplus_demangle_v3.
     579        (main): Set cplus_demangle_v3_p to cplus_demangle_v3_type for
     580        command line symbol.
     581
     582        * testsuite/regress-demangle: Pass the mangled name at the
     583        command line.
     584
     5852002-02-01  H.J. Lu  <hjl@gnu.org>
     586
     587        * cp-demangle.c (cp_demangle_type): Call demangling_new with
     588        DMGL_GNU_V3.
     589
     5902002-01-31  Phil Edwards  <pme@gcc.gnu.org>
     591
     592        * cp-demangle.c:  Revert yesterday's change.
     593
     5942002-01-31  Adam Megacz  <adam@xwt.org>
     595
     596        * gcc/libiberty/configure.in: Treat mingw the same as cywin
     597        wrt HAVE_SYS_ERRLIST.
     598
     5992002-01-30  Phil Edwards  <pme@gcc.gnu.org>
     600
     601        * cp-demangle.c (cp_demangle_type):  Do not protect with IN_LIBGCC2.
     602        (cplus_demangle_v3):  Mimic __cxa_demangle and fall back on
     603        cp_demangle_type.
     604        * testsuite/demangle-expected:  New gnu-v3 test.
     605
     6062002-01-22  Momchil Velikov  <velco@fadata.bg>
     607
     608        * configure.in (variable detection): Use arrays of unspecified
     609        size instead of plain integers.
     610
     6112002-01-18  DJ Delorie  <dj@redhat.com>
     612
     613        * Makefile.in (TESTLIB): New.  This library is for future
     614        testsuites.
     615        (CFILES, REQUIRED_OFILES, CONFIGURED_OFILES): Re-alphabetize,
     616        break down by letter.
     617        (REQUIRED_OFILES): List long-to-compile files first.
     618        (maint-deps): New, target for updating dependencies.
     619        (dependencies): Update.
     620        * maint-tool: Add dependency-generating option.
     621        * configure.in: Check for _doprnt even if we're not providing it.
     622        * configure: Regenerate.
     623
     624        * _doprnt.c: Modifications to allow compiling on any platform.
     625        * copysign.c: Likewise.
     626        * putenv.c: Likewise.
     627        * setenv.c: Likewise.
     628        * vsprintf.c: Likewise.
     629
     6302002-01-15  Douglas B Rupp  <rupp@gnat.com>
     631
     632        * mkstemps.c (mkstemps): On VMS, open temp file with option
     633        that causes it to be deleted when closed.
     634
     6352002-01-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     636
     637        * cp-demangle.c (long_options): Const-ify.
     638        * cplus-dem.c (long_options): Likewise.
     639
     640        * cplus-dem.c (mystrstr): Delete.  All callers changed to use
     641        strstr instead.
     642
     6432001-12-31  Ira Ruben   <ira@apple.com>
     644
     645        * aclocal.m4 (libiberty_AC_FUNC_STRNCMP): Use anon mmap as 2nd try.
     646        * configure: Regenerated.
     647
     6482001-12-24  Douglas B. Rupp  <rupp@gnat.com>
     649
     650        * configure.in (uintptr_t): Use AC_CHECK_TYPE.
     651        * configure: Regenerated.
     652
     6532001-12-12  Craig Rodrigues  <rodrigc@gcc.gnu.org>
     654
     655        PR other/2719
     656        * cplus-dem.c (consume_count): Treat negative count as an error.
     657        * testsuite/demangle-expected: Added testcase.
     658
     659Tue Dec 11 07:08:57 2001  Douglas B. Rupp  <rupp@gnat.com>
     660
     661        * configure.in: Hardcode that vfork works on VMS host.
     662        * configure: Regenerated.
     663
     6642001-12-06  Richard Henderson  <rth@redhat.com>
     665
     666        * cplus-dem.c (libiberty_demanglers): Add no_demangling case.
     667        (cplus_demangle): Support no_demangling.
     668
     6692001-11-27  Zack Weinberg  <zack@codesourcery.com>
     670
     671        * _doprnt.c: Moved here from gcc/doprint.c.  Adjust to build
     672        in libiberty context.  Fix typo in leading comment.
     673        * configure.in: Fix various AC_DEFINEs so autoheader works.
     674        If any of vprintf, vsprintf, vfprintf is missing from libc,
     675        then AC_REPLACE_FUNCS(_doprnt).
     676
     6772001-11-26  DJ Delorie  <dj@redhat.com>
     678            Daniel Jacobowitz  <drow@mvista.com>
     679
     680        * Makefile.in (stamp-h): Depend on Makefile for proper
     681        serialization.
     682        (*-subdir): Depend on config.h for proper serialization.
     683
     6842001-11-26  DJ Delorie  <dj@redhat.com>
     685
     686        * configure.in: Check for alloca.h (for regex.c and putenv.c).
     687        * configure: Regenerate.
     688        * config.h: Add HAVE_ALLOCA_H.
     689
     6902001-11-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     691
     692        * regex.c: Check defined(__STDC__) || defined(ALMOST_STDC) ||
     693        defined(HAVE_STRINGIZE) to determine whether ISO CPP token pasting
     694        is available.
     695
     696Thu Nov 15 11:06:25 2001  Jeffrey A Law  (law@cygnus.com)
     697
     698        * config.in (HAVE_UINTPTR_T): Provide autoconf stub.
     699        * configure.in (HAVE_UINTPTR_T): Test for system defining
     700        uintptr_t and define HAVE_UINTPTR_T appropriately.
     701        * regex.c (uintptr_t): Do not provide a definition if the
     702        system provided one.
     703
     704        * regex.c (PREFIX): Provide an alternate definition for
     705        non-ANSI/ISO compilers.
     706        (ARG_PREFIX): Likewise.
     707
     7082001-11-12  Jim Meyering  <meyering@lucent.com>
     709
     710        * obstack.c (_): Honor the setting of ENABLE_NLS.  Otherwise,
     711        this code would end up calling gettext even in packages built
     712        with --disable-nls.
     713        * getopt.c (_): Likewise.
     714        * regex.c (_): Likewise.
     715
     7162001-11-03  Alan Modra  <amodra@bigpond.net.au>
     717
     718        * configure.in: Cope with missing makeinfo.
     719        * configure: Regenerate.
     720
     7212001-10-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     722
     723        * hex.c (hex_init): Provide empty stub.
     724
     725        * hex.c (hex_init): Delete.
     726        (_hex_value): Const-ify and initialize at compile-time.
     727
     7282001-10-19  H.J. Lu <hjl@gnu.org>
     729
     730        * Makefile.in ($(TARGETLIB)): Also generate pic/$(TARGETLIB) if
     731        necessary.
     732
     7332001-10-17  DJ Delorie  <dj@redhat.com>
     734
     735        * argv.c, asprintf.c, choose-temp.c, concat.c, cplus-dem.c,
     736        ffs.c, fnmatch.txh, getruntime.c, make-temp-file.c,
     737        mkstemps.c, pexecute.c, random.c, strsignal.c, vasprintf.c:
     738        Improve manual formatting.
     739        * functions.texi: Regenerate.
     740
     7412001-10-15  DJ Delorie  <dj@redhat.com>
     742
     743        * Makefile.in (TEXIFILES): Add fnmatch.txh.
     744        (maint-undoc): New.
     745        maint-tool: Add "undoc" tool.
     746        * alloca.c, argv.c, asprintf.c, choose-temp.c, concat.c,
     747        fdmatch.c, ffs.c, getruntime.c, insque.c, lbasename.c,
     748        make-temp-file.c, mkstemps.c, pexecute.c, random.c, spaces.c,
     749        strerror.s, strsignal.c, strtol.c, vasprintf.c: Add or update
     750        documentation.
     751        * fnmatch.txh: New.
     752        * functions.texi: Regenerate.
     753
     7542001-10-10  Joseph S. Myers  <jsm28@cam.ac.uk>
     755
     756        * bcmp.c, setenv.c: Use "nonzero" instead of "non-zero".
     757        * strtod.c: Use "ISO C" instead of "ANSI C".
     758        * functions.texi: Regenerate.
     759
     7602001-10-07  Joseph S. Myers  <jsm28@cam.ac.uk>
     761
     762        * alloca.c, clock.c, getcwd.c, getpagesize.c, getpwd.c, index.c,
     763        libiberty.texi, memchr.c, putenv.c, rindex.c, strchr.c, strdup.c,
     764        strerror.c, strrchr.c, strstr.c, strtod.c, tmpnam.c, vfork.c,
     765        xatexit.c, xmalloc.c, xstrerror.c: Improve manual formatting.  Fix
     766        spelling.  Give names to function arguments in documentation.  Use
     767        (void) prototypes in documentation.
     768        * functions.texi: Regenerate.
     769
     7702001-10-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     771
     772        * argv.c (buildargv, tests, main): Const-ify.
     773        * cp-demangle.c (operator_code): Likewise.
     774        * cplus-dem.c (optable, libiberty_demanglers,
     775        cplus_demangle_set_style, cplus_demangle_name_to_style,
     776        print_demangler_list): Likewise.
     777        * hashtab.c (higher_prime_number): Likewise.
     778        * strcasecmp.c (charmap): Likewise.
     779        * strerror.c (error_info, strerror, main): Likewise.
     780        * strncasecmp.c (charmap): Likewise.
     781        * strsignal.c (signal_info): Likewise.
     782
     7832001-09-29  DJ Delorie  <dj@redhat.com>
     784
     785        * configure: Regenerate.
     786
     7872001-09-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     788
     789        * concat.c: Include stdlib.h.
     790
     7912001-09-27  Eli Zaretskii  <eliz@is.elta.co.il>
     792
     793        * libiberty.texi: (Top level): Add syncodeindex pg.  Add
     794        @dircategory and @direntry directives.  Add @finalout.
     795        (many nodes): Lose the next,prev,up pointers on the @nide line.
     796        (Using, Supplemental Functions, Replacement Functions): Fix
     797        markup.
     798        (Functions): Move around, to allow makeinfo to build the manual
     799        without next,prev,up pointers in thye node lines.
     800        (Licenses): Fix typos.
     801
     802        * index.c, rindex.c, strchr.c, strerror.c, strrchr.c, strstr.c,
     803        strtol.c, xatexit.c, xexit.c, xmalloc.c: Fix spelling and markup.
     804        * functions.texi: Regenerate.
     805
     806        * copying-lib.texi: Lose the next,prev,up pointers on the @node
     807        line.
     808
     8092001-09-27  DJ Delorie  <dj@redhat.com>
     810
     811        * configure.in: Don't use in-tree texinfo, because libiberty must
     812        be built before it.  Check for makeinfo version 4 or higher.
     813        * functions.texi: Regenerate.
     814
     8152001-09-20  DJ Delorie  <dj@redhat.com>
     816            Phil Edwards  <pedwards@disaster.jaj.com>
     817
     818        * configure.in (MAKEINFO, PERL): Detect these.
     819        (--enable-maintainer-mode): Add.
     820        * configure: Regenerate.
     821        * Makefile.in (MAKEINFO, PERL): Define.
     822        (libiberty.info, libiberty.dvi, libiberty.html): New.
     823        (CFILES): Add bsearch.c.
     824        (CONFIGURED_OFILES): New, list of objects configure might add.
     825        (maint-missing, maint-buildall): New, for maintainers only.
     826        (clean, mostlyclean): Add info/dvi/html files.
     827        * libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New.
     828        * gather-docs: New, for maintainers.
     829        * maint-tool: New, for maintainers.
     830        * alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c,
     831        bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c,
     832        getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c,
     833        memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c,
     834        sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c,
     835        strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c,
     836        tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c,
     837        xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update
     838        documentation.
     839
     8402001-09-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     841
     842        * concat.c (reconcat): Fix for traditional C.
     843
     8442001-09-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     845
     846        * concat.c (reconcat): New function.
     847
     8482001-09-17  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     849
     850        * concat.c (vconcat_length, vconcat_copy, concat_length,
     851        concat_copy, concat_copy2): New functions.
     852        (concat): Use vconcat_length/vconcat_copy.
     853
     854        * alloca.c (libiberty_optr, libiberty_nptr, libiberty_len):
     855        Define.
     856
     8572001-09-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     858
     859        * asprintf.c: Don't define USE_STDARG.  Use VPARAMS, VA_OPEN,
     860        VA_FIXEDARG & VA_CLOSE.
     861
     862        * vasprintf.c: Check HAVE_STRING_H when including string.h.
     863        (checkit): Delete redundant prototype.  Add ATTRIBUTE_PRINTF_1.
     864        Use VA_OPEN, VA_FIXEDARG & VA_CLOSE.  Free allocated string.
     865
     8662001-08-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     867
     868        * concat.c (concat): Use VPARAMS, VA_OPEN, VA_FIXEDARG & VA_CLOSE.
     869
     8702001-08-23  Ulrich Drepper  <drepper@redhat.com>
     871
     872        * regex.c (truncate_wchar): Use wcrtomb not wctomb.
     873
     8742001-08-23  Ulrich Drepper  <drepper@redhat.com>
     875
     876        * posix/regex.c [_LIBC] (convert_mbs_to_wcs): Use __mbrtowc
     877        instead of mbrtowc.
     878        [_LIBC]: Use __iswctype instead of iswctype, __wcslen instead of
     879        wcslen, and __wcscoll instead of wcscoll.
     880
     8812001-08-22  Matt Kraai  <kraai@alumni.carnegiemellon.edu>
     882
     883        * fibheap.c (fibheap_init, fibnode_init): Remove.
     884        (fibheap_new, fibnode_new): Use xcalloc to allocate and
     885        initialize memory.
     886        (fibheap_insert): Remove check for node allocation failure.
     887
     8882001-08-21  Richard Henderson  <rth@redhat.com>
     889
     890        * Makefile.in (fibheap.o): Depend on config.h.
     891        * fibheap.c: Tidy formatting.  Use config.h.` Rearrange some
     892        functions for inlining.
     893
     894Tue Aug 21 12:35:04 2001  Christopher Faylor <cgf@cygnus.com>
     895
     896        * configure.in: Need to set HAVE_SYS_ERRLIST and HAVE_SYS_NERR whenever
     897        hosting on cygwin.
     898        * configure: Regenerate.
     899
     9002001-08-20  Andrew Cagney  <ac131313@redhat.com>
     901
     902        * floatformat.c (floatformat_m88110_ext): Remove #ifdef
     903        HARRIS_FLOAT_FORMAT.
     904        (floatformat_ia64_spill_little, floatformat_ia64_quad_little)
     905        (floatformat_ia64_spill_big, floatformat_ia64_quad_big)
     906        (floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword)
     907        (floatformat_m88110_harris_ext): New float formats.
     908
     9092001-08-20  Daniel Berlin  <dan@cgsoftware.com>
     910
     911        * fibheap.c: New file. Fibonacci heap.
     912
     913        * Makefile.in (CFILES): Add fibheap.c.
     914        (REQUIRED_OFILES): Add fibheap.o.
     915        (fibheap.o): Add dependencies for fibheap.o.
     916
     9172001-08-17  Christopher Faylor <cgf@cygnus.com>
     918
     919        * configure.in: Always set HAVE_SYS_ERRLIST when targetting cygwin.
     920        * configure: Regenerate.
     921
     9222001-08-16  Richard Henderson  <rth@redhat.com>
     923
     924        * hashtab.c (htab_hash_string): New.
     925
     9262001-08-13  Andrew Cagney  <ac131313@redhat.com>
     927
     928        * floatformat.c (floatformat_ieee_double_littlebyte_bigword): Fix
     929        name.
     930
     9312001-08-12  Isamu Hasegawa  <isamu@yamato.ibm.com>
     932
     933        * regex.c (wcs_regex_compile): Use appropriate string
     934        to compare with collating element.
     935        Fix the padding for the alignment.
     936
     9372001-08-10  Andrew Cagney  <ac131313@redhat.com>
     938
     939        * lbasename.c (lbasename): Change function definition to return a
     940        const char pointer.
     941
     9422001-08-07  Jason Merrill  <jason_merrill@redhat.com>
     943
     944        * cp-demangle.c (demangle_special_name): "GR" -> "reference temporary
     945        for".
     946
     9472001-08-03  Richard Henderson  <rth@redhat.com>
     948
     949        * Makefile.in (concat.o): Depend on config.h.
     950
     9512001-07-30  Andreas Jaeger  <aj@suse.de>
     952
     953        * concat.c: Include "config.h".
     954
     9552001-07-30  Andreas Jaeger  <aj@suse.de>
     956
     957        * regex.c: Declare wcs functions only if compiling with
     958        MBS_SUPPORT.
     959        Don't use #elif for traditional C.
     960
     9612001-07-23  Ulrich Drepper  <drepper@redhat.com>
     962
     963        * regex.c: Revamp memory allocation for WCHAR functions to
     964        not use too much stack.
     965
     9662001-07-30  Andreas Jaeger  <aj@suse.de>
     967
     968        * regex.c: Declare wcs functions only if compiling with
     969        MBS_SUPPORT.
     970        Don't use #elif for traditional C.
     971
     9722001-07-25  Daniel Jacobowitz  <drow@mvista.com>
     973
     974        * Makefile.in (regex.o): Add dependency on config.h.
     975
     9762001-07-18  Andreas Schwab  <schwab@suse.de>
     977
     978        * regex.c (WORDCHAR_P) [WCHAR]: Also return true for the
     979        underscore character.
     980
     9812001-07-18  Ulrich Drepper  <drepper@redhat.com>
     982
     983        * regex.c: Limit string length printed in debug messages to 100
     984        chars.
     985
     9862001-07-18  Andreas Jaeger  <aj@suse.de>
     987
     988        * regex.c: Place under LGPL version 2.1.
     989
     9902001-07-10  Jeff Johnston  <jjohnstn@redhat.com>
     991
     992        * Makefile.in: Add support for regex code.
     993        * regex.c: New file.
     994
     9952001-07-05  Mark Klein  <mklein@dis.com>
     996
     997        * Makefile.in: Add ffs.c dependency.
     998        * configure.in: Add ffs.c.
     999        * ffs.c: New file.
     1000
     10012001-06-18  Richard Henderson  <rth@redhat.com>
     1002
     1003        * concat.c: Include <sys/types.h>.
     1004
     10052001-06-11  Loren J. Rittle  <ljrittle@acm.org>
     1006
     1007        bootstrap/3106
     1008        * strerror.c (sys_nerr): Hide the OS header version.
     1009        * strsignal.c (sys_nsig): Likewise.
     1010
     10112001-06-10  Richard Henderson  <rth@redhat.com>
     1012
     1013        * concat.c: Include string.h.  Fix int vs size_t usage.
     1014        Simplify the iteration loops.  Use memcpy.
     1015
     10162001-05-16  Matt Kraai  <kraai@alumni.carnegiemellon.edu>
     1017
     1018        * partition.c: Fix misspelling of `implementation'.
     1019
     10202001-05-09  Thiemo Seufer  <seufer@csv.ica.uni-stuttgart.de>
     1021
     1022        * md5.c (md5_init_ctx): Declare constants as unsigned.
     1023        (md5_process_block): Likewise.
     1024
     10252001-05-07  Zack Weinberg  <zackw@stanford.edu>
     1026
     1027        * cp-demangle.c (demangle_v3_with_details,
     1028        is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor): Use K+R style
     1029        function definition.
     1030        * ternary.c: Use K+R style function definitions.  Use PTR, not
     1031        void *.  Make arguments constant where possible.
     1032
     10332001-05-07  Mark Mitchell  <mark@codesourcery.com>
     1034
     1035        * splay-tree.h (splay_tree_max): New function.
     1036        (splay_tree_min): Likewise.
     1037
     10382001-04-15  Daniel Berlin  <dan@cgsoftware.com>
     1039
     1040        * ternary.c: New file - Ternary search tree implementation.
     1041
     1042        * Makefile.in: Add ternary.o, and ternary.c dependencies.
     1043
     10442001-04-03  Zack Weinberg  <zackw@stanford.edu>
     1045
     1046        * make-temp-file.c (try): Inline.
     1047
     10482001-02-28  Richard Henderson  <rth@redhat.com>
     1049
     1050        * Makefile.in (make-temp-file.o): Depend on config.h.
     1051
     10522001-03-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
     1053
     1054        * memchr.c (memchr): Adjust condition to avoid infinite loop.
     1055
     10562001-03-23  Jakub Jelinek  <jakub@redhat.com>
     1057
     1058        * cp-demangle.c (demangle_discriminator): `_0' is discriminator #1,
     1059        `_' not followed by a digit is invalid.
     1060
     10612001-03-22  Jim Blandy  <jimb@redhat.com>
     1062
     1063        * cp-demangle.c (string_list_delete): Use dyn_string_delete
     1064        instead of free, to free the contents as well as the string
     1065        structure.
     1066
     10672001-03-21  Zack Weinberg  <zackw@stanford.edu>
     1068
     1069        * make-temp-file.c: Always default DIR_SEPARATOR to '/'.
     1070        Don't default P_tmpdir to anything.  Try /var/tmp before
     1071        /usr/tmp.
     1072
     10732001-03-20  Zack Weinberg  <zackw@stanford.edu>
     1074
     1075        * choose-temp.c: Split off make_temp_file, and the code
     1076        duplicated between it and choose_temp_base, into...
     1077        * make-temp-file.c: ... here; new file.
     1078
     1079        * Makefile.in (CFILES): Add make-temp-file.c.
     1080        (REQUIRED_OFILES): Add make-temp-file.o.
     1081
     10822001-03-20  Jim Blandy  <jimb@redhat.com>
     1083
     1084        * cp-demangle.c (struct demangling_def): New fields:
     1085        is_constructor and is_destructor.
     1086        (demangling_new): Initialize them.
     1087        (demangle_ctor_dtor_name): Set them, if we detect a constructor
     1088        or destructor.
     1089        (demangle_v3_with_details, is_gnu_v3_mangled_ctor,
     1090        is_gnu_v3_mangled_dtor): New functions.
     1091
     10922001-03-20  Jason Merrill  <jason@redhat.com>
     1093
     1094        * cplus-dem.c (main): Skip initial $.
     1095
     10962001-03-15  Michael Meissner  <meissner@redhat.com>
     1097
     1098        * hashtab.c (higher_prime_number): Silence warning that 4294967291
     1099        might be a signed integer under pre-ISO C systems.
     1100
     11012001-03-10  Neil Booth  <neil@daikokuya.demon.co.uk>
     1102            John David Anglin  <dave@hiauly1.hia.nrc.ca>
     1103
     1104        * libiberty/lbasename.c: New file.
     1105        * libiberty/Makefile.in: Update for lbasename.
     1106
     11072001-03-06  Zack Weinberg  <zackw@stanford.edu>
     1108
     1109        * aclocal.m4 (libiberty_AC_FUNC_C_ALLOCA): New.
     1110        * configure.in: Replace all alloca logic with a simple use of
     1111        the above new macro.
     1112        * config.table: Kill *-*-beos* entry.
     1113        * config/mh-beos: Delete.
     1114        * configure, config.in: Regenerate.
     1115
     1116        * Makefile.in (ALLOCA, HFILES): Kill.
     1117        (REQUIRED_OFILES): Add alloca.o.
     1118        (alloca.o): Depend on libiberty.h.
     1119        (argv.o): Don't depend on alloca-conf.h.
     1120        * alloca-conf.h: Delete.
     1121        * alloca.c: Include libiberty.h.  Kill all #ifdef emacs
     1122        blocks.  Provide the C alloca unconditionally.  Use PTR where
     1123        appropriate.  Make i00afunc static.
     1124        * argv.c: Don't include alloca-conf.h.
     1125
     11262001-03-04  John David Anglin  <dave@hiauly1.hia.nrc.ca>
     1127
     1128        * cplus-dem.c (main): Cast enum style to int.
     1129
     11302001-02-16  Loren J. Rittle  <ljrittle@acm.org>
     1131
     1132        * cplus-dem.c (main): Initialize style.
     1133
     11342001-02-02  Phil Edwards  <pme@sources.redhat.com>
     1135
     1136        * COPYING.LIB:  Update to LGPL 2.1 from the FSF.
     1137
     11382001-01-31  Bryce McKinlay  <bryce@albatross.co.nz>
     1139
     1140        Add support for Java demangling under the v3 ABI:
     1141        * cp-demangle.c (NAMESPACE_SEPARATOR): New define.
     1142        (struct demangling_def): Add `style' field.
     1143        (demangling_new): New parameter `style'. Set it in demangling_t.
     1144        (demangle_prefix): Use NAMESPACE_SEPARATOR.
     1145        (demangle_type_ptr): Don't emit pointer symbol if doing Java output.
     1146        (cp_demangle): New parameter `style'. Pass it to demangling_new().
     1147        (main): Call cp_demangle with extra parameter.
     1148        (java_demangle_v3): New function.
     1149        (java_builtin_type_names): New. Table of primitive type names used
     1150        for Java demangling.
     1151        (demangle_builtin_type): Look up in java_builtin_type_names if doing
     1152        Java output.
     1153        * cplus-dem.c (cplus_demangle): Use java_demangle_v3 to do Java
     1154        demangling.
     1155        (long_options): Remove obsolete `java' option.
     1156        (main): Remove explicit handling of `java' option. Instead, pass style
     1157        parameter in cplus_demangle flags as gdb does.
     1158        * testsuite/demangle.expected: Add some Java test cases.
     1159
    111602000-12-29  DJ Delorie  <dj@redhat.com>
    21161
     
    71166        * md5.c: Ditto.
    81167        * obstack.c: Ditto.
    9        
     1168
    1011692000-12-26  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
    111170
     
    1121271
    1131272        * hashtab.c (htab_expand): Change to return int.  Use calloc or
    114         xcalloc depending on htab->return_allocation_failure.  Return zero
    115         if calloc fails.
     1273        xcalloc depending on htab->return_allocation_failure.  Return zero
     1274        if calloc fails.
    1161275        (htab_create): Update comment to cover memory allocation.
    1171276        (htab_try_create): New.
    1181277        (htab_find_slot_with_hash): Return NULL if htab_expand fails.
    119         Update comment to cover this.
     1278        Update comment to cover this.
    1201279
    12112802000-11-03  Hans-Peter Nilsson  <hp@bitrange.com>
     
    6201779
    6211780        * Makefile.in (xmalloc.o): Add dependency for config.h, fixes make
    622         -j3.
     1781        -j3.
    6231782
    62417832000-05-18  J. David Anglin  <dave@hiauly1.hia.nrc.ca>
     
    12532412
    12542413        * cplus-dem.c (demangle_arm_pt): Remove unused prototype.
    1255         (snarf_numeric_literal): Constify first parameter.
    1256         (code_for_qualifier): Avoid a gcc extension, make the parameter an
    1257         int, not a char.
     2414        (snarf_numeric_literal): Constify first parameter.
     2415        (code_for_qualifier): Avoid a gcc extension, make the parameter an
     2416        int, not a char.
    12582417        (demangle_qualifier): Likewise.
    12592418        (demangle_signature): Cast the argument of a ctype function to
     
    12682427
    12692428        * floatformat.c (floatformat_to_double): Add explicit braces to
    1270         avoid ambiguous `else'.
     2429        avoid ambiguous `else'.
    12712430
    12722431        * fnmatch.c (fnmatch): Change type of variables `c', `c1',
    1273         `cstart' and `cend' to unsigned char.  Cast the argument of macro
    1274         `FOLD', which uses ctype functions, to unsigned char.
     2432        `cstart' and `cend' to unsigned char.  Cast the argument of macro
     2433        `FOLD', which uses ctype functions, to unsigned char.
    12752434
    12762435        * objalloc.c (free): Add prototype.
     
    12832442
    12842443        * cplus-dem.c (demangle_arm_pt): remove declaration -- function
    1285         doesn't exist.
     2444        doesn't exist.
    12862445        (do_hpacc_template_literal): remove unused variable `i'.
    12872446
     
    13272486        * cplus-dem.c
    13282487        (main): Remove default to HP style demangling, set to EDG
    1329         demangling correctly when -edg specified; set the demangling style
    1330         when user specifies 'edg'. Set strip_underscore to
    1331         prepends_underscore, if not HPUXHPPA.  Set
    1332         current_demangling_style to hp_demangling if HPUXHPPA.  Set
    1333         current demangling style correctly if the switch is hp.  Read
    1334         label correctly also in the HP style case.
     2488        demangling correctly when -edg specified; set the demangling style
     2489        when user specifies 'edg'. Set strip_underscore to
     2490        prepends_underscore, if not HPUXHPPA.  Set
     2491        current_demangling_style to hp_demangling if HPUXHPPA.  Set
     2492        current demangling style correctly if the switch is hp.  Read
     2493        label correctly also in the HP style case.
    13352494        (work_stuff): add temp_start field; add field for volatile member
    1336         function.
     2495        function.
    13372496        (arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP
    1338         style for this case is the same as ARM.
     2497        style for this case is the same as ARM.
    13392498        (demangle_args): handle EDG_DEMANGLING style; support HP style.
    13402499        (demangle_arm_hp_template): new function. (It was
    1341         demangle_arm_pt.); check and set value of temp_start field in
    1342         multiple places. Also, when ceching for end of template args,
    1343         check to see if at end of static member of template class.
     2500        demangle_arm_pt.); check and set value of temp_start field in
     2501        multiple places. Also, when ceching for end of template args,
     2502        check to see if at end of static member of template class.
    13442503        (demangle_class): new local variable : save_class_name_end Don't
    1345         include template args in string defining class.
     2504        include template args in string defining class.
    13462505        (demangle_class_name): use demangel_arm_hp_template.
    13472506        (demangle_function_name): handle case where demangling style is
    1348         HP_DEMANGLING and currently point at an 'X' in the mangled name.
    1349         Handle EDG_DEMANGLING style.  Handle constructor and destructor
    1350         ops for HP style.
     2507        HP_DEMANGLING and currently point at an 'X' in the mangled name.
     2508        Handle EDG_DEMANGLING style.  Handle constructor and destructor
     2509        ops for HP style.
    13512510        (demangle_prefix): handle EDG_DEMANGLING and ARM_DEMANGLING
    1352         styles.  global destructor and constructor for HP style are same
    1353         as for ARM style. Same for local variables.
     2511        styles.  global destructor and constructor for HP style are same
     2512        as for ARM style. Same for local variables.
    13542513        (demangle_qualified): handle EDG_DEMANGLING style.
    13552514        (demangle_signature): add case for volatile member function.  For
    1356         cases '1' - '9' : initialize the temp_start field to -1 and handle
    1357         the EDG_DEMANGLING style.  for case 'F' : handle EDG_DEMANGLING
    1358         and AUTO_DEMANGLING styles.  If expecting a function and managed
    1359         to demangle the funct args, then handle the LUCID_DEMANGLING,
    1360         ARM_DEMANGLING, and EDG_DEMANGLING styles.  Add case for local
    1361         class name after "Lnnn_ in HP style case. HP style too needs to
    1362         forget types.  _nnn is OK for HP style, so don't report failure.
     2515        cases '1' - '9' : initialize the temp_start field to -1 and handle
     2516        the EDG_DEMANGLING style.  for case 'F' : handle EDG_DEMANGLING
     2517        and AUTO_DEMANGLING styles.  If expecting a function and managed
     2518        to demangle the funct args, then handle the LUCID_DEMANGLING,
     2519        ARM_DEMANGLING, and EDG_DEMANGLING styles.  Add case for local
     2520        class name after "Lnnn_ in HP style case. HP style too needs to
     2521        forget types.  _nnn is OK for HP style, so don't report failure.
    13632522        (do_hpacc_template_const_value): new function. Handle template's
    1364         value param for HP/aCC.
     2523        value param for HP/aCC.
    13652524        (do_hpacc_template_literal): new function.  Handle a template's
    1366         literal parameter for HP aCC.
     2525        literal parameter for HP aCC.
    13672526        (recursively_demangle): new function
    13682527        (snarf_numeric_literal): new function.
    13692528        (usage): add 'edg' to the list of demangling styles; add hp switch
    1370         to message.
     2529        to message.
    13712530
    13722531Sat Nov 28 17:25:22 1998  Christopher Faylor <cgf@cygnus.com>
     
    14502609
    14512610        * pexecute.c: Check HAVE_CONFIG_H, not IN_GCC, when determining
    1452         whether to include config.h.  Possibly include unistd.h in the
    1453         !IN_GCC case.  Define VFORK_STRING as a printable function call
    1454         for error messages (either "vfork" or "fork".)  If HAVE_VFORK_H is
    1455         defined, include vfork.h.  If VMS is defined, define vfork()
    1456         appropriately.  Remove vfork check on USG, we're using autoconf.
    1457         (pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking
    1458         locally what string to use.
     2611        whether to include config.h.  Possibly include unistd.h in the
     2612        !IN_GCC case.  Define VFORK_STRING as a printable function call
     2613        for error messages (either "vfork" or "fork".)  If HAVE_VFORK_H is
     2614        defined, include vfork.h.  If VMS is defined, define vfork()
     2615        appropriately.  Remove vfork check on USG, we're using autoconf.
     2616        (pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking
     2617        locally what string to use.
    14592618
    146026191998-10-26  Mark Mitchell  <mark@markmitchell.com>
     
    15622721
    15632722        * mkstemp.c: Include config.h even when not IN_GCC.  Wrap header
    1564         inclusions inside HAVE_*_H macros.  Include ansidecl.h when not
    1565         IN_GCC.
     2723        inclusions inside HAVE_*_H macros.  Include ansidecl.h when not
     2724        IN_GCC.
    15662725
    15672726        * vasprintf.c: Include stdarg.h/varargs.h first.
     
    18773036        * config.table: Change config_shell to CONFIG_SHELL, and use
    18783037        libiberty_topdir to find move-if-change.
    1879         (m68k-apollo-bsd*, m68k-apollo-sysv*): Remove.
     3038        (m68k-apollo-bsd*, m68k-apollo-sysv*): Remove.
    18803039        (i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove.
    18813040        (*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove.
     
    20943253        * asprintf.c: stdarg.h when ALMOST_STDC
    20953254        * config/mh-windows (EXTRA_OFILES): add asprintf.o and
    2096         strncasecmp.o.
     3255        strncasecmp.o.
    20973256
    20983257Thu Aug 28 14:27:15 1997  Andrew Cagney  <cagney@b1.cygnus.com>
     
    41365295Mon Jan 20 18:53:23 1992  Stu Grossman  (grossman at cygnus.com)
    41375296
    4138         * getopt.c, getopt1.c, ../include/getopt.h:  Get latest versions.
     5297        * getopt.c, getopt1.c, ../include/getopt.h:  Get latest versions.
    41395298
    41405299Sat Jan 18 16:53:01 1992  Fred Fish  (fnf at cygnus.com)
  • branches/GNU/src/binutils/libiberty/Makefile.in

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11#
    22# Makefile
    3 #   Copyright (C) 1990, 91-99, 2000
     3#   Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003
    44#   Free Software Foundation
    55#
     
    2727#
    2828
     29libiberty_topdir = @libiberty_topdir@
    2930srcdir = @srcdir@
    3031VPATH = @srcdir@
     
    3536bindir = @bindir@
    3637libdir = @libdir@
     38includedir = @includedir@
     39target_header_dir = @target_header_dir@
    3740
    3841SHELL = @SHELL@
     
    4952INSTALL_PROGRAM = @INSTALL_PROGRAM@
    5053INSTALL_DATA = @INSTALL_DATA@
     54mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
     55
     56# Some compilers can't handle cc -c blah.c -o foo/blah.o.
     57OUTPUT_OPTION = @OUTPUT_OPTION@
    5158
    5259AR = @AR@
     
    5764LIBCFLAGS = $(CFLAGS)
    5865RANLIB = @RANLIB@
     66MAKEINFO = @MAKEINFO@
     67PERL = @PERL@
    5968
    6069PICFLAG =
     
    6372
    6473TARGETLIB = libiberty.a
     74TESTLIB = testlib.a
    6575
    6676LIBOBJS = @LIBOBJS@
    67 ALLOCA = @ALLOCA@
    6877
    6978# A configuration can specify extra .o files that should be included,
     
    7786        "CC=$(CC)" \
    7887        "CFLAGS=$(CFLAGS)" \
     88        "DESTDIR=$(DESTDIR)" \
    7989        "LIBCFLAGS=$(LIBCFLAGS)" \
    8090        "EXTRA_OFILES=$(EXTRA_OFILES)" \
     
    96106SUBDIRS = testsuite
    97107
     108# FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
    98109all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
    99         @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
     110        @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
    100111
    101112.PHONY: check installcheck
     
    112123          $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
    113124        else true; fi
    114         $(COMPILE.c) $<
    115 
    116 info: info-subdir
     125        $(COMPILE.c) $< $(OUTPUT_OPTION)
     126
     127# NOTE: If you add new files to the library, add them to this list
     128# (alphabetical), and add them to REQUIRED_OFILES, or
     129# CONFIGURED_OFILES and funcs in configure.in.
     130CFILES = alloca.c argv.c asprintf.c atexit.c                            \
     131        basename.c bcmp.c bcopy.c bsearch.c bzero.c                     \
     132        calloc.c choose-temp.c clock.c concat.c cp-demangle.c           \
     133         cplus-dem.c                                                    \
     134        dyn-string.c                                                    \
     135        fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c               \
     136        getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
     137        hashtab.c hex.c                                                 \
     138        index.c insque.c                                                \
     139        lbasename.c                                                     \
     140        lrealpath.c                                                     \
     141        make-relative-prefix.c                                          \
     142        make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c     \
     143         mempcpy.c memset.c mkstemps.c                                  \
     144        objalloc.c obstack.c                                            \
     145        partition.c                                                     \
     146         pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c                    \
     147         pex-unix.c pex-win32.c                                         \
     148         physmem.c putenv.c                                             \
     149        random.c regex.c rename.c rindex.c                              \
     150        safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c   \
     151         splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \
     152         strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c       \
     153         strstr.c strtod.c strtol.c strtoul.c                           \
     154        ternary.c tmpnam.c                                              \
     155        vasprintf.c vfork.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \
     156        waitpid.c                                                       \
     157        xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
     158
     159# These are always included in the library.  The first four are listed
     160# first and by compile time to optimize parallel builds.
     161REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o               \
     162        alloca.o argv.o                                                 \
     163        choose-temp.o concat.o                                          \
     164        dyn-string.o                                                    \
     165        fdmatch.o fibheap.o floatformat.o fnmatch.o                     \
     166        getopt.o getopt1.o getpwd.o getruntime.o                        \
     167        hashtab.o hex.o                                                 \
     168        lbasename.o                                                     \
     169        lrealpath.o                                                     \
     170        make-relative-prefix.o                                          \
     171        make-temp-file.o                                                \
     172        objalloc.o obstack.o                                            \
     173        partition.o physmem.o @pexecute@                                                \
     174        safe-ctype.o sort.o spaces.o splay-tree.o strerror.o            \
     175         strsignal.o                                                    \
     176        ternary.o                                                       \
     177        xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o
     178
     179# These are all the objects that configure may add to the library via
     180# $funcs or EXTRA_OFILES.  This list exists here only for "make
     181# maint-missing" and "make check".
     182CONFIGURED_OFILES = asprintf.o atexit.o                                 \
     183        basename.o bcmp.o bcopy.o bsearch.o bzero.o                     \
     184        calloc.o clock.o copysign.o                                     \
     185        _doprnt.o                                                       \
     186        ffs.o                                                           \
     187        getcwd.o getpagesize.o                                          \
     188        index.o insque.o                                                \
     189        memchr.o memcmp.o memcpy.o memmove.o mempcpy.o memset.o mkstemps.o \
     190        pex-djgpp.o pex-mpw.o pex-msdos.o pex-os2.o                     \
     191         pex-unix.o pex-win32.o                                         \
     192         putenv.o                                                       \
     193        random.o rename.o rindex.o                                      \
     194        setenv.o sigsetmask.o snprintf.o stpcpy.o stpncpy.o strcasecmp.o \
     195         strchr.o strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o   \
     196         strtod.o strtol.o strtoul.o                                    \
     197        tmpnam.o                                                        \
     198        vasprintf.o vfork.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o \
     199        waitpid.o
     200
     201# These files are installed if the library has been configured to do so.
     202INSTALLED_HEADERS =                                                     \
     203        $(INCDIR)/ansidecl.h                                            \
     204        $(INCDIR)/demangle.h                                            \
     205        $(INCDIR)/dyn-string.h                                          \
     206        $(INCDIR)/fibheap.h                                             \
     207        $(INCDIR)/floatformat.h                                         \
     208        $(INCDIR)/hashtab.h                                             \
     209        $(INCDIR)/libiberty.h                                           \
     210        $(INCDIR)/objalloc.h                                            \
     211        $(INCDIR)/partition.h                                           \
     212        $(INCDIR)/safe-ctype.h                                          \
     213        $(INCDIR)/sort.h                                                \
     214        $(INCDIR)/splay-tree.h                                          \
     215        $(INCDIR)/ternary.h
     216
     217$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
     218        -rm -f $(TARGETLIB) pic/$(TARGETLIB)
     219        $(AR) $(AR_FLAGS) $(TARGETLIB) \
     220          $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
     221        $(RANLIB) $(TARGETLIB)
     222        if [ x"$(PICFLAG)" != x ]; then \
     223          cd pic; \
     224          $(AR) $(AR_FLAGS) $(TARGETLIB) \
     225            $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
     226          $(RANLIB) $(TARGETLIB); \
     227          cd ..; \
     228        else true; fi
     229
     230$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
     231        -rm -f $(TESTLIB)
     232        $(AR) $(AR_FLAGS) $(TESTLIB) \
     233          $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
     234        $(RANLIB) $(TESTLIB)
     235
     236info: libiberty.info info-subdir
    117237install-info: install-info-subdir
    118238clean-info: clean-info-subdir
    119 dvi: dvi-subdir
    120 
    121 # Include files that are in this directory.
    122 HFILES = alloca-conf.h
    123 
    124 # NOTE: If you add new files to the library, add them to this list
    125 # (alphabetical), and add them to REQUIRED_OFILES or funcs in
    126 # configure.in.
    127 CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c        \
    128         bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c           \
    129         cp-demangle.c dyn-string.c fdmatch.c fnmatch.c getcwd.c               \
    130         getpwd.c getopt.c getopt1.c getpagesize.c getruntime.c                \
    131         floatformat.c hashtab.c hex.c index.c insque.c md5.c memchr.c         \
    132         memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c  \
    133         partition.c pexecute.c putenv.c random.c rename.c rindex.c setenv.c   \
    134         sigsetmask.c safe-ctype.c sort.c spaces.c splay-tree.c strcasecmp.c   \
    135         strncasecmp.c strchr.c strdup.c strerror.c strncmp.c strrchr.c        \
    136         strsignal.c strstr.c strtod.c strtol.c strtoul.c tmpnam.c vasprintf.c \
    137         vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c xatexit.c xexit.c   \
    138         xmalloc.c xmemdup.c xstrdup.c xstrerror.c
    139 
    140 # These are always included in the library.
    141 REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o cp-demangle.o     \
    142         dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o          \
    143         getruntime.o hashtab.o hex.o floatformat.o md5.o objalloc.o obstack.o \
    144         partition.o pexecute.o safe-ctype.o sort.o spaces.o splay-tree.o      \
    145         strerror.o strsignal.o xatexit.o xexit.o xmalloc.o xmemdup.o          \
    146         xstrdup.o xstrerror.o
    147 
    148 $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
    149         -rm -f $(TARGETLIB)
    150         $(AR) $(AR_FLAGS) $(TARGETLIB) \
    151           $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
    152         $(RANLIB) $(TARGETLIB)
     239dvi: libiberty.dvi dvi-subdir
     240html: libiberty.html
     241
     242TEXISRC = \
     243        $(srcdir)/libiberty.texi \
     244        $(srcdir)/copying-lib.texi \
     245        $(srcdir)/obstacks.texi \
     246        $(srcdir)/functions.texi
     247
     248# Additional files that have texi snippets that need to be collected
     249# and sorted.  Some are here because the sources are imported from
     250# elsewhere.  Others represent headers in ../include.
     251TEXIFILES = fnmatch.txh pexecute.txh
     252
     253libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
     254        $(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
     255
     256libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC)
     257        texi2dvi $(srcdir)/libiberty.texi
     258
     259libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
     260        $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi
     261
     262@MAINT@$(srcdir)/functions.texi : stamp-functions
     263@MAINT@ @true
     264
     265@MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile
     266@MAINT@@HAVE_PERL@      $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
     267@MAINT@ echo stamp > stamp-functions
    153268
    154269INSTALL_DEST = @INSTALL_DEST@
     
    156271
    157272install_to_libdir: all
    158         $(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
    159         ( cd $(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
    160         mv -f $(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(libdir)$(MULTISUBDIR)/$(TARGETLIB)
     273        ${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
     274        $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n
     275        ( cd $(DESTDIR)$(libdir)$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
     276        mv -f $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)n $(DESTDIR)$(libdir)$(MULTISUBDIR)/$(TARGETLIB)
     277        if test -n "${target_header_dir}"; then \
     278          case "${target_header_dir}" in \
     279            /*)    thd=${target_header_dir};; \
     280            *)     thd=${includedir}${MULTISUBDIR}/${target_header_dir};; \
     281          esac; \
     282          ${mkinstalldirs} $(DESTDIR)$${thd}; \
     283          for h in ${INSTALLED_HEADERS}; do \
     284            ${INSTALL_DATA} $$h $(DESTDIR)$${thd}; \
     285          done; \
     286        fi
    161287        @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
    162288
     289# This is tricky.  Even though CC in the Makefile contains
     290# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
     291# default multilib, so we have to take LIBCFLAGS into account as well,
     292# since it will be passed the multilib flags.
     293MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory`
    163294install_to_tooldir: all
    164         $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n
    165         ( cd $(tooldir)/lib$(MULTISUBDIR) ; $(RANLIB) $(TARGETLIB)n )
    166         mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
     295        ${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)
     296        $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n
     297        ( cd $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) ; $(RANLIB) $(TARGETLIB)n )
     298        mv -f $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)
    167299        @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
    168300
     
    198330etags tags: TAGS etags-subdir
    199331
    200 TAGS: $(CFILES) $(HFILES)
    201         etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
     332TAGS: $(CFILES)
     333        etags `for i in $(CFILES); do echo $(srcdir)/$$i ; done`
    202334
    203335# The standalone demangler (c++filt) has been moved to binutils.
     
    208340
    209341ls:
    210         @echo Makefile $(HFILES) $(CFILES)
     342        @echo Makefile $(CFILES)
     343
     344# Various targets for maintainers.
     345
     346maint-missing :
     347        @$(PERL) $(srcdir)/maint-tool -s $(srcdir) missing $(CFILES) $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
     348
     349maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
     350        @true
     351
     352maint-undoc : $(srcdir)/functions.texi
     353        @$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
     354
     355maint-deps :
     356        @$(PERL) $(srcdir)/maint-tool -s $(srcdir) deps $(INCDIR)
    211357
    212358# Need to deal with profiled libraries, too.
     
    218364        -rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
    219365        -rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
     366        -rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
     367        -rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
     368        -rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
     369        -rm -f libtexi.stamp
    220370        @$(MULTICLEAN) multi-clean DO=mostlyclean
    221371clean: clean-subdir
    222372        $(MAKE) SUBDIRS="" mostlyclean
    223373        -rm -f *.a required-list tmpmulti.out
     374        -rm -f libiberty.dvi libiberty.info* libiberty.html
    224375        @$(MULTICLEAN) multi-clean DO=clean
    225376distclean: distclean-subdir
     
    237388        CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
    238389
     390# Depending on Makefile makes sure that config.status has been re-run
     391# if needed.  This prevents problems with parallel builds.
    239392config.h: stamp-h ; @true
    240 stamp-h: config.in config.status
     393stamp-h: config.in config.status Makefile
    241394        CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
    242395
     
    244397        $(SHELL) ./config.status --recheck
    245398
    246 
     399# Depending on config.h makes sure that config.status has been re-run
     400# if needed.  This prevents problems with parallel builds, in case
     401# subdirectories need to run config.status also.
    247402all-subdir check-subdir installcheck-subdir info-subdir \
    248403install-info-subdir clean-info-subdir dvi-subdir install-subdir \
    249404etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
    250 maintainer-clean-subdir:
     405maintainer-clean-subdir: config.h
    251406        @subdirs='$(SUBDIRS)'; \
    252407        target=`echo $@ | sed -e 's/-subdir//'`; \
    253408        for dir in $$subdirs ; do \
    254           cd $$dir && $(MAKE) $$target; \
     409          cd $$dir && $(MAKE) $(FLAGS_TO_PASS) $$target; \
    255410        done
    256411
    257 $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir
    258 
    259 alloca.o: config.h
     412$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
     413$(CONFIGURED_OFILES): stamp-picdir
     414
     415# The dependencies in the remainder of this file are automatically
     416# generated by "make maint-deps".  Manual edits will be lost.
     417
     418_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
     419alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     420argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     421asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
    260422atexit.o: config.h
    261 argv.o: config.h alloca-conf.h $(INCDIR)/libiberty.h
    262 basename.o: $(INCDIR)/libiberty.h
    263 choose-temp.o: config.h
     423basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     424        $(INCDIR)/safe-ctype.h
     425bsearch.o: config.h $(INCDIR)/ansidecl.h
     426calloc.o: $(INCDIR)/ansidecl.h
     427choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
    264428clock.o: config.h
    265 concat.o: $(INCDIR)/libiberty.h
    266 cplus-dem.o: config.h $(INCDIR)/demangle.h
    267 cp-demangle.o: config.h $(INCDIR)/dyn-string.h $(INCDIR)/demangle.h
    268 dyn-string.o: config.h $(INCDIR)/dyn-string.h
    269 fdmatch.o: $(INCDIR)/libiberty.h
    270 fnmatch.o: config.h $(INCDIR)/fnmatch.h
     429concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     430copysign.o: $(INCDIR)/ansidecl.h
     431cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
     432        $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h
     433cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
     434        $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
     435dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \
     436        $(INCDIR)/libiberty.h
     437fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     438fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \
     439        $(INCDIR)/libiberty.h
     440floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h
     441fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h
    271442getcwd.o: config.h
    272443getopt.o: config.h $(INCDIR)/getopt.h
    273444getopt1.o: config.h $(INCDIR)/getopt.h
    274445getpagesize.o: config.h
    275 getpwd.o: config.h $(INCDIR)/libiberty.h
    276 getruntime.o: config.h $(INCDIR)/libiberty.h
    277 hex.o: $(INCDIR)/libiberty.h
    278 floatformat.o: $(INCDIR)/floatformat.h
    279 mkstemps.o: config.h
    280 md5.o: config.h
    281 objalloc.o: config.h $(INCDIR)/objalloc.h
     446getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     447getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     448hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
     449        $(INCDIR)/libiberty.h
     450hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     451lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     452        $(INCDIR)/safe-ctype.h
     453lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     454make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h \
     455        $(INCDIR)/libiberty.h
     456make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     457md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
     458memchr.o: $(INCDIR)/ansidecl.h
     459memcmp.o: $(INCDIR)/ansidecl.h
     460memcpy.o: $(INCDIR)/ansidecl.h
     461memmove.o: $(INCDIR)/ansidecl.h
     462mempcpy.o: $(INCDIR)/ansidecl.h
     463memset.o: $(INCDIR)/ansidecl.h
     464mkstemps.o: config.h $(INCDIR)/ansidecl.h
     465objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
    282466obstack.o: config.h $(INCDIR)/obstack.h
    283 partition.o: config.h $(INCDIR)/partition.h
    284 pexecute.o: config.h $(INCDIR)/libiberty.h
    285 rename.o: config.h
    286 setenv.o: config.h
    287 sort.o: config.h $(INCDIR)/sort.h $(INCDIR)/ansidecl.h
    288 spaces.o: $(INCDIR)/libiberty.h
    289 splay-tree.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h $(INCDIR)/ansidecl.h
    290 strerror.o: config.h $(INCDIR)/libiberty.h
    291 strsignal.o: config.h $(INCDIR)/libiberty.h
    292 strtol.o: config.h
    293 strtoul.o: config.h
    294 vasprintf.o: config.h
    295 xatexit.o: $(INCDIR)/libiberty.h
    296 xexit.o: config.h $(INCDIR)/libiberty.h
    297 xmalloc.o: config.h $(INCDIR)/libiberty.h
    298 xmemdup.o: config.h $(INCDIR)/libiberty.h
    299 xstrdup.o: config.h $(INCDIR)/libiberty.h
    300 xstrerror.o: config.h $(INCDIR)/libiberty.h
     467partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     468        $(INCDIR)/partition.h
     469pex-djgpp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     470        $(srcdir)/pex-common.h
     471pex-mpw.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     472        $(srcdir)/pex-common.h
     473pex-msdos.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     474        $(srcdir)/pex-common.h $(INCDIR)/safe-ctype.h
     475pex-os2.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     476        $(srcdir)/pex-common.h
     477pex-unix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     478        $(srcdir)/pex-common.h
     479pex-win32.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     480        $(srcdir)/pex-common.h
     481physmem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     482putenv.o: config.h $(INCDIR)/ansidecl.h
     483random.o: $(INCDIR)/ansidecl.h
     484regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
     485rename.o: config.h $(INCDIR)/ansidecl.h
     486safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
     487setenv.o: config.h $(INCDIR)/ansidecl.h
     488sigsetmask.o: $(INCDIR)/ansidecl.h
     489snprintf.o: $(INCDIR)/ansidecl.h
     490sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     491        $(INCDIR)/sort.h
     492spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     493splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     494        $(INCDIR)/splay-tree.h
     495stpcpy.o: $(INCDIR)/ansidecl.h
     496stpncpy.o: $(INCDIR)/ansidecl.h
     497strcasecmp.o: $(INCDIR)/ansidecl.h
     498strchr.o: $(INCDIR)/ansidecl.h
     499strdup.o: $(INCDIR)/ansidecl.h
     500strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     501strncasecmp.o: $(INCDIR)/ansidecl.h
     502strncmp.o: $(INCDIR)/ansidecl.h
     503strrchr.o: $(INCDIR)/ansidecl.h
     504strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     505strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
     506strtol.o: config.h $(INCDIR)/safe-ctype.h
     507strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
     508ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
     509        $(INCDIR)/ternary.h
     510vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     511vfork.o: $(INCDIR)/ansidecl.h
     512vfprintf.o: $(INCDIR)/ansidecl.h
     513vprintf.o: $(INCDIR)/ansidecl.h
     514vsnprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     515vsprintf.o: $(INCDIR)/ansidecl.h
    301516waitpid.o: config.h
    302 hashtab.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/ansidecl.h
     517xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     518xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     519xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     520xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     521xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
     522xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
  • branches/GNU/src/binutils/libiberty/README

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1616instructions in ../README.
    1717
    18 Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu".  Thank you.
     18Please report bugs to "gcc-bugs@gcc.gnu.org" and send fixes to
     19"gcc-patches@gcc.gnu.org".  Thank you.
    1920
    2021ADDING A NEW FILE
  • branches/GNU/src/binutils/libiberty/aclocal.m4

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    4848  p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
    4949                     MAP_ANON|MAP_PRIVATE, dev_zero, 0);
     50  if (p == (char *)-1)
     51    p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
     52                       MAP_ANON|MAP_PRIVATE, -1, 0);
    5053  if (p == (char *)-1)
    5154    exit (2);
     
    8487fi
    8588])
     89
     90dnl See whether we need a declaration for a function.
     91AC_DEFUN(libiberty_NEED_DECLARATION,
     92[AC_MSG_CHECKING([whether $1 must be declared])
     93AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
     94[AC_TRY_COMPILE([
     95#include "confdefs.h"
     96#include <stdio.h>
     97#ifdef HAVE_STRING_H
     98#include <string.h>
     99#else
     100#ifdef HAVE_STRINGS_H
     101#include <strings.h>
     102#endif
     103#endif
     104#ifdef HAVE_STDLIB_H
     105#include <stdlib.h>
     106#endif
     107#ifdef HAVE_UNISTD_H
     108#include <unistd.h>
     109#endif],
     110[char *(*pfn) = (char *(*)) $1],
     111libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
     112AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
     113if test $libiberty_cv_decl_needed_$1 = yes; then
     114  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
     115            [Define if $1 is not declared in system header files.])
     116fi
     117])dnl
    86118
    87119# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
     
    135167EOF
    136168])
     169
     170# We always want a C version of alloca() compiled into libiberty,
     171# because native-compiler support for the real alloca is so !@#$%
     172# unreliable that GCC has decided to use it only when being compiled
     173# by GCC.  This is the part of AC_FUNC_ALLOCA that calculates the
     174# information alloca.c needs.
     175AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA,
     176[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
     177[AC_EGREP_CPP(webecray,
     178[#if defined(CRAY) && ! defined(CRAY2)
     179webecray
     180#else
     181wenotbecray
     182#endif
     183], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
     184if test $ac_cv_os_cray = yes; then
     185  for ac_func in _getb67 GETB67 getb67; do
     186    AC_CHECK_FUNC($ac_func,
     187      [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
     188  [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
     189   systems. This function is required for alloca.c support on those
     190   systems.])  break])
     191  done
     192fi
     193
     194AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
     195[AC_TRY_RUN([find_stack_direction ()
     196{
     197  static char *addr = 0;
     198  auto char dummy;
     199  if (addr == 0)
     200    {
     201      addr = &dummy;
     202      return find_stack_direction ();
     203    }
     204  else
     205    return (&dummy > addr) ? 1 : -1;
     206}
     207main ()
     208{
     209  exit (find_stack_direction() < 0);
     210}],
     211  ac_cv_c_stack_direction=1,
     212  ac_cv_c_stack_direction=-1,
     213  ac_cv_c_stack_direction=0)])
     214AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
     215  [Define if you know the direction of stack growth for your system;
     216   otherwise it will be automatically deduced at run-time.
     217        STACK_DIRECTION > 0 => grows toward higher addresses
     218        STACK_DIRECTION < 0 => grows toward lower addresses
     219        STACK_DIRECTION = 0 => direction of growth unknown])
     220])
  • branches/GNU/src/binutils/libiberty/alloca.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2222   your main control loop, etc. to force garbage collection.  */
    2323
     24/*
     25
     26@deftypefn Replacement void* alloca (size_t @var{size})
     27
     28This function allocates memory which will be automatically reclaimed
     29after the procedure exits.  The @libib{} implementation does not free
     30the memory immediately but will do so eventually during subsequent
     31calls to this function.  Memory is allocated using @code{xmalloc} under
     32normal circumstances.
     33
     34The header file @file{alloca-conf.h} can be used in conjunction with the
     35GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
     36available this function.  The @code{AC_FUNC_ALLOCA} test requires that
     37client code use a block of preprocessor code to be safe (see the Autoconf
     38manual for more); this header incorporates that logic and more, including
     39the possibility of a GCC built-in function.
     40
     41@end deftypefn
     42
     43*/
     44
    2445#ifdef HAVE_CONFIG_H
    2546#include <config.h>
    2647#endif
    2748
     49#include <libiberty.h>
     50
    2851#ifdef HAVE_STRING_H
    2952#include <string.h>
     
    3356#endif
    3457
    35 #ifdef emacs
    36 #include "blockinput.h"
    37 #endif
    38 
    39 /* If compiling with GCC 2, this file's not needed.  Except of course if
    40    the C alloca is explicitly requested.  */
    41 #if defined (USE_C_ALLOCA) || !defined (__GNUC__) || __GNUC__ < 2
    42 
    43 /* If someone has defined alloca as a macro,
    44    there must be some other way alloca is supposed to work.  */
    45 #ifndef alloca
    46 
    47 #ifdef emacs
    48 #ifdef static
    49 /* actually, only want this if static is defined as ""
    50    -- this is for usg, in which emacs must undefine static
    51    in order to make unexec workable
    52    */
    53 #ifndef STACK_DIRECTION
    54 you
    55 lose
    56 -- must know STACK_DIRECTION at compile-time
    57 #endif /* STACK_DIRECTION undefined */
    58 #endif /* static */
    59 #endif /* emacs */
     58/* These variables are used by the ASTRDUP implementation that relies
     59   on C_alloca.  */
     60const char *libiberty_optr;
     61char *libiberty_nptr;
     62unsigned long libiberty_len;
    6063
    6164/* If your stack is a linked list of frames, you have to
     
    6366
    6467#if defined (CRAY) && defined (CRAY_STACKSEG_END)
    65 long i00afunc ();
     68static long i00afunc ();
    6669#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
    6770#else
     
    6972#endif
    7073
    71 #if __STDC__
    72 typedef void *pointer;
    73 #else
    74 typedef char *pointer;
    75 #endif
    76 
    7774#ifndef NULL
    7875#define NULL    0
    7976#endif
    80 
    81 /* Different portions of Emacs need to call different versions of
    82    malloc.  The Emacs executable needs alloca to call xmalloc, because
    83    ordinary malloc isn't protected from input signals.  On the other
    84    hand, the utilities in lib-src need alloca to call malloc; some of
    85    them are very simple, and don't have an xmalloc routine.
    86 
    87    Non-Emacs programs expect this to call use xmalloc.
    88 
    89    Callers below should use malloc.  */
    90 
    91 #ifndef emacs
    92 #define malloc xmalloc
    93 #endif
    94 extern pointer malloc ();
    9577
    9678/* Define STACK_DIRECTION if you know the direction of stack
     
    169151   implementations of C, for example under Gould's UTX/32.  */
    170152
    171 pointer
    172 alloca (size)
    173      unsigned size;
     153/* @undocumented C_alloca */
     154
     155PTR
     156C_alloca (size)
     157     size_t size;
    174158{
    175159  auto char probe;              /* Probes stack depth: */
     
    186170  {
    187171    register header *hp;        /* Traverses linked list.  */
    188 
    189 #ifdef emacs
    190     BLOCK_INPUT;
    191 #endif
    192172
    193173    for (hp = last_alloca_header; hp != NULL;)
     
    197177          register header *np = hp->h.next;
    198178
    199           free ((pointer) hp);  /* Collect garbage.  */
     179          free ((PTR) hp);      /* Collect garbage.  */
    200180
    201181          hp = np;              /* -> next header.  */
     
    205185
    206186    last_alloca_header = hp;    /* -> last valid storage.  */
    207 
    208 #ifdef emacs
    209     UNBLOCK_INPUT;
    210 #endif
    211187  }
    212188
     
    217193
    218194  {
    219     register pointer new = malloc (sizeof (header) + size);
     195    register PTR new = xmalloc (sizeof (header) + size);
    220196    /* Address of header.  */
    221197
     
    230206    /* User storage begins just after header.  */
    231207
    232     return (pointer) ((char *) new + sizeof (header));
     208    return (PTR) ((char *) new + sizeof (header));
    233209  }
    234210}
     
    501477#endif /* not CRAY2 */
    502478#endif /* CRAY */
    503 
    504 #endif /* no alloca */
    505 #endif /* not GCC version 2 */
  • branches/GNU/src/binutils/libiberty/argv.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Create and destroy argument vectors (argv's)
    2    Copyright (C) 1992 Free Software Foundation, Inc.
     2   Copyright (C) 1992, 2001 Free Software Foundation, Inc.
    33   Written by Fred Fish @ Cygnus Support
    44
     
    3030/*  Routines imported from standard C runtime libraries. */
    3131
    32 #ifdef __STDC__
     32#ifdef ANSI_PROTOTYPES
    3333
    3434#include <stddef.h>
     
    3636#include <stdlib.h>
    3737
    38 #else   /* !__STDC__ */
     38#else   /* !ANSI_PROTOTYPES */
    3939
    4040#if !defined _WIN32 || defined __GNUC__
     
    4747#endif
    4848
    49 #endif  /* __STDC__ */
    50 
    51 #include "alloca-conf.h"
     49#endif  /* ANSI_PROTOTYPES */
     50
    5251
    5352#ifndef NULL
     
    6463/*
    6564
    66 NAME
    67 
    68         dupargv -- duplicate an argument vector
    69 
    70 SYNOPSIS
    71 
    72         char **dupargv (vector)
    73         char **vector;
    74 
    75 DESCRIPTION
    76 
    77         Duplicate an argument vector.  Simply scans through the
    78         vector, duplicating each argument until the
    79         terminating NULL is found.
    80 
    81 RETURNS
    82 
    83         Returns a pointer to the argument vector if
    84         successful. Returns NULL if there is insufficient memory to
    85         complete building the argument vector.
     65@deftypefn Extension char** dupargv (char **@var{vector})
     66
     67Duplicate an argument vector.  Simply scans through @var{vector},
     68duplicating each argument until the terminating @code{NULL} is found.
     69Returns a pointer to the argument vector if successful.  Returns
     70@code{NULL} if there is insufficient memory to complete building the
     71argument vector.
     72
     73@end deftypefn
    8674
    8775*/
     
    121109/*
    122110
    123 NAME
    124 
    125         freeargv -- free an argument vector
    126 
    127 SYNOPSIS
    128 
    129         void freeargv (vector)
    130         char **vector;
    131 
    132 DESCRIPTION
    133 
    134         Free an argument vector that was built using buildargv.  Simply scans
    135         through the vector, freeing the memory for each argument until the
    136         terminating NULL is found, and then frees the vector itself.
    137 
    138 RETURNS
    139 
    140         No value.
     111@deftypefn Extension void freeargv (char **@var{vector})
     112
     113Free an argument vector that was built using @code{buildargv}.  Simply
     114scans through @var{vector}, freeing the memory for each argument until
     115the terminating @code{NULL} is found, and then frees @var{vector}
     116itself.
     117
     118@end deftypefn
    141119
    142120*/
     
    159137/*
    160138
    161 NAME
    162 
    163         buildargv -- build an argument vector from a string
    164 
    165 SYNOPSIS
    166 
    167         char **buildargv (sp)
    168         char *sp;
    169 
    170 DESCRIPTION
    171 
    172         Given a pointer to a string, parse the string extracting fields
    173         separated by whitespace and optionally enclosed within either single
    174         or double quotes (which are stripped off), and build a vector of
    175         pointers to copies of the string for each field.  The input string
    176         remains unchanged.
    177 
    178         All of the memory for the pointer array and copies of the string
    179         is obtained from malloc.  All of the memory can be returned to the
    180         system with the single function call freeargv, which takes the
    181         returned result of buildargv, as it's argument.
    182 
    183         The memory for the argv array is dynamically expanded as necessary.
    184 
    185 RETURNS
    186 
    187         Returns a pointer to the argument vector if successful. Returns NULL
    188         if the input string pointer is NULL or if there is insufficient
    189         memory to complete building the argument vector.
    190 
    191 NOTES
    192 
    193         In order to provide a working buffer for extracting arguments into,
    194         with appropriate stripping of quotes and translation of backslash
    195         sequences, we allocate a working buffer at least as long as the input
    196         string.  This ensures that we always have enough space in which to
    197         work, since the extracted arg is never larger than the input string.
    198 
    199         If the input is a null string (as opposed to a NULL pointer), then
    200         buildarg returns an argv that has one arg, a null string.
    201 
    202         Argv is always kept terminated with a NULL arg pointer, so it can
    203         be passed to freeargv at any time, or returned, as appropriate.
     139@deftypefn Extension char** buildargv (char *@var{sp})
     140
     141Given a pointer to a string, parse the string extracting fields
     142separated by whitespace and optionally enclosed within either single
     143or double quotes (which are stripped off), and build a vector of
     144pointers to copies of the string for each field.  The input string
     145remains unchanged.  The last element of the vector is followed by a
     146@code{NULL} element.
     147
     148All of the memory for the pointer array and copies of the string
     149is obtained from @code{malloc}.  All of the memory can be returned to the
     150system with the single function call @code{freeargv}, which takes the
     151returned result of @code{buildargv}, as it's argument.
     152
     153Returns a pointer to the argument vector if successful.  Returns
     154@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
     155memory to complete building the argument vector.
     156
     157If the input is a null string (as opposed to a @code{NULL} pointer),
     158then buildarg returns an argument vector that has one arg, a null
     159string.
     160
     161@end deftypefn
     162
     163The memory for the argv array is dynamically expanded as necessary.
     164
     165In order to provide a working buffer for extracting arguments into,
     166with appropriate stripping of quotes and translation of backslash
     167sequences, we allocate a working buffer at least as long as the input
     168string.  This ensures that we always have enough space in which to
     169work, since the extracted arg is never larger than the input string.
     170
     171The argument vector is always kept terminated with a @code{NULL} arg
     172pointer, so it can be passed to @code{freeargv} at any time, or
     173returned, as appropriate.
     174
    204175*/
    205176
    206177char **buildargv (input)
    207 char *input;
     178     const char *input;
    208179{
    209180  char *arg;
     
    338309/* Simple little test driver. */
    339310
    340 static char *tests[] =
     311static const char *const tests[] =
    341312{
    342313  "a simple command line",
     
    355326};
    356327
    357 main ()
     328int main ()
    358329{
    359330  char **argv;
    360   char **test;
     331  const char *const *test;
    361332  char **targs;
    362333
     
    379350    }
    380351
     352  return 0;
    381353}
    382354
  • branches/GNU/src/binutils/libiberty/asprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2323#include "libiberty.h"
    2424
    25 #if defined (ANSI_PROTOTYPES) || defined (ALMOST_STDC)
    26 #define USE_STDARG
    27 #endif
    28 
    29 #ifdef USE_STDARG
     25#ifdef ANSI_PROTOTYPES
    3026#include <stdarg.h>
    3127#else
     
    3329#endif
    3430
    35 /* VARARGS */
    36 #ifdef USE_STDARG
     31/*
     32
     33@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
     34
     35Like @code{sprintf}, but instead of passing a pointer to a buffer, you
     36pass a pointer to a pointer.  This function will compute the size of
     37the buffer needed, allocate memory with @code{malloc}, and store a
     38pointer to the allocated memory in @code{*@var{resptr}}.  The value
     39returned is the same as @code{sprintf} would return.  If memory could
     40not be allocated, zero is returned and @code{NULL} is stored in
     41@code{*@var{resptr}}.
     42
     43@end deftypefn
     44
     45*/
     46
    3747int
    38 asprintf (char **buf, const char *fmt, ...)
    39 #else
    40 int
    41 asprintf (buf, fmt, va_alist)
    42      char **buf;
    43      const char *fmt;
    44      va_dcl
    45 #endif
     48asprintf VPARAMS ((char **buf, const char *fmt, ...))
    4649{
    4750  int status;
    48   va_list ap;
    49 #ifdef USE_STDARG
    50   va_start (ap, fmt);
    51 #else
    52   va_start (ap);
    53 #endif
     51  VA_OPEN (ap, fmt);
     52  VA_FIXEDARG (ap, char **, buf);
     53  VA_FIXEDARG (ap, const char *, fmt);
    5454  status = vasprintf (buf, fmt, ap);
    55   va_end (ap);
     55  VA_CLOSE (ap);
    5656  return status;
    5757}
  • branches/GNU/src/binutils/libiberty/atexit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */
    22/* This function is in the public domain.  --Mike Stump. */
     3
     4/*
     5
     6@deftypefn Supplemental int atexit (void (*@var{f})())
     7
     8Causes function @var{f} to be called at exit.  Returns 0.
     9
     10@end deftypefn
     11
     12*/
    313
    414#include "config.h"
  • branches/GNU/src/binutils/libiberty/basename.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         basename -- return pointer to last component of a pathname
    75
    8 SYNOPSIS
    9         char *basename (const char *name)
     6@deftypefn Supplemental char* basename (const char *@var{name})
    107
    11 DESCRIPTION
    12         Given a pointer to a string containing a typical pathname
    13         (/usr/src/cmd/ls/ls.c for example), returns a pointer to the
    14         last component of the pathname ("ls.c" in this case).
     8Returns a pointer to the last component of pathname @var{name}.
     9Behavior is undefined if the pathname ends in a directory separator.
    1510
    16 BUGS
    17         Presumes a UNIX or DOS/Windows style path with UNIX or DOS/Windows
    18         style separators.
     11@end deftypefn
     12
    1913*/
    2014
  • branches/GNU/src/binutils/libiberty/bcmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    44/*
    55
    6 NAME
     6@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
    77
    8         bcmp -- compare two memory regions
     8Compares the first @var{count} bytes of two areas of memory.  Returns
     9zero if they are the same, nonzero otherwise.  Returns zero if
     10@var{count} is zero.  A nonzero result only indicates a difference,
     11it does not indicate any sorting order (say, by having a positive
     12result mean @var{x} sorts before @var{y}).
    913
    10 SYNOPSIS
    11 
    12         int bcmp (char *from, char *to, int count)
    13 
    14 DESCRIPTION
    15 
    16         Compare two memory regions and return zero if they are identical,
    17         non-zero otherwise.  If count is zero, return zero.
    18 
    19 NOTES
    20 
    21         No guarantee is made about the non-zero returned value.  In
    22         particular, the results may be signficantly different than
    23         strcmp(), where the return value is guaranteed to be less than,
    24         equal to, or greater than zero, according to lexicographical
    25         sorting of the compared regions.
    26 
    27 BUGS
     14@end deftypefn
    2815
    2916*/
  • branches/GNU/src/binutils/libiberty/bcopy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* bcopy -- copy memory regions of arbitary length
    22
    3 NAME
    4         bcopy -- copy memory regions of arbitrary length
     3@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
    54
    6 SYNOPSIS
    7         void bcopy (char *in, char *out, int length)
     5Copies @var{length} bytes from memory region @var{in} to region
     6@var{out}.  The use of @code{bcopy} is deprecated in new programs.
    87
    9 DESCRIPTION
    10         Copy LENGTH bytes from memory region pointed to by IN to memory
    11         region pointed to by OUT.
    12 
    13 BUGS
    14         Significant speed improvements can be made in some cases by
    15         implementing copies of multiple bytes simultaneously, or unrolling
    16         the copy loop.
     8@end deftypefn
    179
    1810*/
  • branches/GNU/src/binutils/libiberty/bsearch.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2828 * SUCH DAMAGE.
    2929 */
     30
     31/*
     32
     33@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
     34
     35Performs a search over an array of @var{nmemb} elements pointed to by
     36@var{base} for a member that matches the object pointed to by @var{key}.
     37The size of each member is specified by @var{size}.  The array contents
     38should be sorted in ascending order according to the @var{compar}
     39comparison function.  This routine should take two arguments pointing to
     40the @var{key} and to an array member, in that order, and should return an
     41integer less than, equal to, or greater than zero if the @var{key} object
     42is respectively less than, matching, or greater than the array member.
     43
     44@end deftypefn
     45
     46*/
    3047
    3148#include "config.h"
  • branches/GNU/src/binutils/libiberty/bzero.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         bzero -- zero the contents of a specified memory region
    75
    8 SYNOPSIS
    9         void bzero (char *to, int count)
     6@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
    107
    11 DESCRIPTION
    12         Zero COUNT bytes of memory pointed to by TO.
     8Zeros @var{count} bytes starting at @var{mem}.  Use of this function
     9is deprecated in favor of @code{memset}.
    1310
    14 BUGS
    15         Significant speed enhancements may be made in some environments
    16         by zeroing more than a single byte at a time, or by unrolling the
    17         loop.
     11@end deftypefn
    1812
    1913*/
  • branches/GNU/src/binutils/libiberty/calloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* calloc -- allocate memory which has been initialized to zero.
    22   This function is in the public domain. */
     3
     4/*
     5
     6@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
     7
     8Uses @code{malloc} to allocate storage for @var{nelem} objects of
     9@var{elsize} bytes each, then zeros the memory.
     10
     11@end deftypefn
     12
     13*/
    314 
    415#include "ansidecl.h"
    5 #include "libiberty.h"
    6  
    716#ifdef ANSI_PROTOTYPES
    817#include <stddef.h>
     
    1322/* For systems with larger pointers than ints, this must be declared.  */
    1423PTR malloc PARAMS ((size_t));
     24void bzero PARAMS ((PTR, size_t));
    1525
    1626PTR
  • branches/GNU/src/binutils/libiberty/choose-temp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1818Boston, MA 02111-1307, USA.  */
    1919
    20 /* This file exports two functions: choose_temp_base and make_temp_file.  */
    21 
    2220#ifdef HAVE_CONFIG_H
    2321#include "config.h"
     
    2523
    2624#include <stdio.h>      /* May get P_tmpdir.  */
    27 #include <sys/types.h>
    28 #ifdef HAVE_UNISTD_H
    29 #include <unistd.h>
    30 #endif
    3125#ifdef HAVE_STDLIB_H
    3226#include <stdlib.h>
     
    3529#include <string.h>
    3630#endif
    37 #ifdef HAVE_SYS_FILE_H
    38 #include <sys/file.h>   /* May get R_OK, etc. on some systems.  */
    39 #endif
    40 
    41 #ifndef R_OK
    42 #define R_OK 4
    43 #define W_OK 2
    44 #define X_OK 1
    45 #endif
    4631
    4732#include "libiberty.h"
    48 extern int mkstemps ();
    49 
    50 #ifndef IN_GCC
    51 #if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
    52 #define DIR_SEPARATOR '\\'
    53 #endif
    54 #endif
    55 
    56 #ifndef DIR_SEPARATOR
    57 #define DIR_SEPARATOR '/'
    58 #endif
    59 
    60 /* On MSDOS, write temp files in current dir
    61    because there's no place else we can expect to use.  */
    62 /* ??? Although the current directory is tried as a last resort,
    63    this is left in so that on MSDOS it is preferred to /tmp on the
    64    off chance that someone requires this, since that was the previous
    65    behaviour.  */
    66 #ifdef __MSDOS__
    67 #ifndef P_tmpdir
    68 #define P_tmpdir "."
    69 #endif
    70 #endif
     33extern char *choose_tmpdir PARAMS ((void));
    7134
    7235/* Name of temporary file.
    7336   mktemp requires 6 trailing X's.  */
    7437#define TEMP_FILE "ccXXXXXX"
     38#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
    7539
    76 /* Subroutine of choose_temp_base.
    77    If BASE is non-NULL, return it.
    78    Otherwise it checks if DIR is a usable directory.
    79    If success, DIR is returned.
    80    Otherwise NULL is returned.  */
     40/*
    8141
    82 static const char *try PARAMS ((const char *, const char *));
     42@deftypefn Extension char* choose_temp_base (void)
    8343
    84 static const char *
    85 try (dir, base)
    86      const char *dir, *base;
    87 {
    88   if (base != 0)
    89     return base;
    90   if (dir != 0
    91       && access (dir, R_OK | W_OK | X_OK) == 0)
    92     return dir;
    93   return 0;
    94 }
     44Return a prefix for temporary file names or @code{NULL} if unable to
     45find one.  The current directory is chosen if all else fails so the
     46program is exited if a temporary directory can't be found (@code{mktemp}
     47fails).  The buffer for the result is obtained with @code{xmalloc}.
    9548
    96 /* Return a prefix for temporary file names or NULL if unable to find one.
    97    The current directory is chosen if all else fails so the program is
    98    exited if a temporary directory can't be found (mktemp fails).
    99    The buffer for the result is obtained with xmalloc.
     49This function is provided for backwards compatability only.  Its use is
     50not recommended.
    10051
    101    This function is provided for backwards compatability only.  It use
    102    is not recommended.  */
     52@end deftypefn
     53
     54*/
    10355
    10456char *
    10557choose_temp_base ()
    10658{
    107   const char *base = 0;
     59  const char *base = choose_tmpdir ();
    10860  char *temp_filename;
    10961  int len;
    110   static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
    111   static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
    112 
    113   base = try (getenv ("TMPDIR"), base);
    114   base = try (getenv ("TMP"), base);
    115   base = try (getenv ("TEMP"), base);
    116 
    117 #ifdef P_tmpdir
    118   base = try (P_tmpdir, base);
    119 #endif
    120 
    121   /* Try /usr/tmp, then /tmp.  */
    122   base = try (usrtmp, base);
    123   base = try (tmp, base);
    124  
    125   /* If all else fails, use the current directory!  */
    126   if (base == 0)
    127     base = ".";
    12862
    12963  len = strlen (base);
    130   temp_filename = xmalloc (len + 1 /*DIR_SEPARATOR*/
    131                            + strlen (TEMP_FILE) + 1);
     64  temp_filename = xmalloc (len + TEMP_FILE_LEN + 1);
    13265  strcpy (temp_filename, base);
    133 
    134   if (len != 0
    135       && temp_filename[len-1] != '/'
    136       && temp_filename[len-1] != DIR_SEPARATOR)
    137     temp_filename[len++] = DIR_SEPARATOR;
    13866  strcpy (temp_filename + len, TEMP_FILE);
    13967
     
    14371  return temp_filename;
    14472}
    145 /* Return a temporary file name (as a string) or NULL if unable to create
    146    one.  */
    147 
    148 char *
    149 make_temp_file (suffix)
    150      const char *suffix;
    151 {
    152   const char *base = 0;
    153   char *temp_filename;
    154   int base_len, suffix_len;
    155   int fd;
    156   static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
    157   static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
    158 
    159   base = try (getenv ("TMPDIR"), base);
    160   base = try (getenv ("TMP"), base);
    161   base = try (getenv ("TEMP"), base);
    162 
    163 #ifdef P_tmpdir
    164   base = try (P_tmpdir, base);
    165 #endif
    166 
    167   /* Try /usr/tmp, then /tmp.  */
    168   base = try (usrtmp, base);
    169   base = try (tmp, base);
    170  
    171   /* If all else fails, use the current directory!  */
    172   if (base == 0)
    173     base = ".";
    174 
    175   base_len = strlen (base);
    176 
    177   if (suffix)
    178     suffix_len = strlen (suffix);
    179   else
    180     suffix_len = 0;
    181 
    182   temp_filename = xmalloc (base_len + 1 /*DIR_SEPARATOR*/
    183                            + strlen (TEMP_FILE)
    184                            + suffix_len + 1);
    185   strcpy (temp_filename, base);
    186 
    187   if (base_len != 0
    188       && temp_filename[base_len-1] != '/'
    189       && temp_filename[base_len-1] != DIR_SEPARATOR)
    190     temp_filename[base_len++] = DIR_SEPARATOR;
    191   strcpy (temp_filename + base_len, TEMP_FILE);
    192 
    193   if (suffix)
    194     strcat (temp_filename, suffix);
    195 
    196   fd = mkstemps (temp_filename, suffix_len);
    197   /* If mkstemps failed, then something bad is happening.  Maybe we should
    198      issue a message about a possible security attack in progress?  */
    199   if (fd == -1)
    200     abort ();
    201   /* Similarly if we can not close the file.  */
    202   if (close (fd))
    203     abort ();
    204   return temp_filename;
    205 }
  • branches/GNU/src/binutils/libiberty/clock.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2222This exception does not however invalidate any other reasons why
    2323the executable file might be covered by the GNU General Public License. */
     24
     25/*
     26
     27@deftypefn Supplemental long clock (void)
     28
     29Returns an approximation of the CPU time used by the process as a
     30@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
     31number of seconds used.
     32
     33@end deftypefn
     34
     35*/
    2436
    2537#include "config.h"
  • branches/GNU/src/binutils/libiberty/concat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Concatenate variable number of strings.
    2    Copyright (C) 1991, 1994 Free Software Foundation, Inc.
     2   Copyright (C) 1991, 1994, 2001 Free Software Foundation, Inc.
    33   Written by Fred Fish @ Cygnus Support
    44
     
    2222/*
    2323
    24 NAME
    25 
    26         concat -- concatenate a variable number of strings
    27 
    28 SYNOPSIS
    29 
    30         #include <varargs.h>
    31 
    32         char *concat (s1, s2, s3, ..., NULL)
    33 
    34 DESCRIPTION
    35 
    36         Concatenate a variable number of strings and return the result
    37         in freshly malloc'd memory.
    38 
    39         Returns NULL if insufficient memory is available.  The argument
    40         list is terminated by the first NULL pointer encountered.  Pointers
    41         to empty strings are ignored.
     24@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
     25
     26Concatenate zero or more of strings and return the result in freshly
     27@code{xmalloc}ed memory.  Returns @code{NULL} if insufficient memory is
     28available.  The argument list is terminated by the first @code{NULL}
     29pointer encountered.  Pointers to empty strings are ignored.
     30
     31@end deftypefn
    4232
    4333NOTES
     
    5141        that just directly invokes malloc and blindly returns whatever
    5242        malloc returns.
     43
    5344*/
    5445
    5546
     47#ifdef HAVE_CONFIG_H
     48#include "config.h"
     49#endif
    5650#include "ansidecl.h"
    5751#include "libiberty.h"
     52#include <sys/types.h>          /* size_t */
    5853
    5954#ifdef ANSI_PROTOTYPES
     
    6358#endif
    6459
    65 #ifdef __STDC__
    66 #include <stddef.h>
    67 extern size_t strlen (const char *s);
    68 #else
    69 extern int strlen ();
    70 #endif
    71 
     60# if HAVE_STRING_H
     61#  include <string.h>
     62# else
     63#  if HAVE_STRINGS_H
     64#   include <strings.h>
     65#  endif
     66# endif
     67
     68#if HAVE_STDLIB_H
     69#include <stdlib.h>
     70#endif
     71
     72static inline unsigned long vconcat_length PARAMS ((const char *, va_list));
     73static inline unsigned long
     74vconcat_length (first, args)
     75     const char *first;
     76     va_list args;
     77{
     78  unsigned long length = 0;
     79  const char *arg;
     80
     81  for (arg = first; arg ; arg = va_arg (args, const char *))
     82    length += strlen (arg);
     83
     84  return length;
     85}
     86
     87static inline char *vconcat_copy PARAMS ((char *, const char *, va_list));
     88static inline char *
     89vconcat_copy (dst, first, args)
     90     char *dst;
     91     const char *first;
     92     va_list args;
     93{
     94  char *end = dst;
     95  const char *arg;
     96
     97  for (arg = first; arg ; arg = va_arg (args, const char *))
     98    {
     99      unsigned long length = strlen (arg);
     100      memcpy (end, arg, length);
     101      end += length;
     102    }
     103  *end = '\000';
     104
     105  return dst;
     106}
     107
     108/* @undocumented concat_length */
     109
     110unsigned long
     111concat_length VPARAMS ((const char *first, ...))
     112{
     113  unsigned long length;
     114
     115  VA_OPEN (args, first);
     116  VA_FIXEDARG (args, const char *, first);
     117  length = vconcat_length (first, args);
     118  VA_CLOSE (args);
     119
     120  return length;
     121}
     122
     123/* @undocumented concat_copy */
     124
     125char *
     126concat_copy VPARAMS ((char *dst, const char *first, ...))
     127{
     128  char *save_dst;
     129
     130  VA_OPEN (args, first);
     131  VA_FIXEDARG (args, char *, dst);
     132  VA_FIXEDARG (args, const char *, first);
     133  vconcat_copy (dst, first, args);
     134  save_dst = dst; /* With K&R C, dst goes out of scope here.  */
     135  VA_CLOSE (args);
     136
     137  return save_dst;
     138}
     139
     140char *libiberty_concat_ptr;
     141
     142/* @undocumented concat_copy2 */
     143
     144char *
     145concat_copy2 VPARAMS ((const char *first, ...))
     146{
     147  VA_OPEN (args, first);
     148  VA_FIXEDARG (args, const char *, first);
     149  vconcat_copy (libiberty_concat_ptr, first, args);
     150  VA_CLOSE (args);
     151
     152  return libiberty_concat_ptr;
     153}
     154
     155char *
     156concat VPARAMS ((const char *first, ...))
     157{
     158  char *newstr;
     159
     160  /* First compute the size of the result and get sufficient memory.  */
     161  VA_OPEN (args, first);
     162  VA_FIXEDARG (args, const char *, first);
     163  newstr = (char *) xmalloc (vconcat_length (first, args) + 1);
     164  VA_CLOSE (args);
     165
     166  /* Now copy the individual pieces to the result string. */
     167  VA_OPEN (args, first);
     168  VA_FIXEDARG (args, const char *, first);
     169  vconcat_copy (newstr, first, args);
     170  VA_CLOSE (args);
     171
     172  return newstr;
     173}
     174
     175/*
     176
     177@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
     178
     179Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
     180is freed after the string is created.  This is intended to be useful
     181when you're extending an existing string or building up a string in a
     182loop:
     183
     184@example
     185  str = reconcat (str, "pre-", str, NULL);
     186@end example
     187
     188@end deftypefn
     189
     190*/
     191
     192char *
     193reconcat VPARAMS ((char *optr, const char *first, ...))
     194{
     195  char *newstr;
     196
     197  /* First compute the size of the result and get sufficient memory.  */
     198  VA_OPEN (args, first);
     199  VA_FIXEDARG (args, char *, optr);
     200  VA_FIXEDARG (args, const char *, first);
     201  newstr = (char *) xmalloc (vconcat_length (first, args) + 1);
     202  VA_CLOSE (args);
     203
     204  /* Now copy the individual pieces to the result string. */
     205  VA_OPEN (args, first);
     206  VA_FIXEDARG (args, char *, optr);
     207  VA_FIXEDARG (args, const char *, first);
     208  vconcat_copy (newstr, first, args);
     209  if (optr) /* Done before VA_CLOSE so optr stays in scope for K&R C.  */
     210    free (optr);
     211  VA_CLOSE (args);
     212
     213  return newstr;
     214}
     215
     216#ifdef MAIN
    72217#define NULLP (char *)0
    73 
    74 /* VARARGS */
    75 #ifdef ANSI_PROTOTYPES
    76 char *
    77 concat (const char *first, ...)
    78 #else
    79 char *
    80 concat (va_alist)
    81      va_dcl
    82 #endif
    83 {
    84   register int length;
    85   register char *newstr;
    86   register char *end;
    87   register const char *arg;
    88   va_list args;
    89 #ifndef ANSI_PROTOTYPES
    90   const char *first;
    91 #endif
    92 
    93   /* First compute the size of the result and get sufficient memory. */
    94 
    95 #ifdef ANSI_PROTOTYPES
    96   va_start (args, first);
    97 #else
    98   va_start (args);
    99   first = va_arg (args, const char *);
    100 #endif
    101 
    102   if (first == NULLP)
    103     length = 0;
    104   else
    105     {
    106       length = strlen (first);
    107       while ((arg = va_arg (args, const char *)) != NULLP)
    108         {
    109           length += strlen (arg);
    110         }
    111     }
    112   newstr = (char *) xmalloc (length + 1);
    113   va_end (args);
    114 
    115   /* Now copy the individual pieces to the result string. */
    116 
    117   if (newstr != NULLP)
    118     {
    119 #ifdef ANSI_PROTOTYPES
    120       va_start (args, first);
    121 #else
    122       va_start (args);
    123       first = va_arg (args, const char *);
    124 #endif
    125       end = newstr;
    126       if (first != NULLP)
    127         {
    128           arg = first;
    129           while (*arg)
    130             {
    131               *end++ = *arg++;
    132             }
    133           while ((arg = va_arg (args, const char *)) != NULLP)
    134             {
    135               while (*arg)
    136                 {
    137                   *end++ = *arg++;
    138                 }
    139             }
    140         }
    141       *end = '\000';
    142       va_end (args);
    143     }
    144 
    145   return (newstr);
    146 }
    147 
    148 #ifdef MAIN
    149218
    150219/* Simple little test driver. */
  • branches/GNU/src/binutils/libiberty/config.in

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* config.in.  Generated automatically from configure.in by autoheader.  */
    2 
    3 /* Define if using alloca.c.  */
    4 #undef C_ALLOCA
    52
    63/* Define to empty if the keyword does not work.  */
    74#undef const
    85
    9 /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
    10    This function is required for alloca.c support on those systems.  */
    11 #undef CRAY_STACKSEG_END
    12 
    13 /* Define if you have alloca, as a function or macro.  */
    14 #undef HAVE_ALLOCA
    15 
    16 /* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
    17 #undef HAVE_ALLOCA_H
    18 
    196/* Define if you have a working `mmap' system call.  */
    207#undef HAVE_MMAP
     
    2916#undef inline
    3017
     18/* Define if your C compiler doesn't accept -c and -o together.  */
     19#undef NO_MINUS_C_MINUS_O
     20
    3121/* Define to `int' if <sys/types.h> doesn't define.  */
    3222#undef pid_t
     
    3525#undef _POSIX_SOURCE
    3626
    37 /* If using the C implementation of alloca, define if you know the
    38    direction of stack growth for your system; otherwise it will be
    39    automatically deduced at run-time.
    40  STACK_DIRECTION > 0 => grows toward higher addresses
    41  STACK_DIRECTION < 0 => grows toward lower addresses
    42  STACK_DIRECTION = 0 => direction of growth unknown
    43  */
    44 #undef STACK_DIRECTION
    45 
    4627/* Define if you have the ANSI C header files.  */
    4728#undef STDC_HEADERS
     
    5334#undef vfork
    5435
     36/* Define to `unsigned long' if <sys/types.h> doesn't define.  */
     37#undef uintptr_t
     38
     39/* Define if you have the _doprnt function.  */
     40#undef HAVE__DOPRNT
     41
    5542/* Define if you have the asprintf function.  */
    5643#undef HAVE_ASPRINTF
     
    7764#undef HAVE_CALLOC
    7865
     66/* Define if you have the canonicalize_file_name function.  */
     67#undef HAVE_CANONICALIZE_FILE_NAME
     68
    7969/* Define if you have the clock function.  */
    8070#undef HAVE_CLOCK
    8171
     72/* Define if you have the ffs function.  */
     73#undef HAVE_FFS
     74
    8275/* Define if you have the getcwd function.  */
    8376#undef HAVE_GETCWD
     
    8982#undef HAVE_GETRUSAGE
    9083
     84/* Define if you have the getsysinfo function.  */
     85#undef HAVE_GETSYSINFO
     86
    9187/* Define if you have the gettimeofday function.  */
    9288#undef HAVE_GETTIMEOFDAY
     
    110106#undef HAVE_MEMMOVE
    111107
     108/* Define if you have the mempcpy function.  */
     109#undef HAVE_MEMPCPY
     110
    112111/* Define if you have the memset function.  */
    113112#undef HAVE_MEMSET
     
    122121#undef HAVE_PSIGNAL
    123122
     123/* Define if you have the pstat_getdynamic function.  */
     124#undef HAVE_PSTAT_GETDYNAMIC
     125
     126/* Define if you have the pstat_getstatic function.  */
     127#undef HAVE_PSTAT_GETSTATIC
     128
    124129/* Define if you have the putenv function.  */
    125130#undef HAVE_PUTENV
     
    128133#undef HAVE_RANDOM
    129134
     135/* Define if you have the realpath function.  */
     136#undef HAVE_REALPATH
     137
    130138/* Define if you have the rename function.  */
    131139#undef HAVE_RENAME
     
    143151#undef HAVE_SIGSETMASK
    144152
     153/* Define if you have the snprintf function.  */
     154#undef HAVE_SNPRINTF
     155
     156/* Define if you have the stpcpy function.  */
     157#undef HAVE_STPCPY
     158
     159/* Define if you have the stpncpy function.  */
     160#undef HAVE_STPNCPY
     161
    145162/* Define if you have the strcasecmp function.  */
    146163#undef HAVE_STRCASECMP
     
    179196#undef HAVE_SYSCONF
    180197
     198/* Define if you have the sysctl function.  */
     199#undef HAVE_SYSCTL
     200
     201/* Define if you have the sysmp function.  */
     202#undef HAVE_SYSMP
     203
     204/* Define if you have the table function.  */
     205#undef HAVE_TABLE
     206
    181207/* Define if you have the times function.  */
    182208#undef HAVE_TIMES
     
    194220#undef HAVE_VPRINTF
    195221
     222/* Define if you have the vsnprintf function.  */
     223#undef HAVE_VSNPRINTF
     224
    196225/* Define if you have the vsprintf function.  */
    197226#undef HAVE_VSPRINTF
     
    200229#undef HAVE_WAITPID
    201230
     231/* Define if you have the <alloca.h> header file.  */
     232#undef HAVE_ALLOCA_H
     233
    202234/* Define if you have the <fcntl.h> header file.  */
    203235#undef HAVE_FCNTL_H
     
    206238#undef HAVE_LIMITS_H
    207239
     240/* Define if you have the <machine/hal_sysinfo.h> header file.  */
     241#undef HAVE_MACHINE_HAL_SYSINFO_H
     242
    208243/* Define if you have the <stdlib.h> header file.  */
    209244#undef HAVE_STDLIB_H
     
    224259#undef HAVE_SYS_PARAM_H
    225260
     261/* Define if you have the <sys/pstat.h> header file.  */
     262#undef HAVE_SYS_PSTAT_H
     263
    226264/* Define if you have the <sys/resource.h> header file.  */
    227265#undef HAVE_SYS_RESOURCE_H
     
    230268#undef HAVE_SYS_STAT_H
    231269
     270/* Define if you have the <sys/sysctl.h> header file.  */
     271#undef HAVE_SYS_SYSCTL_H
     272
     273/* Define if you have the <sys/sysinfo.h> header file.  */
     274#undef HAVE_SYS_SYSINFO_H
     275
     276/* Define if you have the <sys/sysmp.h> header file.  */
     277#undef HAVE_SYS_SYSMP_H
     278
     279/* Define if you have the <sys/systemcfg.h> header file.  */
     280#undef HAVE_SYS_SYSTEMCFG_H
     281
     282/* Define if you have the <sys/table.h> header file.  */
     283#undef HAVE_SYS_TABLE_H
     284
    232285/* Define if you have the <sys/time.h> header file.  */
    233286#undef HAVE_SYS_TIME_H
     
    242295#undef NEED_DECLARATION_ERRNO
    243296
     297/* Define if you have the `uintptr_t' type. */
     298#undef HAVE_UINTPTR_T
     299
    244300/* Define if you have the sys_errlist variable. */
    245301#undef HAVE_SYS_ERRLIST
     
    251307#undef HAVE_SYS_SIGLIST
    252308
     309/* Define if you have the _system_configuration variable. */
     310#undef HAVE__SYSTEM_CONFIGURATION
     311
     312/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP
     313   systems. This function is required for alloca.c support on those
     314   systems. */
     315#undef CRAY_STACKSEG_END
     316
     317/* Define if you know the direction of stack growth for your system;
     318   otherwise it will be automatically deduced at run-time.
     319        STACK_DIRECTION > 0 => grows toward higher addresses
     320        STACK_DIRECTION < 0 => grows toward lower addresses
     321        STACK_DIRECTION = 0 => direction of growth unknown */
     322#undef STACK_DIRECTION
     323
     324/* Define if canonicalize_file_name is not declared in system header files. */
     325#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME
     326
  • branches/GNU/src/binutils/libiberty/config.table

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     1# Don't build the shared library for build.
     2if [ -n "${with_build_subdir}" ]; then
     3  enable_shared=no
     4fi
     5
     6frag=
    17case "${host}" in
    28  rs6000-ibm-aix3.1 | rs6000-ibm-aix)
     
    713  i370-*-opened*)       frag=mh-openedition ;;
    814  i[345]86-*-windows*)  frag=mh-windows ;;
    9   *-*-beos*)            frag=mh-beos ;;
    1015esac
    1116
    12 frags=$frag
     17if [ -n "${frag}" ]; then
     18  frags=${libiberty_topdir}/libiberty/config/$frag
     19else
     20  frags=
     21fi
    1322
    1423# If they didn't specify --enable-shared, don't generate shared libs.
     
    2029esac
    2130if [ "${shared}" = "yes" ]; then
     31  frag=
    2232  case "${host}" in
    2333    *-*-cygwin*)        ;;
    24     alpha*-*-linux*)    frags="${frags} ../../config/mh-elfalphapic" ;;
    25     arm*-*-*)           frags="${frags} ../../config/mh-armpic" ;;
    26     hppa*-*-*)          frags="${frags} ../../config/mh-papic" ;;
    27     i[3456]86-*-*)      frags="${frags} ../../config/mh-x86pic" ;;
     34    alpha*-*-linux*)    frag=mh-elfalphapic ;;
     35    arm*-*-*)           frag=mh-armpic ;;
     36    hppa*-*-*)          frag=mh-papic ;;
     37    i[3456]86-*-* | x86_64-*-*)
     38                        frag=mh-x86pic ;;
    2839    powerpc*-*-aix*)    ;;
    29     powerpc*-*-*)       frags="${frags} ../../config/mh-ppcpic" ;;
    30     sparc*-*-*)         frags="${frags} ../../config/mh-sparcpic" ;;
    31     *-*-*)              frags="${frags} ../../config/mh-${host_cpu}pic" ;;
     40    powerpc*-*-*)       frag=mh-ppcpic ;;
     41    sparc*-*-*)         frag=mh-sparcpic ;;
     42    s390*-*-*)          frag=mh-s390pic ;;
     43    *)                  frag=mh-${host_cpu}pic ;;
    3244  esac
     45  if [ -n "${frag}" ]; then
     46    frags="${frags} ${libiberty_topdir}/config/${frag}"
     47  fi
    3348fi
    3449
     
    3651
    3752for frag in ${frags}; do
    38   case ${frag} in
    39     ../* )
    40       if [ ${srcdir} = . ]; then
    41         [ -n "${with_target_subdir}" ] && frag=../${frag}
    42         [ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag}
    43       fi
    44       ;;
    45   esac
    46   frag=${srcdir}/${xsrcdir}config/$frag
    4753  if [ -f ${frag} ]; then
    4854    echo "Appending ${frag} to xhost-mkfrag"
  • branches/GNU/src/binutils/libiberty/configure

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1313# Any additions from configure.in:
    1414ac_help="$ac_help
    15   --with-target-subdir=SUBDIR      Configuring in a subdirectory"
     15  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target"
     16ac_help="$ac_help
     17  --with-build-subdir=SUBDIR       Configuring in a subdirectory for build"
    1618ac_help="$ac_help
    1719  --with-cross-host=HOST           Configuring with a cross compiler"
    1820ac_help="$ac_help
    1921  --with-newlib                    Configuring with newlib"
     22ac_help="$ac_help
     23  --enable-maintainer-mode
     24                          enable make rules and dependencies not useful
     25                          (and sometimes confusing) to the casual installer"
     26ac_help="$ac_help
     27  --enable-install-libiberty       Install headers for end users"
    2028
    2129# Initialize some variables set by options.
     
    458466# A filename unique to this package, relative to the directory that
    459467# configure is in, which we can look for to find out if srcdir is correct.
    460 ac_unique_file=pexecute.c
     468ac_unique_file=xmalloc.c
    461469
    462470# Find the source files, if location was not specified.
     
    529537
    530538
     539# This works around the fact that libtool configuration may change LD
     540# for this particular configuration, but some shells, instead of
     541# keeping the changes in LD private, export them just because LD is
     542# exported.  We don't use libtool yet, but some day we might, so...
     543ORIGINAL_LD_FOR_MULTILIBS=$LD
     544
    531545# Check whether --with-target-subdir or --without-target-subdir was given.
    532546if test "${with_target_subdir+set}" = set; then
     
    535549fi
    536550
     551# Check whether --with-build-subdir or --without-build-subdir was given.
     552if test "${with_build_subdir+set}" = set; then
     553  withval="$with_build_subdir"
     554  :
     555fi
     556
    537557# Check whether --with-cross-host or --without-cross-host was given.
    538558if test "${with_cross_host+set}" = set; then
     
    549569
    550570if test "${srcdir}" = "."; then
    551   if test -z "${with_target_subdir}"; then
     571  if test -n "${with_build_subdir}"; then
     572    libiberty_topdir="${srcdir}/../.."
     573    with_target_subdir=
     574  elif test -z "${with_target_subdir}"; then
    552575    libiberty_topdir="${srcdir}/.."
    553576  else
     
    561584  libiberty_topdir="${srcdir}/.."
    562585fi
     586
    563587ac_aux_dir=
    564588for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do
     
    582606
    583607
     608echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
     609echo "configure:610: checking whether to enable maintainer-specific portions of Makefiles" >&5
     610    # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
     611if test "${enable_maintainer_mode+set}" = set; then
     612  enableval="$enable_maintainer_mode"
     613  maintainer_mode=$enableval
     614else
     615  maintainer_mode=no
     616fi
     617
     618
     619echo "$ac_t""$maintainer_mode" 1>&6
     620
     621if test "$maintainer_mode" = "yes"; then
     622  MAINT=''
     623  NOTMAINT='#'
     624else
     625  MAINT='#'
     626  NOTMAINT=''
     627fi
     628
     629# Do we have a single-tree copy of texinfo?  Even if we do, we can't
     630# rely on it - libiberty is built before texinfo.
     631# Extract the first word of "makeinfo", so it can be a program name with args.
     632set dummy makeinfo; ac_word=$2
     633echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
     634echo "configure:635: checking for $ac_word" >&5
     635if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
     636  echo $ac_n "(cached) $ac_c" 1>&6
     637else
     638  if test -n "$MAKEINFO"; then
     639  ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
     640else
     641  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
     642  ac_dummy="$PATH"
     643  for ac_dir in $ac_dummy; do
     644    test -z "$ac_dir" && ac_dir=.
     645    if test -f $ac_dir/$ac_word; then
     646      ac_cv_prog_MAKEINFO="makeinfo"
     647      break
     648    fi
     649  done
     650  IFS="$ac_save_ifs"
     651fi
     652fi
     653MAKEINFO="$ac_cv_prog_MAKEINFO"
     654if test -n "$MAKEINFO"; then
     655  echo "$ac_t""$MAKEINFO" 1>&6
     656else
     657  echo "$ac_t""no" 1>&6
     658fi
     659
     660if test "x$MAKEINFO" = "x"; then
     661    MAKEINFO="@echo makeinfo missing; true"
     662    BUILD_INFO=
     663else
     664    BUILD_INFO=info
     665    case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
     666      x*\ [1-3].* )
     667        MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
     668        BUILD_INFO=
     669        echo "configure: warning:
     670*** Makeinfo is too old. Info documentation will not be built." 1>&2
     671        ;;
     672    esac
     673fi
     674
     675
     676
     677# Extract the first word of "perl", so it can be a program name with args.
     678set dummy perl; ac_word=$2
     679echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
     680echo "configure:681: checking for $ac_word" >&5
     681if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
     682  echo $ac_n "(cached) $ac_c" 1>&6
     683else
     684  if test -n "$PERL"; then
     685  ac_cv_prog_PERL="$PERL" # Let the user override the test.
     686else
     687  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
     688  ac_dummy="$PATH"
     689  for ac_dir in $ac_dummy; do
     690    test -z "$ac_dir" && ac_dir=.
     691    if test -f $ac_dir/$ac_word; then
     692      ac_cv_prog_PERL="perl"
     693      break
     694    fi
     695  done
     696  IFS="$ac_save_ifs"
     697fi
     698fi
     699PERL="$ac_cv_prog_PERL"
     700if test -n "$PERL"; then
     701  echo "$ac_t""$PERL" 1>&6
     702else
     703  echo "$ac_t""no" 1>&6
     704fi
     705
     706if test x"$PERL" = x""; then
     707  HAVE_PERL='#'
     708else
     709  HAVE_PERL=''
     710fi
     711
     712
     713
    584714# Make sure we can run config.sub.
    585715if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
     
    588718
    589719echo $ac_n "checking host system type""... $ac_c" 1>&6
    590 echo "configure:591: checking host system type" >&5
     720echo "configure:721: checking host system type" >&5
    591721
    592722host_alias=$host
     
    611741
    612742echo $ac_n "checking build system type""... $ac_c" 1>&6
    613 echo "configure:614: checking build system type" >&5
     743echo "configure:744: checking build system type" >&5
    614744
    615745build_alias=$build
     
    637767set dummy ${ac_tool_prefix}ar; ac_word=$2
    638768echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
    639 echo "configure:640: checking for $ac_word" >&5
     769echo "configure:770: checking for $ac_word" >&5
    640770if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
    641771  echo $ac_n "(cached) $ac_c" 1>&6
     
    669799set dummy ${ac_tool_prefix}ranlib; ac_word=$2
    670800echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
    671 echo "configure:672: checking for $ac_word" >&5
     801echo "configure:802: checking for $ac_word" >&5
    672802if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
    673803  echo $ac_n "(cached) $ac_c" 1>&6
     
    701831set dummy ranlib; ac_word=$2
    702832echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
    703 echo "configure:704: checking for $ac_word" >&5
     833echo "configure:834: checking for $ac_word" >&5
    704834if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
    705835  echo $ac_n "(cached) $ac_c" 1>&6
     
    738868set dummy gcc; ac_word=$2
    739869echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
    740 echo "configure:741: checking for $ac_word" >&5
     870echo "configure:871: checking for $ac_word" >&5
    741871if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
    742872  echo $ac_n "(cached) $ac_c" 1>&6
     
    768898set dummy cc; ac_word=$2
    769899echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
    770 echo "configure:771: checking for $ac_word" >&5
     900echo "configure:901: checking for $ac_word" >&5
    771901if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
    772902  echo $ac_n "(cached) $ac_c" 1>&6
     
    817947
    818948echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
    819 echo "configure:820: checking whether we are using GNU C" >&5
     949echo "configure:950: checking whether we are using GNU C" >&5
    820950if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
    821951  echo $ac_n "(cached) $ac_c" 1>&6
     
    826956#endif
    827957EOF
    828 if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
     958if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
    829959  ac_cv_prog_gcc=yes
    830960else
     
    842972  CFLAGS=
    843973  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
    844 echo "configure:845: checking whether ${CC-cc} accepts -g" >&5
     974echo "configure:975: checking whether ${CC-cc} accepts -g" >&5
    845975if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
    846976  echo $ac_n "(cached) $ac_c" 1>&6
     
    8721002
    8731003
     1004if test "x$CC" != xcc; then
     1005  echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6
     1006echo "configure:1007: checking whether $CC and cc understand -c and -o together" >&5
     1007else
     1008  echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6
     1009echo "configure:1010: checking whether cc understands -c and -o together" >&5
     1010fi
     1011set dummy $CC; ac_cc="`echo $2 |
     1012                       sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
     1013if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then
     1014  echo $ac_n "(cached) $ac_c" 1>&6
     1015else
     1016  echo 'foo(){}' > conftest.c
     1017# Make sure it works both with $CC and with simple cc.
     1018# We do the test twice because some compilers refuse to overwrite an
     1019# existing .o file with -o, though they will create one.
     1020ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5'
     1021if { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
     1022   test -f conftest.o && { (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
     1023then
     1024  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
     1025  if test "x$CC" != xcc; then
     1026    # Test first that cc exists at all.
     1027    if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     1028      ac_try='cc -c conftest.c -o conftest.o 1>&5'
     1029      if { (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
     1030         test -f conftest.o && { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
     1031      then
     1032        # cc works too.
     1033        :
     1034      else
     1035        # cc exists but doesn't like -o.
     1036        eval ac_cv_prog_cc_${ac_cc}_c_o=no
     1037      fi
     1038    fi
     1039  fi
     1040else
     1041  eval ac_cv_prog_cc_${ac_cc}_c_o=no
     1042fi
     1043rm -f conftest*
     1044
     1045fi
     1046if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
     1047  echo "$ac_t""yes" 1>&6
     1048else
     1049  echo "$ac_t""no" 1>&6
     1050  cat >> confdefs.h <<\EOF
     1051#define NO_MINUS_C_MINUS_O 1
     1052EOF
     1053
     1054fi
     1055
     1056# autoconf is lame and doesn't give us any substitution variable for this.
     1057if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
     1058  NO_MINUS_C_MINUS_O=yes
     1059else
     1060  OUTPUT_OPTION='-o $@'
     1061fi
     1062
     1063
     1064
    8741065echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
    875 echo "configure:876: checking for POSIXized ISC" >&5
     1066echo "configure:1067: checking for POSIXized ISC" >&5
    8761067if test -d /etc/conf/kconfig.d &&
    8771068  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
     
    8941085
    8951086echo $ac_n "checking for working const""... $ac_c" 1>&6
    896 echo "configure:897: checking for working const" >&5
     1087echo "configure:1088: checking for working const" >&5
    8971088if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
    8981089  echo $ac_n "(cached) $ac_c" 1>&6
    8991090else
    9001091  cat > conftest.$ac_ext <<EOF
    901 #line 902 "configure"
     1092#line 1093 "configure"
    9021093#include "confdefs.h"
    9031094
     
    9481139; return 0; }
    9491140EOF
    950 if { (eval echo configure:951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     1141if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    9511142  rm -rf conftest*
    9521143  ac_cv_c_const=yes
     
    9691160
    9701161echo $ac_n "checking for inline""... $ac_c" 1>&6
    971 echo "configure:972: checking for inline" >&5
     1162echo "configure:1163: checking for inline" >&5
    9721163if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
    9731164  echo $ac_n "(cached) $ac_c" 1>&6
     
    9761167for ac_kw in inline __inline__ __inline; do
    9771168  cat > conftest.$ac_ext <<EOF
    978 #line 979 "configure"
     1169#line 1170 "configure"
    9791170#include "confdefs.h"
    9801171
     
    9831174; return 0; }
    9841175EOF
    985 if { (eval echo configure:986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     1176if { (eval echo configure:1177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    9861177  rm -rf conftest*
    9871178  ac_cv_c_inline=$ac_kw; break
     
    10261217# ./install, which can be erroneously created by make from ./install.sh.
    10271218echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
    1028 echo "configure:1029: checking for a BSD compatible install" >&5
     1219echo "configure:1220: checking for a BSD compatible install" >&5
    10291220if test -z "$INSTALL"; then
    10301221if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
     
    10871278# something.
    10881279echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
    1089 echo "configure:1090: checking how to run the C preprocessor" >&5
     1280echo "configure:1281: checking how to run the C preprocessor" >&5
    10901281# On Suns, sometimes $CPP names a directory.
    10911282if test -n "$CPP" && test -d "$CPP"; then
     
    11021293  # not just through cpp.
    11031294  cat > conftest.$ac_ext <<EOF
    1104 #line 1105 "configure"
     1295#line 1296 "configure"
    11051296#include "confdefs.h"
    11061297#include <assert.h>
     
    11081299EOF
    11091300ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1110 { (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1301{ (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    11111302ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    11121303if test -z "$ac_err"; then
     
    11191310  CPP="${CC-cc} -E -traditional-cpp"
    11201311  cat > conftest.$ac_ext <<EOF
    1121 #line 1122 "configure"
     1312#line 1313 "configure"
    11221313#include "confdefs.h"
    11231314#include <assert.h>
     
    11251316EOF
    11261317ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1127 { (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1318{ (eval echo configure:1319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    11281319ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    11291320if test -z "$ac_err"; then
     
    11361327  CPP="${CC-cc} -nologo -E"
    11371328  cat > conftest.$ac_ext <<EOF
    1138 #line 1139 "configure"
     1329#line 1330 "configure"
    11391330#include "confdefs.h"
    11401331#include <assert.h>
     
    11421333EOF
    11431334ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1144 { (eval echo configure:1145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1335{ (eval echo configure:1336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    11451336ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    11461337if test -z "$ac_err"; then
     
    11661357echo "$ac_t""$CPP" 1>&6
    11671358
    1168 for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h
     1359for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
    11691360do
    11701361ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    11711362echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    1172 echo "configure:1173: checking for $ac_hdr" >&5
     1363echo "configure:1364: checking for $ac_hdr" >&5
    11731364if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    11741365  echo $ac_n "(cached) $ac_c" 1>&6
    11751366else
    11761367  cat > conftest.$ac_ext <<EOF
    1177 #line 1178 "configure"
     1368#line 1369 "configure"
    11781369#include "confdefs.h"
    11791370#include <$ac_hdr>
    11801371EOF
    11811372ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1182 { (eval echo configure:1183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1373{ (eval echo configure:1374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    11831374ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    11841375if test -z "$ac_err"; then
     
    12071398
    12081399echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
    1209 echo "configure:1210: checking for sys/wait.h that is POSIX.1 compatible" >&5
     1400echo "configure:1401: checking for sys/wait.h that is POSIX.1 compatible" >&5
    12101401if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
    12111402  echo $ac_n "(cached) $ac_c" 1>&6
    12121403else
    12131404  cat > conftest.$ac_ext <<EOF
    1214 #line 1215 "configure"
     1405#line 1406 "configure"
    12151406#include "confdefs.h"
    12161407#include <sys/types.h>
     
    12281419; return 0; }
    12291420EOF
    1230 if { (eval echo configure:1231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     1421if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    12311422  rm -rf conftest*
    12321423  ac_cv_header_sys_wait_h=yes
     
    12491440
    12501441echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
    1251 echo "configure:1252: checking whether time.h and sys/time.h may both be included" >&5
     1442echo "configure:1443: checking whether time.h and sys/time.h may both be included" >&5
    12521443if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
    12531444  echo $ac_n "(cached) $ac_c" 1>&6
    12541445else
    12551446  cat > conftest.$ac_ext <<EOF
    1256 #line 1257 "configure"
     1447#line 1448 "configure"
    12571448#include "confdefs.h"
    12581449#include <sys/types.h>
     
    12631454; return 0; }
    12641455EOF
    1265 if { (eval echo configure:1266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     1456if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    12661457  rm -rf conftest*
    12671458  ac_cv_header_time=yes
     
    12851476
    12861477echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6
    1287 echo "configure:1288: checking whether errno must be declared" >&5
     1478echo "configure:1479: checking whether errno must be declared" >&5
    12881479if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then
    12891480  echo $ac_n "(cached) $ac_c" 1>&6
    12901481else
    12911482  cat > conftest.$ac_ext <<EOF
    1292 #line 1293 "configure"
     1483#line 1484 "configure"
    12931484#include "confdefs.h"
    12941485#include <errno.h>
     
    12971488; return 0; }
    12981489EOF
    1299 if { (eval echo configure:1300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     1490if { (eval echo configure:1491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    13001491  rm -rf conftest*
    13011492  libiberty_cv_declare_errno=no
     
    13131504then cat >> confdefs.h <<\EOF
    13141505#define NEED_DECLARATION_ERRNO 1
     1506EOF
     1507
     1508fi
     1509
     1510
     1511echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
     1512echo "configure:1513: checking for ANSI C header files" >&5
     1513if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
     1514  echo $ac_n "(cached) $ac_c" 1>&6
     1515else
     1516  cat > conftest.$ac_ext <<EOF
     1517#line 1518 "configure"
     1518#include "confdefs.h"
     1519#include <stdlib.h>
     1520#include <stdarg.h>
     1521#include <string.h>
     1522#include <float.h>
     1523EOF
     1524ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
     1525{ (eval echo configure:1526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1526ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
     1527if test -z "$ac_err"; then
     1528  rm -rf conftest*
     1529  ac_cv_header_stdc=yes
     1530else
     1531  echo "$ac_err" >&5
     1532  echo "configure: failed program was:" >&5
     1533  cat conftest.$ac_ext >&5
     1534  rm -rf conftest*
     1535  ac_cv_header_stdc=no
     1536fi
     1537rm -f conftest*
     1538
     1539if test $ac_cv_header_stdc = yes; then
     1540  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
     1541cat > conftest.$ac_ext <<EOF
     1542#line 1543 "configure"
     1543#include "confdefs.h"
     1544#include <string.h>
     1545EOF
     1546if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     1547  egrep "memchr" >/dev/null 2>&1; then
     1548  :
     1549else
     1550  rm -rf conftest*
     1551  ac_cv_header_stdc=no
     1552fi
     1553rm -f conftest*
     1554
     1555fi
     1556
     1557if test $ac_cv_header_stdc = yes; then
     1558  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
     1559cat > conftest.$ac_ext <<EOF
     1560#line 1561 "configure"
     1561#include "confdefs.h"
     1562#include <stdlib.h>
     1563EOF
     1564if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     1565  egrep "free" >/dev/null 2>&1; then
     1566  :
     1567else
     1568  rm -rf conftest*
     1569  ac_cv_header_stdc=no
     1570fi
     1571rm -f conftest*
     1572
     1573fi
     1574
     1575if test $ac_cv_header_stdc = yes; then
     1576  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
     1577if test "$cross_compiling" = yes; then
     1578  :
     1579else
     1580  cat > conftest.$ac_ext <<EOF
     1581#line 1582 "configure"
     1582#include "confdefs.h"
     1583#include <ctype.h>
     1584#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
     1585#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
     1586#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
     1587int main () { int i; for (i = 0; i < 256; i++)
     1588if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
     1589exit (0); }
     1590
     1591EOF
     1592if { (eval echo configure:1593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     1593then
     1594  :
     1595else
     1596  echo "configure: failed program was:" >&5
     1597  cat conftest.$ac_ext >&5
     1598  rm -fr conftest*
     1599  ac_cv_header_stdc=no
     1600fi
     1601rm -fr conftest*
     1602fi
     1603
     1604fi
     1605fi
     1606
     1607echo "$ac_t""$ac_cv_header_stdc" 1>&6
     1608if test $ac_cv_header_stdc = yes; then
     1609  cat >> confdefs.h <<\EOF
     1610#define STDC_HEADERS 1
     1611EOF
     1612
     1613fi
     1614
     1615echo $ac_n "checking for uintptr_t""... $ac_c" 1>&6
     1616echo "configure:1617: checking for uintptr_t" >&5
     1617if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then
     1618  echo $ac_n "(cached) $ac_c" 1>&6
     1619else
     1620  cat > conftest.$ac_ext <<EOF
     1621#line 1622 "configure"
     1622#include "confdefs.h"
     1623#include <sys/types.h>
     1624#if STDC_HEADERS
     1625#include <stdlib.h>
     1626#include <stddef.h>
     1627#endif
     1628EOF
     1629if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     1630  egrep "(^|[^a-zA-Z_0-9])uintptr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
     1631  rm -rf conftest*
     1632  ac_cv_type_uintptr_t=yes
     1633else
     1634  rm -rf conftest*
     1635  ac_cv_type_uintptr_t=no
     1636fi
     1637rm -f conftest*
     1638
     1639fi
     1640echo "$ac_t""$ac_cv_type_uintptr_t" 1>&6
     1641if test $ac_cv_type_uintptr_t = no; then
     1642  cat >> confdefs.h <<\EOF
     1643#define uintptr_t unsigned long
     1644EOF
     1645
     1646fi
     1647
     1648# Given the above check, we always have uintptr_t or a fallback
     1649# definition.  So define HAVE_UINTPTR_T in case any imported code
     1650# relies on it.
     1651cat >> confdefs.h <<\EOF
     1652#define HAVE_UINTPTR_T 1
     1653EOF
     1654
     1655
     1656echo $ac_n "checking for pid_t""... $ac_c" 1>&6
     1657echo "configure:1658: checking for pid_t" >&5
     1658if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
     1659  echo $ac_n "(cached) $ac_c" 1>&6
     1660else
     1661  cat > conftest.$ac_ext <<EOF
     1662#line 1663 "configure"
     1663#include "confdefs.h"
     1664#include <sys/types.h>
     1665#if STDC_HEADERS
     1666#include <stdlib.h>
     1667#include <stddef.h>
     1668#endif
     1669EOF
     1670if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
     1671  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
     1672  rm -rf conftest*
     1673  ac_cv_type_pid_t=yes
     1674else
     1675  rm -rf conftest*
     1676  ac_cv_type_pid_t=no
     1677fi
     1678rm -f conftest*
     1679
     1680fi
     1681echo "$ac_t""$ac_cv_type_pid_t" 1>&6
     1682if test $ac_cv_type_pid_t = no; then
     1683  cat >> confdefs.h <<\EOF
     1684#define pid_t int
    13151685EOF
    13161686
     
    13301700funcs="$funcs calloc"
    13311701funcs="$funcs clock"
     1702funcs="$funcs ffs"
    13321703funcs="$funcs getcwd"
    13331704funcs="$funcs getpagesize"
     
    13381709funcs="$funcs memcpy"
    13391710funcs="$funcs memmove"
     1711funcs="$funcs mempcpy"
    13401712funcs="$funcs memset"
    13411713funcs="$funcs mkstemps"
     
    13451717funcs="$funcs rindex"
    13461718funcs="$funcs setenv"
     1719funcs="$funcs snprintf"
    13471720funcs="$funcs sigsetmask"
     1721funcs="$funcs stpcpy"
     1722funcs="$funcs stpncpy"
    13481723funcs="$funcs strcasecmp"
    13491724funcs="$funcs strchr"
     
    13591734funcs="$funcs vfprintf"
    13601735funcs="$funcs vprintf"
     1736funcs="$funcs vsnprintf"
    13611737funcs="$funcs vsprintf"
    13621738funcs="$funcs waitpid"
     
    13641740# Also in the old function.def file: alloca, vfork, getopt.
    13651741
    1366 vars="sys_errlist sys_nerr sys_siglist"
     1742vars="sys_errlist sys_nerr sys_siglist _system_configuration"
    13671743
    13681744checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
     1745checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
     1746checkfuncs="$checkfuncs getsysinfo table sysctl"
    13691747
    13701748# These are neither executed nor required, but they help keep
     
    13741752do
    13751753echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1376 echo "configure:1377: checking for $ac_func" >&5
     1754echo "configure:1755: checking for $ac_func" >&5
    13771755if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    13781756  echo $ac_n "(cached) $ac_c" 1>&6
    13791757else
    13801758  cat > conftest.$ac_ext <<EOF
    1381 #line 1382 "configure"
     1759#line 1760 "configure"
    13821760#include "confdefs.h"
    13831761/* System header to define __stub macros and hopefully few prototypes,
     
    14021780; return 0; }
    14031781EOF
    1404 if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     1782if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    14051783  rm -rf conftest*
    14061784  eval "ac_cv_func_$ac_func=yes"
     
    14291807do
    14301808echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1431 echo "configure:1432: checking for $ac_func" >&5
     1809echo "configure:1810: checking for $ac_func" >&5
    14321810if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    14331811  echo $ac_n "(cached) $ac_c" 1>&6
    14341812else
    14351813  cat > conftest.$ac_ext <<EOF
    1436 #line 1437 "configure"
     1814#line 1815 "configure"
    14371815#include "confdefs.h"
    14381816/* System header to define __stub macros and hopefully few prototypes,
     
    14571835; return 0; }
    14581836EOF
    1459 if { (eval echo configure:1460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     1837if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    14601838  rm -rf conftest*
    14611839  eval "ac_cv_func_$ac_func=yes"
     
    14811859done
    14821860
    1483   for ac_func in memmove memset putenv random rename rindex sigsetmask
     1861  for ac_func in memmove mempcpy memset putenv random rename rindex sigsetmask
    14841862do
    14851863echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1486 echo "configure:1487: checking for $ac_func" >&5
     1864echo "configure:1865: checking for $ac_func" >&5
    14871865if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    14881866  echo $ac_n "(cached) $ac_c" 1>&6
    14891867else
    14901868  cat > conftest.$ac_ext <<EOF
    1491 #line 1492 "configure"
     1869#line 1870 "configure"
    14921870#include "confdefs.h"
    14931871/* System header to define __stub macros and hopefully few prototypes,
     
    15121890; return 0; }
    15131891EOF
    1514 if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     1892if { (eval echo configure:1893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    15151893  rm -rf conftest*
    15161894  eval "ac_cv_func_$ac_func=yes"
     
    15361914done
    15371915
    1538   for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
     1916  for ac_func in strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr
    15391917do
    15401918echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1541 echo "configure:1542: checking for $ac_func" >&5
     1919echo "configure:1920: checking for $ac_func" >&5
    15421920if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    15431921  echo $ac_n "(cached) $ac_c" 1>&6
    15441922else
    15451923  cat > conftest.$ac_ext <<EOF
    1546 #line 1547 "configure"
     1924#line 1925 "configure"
    15471925#include "confdefs.h"
    15481926/* System header to define __stub macros and hopefully few prototypes,
     
    15671945; return 0; }
    15681946EOF
    1569 if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     1947if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    15701948  rm -rf conftest*
    15711949  eval "ac_cv_func_$ac_func=yes"
     
    15941972do
    15951973echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1596 echo "configure:1597: checking for $ac_func" >&5
     1974echo "configure:1975: checking for $ac_func" >&5
    15971975if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    15981976  echo $ac_n "(cached) $ac_c" 1>&6
    15991977else
    16001978  cat > conftest.$ac_ext <<EOF
    1601 #line 1602 "configure"
     1979#line 1980 "configure"
    16021980#include "confdefs.h"
    16031981/* System header to define __stub macros and hopefully few prototypes,
     
    16222000; return 0; }
    16232001EOF
    1624 if { (eval echo configure:1625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2002if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    16252003  rm -rf conftest*
    16262004  eval "ac_cv_func_$ac_func=yes"
     
    16492027do
    16502028echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1651 echo "configure:1652: checking for $ac_func" >&5
     2029echo "configure:2030: checking for $ac_func" >&5
    16522030if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    16532031  echo $ac_n "(cached) $ac_c" 1>&6
    16542032else
    16552033  cat > conftest.$ac_ext <<EOF
    1656 #line 1657 "configure"
     2034#line 2035 "configure"
    16572035#include "confdefs.h"
    16582036/* System header to define __stub macros and hopefully few prototypes,
     
    16772055; return 0; }
    16782056EOF
    1679 if { (eval echo configure:1680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2057if { (eval echo configure:2058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    16802058  rm -rf conftest*
    16812059  eval "ac_cv_func_$ac_func=yes"
     
    17012079done
    17022080
    1703   for ac_func in sysconf times sbrk gettimeofday
     2081  for ac_func in sysconf times sbrk gettimeofday ffs snprintf vsnprintf
    17042082do
    17052083echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1706 echo "configure:1707: checking for $ac_func" >&5
     2084echo "configure:2085: checking for $ac_func" >&5
    17072085if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    17082086  echo $ac_n "(cached) $ac_c" 1>&6
    17092087else
    17102088  cat > conftest.$ac_ext <<EOF
    1711 #line 1712 "configure"
     2089#line 2090 "configure"
    17122090#include "confdefs.h"
    17132091/* System header to define __stub macros and hopefully few prototypes,
     
    17322110; return 0; }
    17332111EOF
    1734 if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2112if { (eval echo configure:2113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    17352113  rm -rf conftest*
    17362114  eval "ac_cv_func_$ac_func=yes"
     
    17562134done
    17572135
     2136  for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl
     2137do
     2138echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
     2139echo "configure:2140: checking for $ac_func" >&5
     2140if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
     2141  echo $ac_n "(cached) $ac_c" 1>&6
     2142else
     2143  cat > conftest.$ac_ext <<EOF
     2144#line 2145 "configure"
     2145#include "confdefs.h"
     2146/* System header to define __stub macros and hopefully few prototypes,
     2147    which can conflict with char $ac_func(); below.  */
     2148#include <assert.h>
     2149/* Override any gcc2 internal prototype to avoid an error.  */
     2150/* We use char because int might match the return type of a gcc2
     2151    builtin and then its argument prototype would still apply.  */
     2152char $ac_func();
     2153
     2154int main() {
     2155
     2156/* The GNU C library defines this for functions which it implements
     2157    to always fail with ENOSYS.  Some functions are actually named
     2158    something starting with __ and the normal name is an alias.  */
     2159#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
     2160choke me
     2161#else
     2162$ac_func();
     2163#endif
     2164
     2165; return 0; }
     2166EOF
     2167if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2168  rm -rf conftest*
     2169  eval "ac_cv_func_$ac_func=yes"
     2170else
     2171  echo "configure: failed program was:" >&5
     2172  cat conftest.$ac_ext >&5
     2173  rm -rf conftest*
     2174  eval "ac_cv_func_$ac_func=no"
     2175fi
     2176rm -f conftest*
     2177fi
     2178
     2179if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
     2180  echo "$ac_t""yes" 1>&6
     2181    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
     2182  cat >> confdefs.h <<EOF
     2183#define $ac_tr_func 1
     2184EOF
     2185 
     2186else
     2187  echo "$ac_t""no" 1>&6
     2188fi
     2189done
     2190
     2191  for ac_func in realpath canonicalize_file_name
     2192do
     2193echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
     2194echo "configure:2195: checking for $ac_func" >&5
     2195if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
     2196  echo $ac_n "(cached) $ac_c" 1>&6
     2197else
     2198  cat > conftest.$ac_ext <<EOF
     2199#line 2200 "configure"
     2200#include "confdefs.h"
     2201/* System header to define __stub macros and hopefully few prototypes,
     2202    which can conflict with char $ac_func(); below.  */
     2203#include <assert.h>
     2204/* Override any gcc2 internal prototype to avoid an error.  */
     2205/* We use char because int might match the return type of a gcc2
     2206    builtin and then its argument prototype would still apply.  */
     2207char $ac_func();
     2208
     2209int main() {
     2210
     2211/* The GNU C library defines this for functions which it implements
     2212    to always fail with ENOSYS.  Some functions are actually named
     2213    something starting with __ and the normal name is an alias.  */
     2214#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
     2215choke me
     2216#else
     2217$ac_func();
     2218#endif
     2219
     2220; return 0; }
     2221EOF
     2222if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2223  rm -rf conftest*
     2224  eval "ac_cv_func_$ac_func=yes"
     2225else
     2226  echo "configure: failed program was:" >&5
     2227  cat conftest.$ac_ext >&5
     2228  rm -rf conftest*
     2229  eval "ac_cv_func_$ac_func=no"
     2230fi
     2231rm -f conftest*
     2232fi
     2233
     2234if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
     2235  echo "$ac_t""yes" 1>&6
     2236    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
     2237  cat >> confdefs.h <<EOF
     2238#define $ac_tr_func 1
     2239EOF
     2240 
     2241else
     2242  echo "$ac_t""no" 1>&6
     2243fi
     2244done
     2245
    17582246  cat >> confdefs.h <<\EOF
    17592247#define HAVE_SYS_ERRLIST 1
     
    17682256EOF
    17692257
     2258  cat >> confdefs.h <<\EOF
     2259#define HAVE__SYSTEM_CONFIGURATION 1
     2260EOF
     2261
    17702262fi
    17712263
    17722264# For each of these functions, if the host does not provide the
    17732265# function we want to put FN.o in LIBOBJS, and if the host does
    1774 # provide the function, we want to define HAVE_FN in config.h.  Also,
    1775 # if the host does not provide alloca, we set ALLOCA to alloca.o
     2266# provide the function, we want to define HAVE_FN in config.h.
    17762267
    17772268setobjs=
    17782269CHECK=
     2270target_header_dir=
    17792271if test -n "${with_target_subdir}"; then
    17802272
     
    17882280
    17892281  if test "x${with_newlib}" = "xyes"; then
    1790     ALLOCA="alloca.o"
    17912282    LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
    17922283
     
    18182309  fi
    18192310
     2311  # We may wish to install the target headers somewhere.
     2312  # Check whether --enable-install-libiberty or --disable-install-libiberty was given.
     2313if test "${enable_install_libiberty+set}" = set; then
     2314  enableval="$enable_install_libiberty"
     2315  enable_install_libiberty=$enableval
     2316else
     2317  enable_install_libiberty=no
     2318fi
     2319 
     2320  # Option parsed, now set things appropriately.
     2321  case x"$enable_install_libiberty" in
     2322    xyes|x)
     2323      target_header_dir=libiberty
     2324      ;;
     2325    xno)   
     2326      target_header_dir=
     2327      ;;
     2328    *)
     2329      # This could be sanity-checked in various ways...
     2330      target_header_dir="${enable_install_libiberty}"
     2331      ;;
     2332  esac
     2333
     2334
    18202335else
    18212336
     
    18262341
    18272342
     2343
     2344
     2345case "${host}" in
     2346  *-*-cygwin* | *-*-mingw*)
     2347    cat >> confdefs.h <<\EOF
     2348#define HAVE_SYS_ERRLIST 1
     2349EOF
     2350
     2351    cat >> confdefs.h <<\EOF
     2352#define HAVE_SYS_NERR 1
     2353EOF
     2354
     2355    ;;
     2356esac
    18282357
    18292358if test -z "${setobjs}"; then
     
    19132442    ;;
    19142443
     2444  *-*-*vms*)
     2445    # Under VMS, vfork works very different than on Unix. The standard test
     2446    # won't work, and it isn't easily adaptable. It makes more sense to
     2447    # just force it.
     2448    ac_cv_func_vfork_works=yes
     2449    ;;
     2450
    19152451  esac
    19162452
     
    19182454  # tests.  This will only work if the compiler works.
    19192455  echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
    1920 echo "configure:1921: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
     2456echo "configure:2457: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
    19212457
    19222458ac_ext=c
     
    19292465cat > conftest.$ac_ext << EOF
    19302466
    1931 #line 1932 "configure"
     2467#line 2468 "configure"
    19322468#include "confdefs.h"
    19332469
    19342470main(){return(0);}
    19352471EOF
    1936 if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2472if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    19372473  ac_cv_prog_cc_works=yes
    19382474  # If we can't run a trivial program, we are probably using a cross compiler.
     
    19602496fi
    19612497echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
    1962 echo "configure:1963: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
     2498echo "configure:2499: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
    19632499echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
    19642500cross_compiling=$ac_cv_prog_cc_cross
     
    19672503do
    19682504echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    1969 echo "configure:1970: checking for $ac_func" >&5
     2505echo "configure:2506: checking for $ac_func" >&5
    19702506if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    19712507  echo $ac_n "(cached) $ac_c" 1>&6
    19722508else
    19732509  cat > conftest.$ac_ext <<EOF
    1974 #line 1975 "configure"
     2510#line 2511 "configure"
    19752511#include "confdefs.h"
    19762512/* System header to define __stub macros and hopefully few prototypes,
     
    19952531; return 0; }
    19962532EOF
    1997 if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2533if { (eval echo configure:2534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    19982534  rm -rf conftest*
    19992535  eval "ac_cv_func_$ac_func=yes"
     
    20212557
    20222558
    2023 
    2024   case "${host}" in
    2025   *-*-interix)
    2026     # On Interix, it wrongly concludes that the MSVC compiler supports alloca.
    2027     # (MSVC does on Win32, not on Interix.)
    2028     # This should be temporary.
    2029 
    2030     ac_cv_header_alloca_h=no
    2031     ac_cv_func_alloca_works=no
    2032     ALLOCA=alloca.o
    2033     cat >> confdefs.h <<\EOF
    2034 #define C_ALLOCA 1
    2035 EOF
    2036     cat >> confdefs.h <<EOF
    2037 #define STACK_DIRECTION -1
    2038 EOF
    2039     ;;
    2040   *)
    2041     # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
    2042 # for constant arguments.  Useless!
    2043 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
    2044 echo "configure:2045: checking for working alloca.h" >&5
    2045 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
     2559  echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
     2560echo "configure:2561: checking whether alloca needs Cray hooks" >&5
     2561if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
    20462562  echo $ac_n "(cached) $ac_c" 1>&6
    20472563else
    20482564  cat > conftest.$ac_ext <<EOF
    2049 #line 2050 "configure"
    2050 #include "confdefs.h"
    2051 #include <alloca.h>
    2052 int main() {
    2053 char *p = alloca(2 * sizeof(int));
    2054 ; return 0; }
    2055 EOF
    2056 if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    2057   rm -rf conftest*
    2058   ac_cv_header_alloca_h=yes
    2059 else
    2060   echo "configure: failed program was:" >&5
    2061   cat conftest.$ac_ext >&5
    2062   rm -rf conftest*
    2063   ac_cv_header_alloca_h=no
    2064 fi
    2065 rm -f conftest*
    2066 fi
    2067 
    2068 echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
    2069 if test $ac_cv_header_alloca_h = yes; then
    2070   cat >> confdefs.h <<\EOF
    2071 #define HAVE_ALLOCA_H 1
    2072 EOF
    2073 
    2074 fi
    2075 
    2076 echo $ac_n "checking for alloca""... $ac_c" 1>&6
    2077 echo "configure:2078: checking for alloca" >&5
    2078 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
    2079   echo $ac_n "(cached) $ac_c" 1>&6
    2080 else
    2081   cat > conftest.$ac_ext <<EOF
    2082 #line 2083 "configure"
    2083 #include "confdefs.h"
    2084 
    2085 #ifdef __GNUC__
    2086 # define alloca __builtin_alloca
    2087 #else
    2088 # ifdef _MSC_VER
    2089 #  include <malloc.h>
    2090 #  define alloca _alloca
    2091 # else
    2092 #  if HAVE_ALLOCA_H
    2093 #   include <alloca.h>
    2094 #  else
    2095 #   ifdef _AIX
    2096  #pragma alloca
    2097 #   else
    2098 #    ifndef alloca /* predefined by HP cc +Olibcalls */
    2099 char *alloca ();
    2100 #    endif
    2101 #   endif
    2102 #  endif
    2103 # endif
    2104 #endif
    2105 
    2106 int main() {
    2107 char *p = (char *) alloca(1);
    2108 ; return 0; }
    2109 EOF
    2110 if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    2111   rm -rf conftest*
    2112   ac_cv_func_alloca_works=yes
    2113 else
    2114   echo "configure: failed program was:" >&5
    2115   cat conftest.$ac_ext >&5
    2116   rm -rf conftest*
    2117   ac_cv_func_alloca_works=no
    2118 fi
    2119 rm -f conftest*
    2120 fi
    2121 
    2122 echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
    2123 if test $ac_cv_func_alloca_works = yes; then
    2124   cat >> confdefs.h <<\EOF
    2125 #define HAVE_ALLOCA 1
    2126 EOF
    2127 
    2128 fi
    2129 
    2130 if test $ac_cv_func_alloca_works = no; then
    2131   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
    2132   # that cause trouble.  Some versions do not even contain alloca or
    2133   # contain a buggy version.  If you still want to use their alloca,
    2134   # use ar to extract alloca.o from them instead of compiling alloca.c.
    2135   ALLOCA=alloca.${ac_objext}
    2136   cat >> confdefs.h <<\EOF
    2137 #define C_ALLOCA 1
    2138 EOF
    2139 
    2140 
    2141 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
    2142 echo "configure:2143: checking whether alloca needs Cray hooks" >&5
    2143 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
    2144   echo $ac_n "(cached) $ac_c" 1>&6
    2145 else
    2146   cat > conftest.$ac_ext <<EOF
    2147 #line 2148 "configure"
     2565#line 2566 "configure"
    21482566#include "confdefs.h"
    21492567#if defined(CRAY) && ! defined(CRAY2)
     
    21682586echo "$ac_t""$ac_cv_os_cray" 1>&6
    21692587if test $ac_cv_os_cray = yes; then
    2170 for ac_func in _getb67 GETB67 getb67; do
    2171   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    2172 echo "configure:2173: checking for $ac_func" >&5
     2588  for ac_func in _getb67 GETB67 getb67; do
     2589    echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
     2590echo "configure:2591: checking for $ac_func" >&5
    21732591if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    21742592  echo $ac_n "(cached) $ac_c" 1>&6
    21752593else
    21762594  cat > conftest.$ac_ext <<EOF
    2177 #line 2178 "configure"
     2595#line 2596 "configure"
    21782596#include "confdefs.h"
    21792597/* System header to define __stub macros and hopefully few prototypes,
     
    21982616; return 0; }
    21992617EOF
    2200 if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2618if { (eval echo configure:2619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    22012619  rm -rf conftest*
    22022620  eval "ac_cv_func_$ac_func=yes"
     
    22152633#define CRAY_STACKSEG_END $ac_func
    22162634EOF
    2217 
    22182635  break
    22192636else
     
    22212638fi
    22222639
    2223 done
     2640  done
    22242641fi
    22252642
    22262643echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
    2227 echo "configure:2228: checking stack direction for C alloca" >&5
     2644echo "configure:2645: checking stack direction for C alloca" >&5
    22282645if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
    22292646  echo $ac_n "(cached) $ac_c" 1>&6
     
    22332650else
    22342651  cat > conftest.$ac_ext <<EOF
    2235 #line 2236 "configure"
     2652#line 2653 "configure"
    22362653#include "confdefs.h"
    22372654find_stack_direction ()
     
    22522669}
    22532670EOF
    2254 if { (eval echo configure:2255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     2671if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    22552672then
    22562673  ac_cv_c_stack_direction=1
     
    22712688EOF
    22722689
    2273 fi
    2274 
    2275     ;;
    2276   esac
    2277 
    2278   echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
    2279 echo "configure:2280: checking for ANSI C header files" >&5
    2280 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
     2690
     2691  ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
     2692echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
     2693echo "configure:2694: checking for vfork.h" >&5
     2694if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    22812695  echo $ac_n "(cached) $ac_c" 1>&6
    22822696else
    22832697  cat > conftest.$ac_ext <<EOF
    2284 #line 2285 "configure"
    2285 #include "confdefs.h"
    2286 #include <stdlib.h>
    2287 #include <stdarg.h>
    2288 #include <string.h>
    2289 #include <float.h>
     2698#line 2699 "configure"
     2699#include "confdefs.h"
     2700#include <vfork.h>
    22902701EOF
    22912702ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2292 { (eval echo configure:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    2293 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    2294 if test -z "$ac_err"; then
    2295   rm -rf conftest*
    2296   ac_cv_header_stdc=yes
    2297 else
    2298   echo "$ac_err" >&5
    2299   echo "configure: failed program was:" >&5
    2300   cat conftest.$ac_ext >&5
    2301   rm -rf conftest*
    2302   ac_cv_header_stdc=no
    2303 fi
    2304 rm -f conftest*
    2305 
    2306 if test $ac_cv_header_stdc = yes; then
    2307   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
    2308 cat > conftest.$ac_ext <<EOF
    2309 #line 2310 "configure"
    2310 #include "confdefs.h"
    2311 #include <string.h>
    2312 EOF
    2313 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
    2314   egrep "memchr" >/dev/null 2>&1; then
    2315   :
    2316 else
    2317   rm -rf conftest*
    2318   ac_cv_header_stdc=no
    2319 fi
    2320 rm -f conftest*
    2321 
    2322 fi
    2323 
    2324 if test $ac_cv_header_stdc = yes; then
    2325   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
    2326 cat > conftest.$ac_ext <<EOF
    2327 #line 2328 "configure"
    2328 #include "confdefs.h"
    2329 #include <stdlib.h>
    2330 EOF
    2331 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
    2332   egrep "free" >/dev/null 2>&1; then
    2333   :
    2334 else
    2335   rm -rf conftest*
    2336   ac_cv_header_stdc=no
    2337 fi
    2338 rm -f conftest*
    2339 
    2340 fi
    2341 
    2342 if test $ac_cv_header_stdc = yes; then
    2343   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
    2344 if test "$cross_compiling" = yes; then
    2345   :
    2346 else
    2347   cat > conftest.$ac_ext <<EOF
    2348 #line 2349 "configure"
    2349 #include "confdefs.h"
    2350 #include <ctype.h>
    2351 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
    2352 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
    2353 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
    2354 int main () { int i; for (i = 0; i < 256; i++)
    2355 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
    2356 exit (0); }
    2357 
    2358 EOF
    2359 if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    2360 then
    2361   :
    2362 else
    2363   echo "configure: failed program was:" >&5
    2364   cat conftest.$ac_ext >&5
    2365   rm -fr conftest*
    2366   ac_cv_header_stdc=no
    2367 fi
    2368 rm -fr conftest*
    2369 fi
    2370 
    2371 fi
    2372 fi
    2373 
    2374 echo "$ac_t""$ac_cv_header_stdc" 1>&6
    2375 if test $ac_cv_header_stdc = yes; then
    2376   cat >> confdefs.h <<\EOF
    2377 #define STDC_HEADERS 1
    2378 EOF
    2379 
    2380 fi
    2381 
    2382 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
    2383 echo "configure:2384: checking for pid_t" >&5
    2384 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
    2385   echo $ac_n "(cached) $ac_c" 1>&6
    2386 else
    2387   cat > conftest.$ac_ext <<EOF
    2388 #line 2389 "configure"
    2389 #include "confdefs.h"
    2390 #include <sys/types.h>
    2391 #if STDC_HEADERS
    2392 #include <stdlib.h>
    2393 #include <stddef.h>
    2394 #endif
    2395 EOF
    2396 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
    2397   egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
    2398   rm -rf conftest*
    2399   ac_cv_type_pid_t=yes
    2400 else
    2401   rm -rf conftest*
    2402   ac_cv_type_pid_t=no
    2403 fi
    2404 rm -f conftest*
    2405 
    2406 fi
    2407 echo "$ac_t""$ac_cv_type_pid_t" 1>&6
    2408 if test $ac_cv_type_pid_t = no; then
    2409   cat >> confdefs.h <<\EOF
    2410 #define pid_t int
    2411 EOF
    2412 
    2413 fi
    2414 
    2415 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
    2416 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
    2417 echo "configure:2418: checking for vfork.h" >&5
    2418 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    2419   echo $ac_n "(cached) $ac_c" 1>&6
    2420 else
    2421   cat > conftest.$ac_ext <<EOF
    2422 #line 2423 "configure"
    2423 #include "confdefs.h"
    2424 #include <vfork.h>
    2425 EOF
    2426 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2427 { (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     2703{ (eval echo configure:2704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    24282704ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    24292705if test -z "$ac_err"; then
     
    24502726
    24512727echo $ac_n "checking for working vfork""... $ac_c" 1>&6
    2452 echo "configure:2453: checking for working vfork" >&5
     2728echo "configure:2729: checking for working vfork" >&5
    24532729if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
    24542730  echo $ac_n "(cached) $ac_c" 1>&6
     
    24562732  if test "$cross_compiling" = yes; then
    24572733  echo $ac_n "checking for vfork""... $ac_c" 1>&6
    2458 echo "configure:2459: checking for vfork" >&5
     2734echo "configure:2735: checking for vfork" >&5
    24592735if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
    24602736  echo $ac_n "(cached) $ac_c" 1>&6
    24612737else
    24622738  cat > conftest.$ac_ext <<EOF
    2463 #line 2464 "configure"
     2739#line 2740 "configure"
    24642740#include "confdefs.h"
    24652741/* System header to define __stub macros and hopefully few prototypes,
     
    24842760; return 0; }
    24852761EOF
    2486 if { (eval echo configure:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2762if { (eval echo configure:2763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    24872763  rm -rf conftest*
    24882764  eval "ac_cv_func_vfork=yes"
     
    25062782else
    25072783  cat > conftest.$ac_ext <<EOF
    2508 #line 2509 "configure"
     2784#line 2785 "configure"
    25092785#include "confdefs.h"
    25102786/* Thanks to Paul Eggert for this test.  */
     
    26012877}
    26022878EOF
    2603 if { (eval echo configure:2604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     2879if { (eval echo configure:2880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    26042880then
    26052881  ac_cv_func_vfork_works=yes
     
    26262902    LIBOBJS="$LIBOBJS vfork.o"
    26272903  fi
    2628   for v in $vars; do
    2629     echo $ac_n "checking for $v""... $ac_c" 1>&6
    2630 echo "configure:2631: checking for $v" >&5
    2631     if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
    2632   echo $ac_n "(cached) $ac_c" 1>&6
    2633 else
    2634   cat > conftest.$ac_ext <<EOF
    2635 #line 2636 "configure"
    2636 #include "confdefs.h"
    2637 int *p;
    2638 int main() {
    2639 extern int $v; p = &$v;
    2640 ; return 0; }
    2641 EOF
    2642 if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    2643   rm -rf conftest*
    2644   eval "libiberty_cv_var_$v=yes"
    2645 else
    2646   echo "configure: failed program was:" >&5
    2647   cat conftest.$ac_ext >&5
    2648   rm -rf conftest*
    2649   eval "libiberty_cv_var_$v=no"
    2650 fi
    2651 rm -f conftest*
    2652 fi
    2653 
    2654     if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
    2655       echo "$ac_t""yes" 1>&6
    2656       n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
    2657       cat >> confdefs.h <<EOF
    2658 #define $n 1
    2659 EOF
    2660 
    2661     else
    2662       echo "$ac_t""no" 1>&6
    2663     fi
    2664   done
    2665   for ac_func in $checkfuncs
     2904  # We only need _doprnt if we might use it to implement v*printf.
     2905  if test $ac_cv_func_vprintf != yes \
     2906     || test $ac_cv_func_vfprintf != yes \
     2907     || test $ac_cv_func_vsprintf != yes; then
     2908    for ac_func in _doprnt
    26662909do
    26672910echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    2668 echo "configure:2669: checking for $ac_func" >&5
     2911echo "configure:2912: checking for $ac_func" >&5
    26692912if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    26702913  echo $ac_n "(cached) $ac_c" 1>&6
    26712914else
    26722915  cat > conftest.$ac_ext <<EOF
    2673 #line 2674 "configure"
     2916#line 2917 "configure"
    26742917#include "confdefs.h"
    26752918/* System header to define __stub macros and hopefully few prototypes,
     
    26942937; return 0; }
    26952938EOF
    2696 if { (eval echo configure:2697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2939if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    26972940  rm -rf conftest*
    26982941  eval "ac_cv_func_$ac_func=yes"
     
    27152958else
    27162959  echo "$ac_t""no" 1>&6
     2960LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
    27172961fi
    27182962done
    27192963
    2720 fi
    2721 
    2722 for ac_hdr in unistd.h
    2723 do
    2724 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    2725 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    2726 echo "configure:2727: checking for $ac_hdr" >&5
    2727 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    2728   echo $ac_n "(cached) $ac_c" 1>&6
    2729 else
    2730   cat > conftest.$ac_ext <<EOF
    2731 #line 2732 "configure"
    2732 #include "confdefs.h"
    2733 #include <$ac_hdr>
    2734 EOF
    2735 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2736 { (eval echo configure:2737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    2737 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    2738 if test -z "$ac_err"; then
    2739   rm -rf conftest*
    2740   eval "ac_cv_header_$ac_safe=yes"
    2741 else
    2742   echo "$ac_err" >&5
    2743   echo "configure: failed program was:" >&5
    2744   cat conftest.$ac_ext >&5
    2745   rm -rf conftest*
    2746   eval "ac_cv_header_$ac_safe=no"
    2747 fi
    2748 rm -f conftest*
    2749 fi
    2750 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
    2751   echo "$ac_t""yes" 1>&6
    2752     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
    2753   cat >> confdefs.h <<EOF
    2754 #define $ac_tr_hdr 1
    2755 EOF
    2756  
    2757 else
    2758   echo "$ac_t""no" 1>&6
    2759 fi
    2760 done
    2761 
    2762 for ac_func in getpagesize
     2964
     2965  else
     2966    for ac_func in _doprnt
    27632967do
    27642968echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    2765 echo "configure:2766: checking for $ac_func" >&5
     2969echo "configure:2970: checking for $ac_func" >&5
    27662970if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    27672971  echo $ac_n "(cached) $ac_c" 1>&6
    27682972else
    27692973  cat > conftest.$ac_ext <<EOF
    2770 #line 2771 "configure"
     2974#line 2975 "configure"
    27712975#include "confdefs.h"
    27722976/* System header to define __stub macros and hopefully few prototypes,
     
    27912995; return 0; }
    27922996EOF
    2793 if { (eval echo configure:2794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2997if { (eval echo configure:2998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    27942998  rm -rf conftest*
    27952999  eval "ac_cv_func_$ac_func=yes"
     
    28153019done
    28163020
     3021  fi
     3022
     3023  for v in $vars; do
     3024    echo $ac_n "checking for $v""... $ac_c" 1>&6
     3025echo "configure:3026: checking for $v" >&5
     3026    if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
     3027  echo $ac_n "(cached) $ac_c" 1>&6
     3028else
     3029  cat > conftest.$ac_ext <<EOF
     3030#line 3031 "configure"
     3031#include "confdefs.h"
     3032int *p;
     3033int main() {
     3034extern int $v []; p = $v;
     3035; return 0; }
     3036EOF
     3037if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3038  rm -rf conftest*
     3039  eval "libiberty_cv_var_$v=yes"
     3040else
     3041  echo "configure: failed program was:" >&5
     3042  cat conftest.$ac_ext >&5
     3043  rm -rf conftest*
     3044  eval "libiberty_cv_var_$v=no"
     3045fi
     3046rm -f conftest*
     3047fi
     3048
     3049    if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
     3050      echo "$ac_t""yes" 1>&6
     3051      n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
     3052      cat >> confdefs.h <<EOF
     3053#define $n 1
     3054EOF
     3055
     3056    else
     3057      echo "$ac_t""no" 1>&6
     3058    fi
     3059  done
     3060  for ac_func in $checkfuncs
     3061do
     3062echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
     3063echo "configure:3064: checking for $ac_func" >&5
     3064if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
     3065  echo $ac_n "(cached) $ac_c" 1>&6
     3066else
     3067  cat > conftest.$ac_ext <<EOF
     3068#line 3069 "configure"
     3069#include "confdefs.h"
     3070/* System header to define __stub macros and hopefully few prototypes,
     3071    which can conflict with char $ac_func(); below.  */
     3072#include <assert.h>
     3073/* Override any gcc2 internal prototype to avoid an error.  */
     3074/* We use char because int might match the return type of a gcc2
     3075    builtin and then its argument prototype would still apply.  */
     3076char $ac_func();
     3077
     3078int main() {
     3079
     3080/* The GNU C library defines this for functions which it implements
     3081    to always fail with ENOSYS.  Some functions are actually named
     3082    something starting with __ and the normal name is an alias.  */
     3083#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
     3084choke me
     3085#else
     3086$ac_func();
     3087#endif
     3088
     3089; return 0; }
     3090EOF
     3091if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3092  rm -rf conftest*
     3093  eval "ac_cv_func_$ac_func=yes"
     3094else
     3095  echo "configure: failed program was:" >&5
     3096  cat conftest.$ac_ext >&5
     3097  rm -rf conftest*
     3098  eval "ac_cv_func_$ac_func=no"
     3099fi
     3100rm -f conftest*
     3101fi
     3102
     3103if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
     3104  echo "$ac_t""yes" 1>&6
     3105    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
     3106  cat >> confdefs.h <<EOF
     3107#define $ac_tr_func 1
     3108EOF
     3109 
     3110else
     3111  echo "$ac_t""no" 1>&6
     3112fi
     3113done
     3114
     3115  echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6
     3116echo "configure:3117: checking whether canonicalize_file_name must be declared" >&5
     3117if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then
     3118  echo $ac_n "(cached) $ac_c" 1>&6
     3119else
     3120  cat > conftest.$ac_ext <<EOF
     3121#line 3122 "configure"
     3122#include "confdefs.h"
     3123
     3124#include "confdefs.h"
     3125#include <stdio.h>
     3126#ifdef HAVE_STRING_H
     3127#include <string.h>
     3128#else
     3129#ifdef HAVE_STRINGS_H
     3130#include <strings.h>
     3131#endif
     3132#endif
     3133#ifdef HAVE_STDLIB_H
     3134#include <stdlib.h>
     3135#endif
     3136#ifdef HAVE_UNISTD_H
     3137#include <unistd.h>
     3138#endif
     3139int main() {
     3140char *(*pfn) = (char *(*)) canonicalize_file_name
     3141; return 0; }
     3142EOF
     3143if { (eval echo configure:3144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     3144  rm -rf conftest*
     3145  libiberty_cv_decl_needed_canonicalize_file_name=no
     3146else
     3147  echo "configure: failed program was:" >&5
     3148  cat conftest.$ac_ext >&5
     3149  rm -rf conftest*
     3150  libiberty_cv_decl_needed_canonicalize_file_name=yes
     3151fi
     3152rm -f conftest*
     3153fi
     3154
     3155echo "$ac_t""$libiberty_cv_decl_needed_canonicalize_file_name" 1>&6
     3156if test $libiberty_cv_decl_needed_canonicalize_file_name = yes; then
     3157  cat >> confdefs.h <<\EOF
     3158#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1
     3159EOF
     3160
     3161fi
     3162
     3163fi
     3164
     3165# Figure out which version of pexecute to use.
     3166case "${host}" in
     3167     *-*-mingw* | *-*-winnt*)   pexecute=pex-win32.o  ;;
     3168     *-*-msdosdjgpp*)           pexecute=pex-djgpp.o  ;;
     3169     *-*-msdos*)                pexecute=pex-msdos.o  ;;
     3170     *-*-os2-emx*)              pexecute=pex-os2.o    ;;
     3171     *)                         pexecute=pex-unix.o   ;;
     3172esac
     3173
     3174
     3175for ac_hdr in unistd.h
     3176do
     3177ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
     3178echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
     3179echo "configure:3180: checking for $ac_hdr" >&5
     3180if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
     3181  echo $ac_n "(cached) $ac_c" 1>&6
     3182else
     3183  cat > conftest.$ac_ext <<EOF
     3184#line 3185 "configure"
     3185#include "confdefs.h"
     3186#include <$ac_hdr>
     3187EOF
     3188ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
     3189{ (eval echo configure:3190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     3190ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
     3191if test -z "$ac_err"; then
     3192  rm -rf conftest*
     3193  eval "ac_cv_header_$ac_safe=yes"
     3194else
     3195  echo "$ac_err" >&5
     3196  echo "configure: failed program was:" >&5
     3197  cat conftest.$ac_ext >&5
     3198  rm -rf conftest*
     3199  eval "ac_cv_header_$ac_safe=no"
     3200fi
     3201rm -f conftest*
     3202fi
     3203if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
     3204  echo "$ac_t""yes" 1>&6
     3205    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
     3206  cat >> confdefs.h <<EOF
     3207#define $ac_tr_hdr 1
     3208EOF
     3209 
     3210else
     3211  echo "$ac_t""no" 1>&6
     3212fi
     3213done
     3214
     3215for ac_func in getpagesize
     3216do
     3217echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
     3218echo "configure:3219: checking for $ac_func" >&5
     3219if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
     3220  echo $ac_n "(cached) $ac_c" 1>&6
     3221else
     3222  cat > conftest.$ac_ext <<EOF
     3223#line 3224 "configure"
     3224#include "confdefs.h"
     3225/* System header to define __stub macros and hopefully few prototypes,
     3226    which can conflict with char $ac_func(); below.  */
     3227#include <assert.h>
     3228/* Override any gcc2 internal prototype to avoid an error.  */
     3229/* We use char because int might match the return type of a gcc2
     3230    builtin and then its argument prototype would still apply.  */
     3231char $ac_func();
     3232
     3233int main() {
     3234
     3235/* The GNU C library defines this for functions which it implements
     3236    to always fail with ENOSYS.  Some functions are actually named
     3237    something starting with __ and the normal name is an alias.  */
     3238#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
     3239choke me
     3240#else
     3241$ac_func();
     3242#endif
     3243
     3244; return 0; }
     3245EOF
     3246if { (eval echo configure:3247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3247  rm -rf conftest*
     3248  eval "ac_cv_func_$ac_func=yes"
     3249else
     3250  echo "configure: failed program was:" >&5
     3251  cat conftest.$ac_ext >&5
     3252  rm -rf conftest*
     3253  eval "ac_cv_func_$ac_func=no"
     3254fi
     3255rm -f conftest*
     3256fi
     3257
     3258if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
     3259  echo "$ac_t""yes" 1>&6
     3260    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
     3261  cat >> confdefs.h <<EOF
     3262#define $ac_tr_func 1
     3263EOF
     3264 
     3265else
     3266  echo "$ac_t""no" 1>&6
     3267fi
     3268done
     3269
    28173270echo $ac_n "checking for working mmap""... $ac_c" 1>&6
    2818 echo "configure:2819: checking for working mmap" >&5
     3271echo "configure:3272: checking for working mmap" >&5
    28193272if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
    28203273  echo $ac_n "(cached) $ac_c" 1>&6
     
    28243277else
    28253278  cat > conftest.$ac_ext <<EOF
    2826 #line 2827 "configure"
     3279#line 3280 "configure"
    28273280#include "confdefs.h"
    28283281
     
    29643417
    29653418EOF
    2966 if { (eval echo configure:2967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3419if { (eval echo configure:3420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    29673420then
    29683421  ac_cv_func_mmap_fixed_mapped=yes
     
    29883441
    29893442echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
    2990 echo "configure:2991: checking for working strncmp" >&5
     3443echo "configure:3444: checking for working strncmp" >&5
    29913444if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
    29923445  echo $ac_n "(cached) $ac_c" 1>&6
     
    29963449else
    29973450  cat > conftest.$ac_ext <<EOF
    2998 #line 2999 "configure"
     3451#line 3452 "configure"
    29993452#include "confdefs.h"
    30003453
     
    30413494                     MAP_ANON|MAP_PRIVATE, dev_zero, 0);
    30423495  if (p == (char *)-1)
     3496    p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
     3497                       MAP_ANON|MAP_PRIVATE, -1, 0);
     3498  if (p == (char *)-1)
    30433499    exit (2);
    30443500  else
     
    30573513
    30583514EOF
    3059 if { (eval echo configure:3060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3515if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    30603516then
    30613517  ac_cv_func_strncmp_works=yes
     
    32213677s%@infodir@%$infodir%g
    32223678s%@mandir@%$mandir%g
     3679s%@libiberty_topdir@%$libiberty_topdir%g
     3680s%@MAINT@%$MAINT%g
     3681s%@NOTMAINT@%$NOTMAINT%g
     3682s%@MAKEINFO@%$MAKEINFO%g
     3683s%@BUILD_INFO@%$BUILD_INFO%g
     3684s%@PERL@%$PERL%g
     3685s%@HAVE_PERL@%$HAVE_PERL%g
    32233686s%@host@%$host%g
    32243687s%@host_alias@%$host_alias%g
     
    32353698s%@CC@%$CC%g
    32363699s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
     3700s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g
     3701s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g
    32373702s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
    32383703s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
     
    32423707s%@CPP@%$CPP%g
    32433708s%@CHECK@%$CHECK%g
     3709s%@target_header_dir@%$target_header_dir%g
    32443710s%@LIBOBJS@%$LIBOBJS%g
    3245 s%@ALLOCA@%$ALLOCA%g
     3711s%@pexecute@%$pexecute%g
    32463712s%@INSTALL_DEST@%$INSTALL_DEST%g
    32473713
     
    34583924target=${target}
    34593925with_target_subdir=${with_target_subdir}
     3926with_build_subdir=${with_build_subdir}
    34603927with_multisubdir=${with_multisubdir}
    34613928ac_configure_args="--enable-multilib ${ac_configure_args}"
    34623929CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
     3930ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
    34633931libiberty_topdir=${libiberty_topdir}
    34643932
     
    34673935test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
    34683936if test -n "$CONFIG_FILES"; then
    3469   if test -n "${with_target_subdir}"; then
     3937  if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
    34703938    # FIXME: We shouldn't need to set ac_file
    34713939    ac_file=Makefile
     3940    LD="${ORIGINAL_LD_FOR_MULTILIBS}"
    34723941    . ${libiberty_topdir}/config-ml.in
    34733942  fi
  • branches/GNU/src/binutils/libiberty/configure.in

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22
    33AC_PREREQ(2.13)
    4 AC_INIT(pexecute.c)
     4AC_INIT(xmalloc.c)
     5
     6# This works around the fact that libtool configuration may change LD
     7# for this particular configuration, but some shells, instead of
     8# keeping the changes in LD private, export them just because LD is
     9# exported.  We don't use libtool yet, but some day we might, so...
     10ORIGINAL_LD_FOR_MULTILIBS=$LD
    511
    612dnl We use these options to decide which functions to include.
    713AC_ARG_WITH(target-subdir,
    8 [  --with-target-subdir=SUBDIR      Configuring in a subdirectory])
     14[  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target])
     15AC_ARG_WITH(build-subdir,
     16[  --with-build-subdir=SUBDIR       Configuring in a subdirectory for build])
    917AC_ARG_WITH(cross-host,
    1018[  --with-cross-host=HOST           Configuring with a cross compiler])
     
    1321
    1422if test "${srcdir}" = "."; then
    15   if test -z "${with_target_subdir}"; then
     23  if test -n "${with_build_subdir}"; then
     24    libiberty_topdir="${srcdir}/../.."
     25    with_target_subdir=
     26  elif test -z "${with_target_subdir}"; then
    1627    libiberty_topdir="${srcdir}/.."
    1728  else
     
    2536  libiberty_topdir="${srcdir}/.."
    2637fi
     38AC_SUBST(libiberty_topdir)
    2739AC_CONFIG_AUX_DIR($libiberty_topdir)
     40
     41dnl Very limited version of automake's enable-maintainer-mode
     42
     43AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
     44  dnl maintainer-mode is disabled by default
     45  AC_ARG_ENABLE(maintainer-mode,
     46[  --enable-maintainer-mode
     47                          enable make rules and dependencies not useful
     48                          (and sometimes confusing) to the casual installer],
     49      maintainer_mode=$enableval,
     50      maintainer_mode=no)
     51
     52AC_MSG_RESULT($maintainer_mode)
     53
     54if test "$maintainer_mode" = "yes"; then
     55  MAINT=''
     56  NOTMAINT='#'
     57else
     58  MAINT='#'
     59  NOTMAINT=''
     60fi
     61AC_SUBST(MAINT)dnl
     62AC_SUBST(NOTMAINT)dnl
     63
     64# Do we have a single-tree copy of texinfo?  Even if we do, we can't
     65# rely on it - libiberty is built before texinfo.
     66AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
     67if test "x$MAKEINFO" = "x"; then
     68    MAKEINFO="@echo makeinfo missing; true"
     69    BUILD_INFO=
     70else
     71    BUILD_INFO=info
     72    case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
     73      x*\ [[1-3]].* )
     74        MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
     75        BUILD_INFO=
     76        AC_MSG_WARN([
     77*** Makeinfo is too old. Info documentation will not be built.])
     78        ;;
     79    esac
     80fi
     81AC_SUBST(MAKEINFO)
     82AC_SUBST(BUILD_INFO)
     83
     84AC_CHECK_PROG(PERL, perl, perl, )
     85if test x"$PERL" = x""; then
     86  HAVE_PERL='#'
     87else
     88  HAVE_PERL=''
     89fi
     90AC_SUBST(HAVE_PERL)
    2891
    2992AC_CANONICAL_HOST
     
    39102LIB_AC_PROG_CC
    40103
     104AC_PROG_CC_C_O
     105# autoconf is lame and doesn't give us any substitution variable for this.
     106if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
     107  NO_MINUS_C_MINUS_O=yes
     108else
     109  OUTPUT_OPTION='-o $@'
     110fi
     111AC_SUBST(NO_MINUS_C_MINUS_O)
     112AC_SUBST(OUTPUT_OPTION)
     113
    41114AC_ISC_POSIX
    42115AC_C_CONST
     
    70143# able to link anything, it had better be able to at least compile
    71144# something.
    72 AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h)
     145AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
    73146AC_HEADER_SYS_WAIT
    74147AC_HEADER_TIME
    75148
    76149libiberty_AC_DECLARE_ERRNO
     150
     151AC_CHECK_TYPE(uintptr_t, unsigned long)
     152# Given the above check, we always have uintptr_t or a fallback
     153# definition.  So define HAVE_UINTPTR_T in case any imported code
     154# relies on it.
     155AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
     156
     157AC_TYPE_PID_T
    77158
    78159# This is the list of functions which libiberty will provide if they
     
    88169funcs="$funcs calloc"
    89170funcs="$funcs clock"
     171funcs="$funcs ffs"
    90172funcs="$funcs getcwd"
    91173funcs="$funcs getpagesize"
     
    96178funcs="$funcs memcpy"
    97179funcs="$funcs memmove"
     180funcs="$funcs mempcpy"
    98181funcs="$funcs memset"
    99182funcs="$funcs mkstemps"
     
    103186funcs="$funcs rindex"
    104187funcs="$funcs setenv"
     188funcs="$funcs snprintf"
    105189funcs="$funcs sigsetmask"
     190funcs="$funcs stpcpy"
     191funcs="$funcs stpncpy"
    106192funcs="$funcs strcasecmp"
    107193funcs="$funcs strchr"
     
    117203funcs="$funcs vfprintf"
    118204funcs="$funcs vprintf"
     205funcs="$funcs vsnprintf"
    119206funcs="$funcs vsprintf"
    120207funcs="$funcs waitpid"
     
    122209# Also in the old function.def file: alloca, vfork, getopt.
    123210
    124 vars="sys_errlist sys_nerr sys_siglist"
     211vars="sys_errlist sys_nerr sys_siglist _system_configuration"
    125212
    126213checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
     214checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
     215checkfuncs="$checkfuncs getsysinfo table sysctl"
    127216
    128217# These are neither executed nor required, but they help keep
     
    131220  AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
    132221  AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
    133   AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
    134   AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
     222  AC_CHECK_FUNCS(memmove mempcpy memset putenv random rename rindex sigsetmask)
     223  AC_CHECK_FUNCS(strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr)
    135224  AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
    136225  AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
    137   AC_CHECK_FUNCS(sysconf times sbrk gettimeofday)
     226  AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs snprintf vsnprintf)
     227  AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl)
     228  AC_CHECK_FUNCS(realpath canonicalize_file_name)
    138229  AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
    139230  AC_DEFINE(HAVE_SYS_NERR,    1, [Define if you have the sys_nerr variable.])
    140231  AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
     232  AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.])
    141233fi
    142234
    143235# For each of these functions, if the host does not provide the
    144236# function we want to put FN.o in LIBOBJS, and if the host does
    145 # provide the function, we want to define HAVE_FN in config.h.  Also,
    146 # if the host does not provide alloca, we set ALLOCA to alloca.o
     237# provide the function, we want to define HAVE_FN in config.h.
    147238
    148239setobjs=
    149240CHECK=
     241target_header_dir=
    150242if test -n "${with_target_subdir}"; then
    151243
     
    159251
    160252  if test "x${with_newlib}" = "xyes"; then
    161     ALLOCA="alloca.o"
    162253    LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
    163254
     
    183274  fi
    184275
     276  # We may wish to install the target headers somewhere.
     277  AC_ARG_ENABLE(install-libiberty,
     278  [  --enable-install-libiberty       Install headers for end users],
     279  enable_install_libiberty=$enableval,
     280  enable_install_libiberty=no)dnl
     281 
     282  # Option parsed, now set things appropriately.
     283  case x"$enable_install_libiberty" in
     284    xyes|x)
     285      target_header_dir=libiberty
     286      ;;
     287    xno)   
     288      target_header_dir=
     289      ;;
     290    *)
     291      # This could be sanity-checked in various ways...
     292      target_header_dir="${enable_install_libiberty}"
     293      ;;
     294  esac
     295
     296
    185297else
    186298
     
    191303
    192304AC_SUBST(CHECK)
     305AC_SUBST(target_header_dir)
     306
     307case "${host}" in
     308  *-*-cygwin* | *-*-mingw*)
     309    AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
     310    AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
     311    ;;
     312esac
    193313
    194314if test -z "${setobjs}"; then
     
    272392    ;;
    273393
     394  *-*-*vms*)
     395    # Under VMS, vfork works very different than on Unix. The standard test
     396    # won't work, and it isn't easily adaptable. It makes more sense to
     397    # just force it.
     398    ac_cv_func_vfork_works=yes
     399    ;;
     400
    274401  esac
    275402
     
    278405  AC_PROG_CC_WORKS
    279406  AC_REPLACE_FUNCS($funcs)
    280 
    281   case "${host}" in
    282   *-*-interix)
    283     # On Interix, it wrongly concludes that the MSVC compiler supports alloca.
    284     # (MSVC does on Win32, not on Interix.)
    285     # This should be temporary.
    286 
    287     ac_cv_header_alloca_h=no
    288     ac_cv_func_alloca_works=no
    289     ALLOCA=alloca.o
    290     cat >> confdefs.h <<\EOF
    291 #define C_ALLOCA 1
    292 EOF
    293     cat >> confdefs.h <<EOF
    294 #define STACK_DIRECTION -1
    295 EOF
    296     ;;
    297   *)
    298     AC_FUNC_ALLOCA
    299     ;;
    300   esac
    301 
     407  libiberty_AC_FUNC_C_ALLOCA
    302408  AC_FUNC_VFORK
    303409  if test $ac_cv_func_vfork_works = no; then
    304410    LIBOBJS="$LIBOBJS vfork.o"
    305411  fi
     412  # We only need _doprnt if we might use it to implement v*printf.
     413  if test $ac_cv_func_vprintf != yes \
     414     || test $ac_cv_func_vfprintf != yes \
     415     || test $ac_cv_func_vsprintf != yes; then
     416    AC_REPLACE_FUNCS(_doprnt)
     417  else
     418    AC_CHECK_FUNCS(_doprnt)
     419  fi
     420
    306421  for v in $vars; do
    307422    AC_MSG_CHECKING([for $v])
    308423    AC_CACHE_VAL(libiberty_cv_var_$v,
    309       [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
     424      [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
    310425                   [eval "libiberty_cv_var_$v=yes"],
    311426                   [eval "libiberty_cv_var_$v=no"])])
     
    319434  done
    320435  AC_CHECK_FUNCS($checkfuncs)
    321 fi
     436  libiberty_NEED_DECLARATION(canonicalize_file_name)
     437fi
     438
     439# Figure out which version of pexecute to use.
     440case "${host}" in
     441     *-*-mingw* | *-*-winnt*)   pexecute=pex-win32.o  ;;
     442     *-*-msdosdjgpp*)           pexecute=pex-djgpp.o  ;;
     443     *-*-msdos*)                pexecute=pex-msdos.o  ;;
     444     *-*-os2-emx*)              pexecute=pex-os2.o    ;;
     445     *)                         pexecute=pex-unix.o   ;;
     446esac
     447AC_SUBST(pexecute)
    322448
    323449libiberty_AC_FUNC_STRNCMP
     
    336462[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
    337463if test -n "$CONFIG_FILES"; then
    338   if test -n "${with_target_subdir}"; then
     464  if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
    339465    # FIXME: We shouldn't need to set ac_file
    340466    ac_file=Makefile
     467    LD="${ORIGINAL_LD_FOR_MULTILIBS}"
    341468    . ${libiberty_topdir}/config-ml.in
    342469  fi
     
    346473target=${target}
    347474with_target_subdir=${with_target_subdir}
     475with_build_subdir=${with_build_subdir}
    348476with_multisubdir=${with_multisubdir}
    349477ac_configure_args="--enable-multilib ${ac_configure_args}"
    350478CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
     479ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
    351480libiberty_topdir=${libiberty_topdir}
    352481)
  • branches/GNU/src/binutils/libiberty/copysign.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    130130#endif
    131131
     132#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN)
    132133
    133 double DEFUN(copysign, (x, y), double x AND double y)
     134double
     135copysign (x, y)
     136     double x, y;
    134137{
    135138  __ieee_double_shape_type a,b;
     
    139142  return a.value;
    140143}
     144
     145#else
     146
     147double
     148copysign (x, y)
     149     double x, y;
     150{
     151  if ((x < 0 && y > 0) || (x > 0 && y < 0))
     152    return -x;
     153  return x;
     154}
     155
     156#endif
  • branches/GNU/src/binutils/libiberty/cp-demangle.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Demangler for IA64 / g++ V3 ABI.
    2    Copyright (C) 2000 Free Software Foundation, Inc.
     2   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    33   Written by Alex Samuel <samuel@codesourcery.com>.
    44
     
    99   the Free Software Foundation; either version 2 of the License, or
    1010   (at your option) any later version.
     11
     12   In addition to the permissions in the GNU General Public License, the
     13   Free Software Foundation gives you unlimited permission to link the
     14   compiled version of this file into combinations with other programs,
     15   and to distribute those combinations without any restriction coming
     16   from the use of this file.  (The General Public License restrictions
     17   do apply in other respects; for example, they cover modification of
     18   the file, and distribution when not linked into a combined
     19   executable.)
    1120
    1221   This program is distributed in the hope that it will be useful,
     
    4251#include <string.h>
    4352#endif
     53
     54#include <ctype.h>
    4455
    4556#include "ansidecl.h"
     
    6980#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_"
    7081
     82/* Character(s) to use for namespace separation in demangled output */
     83#define NAMESPACE_SEPARATOR (dm->style == DMGL_JAVA ? "." : "::")
     84
    7185/* If flag_verbose is zero, some simplifications will be made to the
    7286   output to make it easier to read and supress details that are
     
    167181  /* The most recently demangled source-name.  */
    168182  dyn_string_t last_source_name;
     183 
     184  /* Language style to use for demangled output. */
     185  int style;
     186
     187  /* Set to non-zero iff this name is a constructor.  The actual value
     188     indicates what sort of constructor this is; see demangle.h.  */
     189  enum gnu_v3_ctor_kinds is_constructor;
     190
     191  /* Set to non-zero iff this name is a destructor.  The actual value
     192     indicates what sort of destructor this is; see demangle.h.  */
     193  enum gnu_v3_dtor_kinds is_destructor;
     194
    169195};
    170196
     
    241267  PARAMS ((demangling_t));
    242268static demangling_t demangling_new
    243   PARAMS ((const char *));
     269  PARAMS ((const char *, int));
    244270static void demangling_delete
    245271  PARAMS ((demangling_t));
     
    410436    {
    411437      string_list_t next = node->next;
    412       free (node);
     438      dyn_string_delete ((dyn_string_t) node);
    413439      node = next;
    414440    }
     
    784810
    785811static demangling_t
    786 demangling_new (name)
     812demangling_new (name, style)
    787813     const char *name;
     814     int style;
    788815{
    789816  demangling_t dm;
     
    808835      return NULL;
    809836    }
     837  dm->style = style;
     838  dm->is_constructor = (enum gnu_v3_ctor_kinds) 0;
     839  dm->is_destructor = (enum gnu_v3_dtor_kinds) 0;
    810840
    811841  return dm;
     
    871901  PARAMS ((demangling_t, int, dyn_string_t));
    872902static status_t demangle_operator_name
    873   PARAMS ((demangling_t, int, int *));
     903  PARAMS ((demangling_t, int, int *, int *));
    874904static status_t demangle_nv_offset
    875905  PARAMS ((demangling_t));
     
    919949  PARAMS ((demangling_t, int));
    920950static status_t cp_demangle
    921   PARAMS ((const char *, dyn_string_t));
    922 #ifdef IN_LIBGCC2
     951  PARAMS ((const char *, dyn_string_t, int));
    923952static status_t cp_demangle_type
    924953  PARAMS ((const char*, dyn_string_t));
    925 #endif
    926954
    927955/* When passed to demangle_bare_function_type, indicates that the
     
    947975    {
    948976      if (error_message == NULL)
    949         error_message = strdup ("Expected ?");
     977        error_message = (char *) strdup ("Expected ?");
    950978      error_message[9] = c;
    951979      return error_message;
     
    12231251          /* We have another level of scope qualification.  */
    12241252          if (nested)
    1225             RETURN_IF_ERROR (result_add (dm, "::"));
     1253            RETURN_IF_ERROR (result_add (dm, NAMESPACE_SEPARATOR));
    12261254          else
    12271255            nested = 1;
     
    13001328        *suppress_return_type = 1;
    13011329
    1302       RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args));
     1330      RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args, NULL));
    13031331    }
    13041332  else if (peek == 'C' || peek == 'D')
     
    14411469  while (length-- > 0)
    14421470    {
     1471      int ch;
    14431472      if (end_of_name_p (dm))
    14441473        return "Unexpected end of name in <identifier>.";
    1445       if (!dyn_string_append_char (identifier, next_char (dm)))
     1474      ch = next_char (dm);
     1475
     1476      /* Handle extended Unicode characters.  We encode them as __U{hex}_,
     1477         where {hex} omits leading 0's.  For instance, '$' is encoded as
     1478         "__U24_".  */
     1479      if (ch == '_'
     1480          && peek_char (dm) == '_'
     1481          && peek_char_next (dm) == 'U')
     1482        {
     1483          char buf[10];
     1484          int pos = 0;
     1485          advance_char (dm); advance_char (dm); length -= 2;
     1486          while (length-- > 0)
     1487            {
     1488              ch = next_char (dm);
     1489              if (!isxdigit (ch))
     1490                break;
     1491              buf[pos++] = ch;
     1492            }
     1493          if (ch != '_' || length < 0)
     1494            return STATUS_ERROR;
     1495          if (pos == 0)
     1496            {
     1497              /* __U_ just means __U.  */
     1498              if (!dyn_string_append_cstr (identifier, "__U"))
     1499                return STATUS_ALLOCATION_FAILED;
     1500              continue;
     1501            }
     1502          else
     1503            {
     1504              buf[pos] = '\0';
     1505              ch = strtol (buf, 0, 16);
     1506            }
     1507        }
     1508
     1509      if (!dyn_string_append_char (identifier, ch))
    14461510        return STATUS_ALLOCATION_FAILED;
    14471511    }
     
    14761540   the short form is emitted; otherwise the full source form
    14771541   (`operator +' etc.) is emitted.  *NUM_ARGS is set to the number of
    1478    operands that the operator takes. 
     1542   operands that the operator takes.  If TYPE_ARG is non-NULL,
     1543   *TYPE_ARG is set to 1 if the first argument is a type and 0
     1544   otherwise.
    14791545
    14801546    <operator-name>
     
    15261592                  ::= ix        # []           
    15271593                  ::= qu        # ?
    1528                   ::= sz        # sizeof
     1594                  ::= st        # sizeof (a type)
     1595                  ::= sz        # sizeof (an expression)
    15291596                  ::= cv <type> # cast       
    15301597                  ::= v [0-9] <source-name>  # vendor extended operator  */
    15311598
    15321599static status_t
    1533 demangle_operator_name (dm, short_name, num_args)
     1600demangle_operator_name (dm, short_name, num_args, type_arg)
    15341601     demangling_t dm;
    15351602     int short_name;
    15361603     int *num_args;
     1604     int *type_arg;
    15371605{
    15381606  struct operator_code
    15391607  {
    15401608    /* The mangled code for this operator.  */
    1541     const char *code;
     1609    const char *const code;
    15421610    /* The source name of this operator.  */
    1543     const char *name;
     1611    const char *const name;
    15441612    /* The number of arguments this operator takes.  */
    1545     int num_args;
     1613    const int num_args;
    15461614  };
    15471615
     
    16081676  DEMANGLE_TRACE ("operator-name", dm);
    16091677
     1678  /* Assume the first argument is not a type.  */
     1679  if (type_arg)
     1680    *type_arg = 0;
     1681
    16101682  /* Is this a vendor-extended operator?  */
    16111683  if (c0 == 'v' && IS_DIGIT (c1))
     
    16241696      RETURN_IF_ERROR (demangle_type (dm));
    16251697      *num_args = 0;
     1698      return STATUS_OK;
     1699    }
     1700
     1701  /* Is it the sizeof variant that takes a type?  */
     1702  if (c0 == 's' && c1 == 't')
     1703    {
     1704      RETURN_IF_ERROR (result_add (dm, " sizeof"));
     1705      *num_args = 1;
     1706      if (type_arg)
     1707        *type_arg = 1;
    16261708      return STATUS_OK;
    16271709    }
     
    18241906  if (peek == 'G')
    18251907    {
    1826       /* A guard variable name.  Consume the G.  */
     1908      /* Consume the G.  */
    18271909      advance_char (dm);
    1828       RETURN_IF_ERROR (demangle_char (dm, 'V'));
    1829       RETURN_IF_ERROR (result_add (dm, "guard variable for "));
    1830       RETURN_IF_ERROR (demangle_name (dm, &unused));
     1910      switch (peek_char (dm))
     1911        {
     1912        case 'V':
     1913          /* A guard variable name.  */
     1914          advance_char (dm);
     1915          RETURN_IF_ERROR (result_add (dm, "guard variable for "));
     1916          RETURN_IF_ERROR (demangle_name (dm, &unused));
     1917          break;
     1918
     1919        case 'R':
     1920          /* A reference temporary.  */
     1921          advance_char (dm);
     1922          RETURN_IF_ERROR (result_add (dm, "reference temporary for "));
     1923          RETURN_IF_ERROR (demangle_name (dm, &unused));
     1924          break;
     1925         
     1926        default:
     1927          return "Unrecognized <special-name>.";
     1928        }
    18311929    }
    18321930  else if (peek == 'T')
     
    20112109      /* A constructor name.  Consume the C.  */
    20122110      advance_char (dm);
    2013       if (peek_char (dm) < '1' || peek_char (dm) > '3')
     2111      flavor = next_char (dm);
     2112      if (flavor < '1' || flavor > '3')
    20142113        return "Unrecognized constructor.";
    20152114      RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
     2115      switch (flavor)
     2116        {
     2117        case '1': dm->is_constructor = gnu_v3_complete_object_ctor;
     2118          break;
     2119        case '2': dm->is_constructor = gnu_v3_base_object_ctor;
     2120          break;
     2121        case '3': dm->is_constructor = gnu_v3_complete_object_allocating_ctor;
     2122          break;
     2123        }
    20162124      /* Print the flavor of the constructor if in verbose mode.  */
    2017       flavor = next_char (dm) - '1';
    20182125      if (flag_verbose)
    20192126        {
    20202127          RETURN_IF_ERROR (result_add (dm, "["));
    2021           RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor]));
     2128          RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor - '1']));
    20222129          RETURN_IF_ERROR (result_add_char (dm, ']'));
    20232130        }
     
    20272134      /* A destructor name.  Consume the D.  */
    20282135      advance_char (dm);
    2029       if (peek_char (dm) < '0' || peek_char (dm) > '2')
     2136      flavor = next_char (dm);
     2137      if (flavor < '0' || flavor > '2')
    20302138        return "Unrecognized destructor.";
    20312139      RETURN_IF_ERROR (result_add_char (dm, '~'));
    20322140      RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
     2141      switch (flavor)
     2142        {
     2143        case '0': dm->is_destructor = gnu_v3_deleting_dtor;
     2144          break;
     2145        case '1': dm->is_destructor = gnu_v3_complete_object_dtor;
     2146          break;
     2147        case '2': dm->is_destructor = gnu_v3_base_object_dtor;
     2148          break;
     2149        }
    20332150      /* Print the flavor of the destructor if in verbose mode.  */
    2034       flavor = next_char (dm) - '0';
    20352151      if (flag_verbose)
    20362152        {
    20372153          RETURN_IF_ERROR (result_add (dm, " ["));
    2038           RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor]));
     2154          RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor - '0']));
    20392155          RETURN_IF_ERROR (result_add_char (dm, ']'));
    20402156        }
     
    20942210                                          substitution_start));
    20952211      /* Insert an asterisk where we're told to; it doesn't
    2096          necessarily go at the end.  */
    2097       RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*'));
     2212         necessarily go at the end.  If we're doing Java style output,
     2213         there is no pointer symbol.  */
     2214      if (dm->style != DMGL_JAVA)
     2215        RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*'));
    20982216      /* The next (outermost) pointer or reference character should go
    20992217         after this one.  */
     
    24702588};
    24712589
     2590/* Java source names of builtin types.  Types that arn't valid in Java
     2591   are also included here - we don't fail if someone attempts to demangle a
     2592   C++ symbol in Java style. */
     2593static const char *const java_builtin_type_names[26] =
     2594{
     2595  "signed char",                /* a */
     2596  "boolean", /* C++ "bool" */   /* b */
     2597  "byte", /* C++ "char" */      /* c */
     2598  "double",                     /* d */
     2599  "long double",                /* e */
     2600  "float",                      /* f */
     2601  "__float128",                 /* g */
     2602  "unsigned char",              /* h */
     2603  "int",                        /* i */
     2604  "unsigned",                   /* j */
     2605  NULL,                         /* k */
     2606  "long",                       /* l */
     2607  "unsigned long",              /* m */
     2608  "__int128",                   /* n */
     2609  "unsigned __int128",          /* o */
     2610  NULL,                         /* p */
     2611  NULL,                         /* q */
     2612  NULL,                         /* r */
     2613  "short",                      /* s */
     2614  "unsigned short",             /* t */
     2615  NULL,                         /* u */
     2616  "void",                       /* v */
     2617  "char", /* C++ "wchar_t" */   /* w */
     2618  "long", /* C++ "long long" */ /* x */
     2619  "unsigned long long",         /* y */
     2620  "..."                         /* z */
     2621};
     2622
    24722623/* Demangles and emits a <builtin-type>. 
    24732624
     
    25122663  else if (code >= 'a' && code <= 'z')
    25132664    {
    2514       const char *type_name = builtin_type_names[code - 'a'];
     2665      const char *type_name;
     2666      /* Java uses different names for some built-in types. */
     2667      if (dm->style == DMGL_JAVA)
     2668        type_name = java_builtin_type_names[code - 'a'];
     2669      else
     2670        type_name = builtin_type_names[code - 'a'];
    25152671      if (type_name == NULL)
    25162672        return "Unrecognized <builtin-type> code.";
     
    30553211    {
    30563212      int num_args;
     3213      int type_arg;
    30573214      status_t status = STATUS_OK;
    30583215      dyn_string_t operator_name;
     
    30623219         first.  */
    30633220      RETURN_IF_ERROR (result_push (dm));
    3064       RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args));
     3221      RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args,
     3222                                               &type_arg));
    30653223      operator_name = (dyn_string_t) result_pop (dm);
    30663224
     
    30833241      /* Emit its second (if binary) or only (if unary) operand.  */
    30843242      RETURN_IF_ERROR (result_add_char (dm, '('));
    3085       RETURN_IF_ERROR (demangle_expression (dm));
     3243      if (type_arg)
     3244        RETURN_IF_ERROR (demangle_type (dm));
     3245      else
     3246        RETURN_IF_ERROR (demangle_expression (dm));
    30863247      RETURN_IF_ERROR (result_add_char (dm, ')'));
    30873248
     
    33703531               less than the discriminator ordinal, counting from
    33713532               zero.  */
    3372             RETURN_IF_ERROR (int_to_dyn_string (discriminator + 2,
     3533            RETURN_IF_ERROR (int_to_dyn_string (discriminator + 1,
    33733534                                                (dyn_string_t) dm->result));
    33743535        }
    33753536      else
    3376         {
    3377           if (flag_verbose)
    3378             /* A missing digit correspond to one.  */
    3379             RETURN_IF_ERROR (result_add_char (dm, '1'));
    3380         }
     3537        return STATUS_ERROR;
    33813538      if (flag_verbose)
    33823539        RETURN_IF_ERROR (result_add_char (dm, ']'));
     
    33963553
    33973554static status_t
    3398 cp_demangle (name, result)
     3555cp_demangle (name, result, style)
    33993556     const char *name;
    34003557     dyn_string_t result;
     3558     int style;
    34013559{
    34023560  status_t status;
     
    34053563  if (length > 2 && name[0] == '_' && name[1] == 'Z')
    34063564    {
    3407       demangling_t dm = demangling_new (name);
     3565      demangling_t dm = demangling_new (name, style);
    34083566      if (dm == NULL)
    34093567        return STATUS_ALLOCATION_FAILED;
     
    34443602   an error message, and the contents of RESULT are unchanged.  */
    34453603
    3446 #ifdef IN_LIBGCC2
    34473604static status_t
    34483605cp_demangle_type (type_name, result)
     
    34513608{
    34523609  status_t status;
    3453   demangling_t dm = demangling_new (type_name);
     3610  demangling_t dm = demangling_new (type_name, DMGL_GNU_V3);
    34543611 
    34553612  if (dm == NULL)
     
    34823639}
    34833640
     3641#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
    34843642extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
    34853643
     
    35523710    /* MANGLED_NAME apprears to be a function or variable name.
    35533711       Demangle it accordingly.  */
    3554     result = cp_demangle (mangled_name, &demangled_name);
     3712    result = cp_demangle (mangled_name, &demangled_name, 0);
    35553713  else
    35563714    /* Try to demangled MANGLED_NAME as the name of a type.  */
     
    35893747}
    35903748
    3591 #else /* !IN_LIBGCC2 */
     3749#else /* ! (IN_LIBGCC2 || IN_GLIBCPP_V3) */
    35923750
    35933751/* Variant entry point for integration with the existing cplus-dem
     
    35983756
    35993757char *
    3600 cplus_demangle_v3 (mangled)
     3758cplus_demangle_v3 (mangled, options)
    36013759     const char* mangled;
     3760     int options;
    36023761{
    36033762  dyn_string_t demangled;
    36043763  status_t status;
    3605 
    3606   /* If this isn't a mangled name, don't pretend to demangle it.  */
    3607   if (strncmp (mangled, "_Z", 2) != 0)
    3608     return NULL;
     3764  int type = !!(options & DMGL_TYPES);
     3765
     3766  if (mangled[0] == '_' && mangled[1] == 'Z')
     3767    /* It is not a type.  */
     3768    type = 0;
     3769  else
     3770    {
     3771      /* It is a type. Stop if we don't want to demangle types. */
     3772      if (!type)
     3773        return NULL;
     3774    }
     3775
     3776  flag_verbose = !!(options & DMGL_VERBOSE);
    36093777
    36103778  /* Create a dyn_string to hold the demangled name.  */
    36113779  demangled = dyn_string_new (0);
    36123780  /* Attempt the demangling.  */
    3613   status = cp_demangle ((char *) mangled, demangled);
     3781  if (!type)
     3782    /* Appears to be a function or variable name.  */
     3783    status = cp_demangle (mangled, demangled, 0);
     3784  else
     3785    /* Try to demangle it as the name of a type.  */
     3786    status = cp_demangle_type (mangled, demangled);
    36143787
    36153788  if (STATUS_NO_ERROR (status))
     
    36353808}
    36363809
    3637 #endif /* IN_LIBGCC2 */
     3810/* Demangle a Java symbol.  Java uses a subset of the V3 ABI C++ mangling
     3811   conventions, but the output formatting is a little different.
     3812   This instructs the C++ demangler not to emit pointer characters ("*"), and
     3813   to use Java's namespace separator symbol ("." instead of "::").  It then
     3814   does an additional pass over the demangled output to replace instances
     3815   of JArray<TYPE> with TYPE[].  */
     3816
     3817char *
     3818java_demangle_v3 (mangled)
     3819     const char* mangled;
     3820{
     3821  dyn_string_t demangled;
     3822  char *next;
     3823  char *end;
     3824  int len;
     3825  status_t status;
     3826  int nesting = 0;
     3827  char *cplus_demangled;
     3828  char *return_value;
     3829   
     3830  /* Create a dyn_string to hold the demangled name.  */
     3831  demangled = dyn_string_new (0);
     3832
     3833  /* Attempt the demangling.  */
     3834  status = cp_demangle ((char *) mangled, demangled, DMGL_JAVA);
     3835
     3836  if (STATUS_NO_ERROR (status))
     3837    /* Demangling succeeded.  */
     3838    {
     3839      /* Grab the demangled result from the dyn_string. */
     3840      cplus_demangled = dyn_string_release (demangled);
     3841    }
     3842  else if (status == STATUS_ALLOCATION_FAILED)
     3843    {
     3844      fprintf (stderr, "Memory allocation failed.\n");
     3845      abort ();
     3846    }
     3847  else
     3848    /* Demangling failed.  */
     3849    {
     3850      dyn_string_delete (demangled);
     3851      return NULL;
     3852    }
     3853 
     3854  len = strlen (cplus_demangled);
     3855  next = cplus_demangled;
     3856  end = next + len;
     3857  demangled = NULL;
     3858
     3859  /* Replace occurances of JArray<TYPE> with TYPE[]. */
     3860  while (next < end)
     3861    {
     3862      char *open_str = strstr (next, "JArray<");
     3863      char *close_str = NULL;
     3864      if (nesting > 0)
     3865        close_str = strchr (next, '>');
     3866   
     3867      if (open_str != NULL && (close_str == NULL || close_str > open_str))
     3868        {
     3869          ++nesting;
     3870         
     3871          if (!demangled)
     3872            demangled = dyn_string_new(len);
     3873
     3874          /* Copy prepending symbols, if any. */
     3875          if (open_str > next)
     3876            {
     3877              open_str[0] = 0;
     3878              dyn_string_append_cstr (demangled, next);
     3879            }     
     3880          next = open_str + 7;
     3881        }
     3882      else if (close_str != NULL)
     3883        {
     3884          --nesting;
     3885         
     3886          /* Copy prepending type symbol, if any. Squash any spurious
     3887             whitespace. */
     3888          if (close_str > next && next[0] != ' ')
     3889            {
     3890              close_str[0] = 0;
     3891              dyn_string_append_cstr (demangled, next);
     3892            }
     3893          dyn_string_append_cstr (demangled, "[]");       
     3894          next = close_str + 1;
     3895        }
     3896      else
     3897        {
     3898          /* There are no more arrays. Copy the rest of the symbol, or
     3899             simply return the original symbol if no changes were made. */
     3900          if (next == cplus_demangled)
     3901            return cplus_demangled;
     3902
     3903          dyn_string_append_cstr (demangled, next);
     3904          next = end;
     3905        }
     3906    }
     3907
     3908  free (cplus_demangled);
     3909 
     3910  if (demangled)
     3911    return_value = dyn_string_release (demangled);
     3912  else
     3913    return_value = NULL;
     3914
     3915  return return_value;
     3916}
     3917
     3918#endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */
     3919
     3920
     3921#ifndef IN_GLIBCPP_V3
     3922/* Demangle NAME in the G++ V3 ABI demangling style, and return either
     3923   zero, indicating that some error occurred, or a demangling_t
     3924   holding the results.  */
     3925static demangling_t
     3926demangle_v3_with_details (name)
     3927     const char *name;
     3928{
     3929  demangling_t dm;
     3930  status_t status;
     3931
     3932  if (strncmp (name, "_Z", 2))
     3933    return 0;
     3934
     3935  dm = demangling_new (name, DMGL_GNU_V3);
     3936  if (dm == NULL)
     3937    {
     3938      fprintf (stderr, "Memory allocation failed.\n");
     3939      abort ();
     3940    }
     3941
     3942  status = result_push (dm);
     3943  if (! STATUS_NO_ERROR (status))
     3944    {
     3945      demangling_delete (dm);
     3946      fprintf (stderr, "%s\n", status);
     3947      abort ();
     3948    }
     3949
     3950  status = demangle_mangled_name (dm);
     3951  if (STATUS_NO_ERROR (status))
     3952    return dm;
     3953
     3954  demangling_delete (dm);
     3955  return 0;
     3956}
     3957
     3958
     3959/* Return non-zero iff NAME is the mangled form of a constructor name
     3960   in the G++ V3 ABI demangling style.  Specifically, return:
     3961   - '1' if NAME is a complete object constructor,
     3962   - '2' if NAME is a base object constructor, or
     3963   - '3' if NAME is a complete object allocating constructor.  */
     3964enum gnu_v3_ctor_kinds
     3965is_gnu_v3_mangled_ctor (name)
     3966     const char *name;
     3967{
     3968  demangling_t dm = demangle_v3_with_details (name);
     3969
     3970  if (dm)
     3971    {
     3972      enum gnu_v3_ctor_kinds result = dm->is_constructor;
     3973      demangling_delete (dm);
     3974      return result;
     3975    }
     3976  else
     3977    return (enum gnu_v3_ctor_kinds) 0;
     3978}
     3979
     3980
     3981/* Return non-zero iff NAME is the mangled form of a destructor name
     3982   in the G++ V3 ABI demangling style.  Specifically, return:
     3983   - '0' if NAME is a deleting destructor,
     3984   - '1' if NAME is a complete object destructor, or
     3985   - '2' if NAME is a base object destructor.  */
     3986enum gnu_v3_dtor_kinds
     3987is_gnu_v3_mangled_dtor (name)
     3988     const char *name;
     3989{
     3990  demangling_t dm = demangle_v3_with_details (name);
     3991
     3992  if (dm)
     3993    {
     3994      enum gnu_v3_dtor_kinds result = dm->is_destructor;
     3995      demangling_delete (dm);
     3996      return result;
     3997    }
     3998  else
     3999    return (enum gnu_v3_dtor_kinds) 0;
     4000}
     4001#endif /* IN_GLIBCPP_V3 */
     4002
    36384003
    36394004#ifdef STANDALONE_DEMANGLER
     
    36704035
    36714036/* Option specification for getopt_long.  */
    3672 static struct option long_options[] =
     4037static const struct option long_options[] =
    36734038{
    36744039  { "help",    no_argument, NULL, 'h' },
     
    37724137
    37734138          /* Attempt to demangle the name.  */
    3774           status = cp_demangle (dyn_string_buf (mangled), demangled);
     4139          status = cp_demangle (dyn_string_buf (mangled), demangled, 0);
    37754140
    37764141          /* If the demangling succeeded, great!  Print out the
     
    38114176        {
    38124177          /* Attempt to demangle.  */
    3813           status = cp_demangle (argv[i], result);
     4178          status = cp_demangle (argv[i], result, 0);
    38144179
    38154180          /* If it worked, print the demangled name.  */
     
    38194184          else if (status == STATUS_ALLOCATION_FAILED)
    38204185            {
    3821               fprintf (stderr, "Memory allocaiton failed.\n");
     4186              fprintf (stderr, "Memory allocation failed.\n");
    38224187              abort ();
    38234188            }
  • branches/GNU/src/binutils/libiberty/cplus-dem.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Demangler for GNU C++
    22   Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999,
    3    2000 Free Software Foundation, Inc.
     3   2000, 2001 Free Software Foundation, Inc.
    44   Written by James Clark (jjc@jclark.uucp)
    55   Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
     
    1111License as published by the Free Software Foundation; either
    1212version 2 of the License, or (at your option) any later version.
     13
     14In addition to the permissions in the GNU Library General Public
     15License, the Free Software Foundation gives you unlimited permission
     16to link the compiled version of this file into combinations with other
     17programs, and to distribute those combinations without any restriction
     18coming from the use of this file.  (The Library Public License
     19restrictions do apply in other respects; for example, they cover
     20modification of the file, and distribution when not linked into a
     21combined executable.)
    1322
    1423Libiberty is distributed in the hope that it will be useful,
     
    6372
    6473extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
    65 
    66 static const char *mystrstr PARAMS ((const char *, const char *));
    67 
    68 static const char *
    69 mystrstr (s1, s2)
    70      const char *s1, *s2;
    71 {
    72   register const char *p = s1;
    73   register int len = strlen (s2);
    74 
    75   for (; (p = strchr (p, *s2)) != 0; p++)
    76     {
    77       if (strncmp (p, s2, len) == 0)
    78         {
    79           return (p);
    80         }
    81     }
    82   return (0);
    83 }
    8474
    8575/* In order to allow a single demangler executable to demangle strings
     
    158148static const struct optable
    159149{
    160   const char *in;
    161   const char *out;
    162   int flags;
     150  const char *const in;
     151  const char *const out;
     152  const int flags;
    163153} optable[] = {
    164154  {"nw",          " new",       DMGL_ANSI},     /* new (1.92,    ansi) */
     
    257247} type_kind_t;
    258248
    259 struct demangler_engine libiberty_demanglers[] =
    260 {
     249const struct demangler_engine libiberty_demanglers[] =
     250{
     251  {
     252    NO_DEMANGLING_STYLE_STRING,
     253    no_demangling,
     254    "Demangling disabled"
     255  }
     256  ,
    261257  {
    262258    AUTO_DEMANGLING_STYLE_STRING,
     
    319315
    320316#define STRING_EMPTY(str)       ((str) -> b == (str) -> p)
    321 #define PREPEND_BLANK(str)      {if (!STRING_EMPTY(str)) \
    322     string_prepend(str, " ");}
    323317#define APPEND_BLANK(str)       {if (!STRING_EMPTY(str)) \
    324318    string_append(str, " ");}
     
    530524
    531525static void
    532 grow_vect PARAMS ((void **, size_t *, size_t, int));
     526grow_vect PARAMS ((char **, size_t *, size_t, int));
    533527
    534528/* Translate count to integer, consuming tokens in the process.
     
    568562      (*type)++;
    569563    }
     564
     565  if (count < 0)
     566    count = -1;
    570567
    571568  return (count);
     
    848845     enum demangling_styles style;
    849846{
    850   struct demangler_engine *demangler = libiberty_demanglers;
     847  const struct demangler_engine *demangler = libiberty_demanglers;
    851848
    852849  for (; demangler->demangling_style != unknown_demangling; ++demangler)
     
    866863     const char *name;
    867864{
    868   struct demangler_engine *demangler = libiberty_demanglers;
     865  const struct demangler_engine *demangler = libiberty_demanglers;
    869866
    870867  for (; demangler->demangling_style != unknown_demangling; ++demangler)
     
    878875
    879876   If MANGLED is a mangled function name produced by GNU C++, then
    880    a pointer to a malloced string giving a C++ representation
     877   a pointer to a @code{malloc}ed string giving a C++ representation
    881878   of the name will be returned; otherwise NULL will be returned.
    882879   It is the caller's responsibility to free the string which
     
    910907  char *ret;
    911908  struct work_stuff work[1];
     909
     910  if (current_demangling_style == no_demangling)
     911    return xstrdup (mangled);
     912
    912913  memset ((char *) work, 0, sizeof (work));
    913914  work->options = options;
     
    918919  if (GNU_V3_DEMANGLING || AUTO_DEMANGLING)
    919920    {
    920       ret = cplus_demangle_v3 (mangled);
     921      ret = cplus_demangle_v3 (mangled, work->options);
    921922      if (ret || GNU_V3_DEMANGLING)
    922923        return ret;
     924    }
     925
     926  if (JAVA_DEMANGLING)
     927    {
     928      ret = java_demangle_v3 (mangled);
     929      if (ret)
     930        return ret;
    923931    }
    924932
     
    938946static void
    939947grow_vect (old_vect, size, min_size, element_size)
    940      void **old_vect;
     948     char **old_vect;
    941949     size_t *size;
    942950     size_t min_size;
     
    948956      if (*size < min_size)
    949957        *size = min_size;
    950       *old_vect = xrealloc (*old_vect, *size * element_size);
     958      *old_vect = (void *) xrealloc (*old_vect, *size * element_size);
    951959    }
    952960}
     
    971979  int at_start_name;
    972980  int changed;
    973   char *demangling_buffer = NULL;
    974   size_t demangling_buffer_size = 0;
     981  size_t demangled_size = 0;
    975982 
    976983  changed = 0;
     
    10001007 
    10011008  /* Make demangled big enough for possible expansion by operator name.  */
    1002   grow_vect ((void **) &(demangling_buffer),
    1003              &demangling_buffer_size,  2 * len0 + 1,
     1009  grow_vect (&demangled,
     1010             &demangled_size,  2 * len0 + 1,
    10041011             sizeof (char));
    1005   demangled = demangling_buffer;
    10061012 
    10071013  if (ISDIGIT ((unsigned char) mangled[len0 - 1])) {
     
    10531059 
    10541060 Suppress:
    1055   grow_vect ((void **) &(demangling_buffer),
    1056              &demangling_buffer_size,  strlen (mangled) + 3,
     1061  grow_vect (&demangled,
     1062             &demangled_size,  strlen (mangled) + 3,
    10571063             sizeof (char));
    1058   demangled = demangling_buffer;
     1064
    10591065  if (mangled[0] == '<')
    10601066     strcpy (demangled, mangled);
     
    10681074   to be able to demangle a name with a B, K or n code, we need to
    10691075   have a longer term memory of what types have been seen. The original
    1070    now intializes and cleans up the squangle code info, while internal
     1076   now initializes and cleans up the squangle code info, while internal
    10711077   calls go directly to this routine to avoid resetting that info. */
    10721078
     
    12081214  if (from->ntmpl_args)
    12091215    to->tmpl_argvec
    1210       = xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));
     1216      = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));
    12111217
    12121218  for (i = 0; i < from->ntmpl_args; i++)
     
    14331439                string_append (&s, SCOPE_STRING (work));
    14341440                string_prepends (declp, &s);
     1441                string_delete (&s);
    14351442              }
    14361443            oldmangled = NULL;
     
    15121519              /* Read the return type. */
    15131520              string return_type;
    1514               string_init (&return_type);
    15151521
    15161522              (*mangled)++;
     
    17871793      /* By default, we let the number decide whether we shall consume an
    17881794         underscore.  */
    1789       int consume_following_underscore = 0;
     1795      int multidigit_without_leading_underscore = 0;
    17901796      int leave_following_underscore = 0;
    17911797
    17921798      success = 0;
    17931799
    1794       /* Negative numbers are indicated with a leading `m'.  */
    1795       if (**mangled == 'm')
    1796         {
    1797           string_appendn (s, "-", 1);
    1798           (*mangled)++;
    1799         }
    1800       else if (mangled[0][0] == '_' && mangled[0][1] == 'm')
    1801         {
    1802           /* Since consume_count_with_underscores does not handle the
    1803              `m'-prefix we must do it here, using consume_count and
    1804              adjusting underscores: we have to consume the underscore
    1805              matching the prepended one.  */
    1806           consume_following_underscore = 1;
    1807           string_appendn (s, "-", 1);
    1808           (*mangled) += 2;
    1809         }
    1810       else if (**mangled == '_')
    1811         {
    1812           /* Do not consume a following underscore;
    1813              consume_following_underscore will consume what should be
    1814              consumed.  */
     1800      if (**mangled == '_')
     1801        {
     1802          if (mangled[0][1] == 'm')
     1803            {
     1804              /* Since consume_count_with_underscores does not handle the
     1805                 `m'-prefix we must do it here, using consume_count and
     1806                 adjusting underscores: we have to consume the underscore
     1807                 matching the prepended one.  */
     1808              multidigit_without_leading_underscore = 1;
     1809              string_appendn (s, "-", 1);
     1810              (*mangled) += 2;
     1811            }
     1812          else
     1813            {
     1814              /* Do not consume a following underscore;
     1815                 consume_count_with_underscores will consume what
     1816                 should be consumed.  */
     1817              leave_following_underscore = 1;
     1818            }
     1819        }
     1820      else
     1821        {
     1822          /* Negative numbers are indicated with a leading `m'.  */
     1823          if (**mangled == 'm')
     1824          {
     1825            string_appendn (s, "-", 1);
     1826            (*mangled)++;
     1827          }
     1828          /* Since consume_count_with_underscores does not handle
     1829             multi-digit numbers that do not start with an underscore,
     1830             and this number can be an integer template parameter,
     1831             we have to call consume_count. */
     1832          multidigit_without_leading_underscore = 1;
     1833          /* These multi-digit numbers never end on an underscore,
     1834             so if there is one then don't eat it. */
    18151835          leave_following_underscore = 1;
    18161836        }
     
    18201840         the leading underscore (that we consumed) if it is to handle
    18211841         multi-digit numbers.  */
    1822       if (consume_following_underscore)
     1842      if (multidigit_without_leading_underscore)
    18231843        value = consume_count (mangled);
    18241844      else
     
    18381858             underscore, we need to do something more radical.  */
    18391859
    1840           if ((value > 9 || consume_following_underscore)
     1860          if ((value > 9 || multidigit_without_leading_underscore)
    18411861              && ! leave_following_underscore
    18421862              && **mangled == '_')
     
    18461866          success = 1;
    18471867        }
    1848     }
     1868      }
    18491869
    18501870  return success;
     
    22342254  /* Check if ARM template with "__pt__" in it ("parameterized type") */
    22352255  /* Allow HP also here, because HP's cfront compiler follows ARM to some extent */
    2236   if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = mystrstr (mangled, "__pt__")))
     2256  if ((ARM_DEMANGLING || HP_DEMANGLING) && (*anchor = strstr (mangled, "__pt__")))
    22372257    {
    22382258      int len;
     
    22492269  if (AUTO_DEMANGLING || EDG_DEMANGLING)
    22502270    {
    2251       if ((*anchor = mystrstr (mangled, "__tm__"))
    2252           || (*anchor = mystrstr (mangled, "__ps__"))
    2253           || (*anchor = mystrstr (mangled, "__pt__")))
     2271      if ((*anchor = strstr (mangled, "__tm__"))
     2272          || (*anchor = strstr (mangled, "__ps__"))
     2273          || (*anchor = strstr (mangled, "__pt__")))
    22542274        {
    22552275          int len;
     
    22642284            }
    22652285        }
    2266       else if ((*anchor = mystrstr (mangled, "__S")))
     2286      else if ((*anchor = strstr (mangled, "__S")))
    22672287        {
    22682288          int len;
     
    23142334      while (1)
    23152335        {
    2316           string_clear (&arg);
     2336          string_delete (&arg);
    23172337          switch (**mangled)
    23182338            {
     
    23712391      /* should do error checking here */
    23722392      while (args < e) {
    2373         string_clear (&arg);
     2393        string_delete (&arg);
    23742394
    23752395        /* Check for type or literal here */
     
    23862406            string_append (&arg, "(");
    23872407            string_appends (&arg, &type_str);
     2408            string_delete (&type_str);
    23882409            string_append (&arg, ")");
    23892410            if (*args != 'L')
     
    24032424          default:
    24042425            /* Not handling other HP cfront stuff */
    2405             if (!do_type (work, &args, &arg))
    2406               goto cfront_template_args_done;
     2426            {
     2427              const char* old_args = args;
     2428              if (!do_type (work, &args, &arg))
     2429                goto cfront_template_args_done;
     2430
     2431              /* Fail if we didn't make any progress: prevent infinite loop. */
     2432              if (args == old_args)
     2433                return;
     2434            }
    24072435          }
    24082436        string_appends (declp, &arg);
     
    25652593     "__"-sequence.  This is the normal case.  */
    25662594  if (ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING
    2567       || mystrstr (scan + 2, "__") == NULL)
     2595      || strstr (scan + 2, "__") == NULL)
    25682596    {
    25692597      demangle_function_name (work, mangled, declp, scan);
     
    27082736  /*  This block of code is a reduction in strength time optimization
    27092737      of:
    2710       scan = mystrstr (*mangled, "__"); */
     2738      scan = strstr (*mangled, "__"); */
    27112739
    27122740  {
     
    28002828              scan++;
    28012829            }
    2802           if ((scan = mystrstr (scan, "__")) == NULL || (*(scan + 2) == '\0'))
     2830          if ((scan = strstr (scan, "__")) == NULL || (*(scan + 2) == '\0'))
    28032831            {
    28042832              /* No separator (I.E. "__not_mangled"), or empty signature
     
    33363364          else
    33373365            {
     3366              string_delete (&last_name);
    33383367              success = do_type (work, mangled, &last_name);
    33393368              if (!success)
     
    34783507  const char *remembered_type;
    34793508  int type_quals;
    3480   string btype;
    34813509  type_kind_t tk = tk_none;
    34823510
    3483   string_init (&btype);
    34843511  string_init (&decl);
    34853512  string_init (result);
     
    35993626                do_type (work, mangled, &temp);
    36003627                string_prepends (&decl, &temp);
     3628                string_delete (&temp);
    36013629              }
    36023630            else if (**mangled == 't')
     
    36093637                  {
    36103638                    string_prependn (&decl, temp.b, temp.p - temp.b);
    3611                     string_clear (&temp);
     3639                    string_delete (&temp);
    36123640                  }
    36133641                else
     
    37893817  char buf[10];
    37903818  unsigned int dec = 0;
    3791   string btype;
    37923819  type_kind_t tk = tk_integral;
    3793 
    3794   string_init (&btype);
    37953820
    37963821  /* First pick off any type qualifiers.  There can be more than one.  */
     
    39653990    case 't':
    39663991      {
     3992        string btype;
     3993        string_init (&btype);
    39673994        success = demangle_template (work, mangled, &btype, 0, 1, 1);
    39683995        string_appends (result, &btype);
     3996        string_delete (&btype);
    39693997        break;
    39703998      }
     
    41684196     type vector when processing a repeated type.  */
    41694197  if (work->previous_argument)
    4170     string_clear (work->previous_argument);
     4198    string_delete (work->previous_argument);
    41714199  else
    4172     {
    4173       work->previous_argument = (string*) xmalloc (sizeof (string));
    4174       string_init (work->previous_argument);
    4175     }
     4200    work->previous_argument = (string*) xmalloc (sizeof (string));
    41764201
    41774202  if (!do_type (work, mangled, work->previous_argument))
     
    45374562  /* Restore the previous_argument field.  */
    45384563  if (work->previous_argument)
    4539     string_delete (work->previous_argument);
     4564    {
     4565      string_delete (work->previous_argument);
     4566      free ((char *) work->previous_argument);
     4567    }
    45404568  work->previous_argument = saved_previous_argument;
    45414569  --work->forgetting_types;
     
    48624890  string_append (s, buf);
    48634891}
    4864 
    4865 /* To generate a standalone demangler program for testing purposes,
    4866    just compile and link this file with -DMAIN and libiberty.a.  When
    4867    run, it demangles each command line arg, or each stdin string, and
    4868    prints the result on stdout.  */
    4869 
    4870 #ifdef MAIN
    4871 
    4872 #include "getopt.h"
    4873 
    4874 static const char *program_name;
    4875 static const char *program_version = VERSION;
    4876 static int flags = DMGL_PARAMS | DMGL_ANSI;
    4877 
    4878 static void demangle_it PARAMS ((char *));
    4879 static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;
    4880 static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN;
    4881 static void print_demangler_list PARAMS ((FILE *));
    4882 
    4883 static void
    4884 demangle_it (mangled_name)
    4885      char *mangled_name;
    4886 {
    4887   char *result;
    4888 
    4889   result = cplus_demangle (mangled_name, flags);
    4890   if (result == NULL)
    4891     {
    4892       printf ("%s\n", mangled_name);
    4893     }
    4894   else
    4895     {
    4896       printf ("%s\n", result);
    4897       free (result);
    4898     }
    4899 }
    4900 
    4901 static void
    4902 print_demangler_list (stream)
    4903      FILE *stream;
    4904 {
    4905   struct demangler_engine *demangler;
    4906 
    4907   fprintf (stream, "{%s", libiberty_demanglers->demangling_style_name);
    4908  
    4909   for (demangler = libiberty_demanglers + 1;
    4910        demangler->demangling_style != unknown_demangling;
    4911        ++demangler)
    4912     fprintf (stream, ",%s", demangler->demangling_style_name);
    4913 
    4914   fprintf (stream, "}");
    4915 }
    4916 
    4917 static void
    4918 usage (stream, status)
    4919      FILE *stream;
    4920      int status;
    4921 {
    4922   fprintf (stream, "\
    4923 Usage: %s [-_] [-n] [--strip-underscores] [--no-strip-underscores] \n",
    4924            program_name);
    4925 
    4926   fprintf (stream, "\
    4927        [-s ");
    4928   print_demangler_list (stream);
    4929   fprintf (stream, "]\n");
    4930 
    4931   fprintf (stream, "\
    4932        [--format ");
    4933   print_demangler_list (stream);
    4934   fprintf (stream, "]\n");
    4935 
    4936   fprintf (stream, "\
    4937        [--help] [--version] [arg...]\n");
    4938   exit (status);
    4939 }
    4940 
    4941 #define MBUF_SIZE 32767
    4942 char mbuffer[MBUF_SIZE];
    4943 
    4944 /* Defined in the automatically-generated underscore.c.  */
    4945 extern int prepends_underscore;
    4946 
    4947 int strip_underscore = 0;
    4948 
    4949 static struct option long_options[] = {
    4950   {"strip-underscores", no_argument, 0, '_'},
    4951   {"format", required_argument, 0, 's'},
    4952   {"help", no_argument, 0, 'h'},
    4953   {"java", no_argument, 0, 'j'},
    4954   {"no-strip-underscores", no_argument, 0, 'n'},
    4955   {"version", no_argument, 0, 'v'},
    4956   {0, no_argument, 0, 0}
    4957 };
    4958 
    4959 /* More 'friendly' abort that prints the line and file.
    4960    config.h can #define abort fancy_abort if you like that sort of thing.  */
    4961 
    4962 void
    4963 fancy_abort ()
    4964 {
    4965   fatal ("Internal gcc abort.");
    4966 }
    4967 
    4968 
    4969 static const char *
    4970 standard_symbol_characters PARAMS ((void));
    4971 
    4972 static const char *
    4973 hp_symbol_characters PARAMS ((void));
    4974 
    4975 static const char *
    4976 gnu_v3_symbol_characters PARAMS ((void));
    4977 
    4978 /* Return the string of non-alnum characters that may occur
    4979    as a valid symbol component, in the standard assembler symbol
    4980    syntax.  */
    4981 
    4982 static const char *
    4983 standard_symbol_characters ()
    4984 {
    4985   return "_$.";
    4986 }
    4987 
    4988 
    4989 /* Return the string of non-alnum characters that may occur
    4990    as a valid symbol name component in an HP object file.
    4991 
    4992    Note that, since HP's compiler generates object code straight from
    4993    C++ source, without going through an assembler, its mangled
    4994    identifiers can use all sorts of characters that no assembler would
    4995    tolerate, so the alphabet this function creates is a little odd.
    4996    Here are some sample mangled identifiers offered by HP:
    4997 
    4998         typeid*__XT24AddressIndExpClassMember_
    4999         [Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv
    5000         __ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv
    5001 
    5002    This still seems really weird to me, since nowhere else in this
    5003    file is there anything to recognize curly brackets, parens, etc.
    5004    I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me
    5005    this is right, but I still strongly suspect that there's a
    5006    misunderstanding here.
    5007 
    5008    If we decide it's better for c++filt to use HP's assembler syntax
    5009    to scrape identifiers out of its input, here's the definition of
    5010    the symbol name syntax from the HP assembler manual:
    5011 
    5012        Symbols are composed of uppercase and lowercase letters, decimal
    5013        digits, dollar symbol, period (.), ampersand (&), pound sign(#) and
    5014        underscore (_). A symbol can begin with a letter, digit underscore or
    5015        dollar sign. If a symbol begins with a digit, it must contain a
    5016        non-digit character.
    5017 
    5018    So have fun.  */
    5019 static const char *
    5020 hp_symbol_characters ()
    5021 {
    5022   return "_$.<>#,*&[]:(){}";
    5023 }
    5024 
    5025 
    5026 /* Return the string of non-alnum characters that may occur
    5027    as a valid symbol component in the GNU C++ V3 ABI mangling
    5028    scheme.  */
    5029 
    5030 static const char *
    5031 gnu_v3_symbol_characters ()
    5032 {
    5033   return "_$.";
    5034 }
    5035 
    5036 
    5037 extern int main PARAMS ((int, char **));
    5038 
    5039 int
    5040 main (argc, argv)
    5041      int argc;
    5042      char **argv;
    5043 {
    5044   char *result;
    5045   int c;
    5046   const char *valid_symbols;
    5047 
    5048   program_name = argv[0];
    5049 
    5050   strip_underscore = prepends_underscore;
    5051 
    5052   while ((c = getopt_long (argc, argv, "_ns:j", long_options, (int *) 0)) != EOF)
    5053     {
    5054       switch (c)
    5055         {
    5056         case '?':
    5057           usage (stderr, 1);
    5058           break;
    5059         case 'h':
    5060           usage (stdout, 0);
    5061         case 'n':
    5062           strip_underscore = 0;
    5063           break;
    5064         case 'v':
    5065           printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version);
    5066           return (0);
    5067         case '_':
    5068           strip_underscore = 1;
    5069           break;
    5070         case 'j':
    5071           flags |= DMGL_JAVA;
    5072           break;
    5073         case 's':
    5074           {
    5075             enum demangling_styles style;
    5076 
    5077             style = cplus_demangle_name_to_style (optarg);
    5078             if (style == unknown_demangling)
    5079               {
    5080                 fprintf (stderr, "%s: unknown demangling style `%s'\n",
    5081                          program_name, optarg);
    5082                 return (1);
    5083               }
    5084             else
    5085               cplus_demangle_set_style (style);
    5086           }
    5087           break;
    5088         }
    5089     }
    5090 
    5091   if (optind < argc)
    5092     {
    5093       for ( ; optind < argc; optind++)
    5094         {
    5095           demangle_it (argv[optind]);
    5096         }
    5097     }
    5098   else
    5099     {
    5100       switch (current_demangling_style)
    5101         {
    5102         case gnu_demangling:
    5103         case lucid_demangling:
    5104         case arm_demangling:
    5105         case java_demangling:
    5106         case edg_demangling:
    5107         case gnat_demangling:
    5108         case auto_demangling:
    5109           valid_symbols = standard_symbol_characters ();
    5110           break;
    5111         case hp_demangling:
    5112           valid_symbols = hp_symbol_characters ();
    5113           break;
    5114         case gnu_v3_demangling:
    5115           valid_symbols = gnu_v3_symbol_characters ();
    5116           break;
    5117         default:
    5118           /* Folks should explicitly indicate the appropriate alphabet for
    5119              each demangling.  Providing a default would allow the
    5120              question to go unconsidered.  */
    5121           abort ();
    5122         }
    5123 
    5124       for (;;)
    5125         {
    5126           int i = 0;
    5127           c = getchar ();
    5128           /* Try to read a label.  */
    5129           while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))
    5130             {
    5131               if (i >= MBUF_SIZE-1)
    5132                 break;
    5133               mbuffer[i++] = c;
    5134               c = getchar ();
    5135             }
    5136           if (i > 0)
    5137             {
    5138               int skip_first = 0;
    5139 
    5140               if (mbuffer[0] == '.')
    5141                 ++skip_first;
    5142               if (strip_underscore && mbuffer[skip_first] == '_')
    5143                 ++skip_first;
    5144 
    5145               if (skip_first > i)
    5146                 skip_first = i;
    5147 
    5148               mbuffer[i] = 0;
    5149 
    5150               result = cplus_demangle (mbuffer + skip_first, flags);
    5151               if (result)
    5152                 {
    5153                   if (mbuffer[0] == '.')
    5154                     putc ('.', stdout);
    5155                   fputs (result, stdout);
    5156                   free (result);
    5157                 }
    5158               else
    5159                 fputs (mbuffer, stdout);
    5160 
    5161               fflush (stdout);
    5162             }
    5163           if (c == EOF)
    5164             break;
    5165           putchar (c);
    5166           fflush (stdout);
    5167         }
    5168     }
    5169 
    5170   return (0);
    5171 }
    5172 
    5173 static void
    5174 fatal (str)
    5175      const char *str;
    5176 {
    5177   fprintf (stderr, "%s: %s\n", program_name, str);
    5178   exit (1);
    5179 }
    5180 
    5181 PTR
    5182 xmalloc (size)
    5183   size_t size;
    5184 {
    5185   register PTR value = (PTR) malloc (size);
    5186   if (value == 0)
    5187     fatal ("virtual memory exhausted");
    5188   return value;
    5189 }
    5190 
    5191 PTR
    5192 xrealloc (ptr, size)
    5193   PTR ptr;
    5194   size_t size;
    5195 {
    5196   register PTR value = (PTR) realloc (ptr, size);
    5197   if (value == 0)
    5198     fatal ("virtual memory exhausted");
    5199   return value;
    5200 }
    5201 #endif  /* main */
  • branches/GNU/src/binutils/libiberty/dyn-string.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* An abstract string datatype.
    2    Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
     2   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
    33   Contributed by Mark Mitchell (mark@markmitchell.com).
    44
     
    1010any later version.
    1111
     12In addition to the permissions in the GNU General Public License, the
     13Free Software Foundation gives you unlimited permission to link the
     14compiled version of this file into combinations with other programs,
     15and to distribute those combinations without any restriction coming
     16from the use of this file.  (The General Public License restrictions
     17do apply in other respects; for example, they cover modification of
     18the file, and distribution when not linked into a combined
     19executable.)
     20
    1221GNU CC is distributed in the hope that it will be useful,
    1322but WITHOUT ANY WARRANTY; without even the implied warranty of
     
    4251   through the call chain.  */
    4352
    44 #ifdef IN_LIBGCC2
     53#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
    4554#define RETURN_ON_ALLOCATION_FAILURE
    4655#endif
  • branches/GNU/src/binutils/libiberty/fdmatch.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2121/*
    2222
    23 NAME
     23@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
    2424
    25         fdmatch -- see if two file descriptors refer to same file
     25Check to see if two open file descriptors refer to the same file.
     26This is useful, for example, when we have an open file descriptor for
     27an unnamed file, and the name of a file that we believe to correspond
     28to that fd.  This can happen when we are exec'd with an already open
     29file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
     30that return open file descriptors for mapped address spaces.  All we
     31have to do is open the file by name and check the two file descriptors
     32for a match, which is done by comparing major and minor device numbers
     33and inode numbers.
    2634
    27 SYNOPSIS
    28 
    29         int fdmatch (int fd1, int fd2)
    30 
    31 DESCRIPTION
    32 
    33         Check to see if two open file descriptors refer to the same file.
    34         This is useful, for example, when we have an open file descriptor
    35         for an unnamed file, and the name of a file that we believe to
    36         correspond to that fd.  This can happen when we are exec'd with
    37         an already open file (stdout for example) or from the SVR4 /proc
    38         calls that return open file descriptors for mapped address spaces.
    39         All we have to do is open the file by name and check the two file
    40         descriptors for a match, which is done by comparing major&minor
    41         device numbers and inode numbers.
     35@end deftypefn
    4236
    4337BUGS
  • branches/GNU/src/binutils/libiberty/floatformat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1818Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    1919
     20#include "ansidecl.h"
    2021#include "floatformat.h"
    2122#include <math.h>               /* ldexp */
    22 #ifdef __STDC__
     23#ifdef ANSI_PROTOTYPES
    2324#include <stddef.h>
    2425extern void *memcpy (void *s1, const void *s2, size_t n);
     
    6768  floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
    6869  floatformat_intbit_no,
    69   "floatformat_ieee_double_little"
     70  "floatformat_ieee_double_littlebyte_bigword"
    7071};
    7172
     
    9293const struct floatformat floatformat_m88110_ext =
    9394{
    94 #ifdef HARRIS_FLOAT_FORMAT
     95  floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
     96  floatformat_intbit_yes,
     97  "floatformat_m88110_ext"
     98};
     99const struct floatformat floatformat_m88110_harris_ext =
     100{
    95101  /* Harris uses raw format 128 bytes long, but the number is just an ieee
    96102     double, and the last 64 bits are wasted. */
    97103  floatformat_big,128, 0, 1, 11,  0x3ff,  0x7ff, 12, 52,
    98104  floatformat_intbit_no,
    99   "floatformat_m88110_ext(harris)"
    100 #else
    101   floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
    102   floatformat_intbit_yes,
    103   "floatformat_m88110_ext"
    104 #endif /* HARRIS_FLOAT_FORMAT */
    105 };
    106 const struct floatformat floatformat_arm_ext =
     105  "floatformat_m88110_ext_harris"
     106};
     107const struct floatformat floatformat_arm_ext_big =
    107108{
    108109  /* Bits 1 to 16 are unused.  */
    109110  floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
    110111  floatformat_intbit_yes,
    111   "floatformat_arm_ext"
     112  "floatformat_arm_ext_big"
     113};
     114const struct floatformat floatformat_arm_ext_littlebyte_bigword =
     115{
     116  /* Bits 1 to 16 are unused.  */
     117  floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
     118  floatformat_intbit_yes,
     119  "floatformat_arm_ext_littlebyte_bigword"
     120};
     121const struct floatformat floatformat_ia64_spill_big =
     122{
     123  floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
     124  floatformat_intbit_yes,
     125  "floatformat_ia64_spill_big"
     126};
     127const struct floatformat floatformat_ia64_spill_little =
     128{
     129  floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
     130  floatformat_intbit_yes,
     131  "floatformat_ia64_spill_little"
     132};
     133const struct floatformat floatformat_ia64_quad_big =
     134{
     135  floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
     136  floatformat_intbit_no,
     137  "floatformat_ia64_quad_big"
     138};
     139const struct floatformat floatformat_ia64_quad_little =
     140{
     141  floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
     142  floatformat_intbit_no,
     143  "floatformat_ia64_quad_little"
    112144};
    113145
  • branches/GNU/src/binutils/libiberty/getcwd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         getcwd -- get absolute pathname for current working directory
    75
    8 SYNOPSIS
    9         char *getcwd (char pathname[len], len)
     6@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
    107
    11 DESCRIPTION
    12         Copy the absolute pathname for the current working directory into
    13         the supplied buffer and return a pointer to the buffer.  If the
    14         current directory's path doesn't fit in LEN characters, the result
    15         is NULL and errno is set.
     8Copy the absolute pathname for the current working directory into
     9@var{pathname}, which is assumed to point to a buffer of at least
     10@var{len} bytes, and return a pointer to the buffer.  If the current
     11directory's path doesn't fit in @var{len} characters, the result is
     12@code{NULL} and @code{errno} is set.  If @var{pathname} is a null pointer,
     13@code{getcwd} will obtain @var{len} bytes of space using
     14@code{malloc}.
    1615
    17         If pathname is a null pointer, getcwd() will obtain size bytes of
    18         space using malloc.
    19 
    20 BUGS
    21         Emulated via the getwd() call, which is reasonable for most
    22         systems that do not have getcwd().
     16@end deftypefn
    2317
    2418*/
     
    4741getcwd (buf, len)
    4842  char *buf;
    49   int len;
     43  size_t len;
    5044{
    5145  char ourbuf[MAXPATHLEN];
  • branches/GNU/src/binutils/libiberty/getopt.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    8484/* This is for other GNU distributions with internationalized messages.
    8585   When compiling libc, the _ macro is predefined.  */
    86 # ifdef HAVE_LIBINTL_H
     86# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
    8787#  include <libintl.h>
    8888#  define _(msgid)      gettext (msgid)
     
    337337      else
    338338        {
    339           memset (__mempcpy (new_str, __getopt_nonoption_flags,
    340                              nonoption_flags_max_len),
     339          memset (mempcpy (new_str, __getopt_nonoption_flags,
     340                           nonoption_flags_max_len),
    341341                  '\0', top + 1 - nonoption_flags_max_len);
    342342          nonoption_flags_max_len = top + 1;
     
    448448                nonoption_flags_max_len = -1;
    449449              else
    450                 memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
     450                memset (mempcpy (__getopt_nonoption_flags, orig_str, len),
    451451                        '\0', nonoption_flags_max_len - len);
    452452            }
  • branches/GNU/src/binutils/libiberty/getpagesize.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33/*
    44
    5 NAME
     5@deftypefn Supplemental int getpagesize (void)
    66
    7         getpagesize -- return the number of bytes in page of memory
     7Returns the number of bytes in a page of memory.  This is the
     8granularity of many of the system memory management routines.  No
     9guarantee is made as to whether or not it is the same as the basic
     10memory management hardware page size.
    811
    9 SYNOPSIS
    10 
    11         int getpagesize (void)
    12 
    13 DESCRIPTION
    14 
    15         Returns the number of bytes in a page of memory.  This is the
    16         granularity of many of the system memory management routines.
    17         No guarantee is made as to whether or not it is the same as the
    18         basic memory management hardware page size.
     12@end deftypefn
    1913
    2014BUGS
  • branches/GNU/src/binutils/libiberty/getpwd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* getpwd.c - get the working directory */
     2
     3/*
     4
     5@deftypefn Supplemental char* getpwd (void)
     6
     7Returns the current working directory.  This implementation caches the
     8result on the assumption that the process will not call @code{chdir}
     9between calls to @code{getpwd}.
     10
     11@end deftypefn
     12
     13*/
    214
    315#ifdef HAVE_CONFIG_H
  • branches/GNU/src/binutils/libiberty/getruntime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Return time used so far, in microseconds.
    2    Copyright (C) 1994, 1999 Free Software Foundation, Inc.
     2   Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc.
    33
    44This file is part of the libiberty library.
     
    2222#include "ansidecl.h"
    2323#include "libiberty.h"
     24
     25/* On some systems (such as WindISS), you must include <sys/types.h>
     26   to get the definition of "time_t" before you include <time.h>.  */
     27#include <sys/types.h>
    2428
    2529/* There are several ways to get elapsed execution time; unfortunately no
     
    7478#endif
    7579
     80/*
     81
     82@deftypefn Replacement long get_run_time (void)
     83
     84Returns the time used so far, in microseconds.  If possible, this is
     85the time used by this process, else it is the elapsed time since the
     86process started.
     87
     88@end deftypefn
     89
     90*/
     91
    7692long
    7793get_run_time ()
  • branches/GNU/src/binutils/libiberty/hashtab.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* An expandable hash tables datatype. 
    2    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
     2   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    33   Contributed by Vladimir Makarov (vmakarov@cygnus.com).
    44
     
    8181  /* These are primes that are near, but slightly smaller than, a
    8282     power of two.  */
    83   static unsigned long primes[] = {
    84     2,
    85     7,
    86     13,
    87     31,
    88     61,
    89     127,
    90     251,
    91     509,
    92     1021,
    93     2039,
    94     4093,
    95     8191,
    96     16381,
    97     32749,
    98     65521,
    99     131071,
    100     262139,
    101     524287,
    102     1048573,
    103     2097143,
    104     4194301,
    105     8388593,
    106     16777213,
    107     33554393,
    108     67108859,
    109     134217689,
    110     268435399,
    111     536870909,
    112     1073741789,
    113     2147483647,
    114     4294967291
     83  static const unsigned long primes[] = {
     84    (unsigned long) 7,
     85    (unsigned long) 13,
     86    (unsigned long) 31,
     87    (unsigned long) 61,
     88    (unsigned long) 127,
     89    (unsigned long) 251,
     90    (unsigned long) 509,
     91    (unsigned long) 1021,
     92    (unsigned long) 2039,
     93    (unsigned long) 4093,
     94    (unsigned long) 8191,
     95    (unsigned long) 16381,
     96    (unsigned long) 32749,
     97    (unsigned long) 65521,
     98    (unsigned long) 131071,
     99    (unsigned long) 262139,
     100    (unsigned long) 524287,
     101    (unsigned long) 1048573,
     102    (unsigned long) 2097143,
     103    (unsigned long) 4194301,
     104    (unsigned long) 8388593,
     105    (unsigned long) 16777213,
     106    (unsigned long) 33554393,
     107    (unsigned long) 67108859,
     108    (unsigned long) 134217689,
     109    (unsigned long) 268435399,
     110    (unsigned long) 536870909,
     111    (unsigned long) 1073741789,
     112    (unsigned long) 2147483647,
     113                                        /* 4294967291L */
     114    ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
    115115  };
    116116
    117   unsigned long* low = &primes[0];
    118   unsigned long* high = &primes[sizeof(primes) / sizeof(primes[0])];
     117  const unsigned long *low = &primes[0];
     118  const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])];
    119119
    120120  while (low != high)
    121121    {
    122       unsigned long* mid = low + (high - low) / 2;
     122      const unsigned long *mid = low + (high - low) / 2;
    123123      if (n > *mid)
    124124        low = mid + 1;
     
    159159   source length.  Created hash table is initiated as empty (all the
    160160   hash table entries are EMPTY_ENTRY).  The function returns the
    161    created hash table.  Memory allocation must not fail.  */
    162 
     161   created hash table, or NULL if memory allocation fails.  */
     162
     163htab_t
     164htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f)
     165     size_t size;
     166     htab_hash hash_f;
     167     htab_eq eq_f;
     168     htab_del del_f;
     169     htab_alloc alloc_f;
     170     htab_free free_f;
     171{
     172  htab_t result;
     173
     174  size = higher_prime_number (size);
     175  result = (htab_t) (*alloc_f) (1, sizeof (struct htab));
     176  if (result == NULL)
     177    return NULL;
     178  result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR));
     179  if (result->entries == NULL)
     180    {
     181      if (free_f != NULL)
     182        (*free_f) (result);
     183      return NULL;
     184    }
     185  result->size = size;
     186  result->hash_f = hash_f;
     187  result->eq_f = eq_f;
     188  result->del_f = del_f;
     189  result->alloc_f = alloc_f;
     190  result->free_f = free_f;
     191  return result;
     192}
     193
     194/* As above, but use the variants of alloc_f and free_f which accept
     195   an extra argument.  */
     196
     197htab_t
     198htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f,
     199                      free_f)
     200     size_t size;
     201     htab_hash hash_f;
     202     htab_eq eq_f;
     203     htab_del del_f;
     204     PTR alloc_arg;
     205     htab_alloc_with_arg alloc_f;
     206     htab_free_with_arg free_f;
     207{
     208  htab_t result;
     209
     210  size = higher_prime_number (size);
     211  result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab));
     212  if (result == NULL)
     213    return NULL;
     214  result->entries = (PTR *) (*alloc_f) (alloc_arg, size, sizeof (PTR));
     215  if (result->entries == NULL)
     216    {
     217      if (free_f != NULL)
     218        (*free_f) (alloc_arg, result);
     219      return NULL;
     220    }
     221  result->size = size;
     222  result->hash_f = hash_f;
     223  result->eq_f = eq_f;
     224  result->del_f = del_f;
     225  result->alloc_arg = alloc_arg;
     226  result->alloc_with_arg_f = alloc_f;
     227  result->free_with_arg_f = free_f;
     228  return result;
     229}
     230
     231/* Update the function pointers and allocation parameter in the htab_t.  */
     232
     233void
     234htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f)
     235     htab_t htab;
     236     htab_hash hash_f;
     237     htab_eq eq_f;
     238     htab_del del_f;
     239     PTR alloc_arg;
     240     htab_alloc_with_arg alloc_f;
     241     htab_free_with_arg free_f;
     242{
     243  htab->hash_f = hash_f;
     244  htab->eq_f = eq_f;
     245  htab->del_f = del_f;
     246  htab->alloc_arg = alloc_arg;
     247  htab->alloc_with_arg_f = alloc_f;
     248  htab->free_with_arg_f = free_f;
     249}
     250
     251/* These functions exist solely for backward compatibility.  */
     252
     253#undef htab_create
    163254htab_t
    164255htab_create (size, hash_f, eq_f, del_f)
     
    168259     htab_del del_f;
    169260{
    170   htab_t result;
    171 
    172   size = higher_prime_number (size);
    173   result = (htab_t) xcalloc (1, sizeof (struct htab));
    174   result->entries = (PTR *) xcalloc (size, sizeof (PTR));
    175   result->size = size;
    176   result->hash_f = hash_f;
    177   result->eq_f = eq_f;
    178   result->del_f = del_f;
    179   result->return_allocation_failure = 0;
    180   return result;
    181 }
    182 
    183 /* This function creates table with length slightly longer than given
    184    source length.  The created hash table is initiated as empty (all the
    185    hash table entries are EMPTY_ENTRY).  The function returns the created
    186    hash table.  Memory allocation may fail; it may return NULL.  */
     261  return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free);
     262}
    187263
    188264htab_t
     
    193269     htab_del del_f;
    194270{
    195   htab_t result;
    196 
    197   size = higher_prime_number (size);
    198   result = (htab_t) calloc (1, sizeof (struct htab));
    199   if (result == NULL)
    200     return NULL;
    201 
    202   result->entries = (PTR *) calloc (size, sizeof (PTR));
    203   if (result->entries == NULL)
    204     {
    205       free (result);
    206       return NULL;
    207     }
    208 
    209   result->size = size;
    210   result->hash_f = hash_f;
    211   result->eq_f = eq_f;
    212   result->del_f = del_f;
    213   result->return_allocation_failure = 1;
    214   return result;
     271  return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free);
    215272}
    216273
     
    230287        (*htab->del_f) (htab->entries[i]);
    231288
    232   free (htab->entries);
    233   free (htab);
     289  if (htab->free_f != NULL)
     290    {
     291      (*htab->free_f) (htab->entries);
     292      (*htab->free_f) (htab);
     293    }
     294  else if (htab->free_with_arg_f != NULL)
     295    {
     296      (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries);
     297      (*htab->free_with_arg_f) (htab->alloc_arg, htab);
     298    }
    234299}
    235300
     
    264329{
    265330  size_t size = htab->size;
    266   hashval_t hash2 = 1 + hash % (size - 2);
    267331  unsigned int index = hash % size;
    268 
     332  PTR *slot = htab->entries + index;
     333  hashval_t hash2;
     334
     335  if (*slot == EMPTY_ENTRY)
     336    return slot;
     337  else if (*slot == DELETED_ENTRY)
     338    abort ();
     339
     340  hash2 = 1 + hash % (size - 2);
    269341  for (;;)
    270342    {
    271       PTR *slot = htab->entries + index;
    272 
     343      index += hash2;
     344      if (index >= size)
     345        index -= size;
     346
     347      slot = htab->entries + index;
    273348      if (*slot == EMPTY_ENTRY)
    274349        return slot;
    275350      else if (*slot == DELETED_ENTRY)
    276351        abort ();
    277 
    278       index += hash2;
    279       if (index >= size)
    280         index -= size;
    281352    }
    282353}
     
    297368  PTR *olimit;
    298369  PTR *p;
     370  PTR *nentries;
     371  size_t nsize;
    299372
    300373  oentries = htab->entries;
    301374  olimit = oentries + htab->size;
    302375
    303   htab->size = higher_prime_number (htab->size * 2);
    304 
    305   if (htab->return_allocation_failure)
    306     {
    307       PTR *nentries = (PTR *) calloc (htab->size, sizeof (PTR *));
    308       if (nentries == NULL)
    309         return 0;
    310       htab->entries = nentries;
    311     }
     376  /* Resize only when table after removal of unused elements is either
     377     too full or too empty.  */
     378  if ((htab->n_elements - htab->n_deleted) * 2 > htab->size
     379      || ((htab->n_elements - htab->n_deleted) * 8 < htab->size
     380          && htab->size > 32))
     381    nsize = higher_prime_number ((htab->n_elements - htab->n_deleted) * 2);
    312382  else
    313     htab->entries = (PTR *) xcalloc (htab->size, sizeof (PTR *));
     383    nsize = htab->size;
     384
     385  if (htab->alloc_with_arg_f != NULL)
     386    nentries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
     387                                                  sizeof (PTR *));
     388  else
     389    nentries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR *));
     390  if (nentries == NULL)
     391    return 0;
     392  htab->entries = nentries;
     393  htab->size = nsize;
    314394
    315395  htab->n_elements -= htab->n_deleted;
     
    332412  while (p < olimit);
    333413
    334   free (oentries);
     414  if (htab->free_f != NULL)
     415    (*htab->free_f) (oentries);
     416  else if (htab->free_with_arg_f != NULL)
     417    (*htab->free_with_arg_f) (htab->alloc_arg, oentries);
    335418  return 1;
    336419}
     
    405488  hashval_t hash2;
    406489  size_t size;
     490  PTR entry;
    407491
    408492  if (insert == INSERT && htab->size * 3 <= htab->n_elements * 4
     
    411495
    412496  size = htab->size;
    413   hash2 = 1 + hash % (size - 2);
    414497  index = hash % size;
    415498
     
    417500  first_deleted_slot = NULL;
    418501
     502  entry = htab->entries[index];
     503  if (entry == EMPTY_ENTRY)
     504    goto empty_entry;
     505  else if (entry == DELETED_ENTRY)
     506    first_deleted_slot = &htab->entries[index];
     507  else if ((*htab->eq_f) (entry, element))
     508    return &htab->entries[index];
     509     
     510  hash2 = 1 + hash % (size - 2);
    419511  for (;;)
    420512    {
    421       PTR entry = htab->entries[index];
     513      htab->collisions++;
     514      index += hash2;
     515      if (index >= size)
     516        index -= size;
     517     
     518      entry = htab->entries[index];
    422519      if (entry == EMPTY_ENTRY)
    423         {
    424           if (insert == NO_INSERT)
    425             return NULL;
    426 
    427           htab->n_elements++;
    428 
    429           if (first_deleted_slot)
    430             {
    431               *first_deleted_slot = EMPTY_ENTRY;
    432               return first_deleted_slot;
    433             }
    434 
    435           return &htab->entries[index];
    436         }
    437 
    438       if (entry == DELETED_ENTRY)
     520        goto empty_entry;
     521      else if (entry == DELETED_ENTRY)
    439522        {
    440523          if (!first_deleted_slot)
    441524            first_deleted_slot = &htab->entries[index];
    442525        }
    443       else  if ((*htab->eq_f) (entry, element))
     526      else if ((*htab->eq_f) (entry, element))
    444527        return &htab->entries[index];
    445      
    446       htab->collisions++;
    447       index += hash2;
    448       if (index >= size)
    449         index -= size;
    450     }
     528    }
     529
     530 empty_entry:
     531  if (insert == NO_INSERT)
     532    return NULL;
     533
     534  htab->n_elements++;
     535
     536  if (first_deleted_slot)
     537    {
     538      *first_deleted_slot = EMPTY_ENTRY;
     539      return first_deleted_slot;
     540    }
     541
     542  return &htab->entries[index];
    451543}
    452544
     
    512604
    513605void
    514 htab_traverse (htab, callback, info)
     606htab_traverse_noresize (htab, callback, info)
    515607     htab_t htab;
    516608     htab_trav callback;
    517609     PTR info;
    518610{
    519   PTR *slot = htab->entries;
    520   PTR *limit = slot + htab->size;
     611  PTR *slot;
     612  PTR *limit;
     613
     614  slot = htab->entries;
     615  limit = slot + htab->size;
    521616
    522617  do
     
    531626}
    532627
     628/* Like htab_traverse_noresize, but does resize the table when it is
     629   too empty to improve effectivity of subsequent calls.  */
     630
     631void
     632htab_traverse (htab, callback, info)
     633     htab_t htab;
     634     htab_trav callback;
     635     PTR info;
     636{
     637  if ((htab->n_elements - htab->n_deleted) * 8 < htab->size)
     638    htab_expand (htab);
     639
     640  htab_traverse_noresize (htab, callback, info);
     641}
     642
    533643/* Return the current size of given hash table. */
    534644
     
    561671  return (double) htab->collisions / (double) htab->searches;
    562672}
     673
     674/* Hash P as a null-terminated string.
     675
     676   Copied from gcc/hashtable.c.  Zack had the following to say with respect
     677   to applicability, though note that unlike hashtable.c, this hash table
     678   implementation re-hashes rather than chain buckets.
     679
     680   http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01021.html
     681   From: Zack Weinberg <zackw@panix.com>
     682   Date: Fri, 17 Aug 2001 02:15:56 -0400
     683
     684   I got it by extracting all the identifiers from all the source code
     685   I had lying around in mid-1999, and testing many recurrences of
     686   the form "H_n = H_{n-1} * K + c_n * L + M" where K, L, M were either
     687   prime numbers or the appropriate identity.  This was the best one.
     688   I don't remember exactly what constituted "best", except I was
     689   looking at bucket-length distributions mostly.
     690   
     691   So it should be very good at hashing identifiers, but might not be
     692   as good at arbitrary strings.
     693   
     694   I'll add that it thoroughly trounces the hash functions recommended
     695   for this use at http://burtleburtle.net/bob/hash/index.html, both
     696   on speed and bucket distribution.  I haven't tried it against the
     697   function they just started using for Perl's hashes.  */
     698
     699hashval_t
     700htab_hash_string (p)
     701     const PTR p;
     702{
     703  const unsigned char *str = (const unsigned char *) p;
     704  hashval_t r = 0;
     705  unsigned char c;
     706
     707  while ((c = *str++) != 0)
     708    r = r * 67 + c - 113;
     709
     710  return r;
     711}
  • branches/GNU/src/binutils/libiberty/hex.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Hex character manipulation support.
    2    Copyright (C) 1995 Free Software Foundation, Inc.
     2   Copyright (C) 1995, 2001 Free Software Foundation, Inc.
    33
    44This file is part of the libiberty library.
     
    1818Boston, MA 02111-1307, USA.  */
    1919
     20#include <stdio.h>  /* for EOF */
    2021#include "libiberty.h"
     22
     23/*
     24
     25@deftypefn Extension void hex_init (void)
     26
     27Initializes the array mapping the current character set to
     28corresponding hex values.  This function must be called before any
     29call to @code{hex_p} or @code{hex_value}.  If you fail to call it, a
     30default ASCII-based table will normally be used on ASCII systems.
     31
     32@end deftypefn
     33
     34@deftypefn Extension int hex_p (int @var{c})
     35
     36Evaluates to non-zero if the given character is a valid hex character,
     37or zero if it is not.  Note that the value you pass will be cast to
     38@code{unsigned char} within the macro.
     39
     40@end deftypefn
     41
     42@deftypefn Extension int hex_value (int @var{c})
     43
     44Returns the numeric equivalent of the given character when interpreted
     45as a hexidecimal digit.  The result is undefined if you pass an
     46invalid hex digit.  Note that the value you pass will be cast to
     47@code{unsigned char} within the macro.
     48
     49@end deftypefn
     50
     51@undocumented _hex_array_size
     52@undocumented _hex_bad
     53@undocumented _hex_value
     54
     55*/
     56
     57
     58/* Are we ASCII? */
     59#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
     60  && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
     61  && EOF == -1
     62
     63const char _hex_value[_hex_array_size] =
     64{
     65  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* NUL SOH STX ETX */
     66  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* EOT ENQ ACK BEL */
     67  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* BS  HT  LF  VT  */
     68  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* FF  CR  SO  SI  */
     69  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* DLE DC1 DC2 DC3 */
     70  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* DC4 NAK SYN ETB */
     71  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* CAN EM  SUB ESC */
     72  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* FS  GS  RS  US  */
     73
     74  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* SP  !   "   #   */
     75  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* $   %   &   '   */
     76  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* (   )   *   +   */
     77  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* ,   -   .   /   */
     78  0,        1,        2,        3,          /* 0   1   2   3   */
     79  4,        5,        6,        7,          /* 4   5   6   7   */
     80  8,        9,        _hex_bad, _hex_bad,   /* 8   9   :   ;   */
     81  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* <   =   >   ?   */
     82
     83  _hex_bad, 10,       11,       12,         /* @   A   B   C   */
     84  13,       14,       15,       _hex_bad,   /* D   E   F   G   */
     85  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* H   I   J   K   */
     86  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* L   M   N   O   */
     87  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* P   Q   R   S   */
     88  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* T   U   V   W   */
     89  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* X   Y   Z   [   */
     90  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* \   ]   ^   _   */
     91
     92  _hex_bad, 10,       11,       12,         /* `   a   b   c   */
     93  13,       14,       15,       _hex_bad,   /* d   e   f   g   */
     94  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* h   i   j   k   */
     95  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* l   m   n   o   */
     96  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* p   q   r   s   */
     97  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* t   u   v   w   */
     98  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* x   y   z   {   */
     99  _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* |   }   ~   DEL */
     100
     101  /* The high half of unsigned char, all values are _hex_bad.  */
     102  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     103  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     104  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     105  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     106  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     107  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     108  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     109  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     110
     111  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     112  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     113  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     114  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     115  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     116  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     117  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     118  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     119
     120  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     121  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     122  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     123  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     124  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     125  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     126  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     127  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     128
     129  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     130  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     131  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     132  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     133  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     134  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     135  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     136  _hex_bad, _hex_bad, _hex_bad, _hex_bad,
     137};
     138#define HEX_TABLE_INITIALIZED
     139
     140#else
    21141
    22142char _hex_value[_hex_array_size];
    23143
    24 void hex_init ()
     144#endif /* not ASCII */
     145
     146void
     147hex_init ()
    25148{
     149#ifndef HEX_TABLE_INITIALIZED
    26150  int i;
    27   for (i = 0; i < _hex_array_size; i++)
    28     _hex_value[i] = _hex_bad;
    29   for (i = 0; i < 10; i++)
    30     _hex_value['0' + i] = i;
    31   for (i = 0; i < 6; i++)
    32     _hex_value['a' + i] = _hex_value['A' + i] = 10 + i;
     151
     152  for (i=0; i<_hex_array_size; i++)
     153    {
     154      switch (i)
     155        {
     156        case '0': _hex_value[i] = 0; break;
     157        case '1': _hex_value[i] = 1; break;
     158        case '2': _hex_value[i] = 2; break;
     159        case '3': _hex_value[i] = 3; break;
     160        case '4': _hex_value[i] = 4; break;
     161        case '5': _hex_value[i] = 5; break;
     162        case '6': _hex_value[i] = 6; break;
     163        case '7': _hex_value[i] = 7; break;
     164        case '8': _hex_value[i] = 8; break;
     165        case '9': _hex_value[i] = 9; break;
     166
     167        case 'a': case 'A': _hex_value[i] = 10; break;
     168        case 'b': case 'B': _hex_value[i] = 11; break;
     169        case 'c': case 'C': _hex_value[i] = 12; break;
     170        case 'd': case 'D': _hex_value[i] = 13; break;
     171        case 'e': case 'E': _hex_value[i] = 14; break;
     172        case 'f': case 'F': _hex_value[i] = 15; break;
     173
     174        default:
     175          _hex_value[i] = _hex_bad;
     176          break;
     177        }
     178    }
     179#endif
    33180}
  • branches/GNU/src/binutils/libiberty/index.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Stub implementation of (obsolete) index(). */
     2
     3/*
     4
     5@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
     6
     7Returns a pointer to the first occurrence of the character @var{c} in
     8the string @var{s}, or @code{NULL} if not found.  The use of @code{index} is
     9deprecated in new programs in favor of @code{strchr}.
     10
     11@end deftypefn
     12
     13*/
    214
    315extern char * strchr();
  • branches/GNU/src/binutils/libiberty/insque.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         insque, remque -- insert, remove an element from a queue
    75
    8 SYNOPSIS
    9         struct qelem {
    10           struct qelem *q_forw;
    11           struct qelem *q_back;
    12           char q_data[];
    13         };
     6@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
     7@deftypefnx Supplemental void remque (struct qelem *@var{elem})
    148
    15         void insque (struct qelem *elem, struct qelem *pred)
     9Routines to manipulate queues built from doubly linked lists.  The
     10@code{insque} routine inserts @var{elem} in the queue immediately
     11after @var{pred}.  The @code{remque} routine removes @var{elem} from
     12its containing queue.  These routines expect to be passed pointers to
     13structures which have as their first members a forward pointer and a
     14back pointer, like this prototype (although no prototype is provided):
    1615
    17         void remque (struct qelem *elem)
     16@example
     17struct qelem @{
     18  struct qelem *q_forw;
     19  struct qelem *q_back;
     20  char q_data[];
     21@};
     22@end example
    1823
    19 DESCRIPTION
    20         Routines to manipulate queues built from doubly linked lists.
    21         The insque routine inserts ELEM in the queue immediately after
    22         PRED.  The remque routine removes ELEM from its containing queue.
     24@end deftypefn
     25
    2326*/
    2427
  • branches/GNU/src/binutils/libiberty/md5.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    6666     struct md5_ctx *ctx;
    6767{
    68   ctx->A = 0x67452301;
    69   ctx->B = 0xefcdab89;
    70   ctx->C = 0x98badcfe;
    71   ctx->D = 0x10325476;
     68  ctx->A = (md5_uint32) 0x67452301;
     69  ctx->B = (md5_uint32) 0xefcdab89;
     70  ctx->C = (md5_uint32) 0x98badcfe;
     71  ctx->D = (md5_uint32) 0x10325476;
    7272
    7373  ctx->total[0] = ctx->total[1] = 0;
     
    230230        }
    231231
    232       buffer = (const char *) buffer + add;
     232      buffer = (const void *) ((const char *) buffer + add);
    233233      len -= add;
    234234    }
     
    238238    {
    239239      md5_process_block (buffer, len & ~63, ctx);
    240       buffer = (const char *) buffer + (len & ~63);
     240      buffer = (const void *) ((const char *) buffer + (len & ~63));
    241241      len &= 63;
    242242    }
     
    270270{
    271271  md5_uint32 correct_words[16];
    272   const md5_uint32 *words = buffer;
     272  const md5_uint32 *words = (const md5_uint32 *) buffer;
    273273  size_t nwords = len / sizeof (md5_uint32);
    274274  const md5_uint32 *endp = words + nwords;
     
    323323
    324324      /* Round 1.  */
    325       OP (A, B, C, D,  7, 0xd76aa478);
    326       OP (D, A, B, C, 12, 0xe8c7b756);
    327       OP (C, D, A, B, 17, 0x242070db);
    328       OP (B, C, D, A, 22, 0xc1bdceee);
    329       OP (A, B, C, D,  7, 0xf57c0faf);
    330       OP (D, A, B, C, 12, 0x4787c62a);
    331       OP (C, D, A, B, 17, 0xa8304613);
    332       OP (B, C, D, A, 22, 0xfd469501);
    333       OP (A, B, C, D,  7, 0x698098d8);
    334       OP (D, A, B, C, 12, 0x8b44f7af);
    335       OP (C, D, A, B, 17, 0xffff5bb1);
    336       OP (B, C, D, A, 22, 0x895cd7be);
    337       OP (A, B, C, D,  7, 0x6b901122);
    338       OP (D, A, B, C, 12, 0xfd987193);
    339       OP (C, D, A, B, 17, 0xa679438e);
    340       OP (B, C, D, A, 22, 0x49b40821);
     325      OP (A, B, C, D,  7, (md5_uint32) 0xd76aa478);
     326      OP (D, A, B, C, 12, (md5_uint32) 0xe8c7b756);
     327      OP (C, D, A, B, 17, (md5_uint32) 0x242070db);
     328      OP (B, C, D, A, 22, (md5_uint32) 0xc1bdceee);
     329      OP (A, B, C, D,  7, (md5_uint32) 0xf57c0faf);
     330      OP (D, A, B, C, 12, (md5_uint32) 0x4787c62a);
     331      OP (C, D, A, B, 17, (md5_uint32) 0xa8304613);
     332      OP (B, C, D, A, 22, (md5_uint32) 0xfd469501);
     333      OP (A, B, C, D,  7, (md5_uint32) 0x698098d8);
     334      OP (D, A, B, C, 12, (md5_uint32) 0x8b44f7af);
     335      OP (C, D, A, B, 17, (md5_uint32) 0xffff5bb1);
     336      OP (B, C, D, A, 22, (md5_uint32) 0x895cd7be);
     337      OP (A, B, C, D,  7, (md5_uint32) 0x6b901122);
     338      OP (D, A, B, C, 12, (md5_uint32) 0xfd987193);
     339      OP (C, D, A, B, 17, (md5_uint32) 0xa679438e);
     340      OP (B, C, D, A, 22, (md5_uint32) 0x49b40821);
    341341
    342342      /* For the second to fourth round we have the possibly swapped words
     
    344344         argument specifying the function to use.  */
    345345#undef OP
    346 #define OP(f, a, b, c, d, k, s, T)                                      \
     346#define OP(a, b, c, d, k, s, T)                                         \
    347347      do                                                                \
    348348        {                                                               \
    349           a += f (b, c, d) + correct_words[k] + T;                      \
     349          a += FX (b, c, d) + correct_words[k] + T;                     \
    350350          CYCLIC (a, s);                                                \
    351351          a += b;                                                       \
     
    353353      while (0)
    354354
     355#define FX(b, c, d) FG (b, c, d)
     356
    355357      /* Round 2.  */
    356       OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
    357       OP (FG, D, A, B, C,  6,  9, 0xc040b340);
    358       OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
    359       OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
    360       OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
    361       OP (FG, D, A, B, C, 10,  9, 0x02441453);
    362       OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
    363       OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
    364       OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
    365       OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
    366       OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
    367       OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
    368       OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
    369       OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
    370       OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
    371       OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
     358      OP (A, B, C, D,  1,  5, (md5_uint32) 0xf61e2562);
     359      OP (D, A, B, C,  6,  9, (md5_uint32) 0xc040b340);
     360      OP (C, D, A, B, 11, 14, (md5_uint32) 0x265e5a51);
     361      OP (B, C, D, A,  0, 20, (md5_uint32) 0xe9b6c7aa);
     362      OP (A, B, C, D,  5,  5, (md5_uint32) 0xd62f105d);
     363      OP (D, A, B, C, 10,  9, (md5_uint32) 0x02441453);
     364      OP (C, D, A, B, 15, 14, (md5_uint32) 0xd8a1e681);
     365      OP (B, C, D, A,  4, 20, (md5_uint32) 0xe7d3fbc8);
     366      OP (A, B, C, D,  9,  5, (md5_uint32) 0x21e1cde6);
     367      OP (D, A, B, C, 14,  9, (md5_uint32) 0xc33707d6);
     368      OP (C, D, A, B,  3, 14, (md5_uint32) 0xf4d50d87);
     369      OP (B, C, D, A,  8, 20, (md5_uint32) 0x455a14ed);
     370      OP (A, B, C, D, 13,  5, (md5_uint32) 0xa9e3e905);
     371      OP (D, A, B, C,  2,  9, (md5_uint32) 0xfcefa3f8);
     372      OP (C, D, A, B,  7, 14, (md5_uint32) 0x676f02d9);
     373      OP (B, C, D, A, 12, 20, (md5_uint32) 0x8d2a4c8a);
     374
     375#undef FX
     376#define FX(b, c, d) FH (b, c, d)
    372377
    373378      /* Round 3.  */
    374       OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
    375       OP (FH, D, A, B, C,  8, 11, 0x8771f681);
    376       OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
    377       OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
    378       OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
    379       OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
    380       OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
    381       OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
    382       OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
    383       OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
    384       OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
    385       OP (FH, B, C, D, A,  6, 23, 0x04881d05);
    386       OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
    387       OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
    388       OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
    389       OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
     379      OP (A, B, C, D,  5,  4, (md5_uint32) 0xfffa3942);
     380      OP (D, A, B, C,  8, 11, (md5_uint32) 0x8771f681);
     381      OP (C, D, A, B, 11, 16, (md5_uint32) 0x6d9d6122);
     382      OP (B, C, D, A, 14, 23, (md5_uint32) 0xfde5380c);
     383      OP (A, B, C, D,  1,  4, (md5_uint32) 0xa4beea44);
     384      OP (D, A, B, C,  4, 11, (md5_uint32) 0x4bdecfa9);
     385      OP (C, D, A, B,  7, 16, (md5_uint32) 0xf6bb4b60);
     386      OP (B, C, D, A, 10, 23, (md5_uint32) 0xbebfbc70);
     387      OP (A, B, C, D, 13,  4, (md5_uint32) 0x289b7ec6);
     388      OP (D, A, B, C,  0, 11, (md5_uint32) 0xeaa127fa);
     389      OP (C, D, A, B,  3, 16, (md5_uint32) 0xd4ef3085);
     390      OP (B, C, D, A,  6, 23, (md5_uint32) 0x04881d05);
     391      OP (A, B, C, D,  9,  4, (md5_uint32) 0xd9d4d039);
     392      OP (D, A, B, C, 12, 11, (md5_uint32) 0xe6db99e5);
     393      OP (C, D, A, B, 15, 16, (md5_uint32) 0x1fa27cf8);
     394      OP (B, C, D, A,  2, 23, (md5_uint32) 0xc4ac5665);
     395
     396#undef FX
     397#define FX(b, c, d) FI (b, c, d)
    390398
    391399      /* Round 4.  */
    392       OP (FI, A, B, C, D,  0,  6, 0xf4292244);
    393       OP (FI, D, A, B, C,  7, 10, 0x432aff97);
    394       OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
    395       OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
    396       OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
    397       OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
    398       OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
    399       OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
    400       OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
    401       OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
    402       OP (FI, C, D, A, B,  6, 15, 0xa3014314);
    403       OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
    404       OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
    405       OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
    406       OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
    407       OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
     400      OP (A, B, C, D,  0,  6, (md5_uint32) 0xf4292244);
     401      OP (D, A, B, C,  7, 10, (md5_uint32) 0x432aff97);
     402      OP (C, D, A, B, 14, 15, (md5_uint32) 0xab9423a7);
     403      OP (B, C, D, A,  5, 21, (md5_uint32) 0xfc93a039);
     404      OP (A, B, C, D, 12,  6, (md5_uint32) 0x655b59c3);
     405      OP (D, A, B, C,  3, 10, (md5_uint32) 0x8f0ccc92);
     406      OP (C, D, A, B, 10, 15, (md5_uint32) 0xffeff47d);
     407      OP (B, C, D, A,  1, 21, (md5_uint32) 0x85845dd1);
     408      OP (A, B, C, D,  8,  6, (md5_uint32) 0x6fa87e4f);
     409      OP (D, A, B, C, 15, 10, (md5_uint32) 0xfe2ce6e0);
     410      OP (C, D, A, B,  6, 15, (md5_uint32) 0xa3014314);
     411      OP (B, C, D, A, 13, 21, (md5_uint32) 0x4e0811a1);
     412      OP (A, B, C, D,  4,  6, (md5_uint32) 0xf7537e82);
     413      OP (D, A, B, C, 11, 10, (md5_uint32) 0xbd3af235);
     414      OP (C, D, A, B,  2, 15, (md5_uint32) 0x2ad7d2bb);
     415      OP (B, C, D, A,  9, 21, (md5_uint32) 0xeb86d391);
    408416
    409417      /* Add the starting values of the context.  */
  • branches/GNU/src/binutils/libiberty/memchr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/*
    2 FUNCTION
    3         <<memchr>>---find character in memory
    42
    5 INDEX
    6         memchr
     3@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
    74
    8 ANSI_SYNOPSIS
    9         #include <string.h>
    10         void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>);
     5This function searches memory starting at @code{*@var{s}} for the
     6character @var{c}.  The search only ends with the first occurrence of
     7@var{c}, or after @var{length} characters; in particular, a null
     8character does not terminate the search.  If the character @var{c} is
     9found within @var{length} characters of @code{*@var{s}}, a pointer
     10to the character is returned.  If @var{c} is not found, then @code{NULL} is
     11returned.
    1112
    12 TRAD_SYNOPSIS
    13         #include <string.h>
    14         void *memchr(<[src]>, <[c]>, <[length]>)
    15         void *<[src]>;
    16         void *<[c]>;
    17         size_t <[length]>;
    18 
    19 DESCRIPTION
    20         This function searches memory starting at <<*<[src]>>> for the
    21         character <[c]>.  The search only ends with the first
    22         occurrence of <[c]>, or after <[length]> characters; in
    23         particular, <<NULL>> does not terminate the search.
    24 
    25 RETURNS
    26         If the character <[c]> is found within <[length]> characters
    27         of <<*<[src]>>>, a pointer to the character is returned. If
    28         <[c]> is not found, then <<NULL>> is returned. 
    29 
    30 PORTABILITY
    31 <<memchr>>  requires no supporting OS subroutines.
    32 
    33 QUICKREF
    34         memchr ansi pure
     13@end deftypefn
    3514
    3615*/
    3716
    3817#include <ansidecl.h>
    39 #ifdef __STDC__
     18#ifdef ANSI_PROTOTYPES
    4019#include <stddef.h>
    4120#else
     
    5130  const unsigned char *src = (const unsigned char *)src_void;
    5231 
    53   while (--length >= 0)
     32  while (length-- > 0)
    5433  {
    5534    if (*src == c)
  • branches/GNU/src/binutils/libiberty/memcmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         memcmp -- compare two memory regions
    75
    8 SYNOPSIS
    9         int memcmp (const void *from, const void *to, size_t count)
     6@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
    107
    11 DESCRIPTION
    12         Compare two memory regions and return less than,
    13         equal to, or greater than zero, according to lexicographical
    14         ordering of the compared regions.
     8Compares the first @var{count} bytes of two areas of memory.  Returns
     9zero if they are the same, a value less than zero if @var{x} is
     10lexically less than @var{y}, or a value greater than zero if @var{x}
     11is lexically greater than @var{y}.  Note that lexical order is determined
     12as if comparing unsigned char arrays.
     13
     14@end deftypefn
     15
    1516*/
    1617
    1718#include <ansidecl.h>
    18 #ifdef __STDC__
     19#ifdef ANSI_PROTOTYPES
    1920#include <stddef.h>
    2021#else
     
    2324
    2425int
    25 DEFUN(memcmp, (str1, str2, count),
    26       const PTR str1 AND const PTR str2 AND size_t count)
     26memcmp (str1, str2, count)
     27     const PTR str1;
     28     const PTR str2;
     29     size_t count;
    2730{
    2831  register const unsigned char *s1 = (const unsigned char*)str1;
  • branches/GNU/src/binutils/libiberty/memcpy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         memcpy -- copy memory regions of arbitary length
    75
    8 SYNOPSIS
    9         void* memcpy (void *out, const void *in, size_t n);
     6@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
    107
    11 DESCRIPTION
    12         Copy LENGTH bytes from memory region pointed to by IN to memory
    13         region pointed to by OUT.
     8Copies @var{length} bytes from memory region @var{in} to region
     9@var{out}.  Returns a pointer to @var{out}.
     10
     11@end deftypefn
     12
    1413*/
    1514
    1615#include <ansidecl.h>
    17 #ifdef __STDC__
     16#ifdef ANSI_PROTOTYPES
    1817#include <stddef.h>
    1918#else
     
    2120#endif
    2221
     22void bcopy PARAMS((const void*, void*, size_t));
     23
    2324PTR
    24 DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length)
     25memcpy (out, in, length)
     26     PTR out;
     27     const PTR in;
     28     size_t length;
    2529{
    2630    bcopy(in, out, length);
  • branches/GNU/src/binutils/libiberty/memmove.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Wrapper to implement ANSI C's memmove using BSD's bcopy. */
    22/* This function is in the public domain.  --Per Bothner. */
     3
     4/*
     5
     6@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
     7
     8Copies @var{count} bytes from memory area @var{from} to memory area
     9@var{to}, returning a pointer to @var{to}.
     10
     11@end deftypefn
     12
     13*/
     14
    315#include <ansidecl.h>
    4 #ifdef __STDC__
     16#ifdef ANSI_PROTOTYPES
    517#include <stddef.h>
    618#else
    719#define size_t unsigned long
    820#endif
     21
     22void bcopy PARAMS ((const void*, void*, size_t));
    923
    1024PTR
  • branches/GNU/src/binutils/libiberty/memset.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22   This implementation is in the public domain.  */
    33
     4/*
     5
     6@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
     7
     8Sets the first @var{count} bytes of @var{s} to the constant byte
     9@var{c}, returning a pointer to @var{s}.
     10
     11@end deftypefn
     12
     13*/
     14
    415#include <ansidecl.h>
    5 #ifdef __STDC__
     16#ifdef ANSI_PROTOTYPES
    617#include <stddef.h>
    718#else
     
    1021
    1122PTR
    12 DEFUN(memset, (dest, val, len),
    13       PTR dest AND register int val AND register size_t len)
     23memset (dest, val, len)
     24     PTR dest;
     25     register int val;
     26     register size_t len;
    1427{
    1528  register unsigned char *ptr = (unsigned char*)dest;
  • branches/GNU/src/binutils/libiberty/mkstemps.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    5050#endif
    5151
    52 /* Generate a unique temporary file name from TEMPLATE.
     52/*
    5353
    54    TEMPLATE has the form:
     54@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
    5555
    56    <path>/ccXXXXXX<suffix>
     56Generate a unique temporary file name from @var{template}.
     57@var{template} has the form:
    5758
    58    SUFFIX_LEN tells us how long <suffix> is (it can be zero length).
     59@example
     60   @var{path}/ccXXXXXX@var{suffix}
     61@end example
    5962
    60    The last six characters of TEMPLATE before <suffix> must be "XXXXXX";
    61    they are replaced with a string that makes the filename unique.
     63@var{suffix_len} tells us how long @var{suffix} is (it can be zero
     64length).  The last six characters of @var{template} before @var{suffix}
     65must be @samp{XXXXXX}; they are replaced with a string that makes the
     66filename unique.  Returns a file descriptor open on the file for
     67reading and writing.
    6268
    63    Returns a file descriptor open on the file for reading and writing.  */
     69@end deftypefn
     70
     71*/
     72
    6473int
    6574mkstemps (template, suffix_len)
     
    113122      XXXXXX[5] = letters[v % 62];
    114123
     124#ifdef VMS
     125      fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
     126#else
    115127      fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
     128#endif
    116129      if (fd >= 0)
    117130        /* The file does not exist.  */
  • branches/GNU/src/binutils/libiberty/obstack.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    456456/* Define the error handler.  */
    457457#ifndef _
    458 # ifdef HAVE_LIBINTL_H
     458# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
    459459#  include <libintl.h>
    460460#  ifndef _
  • branches/GNU/src/binutils/libiberty/partition.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* List implentation of a partition of consecutive integers.
    2    Copyright (C) 2000 Free Software Foundation, Inc.
     1/* List implementation of a partition of consecutive integers.
     2   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
    33   Contributed by CodeSourcery, LLC.
    44
  • branches/GNU/src/binutils/libiberty/putenv.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
     1/* Copyright (C) 1991, 1994, 1995, 1996, 2002 Free Software Foundation, Inc.
    22   This file based on putenv.c in the GNU C Library.
    33
     
    1717   Boston, MA 02111-1307, USA.  */
    1818
     19/*
     20
     21@deftypefn Supplemental int putenv (const char *@var{string})
     22
     23Uses @code{setenv} or @code{unsetenv} to put @var{string} into
     24the environment or remove it.  If @var{string} is of the form
     25@samp{name=value} the string is added; if no @samp{=} is present the
     26name is unset/removed.
     27
     28@end deftypefn
     29
     30*/
     31
    1932#if defined (_AIX) && !defined (__GNUC__)
    2033 #pragma alloca
     
    2639
    2740#include "ansidecl.h"
     41
     42#define putenv libiberty_putenv
    2843
    2944#if HAVE_STDLIB_H
     
    4560# endif /* alloca */
    4661#endif /* HAVE_ALLOCA_H */
     62
     63#undef putenv
    4764
    4865/* Below this point, it's verbatim code from the glibc-2.0 implementation */
  • branches/GNU/src/binutils/libiberty/random.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    3434 * It was reworked for the GNU C Library by Roland McGrath.
    3535 */
     36
     37/*
     38
     39@deftypefn Supplement {long int} random (void)
     40@deftypefnx Supplement void srandom (unsigned int @var{seed})
     41@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
     42@deftypefnx Supplement void* setstate (void *@var{arg_state})
     43
     44Random number functions.  @code{random} returns a random number in the
     45range 0 to @code{LONG_MAX}.  @code{srandom} initializes the random
     46number generator to some starting point determined by @var{seed}
     47(else, the values returned by @code{random} are always the same for each
     48run of the program).  @code{initstate} and @code{setstate} allow fine-grained
     49control over the state of the random number generator.
     50
     51@end deftypefn
     52
     53*/
    3654
    3755#include <errno.h>
  • branches/GNU/src/binutils/libiberty/rename.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22   This function is in the public domain. */
    33
    4 /* Rename a file.  */
     4/*
    55
     6@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
     7
     8Renames a file from @var{old} to @var{new}.  If @var{new} already
     9exists, it is removed.
     10
     11@end deftypefn
     12
     13*/
     14
     15#include "ansidecl.h"
    616#ifdef HAVE_CONFIG_H
    717#include "config.h"
     
    1424int
    1525rename (zfrom, zto)
    16      char *zfrom;
    17      char *zto;
     26     const char *zfrom;
     27     const char *zto;
    1828{
    1929  if (link (zfrom, zto) < 0)
  • branches/GNU/src/binutils/libiberty/rindex.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Stub implementation of (obsolete) rindex(). */
     2
     3/*
     4
     5@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
     6
     7Returns a pointer to the last occurrence of the character @var{c} in
     8the string @var{s}, or @code{NULL} if not found.  The use of @code{rindex} is
     9deprecated in new programs in favor of @code{strrchr}.
     10
     11@end deftypefn
     12
     13*/
    214
    315extern char *strrchr ();
  • branches/GNU/src/binutils/libiberty/safe-ctype.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    4949
    5050/* Masks.  */
    51 #define L  lo|is   |pr  /* lower case letter */
    52 #define XL lo|is|xd|pr  /* lowercase hex digit */
    53 #define U  up|is   |pr  /* upper case letter */
    54 #define XU up|is|xd|pr  /* uppercase hex digit */
    55 #define D  di   |xd|pr  /* decimal digit */
    56 #define P  pn      |pr  /* punctuation */
    57 #define _  pn|is   |pr  /* underscore */
     51#define L  (const unsigned short) (lo|is   |pr) /* lower case letter */
     52#define XL (const unsigned short) (lo|is|xd|pr) /* lowercase hex digit */
     53#define U  (const unsigned short) (up|is   |pr) /* upper case letter */
     54#define XU (const unsigned short) (up|is|xd|pr) /* uppercase hex digit */
     55#define D  (const unsigned short) (di   |xd|pr) /* decimal digit */
     56#define P  (const unsigned short) (pn      |pr) /* punctuation */
     57#define _  (const unsigned short) (pn|is   |pr) /* underscore */
    5858
    59 #define C           cn  /* control character */
    60 #define Z  nv      |cn  /* NUL */
    61 #define M  nv|sp   |cn  /* cursor movement: \f \v */
    62 #define V  vs|sp   |cn  /* vertical space: \r \n */
    63 #define T  nv|sp|bl|cn  /* tab */
    64 #define S  nv|sp|bl|pr  /* space */
     59#define C  (const unsigned short) (         cn) /* control character */
     60#define Z  (const unsigned short) (nv      |cn) /* NUL */
     61#define M  (const unsigned short) (nv|sp   |cn) /* cursor movement: \f \v */
     62#define V  (const unsigned short) (vs|sp   |cn) /* vertical space: \r \n */
     63#define T  (const unsigned short) (nv|sp|bl|cn) /* tab */
     64#define S  (const unsigned short) (nv|sp|bl|pr) /* space */
    6565
    6666/* Are we ASCII? */
  • branches/GNU/src/binutils/libiberty/setenv.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
     1/* Copyright (C) 1992, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
    22   This file based on setenv.c in the GNU C Library.
    33
     
    1717   Boston, MA 02111-1307, USA.  */
    1818
     19
     20/*
     21
     22@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
     23@deftypefnx Supplemental void unsetenv (const char *@var{name})
     24
     25@code{setenv} adds @var{name} to the environment with value
     26@var{value}.  If the name was already present in the environment,
     27the new value will be stored only if @var{overwrite} is nonzero.
     28The companion @code{unsetenv} function removes @var{name} from the
     29environment.  This implementation is not safe for multithreaded code.
     30
     31@end deftypefn
     32
     33*/
     34
    1935#if HAVE_CONFIG_H
    2036# include <config.h>
    2137#endif
     38
     39#define setenv libiberty_setenv
     40#define unsetenv libiberty_unsetenv
    2241
    2342#include "ansidecl.h"
     
    4564extern char **environ;
    4665#endif
     66
     67#undef setenv
     68#undef unsetenv
    4769
    4870/* LOCK and UNLOCK are defined as no-ops.  This makes the libiberty
  • branches/GNU/src/binutils/libiberty/sigsetmask.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    44   This file is in the public doamin. */
    55
    6 /* Set the current signal mask to the set provided, and return the
    7    previous value */
     6/*
     7
     8@deftypefn Supplemental int sigsetmask (int @var{set})
     9
     10Sets the signal mask to the one provided in @var{set} and returns
     11the old mask (which, for libiberty's implementation, will always
     12be the value @code{1}).
     13
     14@end deftypefn
     15
     16*/
    817
    918#define _POSIX_SOURCE
     
    1726#ifdef SIG_SETMASK
    1827int
    19 DEFUN(sigsetmask,(set),
    20       int set)
     28sigsetmask (set)
     29      int set;
    2130{
    2231    sigset_t new;
  • branches/GNU/src/binutils/libiberty/spaces.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2020/*
    2121
    22 NAME
     22@deftypefn Extension char* spaces (int @var{count})
    2323
    24         spaces -- return a pointer to a buffer full of spaces
     24Returns a pointer to a memory region filled with the specified
     25number of spaces and null terminated.  The returned pointer is
     26valid until at least the next call.
    2527
    26 SYNOPSIS
    27 
    28         char *spaces (int count)
    29 
    30 DESCRIPTION
    31 
    32         Returns a pointer to a memory region filled with the specified
    33         number of spaces and null terminated.  The returned pointer is
    34         valid until at least the next call.
    35        
    36 BUGS
     28@end deftypefn
    3729
    3830*/
  • branches/GNU/src/binutils/libiberty/splay-tree.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* A splay-tree datatype. 
    2    Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
     2   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    33   Contributed by Mark Mitchell (mark@markmitchell.com).
    44
     
    7171    (*sp->delete_value)(node->value);
    7272
    73   free ((char*) node);
     73  (*sp->deallocate) ((char*) node, sp->allocate_data);
    7474}
    7575
     
    228228}
    229229
     230
     231/* An allocator and deallocator based on xmalloc.  */
     232static void *
     233splay_tree_xmalloc_allocate (size, data)
     234     int size;
     235     void *data ATTRIBUTE_UNUSED;
     236{
     237  return (void *) xmalloc (size);
     238}
     239
     240static void
     241splay_tree_xmalloc_deallocate (object, data)
     242     void *object;
     243     void *data ATTRIBUTE_UNUSED;
     244{
     245  free (object);
     246}
     247
     248
    230249/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
    231250   DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
    232    values.  */
     251   values.  Use xmalloc to allocate the splay tree structure, and any
     252   nodes added.  */
    233253
    234254splay_tree
     
    238258     splay_tree_delete_value_fn delete_value_fn;
    239259{
    240   splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree_s));
     260  return (splay_tree_new_with_allocator
     261          (compare_fn, delete_key_fn, delete_value_fn,
     262           splay_tree_xmalloc_allocate, splay_tree_xmalloc_deallocate, 0));
     263}
     264
     265
     266/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
     267   DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
     268   values.  */
     269
     270splay_tree
     271splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn,
     272                               allocate_fn, deallocate_fn, allocate_data)
     273     splay_tree_compare_fn compare_fn;
     274     splay_tree_delete_key_fn delete_key_fn;
     275     splay_tree_delete_value_fn delete_value_fn;
     276     splay_tree_allocate_fn allocate_fn;
     277     splay_tree_deallocate_fn deallocate_fn;
     278     void *allocate_data;
     279{
     280  splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s),
     281                                               allocate_data);
    241282  sp->root = 0;
    242283  sp->comp = compare_fn;
    243284  sp->delete_key = delete_key_fn;
    244285  sp->delete_value = delete_value_fn;
     286  sp->allocate = allocate_fn;
     287  sp->deallocate = deallocate_fn;
     288  sp->allocate_data = allocate_data;
    245289
    246290  return sp;
     
    254298{
    255299  splay_tree_delete_helper (sp, sp->root);
    256   free ((char*) sp);
     300  (*sp->deallocate) ((char*) sp, sp->allocate_data);
    257301}
    258302
     
    287331      splay_tree_node node;
    288332     
    289       node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node_s));
     333      node = ((splay_tree_node)
     334              (*sp->allocate) (sizeof (struct splay_tree_node_s),
     335                               sp->allocate_data));
    290336      node->key = key;
    291337      node->value = value;
     
    331377      if (sp->delete_value)
    332378        (*sp->delete_value) (sp->root->value);
    333       free (sp->root);
     379      (*sp->deallocate) (sp->root, sp->allocate_data);
    334380
    335381      /* One of the children is now the root.  Doesn't matter much
     
    369415}
    370416
     417/* Return the node in SP with the greatest key.  */
     418
     419splay_tree_node
     420splay_tree_max (sp)
     421     splay_tree sp;
     422{
     423  splay_tree_node n = sp->root;
     424
     425  if (!n)
     426    return NULL;
     427
     428  while (n->right)
     429    n = n->right;
     430
     431  return n;
     432}
     433
     434/* Return the node in SP with the smallest key.  */
     435
     436splay_tree_node
     437splay_tree_min (sp)
     438     splay_tree sp;
     439{
     440  splay_tree_node n = sp->root;
     441
     442  if (!n)
     443    return NULL;
     444
     445  while (n->left)
     446    n = n->left;
     447
     448  return n;
     449}
     450
    371451/* Return the immediate predecessor KEY, or NULL if there is no
    372452   predecessor.  KEY need not be present in the tree.  */
     
    403483
    404484/* Return the immediate successor KEY, or NULL if there is no
    405    predecessor.  KEY need not be present in the tree.  */
     485   successor.  KEY need not be present in the tree.  */
    406486
    407487splay_tree_node
     
    413493  splay_tree_node node;
    414494
    415   /* If the tree is empty, there is certainly no predecessor.  */
     495  /* If the tree is empty, there is certainly no successor.  */
    416496  if (!sp->root)
    417497    return NULL;
  • branches/GNU/src/binutils/libiberty/strcasecmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1111 */
    1212
     13/*
     14 
     15@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
     16
     17A case-insensitive @code{strcmp}.
     18
     19@end deftypefn
     20
     21*/
     22
    1323#if defined(LIBC_SCCS) && !defined(lint)
    1424static char sccsid[] = "@(#)strcasecmp.c        5.5 (Berkeley) 11/24/87";
     
    1626
    1727#include <ansidecl.h>
    18 #ifdef __STDC__
     28#ifdef ANSI_PROTOTYPES
    1929#include <stddef.h>
    2030#else
     
    2838 */
    2939typedef unsigned char uc;
    30 static unsigned char charmap[] = {
     40static const unsigned char charmap[] = {
    3141        (uc)'\000',(uc)'\001',(uc)'\002',(uc)'\003',(uc)'\004',(uc)'\005',(uc)'\006',(uc)'\007',
    3242        (uc)'\010',(uc)'\011',(uc)'\012',(uc)'\013',(uc)'\014',(uc)'\015',(uc)'\016',(uc)'\017',
  • branches/GNU/src/binutils/libiberty/strchr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         strchr -- return pointer to first occurance of a character
    75
    8 SYNOPSIS
    9         char *strchr (const char *s, int c)
     6@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
    107
    11 DESCRIPTION
    12         Returns a pointer to the first occurance of character C in
    13         string S, or a NULL pointer if no occurance is found.
    14        
    15 BUGS
    16         Behavior when character is the null character is implementation
    17         dependent.
     8Returns a pointer to the first occurrence of the character @var{c} in
     9the string @var{s}, or @code{NULL} if not found.  If @var{c} is itself the
     10null character, the results are undefined.
     11
     12@end deftypefn
     13
    1814*/
    1915
  • branches/GNU/src/binutils/libiberty/strdup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     1/*
     2
     3@deftypefn Supplemental char* strdup (const char *@var{s})
     4
     5Returns a pointer to a copy of @var{s} in memory obtained from
     6@code{malloc}, or @code{NULL} if insufficient memory was available.
     7
     8@end deftypefn
     9
     10*/
     11
     12#include <ansidecl.h>
     13#ifdef ANSI_PROTOTYPES
     14#include <stddef.h>
     15#else
     16#define size_t unsigned long
     17#endif
     18
     19extern size_t   strlen PARAMS ((const char*));
     20extern PTR      malloc PARAMS ((size_t));
     21extern PTR      memcpy PARAMS ((PTR, const PTR, size_t));
     22
    123char *
    224strdup(s)
    325     char *s;
    426{
    5     char *result = (char*)malloc(strlen(s) + 1);
    6     if (result == (char*)0)
    7         return (char*)0;
    8     strcpy(result, s);
    9     return result;
     27  size_t len = strlen (s) + 1;
     28  char *result = (char*) malloc (len);
     29  if (result == (char*) 0)
     30    return (char*) 0;
     31  return (char*) memcpy (result, s, len);
    1032}
  • branches/GNU/src/binutils/libiberty/strerror.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1414   attributes.  So we hide the declaration in errno.h (if any) using a
    1515   macro. */
     16#define sys_nerr sys_nerr__
    1617#define sys_errlist sys_errlist__
    1718#endif
     
    2122
    2223#ifdef HAVE_SYS_ERRLIST
     24#undef sys_nerr
    2325#undef sys_errlist
    2426#endif
     
    5759struct error_info
    5860{
    59   int value;            /* The numeric value from <errno.h> */
    60   const char *name;     /* The equivalent symbolic value */
     61  const int value;              /* The numeric value from <errno.h> */
     62  const char *const name;       /* The equivalent symbolic value */
    6163#ifndef HAVE_SYS_ERRLIST
    62   const char *msg;      /* Short message about this value */
     64  const char *const msg;        /* Short message about this value */
    6365#endif
    6466};
     
    561563/*
    562564
    563 NAME
    564 
    565         errno_max -- return the max errno value
    566 
    567 SYNOPSIS
    568 
    569         int errno_max ();
    570 
    571 DESCRIPTION
    572 
    573         Returns the maximum errno value for which a corresponding symbolic
    574         name or message is available.  Note that in the case where
    575         we use the sys_errlist supplied by the system, it is possible for
    576         there to be more symbolic names than messages, or vice versa.
    577         In fact, the manual page for perror(3C) explicitly warns that one
    578         should check the size of the table (sys_nerr) before indexing it,
    579         since new error codes may be added to the system before they are
    580         added to the table.  Thus sys_nerr might be smaller than value
    581         implied by the largest errno value defined in <errno.h>.
    582 
    583         We return the maximum value that can be used to obtain a meaningful
    584         symbolic name or message.
     565
     566@deftypefn Extension int errno_max (void)
     567
     568Returns the maximum @code{errno} value for which a corresponding
     569symbolic name or message is available.  Note that in the case where we
     570use the @code{sys_errlist} supplied by the system, it is possible for
     571there to be more symbolic names than messages, or vice versa.  In
     572fact, the manual page for @code{perror(3C)} explicitly warns that one
     573should check the size of the table (@code{sys_nerr}) before indexing
     574it, since new error codes may be added to the system before they are
     575added to the table.  Thus @code{sys_nerr} might be smaller than value
     576implied by the largest @code{errno} value defined in @code{<errno.h>}.
     577
     578We return the maximum value that can be used to obtain a meaningful
     579symbolic name or message.
     580
     581@end deftypefn
    585582
    586583*/
     
    603600/*
    604601
    605 NAME
    606 
    607         strerror -- map an error number to an error message string
    608 
    609 SYNOPSIS
    610 
    611         char *strerror (int errnoval)
    612 
    613 DESCRIPTION
    614 
    615         Maps an errno number to an error message string, the contents of
    616         which are implementation defined.  On systems which have the external
    617         variables sys_nerr and sys_errlist, these strings will be the same
    618         as the ones used by perror().
    619 
    620         If the supplied error number is within the valid range of indices
    621         for the sys_errlist, but no message is available for the particular
    622         error number, then returns the string "Error NUM", where NUM is the
    623         error number.
    624 
    625         If the supplied error number is not a valid index into sys_errlist,
    626         returns NULL.
    627 
    628         The returned string is only guaranteed to be valid only until the
    629         next call to strerror.
     602@deftypefn Supplemental char* strerror (int @var{errnoval})
     603
     604Maps an @code{errno} number to an error message string, the contents
     605of which are implementation defined.  On systems which have the
     606external variables @code{sys_nerr} and @code{sys_errlist}, these
     607strings will be the same as the ones used by @code{perror}.
     608
     609If the supplied error number is within the valid range of indices for
     610the @code{sys_errlist}, but no message is available for the particular
     611error number, then returns the string @samp{Error @var{num}}, where
     612@var{num} is the error number.
     613
     614If the supplied error number is not a valid index into
     615@code{sys_errlist}, returns @code{NULL}.
     616
     617The returned string is only guaranteed to be valid only until the
     618next call to @code{strerror}.
     619
     620@end deftypefn
    630621
    631622*/
     
    635626  int errnoval;
    636627{
    637   char *msg;
     628  const char *msg;
    638629  static char buf[32];
    639630
     
    677668/*
    678669
    679 NAME
    680 
    681         strerrno -- map an error number to a symbolic name string
    682 
    683 SYNOPSIS
    684 
    685         const char *strerrno (int errnoval)
    686 
    687 DESCRIPTION
    688 
    689         Given an error number returned from a system call (typically
    690         returned in errno), returns a pointer to a string containing the
    691         symbolic name of that error number, as found in <errno.h>.
    692 
    693         If the supplied error number is within the valid range of indices
    694         for symbolic names, but no name is available for the particular
    695         error number, then returns the string "Error NUM", where NUM is
    696         the error number.
    697 
    698         If the supplied error number is not within the range of valid
    699         indices, then returns NULL.
    700 
    701 BUGS
    702 
    703         The contents of the location pointed to are only guaranteed to be
    704         valid until the next call to strerrno.
     670@deftypefn Replacement {const char*} strerrno (int @var{errnum})
     671
     672Given an error number returned from a system call (typically returned
     673in @code{errno}), returns a pointer to a string containing the
     674symbolic name of that error number, as found in @code{<errno.h>}.
     675
     676If the supplied error number is within the valid range of indices for
     677symbolic names, but no name is available for the particular error
     678number, then returns the string @samp{Error @var{num}}, where @var{num}
     679is the error number.
     680
     681If the supplied error number is not within the range of valid
     682indices, then returns @code{NULL}.
     683
     684The contents of the location pointed to are only guaranteed to be
     685valid until the next call to @code{strerrno}.
     686
     687@end deftypefn
    705688
    706689*/
     
    745728/*
    746729
    747 NAME
    748 
    749         strtoerrno -- map a symbolic errno name to a numeric value
    750 
    751 SYNOPSIS
    752 
    753         int strtoerrno (char *name)
    754 
    755 DESCRIPTION
    756 
    757         Given the symbolic name of a error number, map it to an errno value.
    758         If no translation is found, returns 0.
     730@deftypefn Extension int strtoerrno (const char *@var{name})
     731
     732Given the symbolic name of a error number (e.g., @code{EACCES}), map it
     733to an errno value.  If no translation is found, returns 0.
     734
     735@end deftypefn
    759736
    760737*/
     
    807784  int errnmax;
    808785  const char *name;
    809   char *msg;
     786  const char *msg;
    810787  char *strerror ();
    811788
  • branches/GNU/src/binutils/libiberty/strncasecmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1111 */
    1212
     13/*
     14 
     15@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
     16
     17A case-insensitive @code{strncmp}.
     18
     19@end deftypefn
     20
     21*/
     22
    1323#if defined(LIBC_SCCS) && !defined(lint)
    1424static char sccsid[] = "@(#)strcasecmp.c        5.5 (Berkeley) 11/24/87";
     
    1626
    1727#include <ansidecl.h>
    18 #ifdef __STDC__
     28#ifdef ANSI_PROTOTYPES
    1929#include <stddef.h>
    2030#else
     
    2737 * based upon ascii character sequences.
    2838 */
    29 static unsigned char charmap[] = {
     39static const unsigned char charmap[] = {
    3040        '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
    3141        '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
  • branches/GNU/src/binutils/libiberty/strncmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22   This function is in the public domain.  */
    33
     4/*
     5
     6@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
     7
     8Compares the first @var{n} bytes of two strings, returning a value as
     9@code{strcmp}.
     10
     11@end deftypefn
     12
     13*/
     14
    415#include <ansidecl.h>
    5 #ifdef __STDC__
     16#ifdef ANSI_PROTOTYPES
    617#include <stddef.h>
    718#else
  • branches/GNU/src/binutils/libiberty/strrchr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    33
    44/*
    5 NAME
    6         strrchr -- return pointer to last occurance of a character
    75
    8 SYNOPSIS
    9         char *strrchr (const char *s, int c)
     6@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
    107
    11 DESCRIPTION
    12         Returns a pointer to the last occurance of character C in
    13         string S, or a NULL pointer if no occurance is found.
    14        
    15 BUGS
    16         Behavior when character is the null character is implementation
    17         dependent.
     8Returns a pointer to the last occurrence of the character @var{c} in
     9the string @var{s}, or @code{NULL} if not found.  If @var{c} is itself the
     10null character, the results are undefined.
     11
     12@end deftypefn
     13
    1814*/
    1915
  • branches/GNU/src/binutils/libiberty/strsignal.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1818   declare it ourselves.  With luck, this will always work.  */
    1919#define sys_siglist no_such_symbol
     20#define sys_nsig sys_nsig__no_such_symbol
    2021
    2122#include <stdio.h>
     
    3940   found in the system header files.  */
    4041#undef sys_siglist
     42#undef sys_nsig
    4143
    4244#ifndef NULL
    43 #  ifdef __STDC__
     45#  ifdef ANSI_PROTOTYPES
    4446#    define NULL (void *) 0
    4547#  else
     
    6668struct signal_info
    6769{
    68   int value;            /* The numeric value from <signal.h> */
    69   const char *name;     /* The equivalent symbolic value */
     70  const int value;              /* The numeric value from <signal.h> */
     71  const char *const name;       /* The equivalent symbolic value */
    7072#ifndef HAVE_SYS_SIGLIST
    71   const char *msg;      /* Short message about this value */
     73  const char *const msg;        /* Short message about this value */
    7274#endif
    7375};
     
    349351/*
    350352
    351 NAME
    352 
    353         signo_max -- return the max signo value
    354 
    355 SYNOPSIS
    356 
    357         int signo_max ();
    358 
    359 DESCRIPTION
    360 
    361         Returns the maximum signo value for which a corresponding symbolic
    362         name or message is available.  Note that in the case where
    363         we use the sys_siglist supplied by the system, it is possible for
    364         there to be more symbolic names than messages, or vice versa.
    365         In fact, the manual page for psignal(3b) explicitly warns that one
    366         should check the size of the table (NSIG) before indexing it,
    367         since new signal codes may be added to the system before they are
    368         added to the table.  Thus NSIG might be smaller than value
    369         implied by the largest signo value defined in <signal.h>.
    370 
    371         We return the maximum value that can be used to obtain a meaningful
    372         symbolic name or message.
     353@deftypefn Extension int signo_max (void)
     354
     355Returns the maximum signal value for which a corresponding symbolic
     356name or message is available.  Note that in the case where we use the
     357@code{sys_siglist} supplied by the system, it is possible for there to
     358be more symbolic names than messages, or vice versa.  In fact, the
     359manual page for @code{psignal(3b)} explicitly warns that one should
     360check the size of the table (@code{NSIG}) before indexing it, since
     361new signal codes may be added to the system before they are added to
     362the table.  Thus @code{NSIG} might be smaller than value implied by
     363the largest signo value defined in @code{<signal.h>}.
     364
     365We return the maximum value that can be used to obtain a meaningful
     366symbolic name or message.
     367
     368@end deftypefn
    373369
    374370*/
     
    390386/*
    391387
    392 NAME
    393 
    394         strsignal -- map a signal number to a signal message string
    395 
    396 SYNOPSIS
    397 
    398         const char *strsignal (int signo)
    399 
    400 DESCRIPTION
    401 
    402         Maps an signal number to an signal message string, the contents of
    403         which are implementation defined.  On systems which have the external
    404         variable sys_siglist, these strings will be the same as the ones used
    405         by psignal().
    406 
    407         If the supplied signal number is within the valid range of indices
    408         for the sys_siglist, but no message is available for the particular
    409         signal number, then returns the string "Signal NUM", where NUM is the
    410         signal number.
    411 
    412         If the supplied signal number is not a valid index into sys_siglist,
    413         returns NULL.
    414 
    415         The returned string is only guaranteed to be valid only until the
    416         next call to strsignal.
     388@deftypefn Supplemental {const char *} strsignal (int @var{signo})
     389
     390Maps an signal number to an signal message string, the contents of
     391which are implementation defined.  On systems which have the external
     392variable @code{sys_siglist}, these strings will be the same as the
     393ones used by @code{psignal()}.
     394
     395If the supplied signal number is within the valid range of indices for
     396the @code{sys_siglist}, but no message is available for the particular
     397signal number, then returns the string @samp{Signal @var{num}}, where
     398@var{num} is the signal number.
     399
     400If the supplied signal number is not a valid index into
     401@code{sys_siglist}, returns @code{NULL}.
     402
     403The returned string is only guaranteed to be valid only until the next
     404call to @code{strsignal}.
     405
     406@end deftypefn
    417407
    418408*/
     
    460450/*
    461451
    462 NAME
    463 
    464         strsigno -- map an signal number to a symbolic name string
    465 
    466 SYNOPSIS
    467 
    468         const char *strsigno (int signo)
    469 
    470 DESCRIPTION
    471 
    472         Given an signal number, returns a pointer to a string containing
    473         the symbolic name of that signal number, as found in <signal.h>.
    474 
    475         If the supplied signal number is within the valid range of indices
    476         for symbolic names, but no name is available for the particular
    477         signal number, then returns the string "Signal NUM", where NUM is
    478         the signal number.
    479 
    480         If the supplied signal number is not within the range of valid
    481         indices, then returns NULL.
    482 
    483 BUGS
    484 
    485         The contents of the location pointed to are only guaranteed to be
    486         valid until the next call to strsigno.
     452@deftypefn Extension {const char*} strsigno (int @var{signo})
     453
     454Given an signal number, returns a pointer to a string containing the
     455symbolic name of that signal number, as found in @code{<signal.h>}.
     456
     457If the supplied signal number is within the valid range of indices for
     458symbolic names, but no name is available for the particular signal
     459number, then returns the string @samp{Signal @var{num}}, where
     460@var{num} is the signal number.
     461
     462If the supplied signal number is not within the range of valid
     463indices, then returns @code{NULL}.
     464
     465The contents of the location pointed to are only guaranteed to be
     466valid until the next call to @code{strsigno}.
     467
     468@end deftypefn
    487469
    488470*/
     
    523505/*
    524506
    525 NAME
    526 
    527         strtosigno -- map a symbolic signal name to a numeric value
    528 
    529 SYNOPSIS
    530 
    531         int strtosigno (char *name)
    532 
    533 DESCRIPTION
    534 
    535         Given the symbolic name of a signal, map it to a signal number.
    536         If no translation is found, returns 0.
     507@deftypefn Extension int strtosigno (const char *@var{name})
     508
     509Given the symbolic name of a signal, map it to a signal number.  If no
     510translation is found, returns 0.
     511
     512@end deftypefn
    537513
    538514*/
     
    569545/*
    570546
    571 NAME
    572 
    573         psignal -- print message about signal to stderr
    574 
    575 SYNOPSIS
    576 
    577         void psignal (unsigned signo, char *message);
    578 
    579 DESCRIPTION
    580 
    581         Print to the standard error the message, followed by a colon,
    582         followed by the description of the signal specified by signo,
    583         followed by a newline.
     547@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
     548
     549Print @var{message} to the standard error, followed by a colon,
     550followed by the description of the signal specified by @var{signo},
     551followed by a newline.
     552
     553@end deftypefn
     554
    584555*/
    585556
  • branches/GNU/src/binutils/libiberty/strstr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    44/*
    55
    6 NAME
     6@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
    77
    8         strstr -- locate first occurance of a substring
     8This function searches for the substring @var{sub} in the string
     9@var{string}, not including the terminating null characters.  A pointer
     10to the first occurrence of @var{sub} is returned, or @code{NULL} if the
     11substring is absent.  If @var{sub} points to a string with zero
     12length, the function returns @var{string}.
    913
    10 SYNOPSIS
     14@end deftypefn
    1115
    12         #include <string.h>
    13 
    14         char *strstr (char *s1, char *s2)
    15 
    16 DESCRIPTION
    17 
    18         Locates the first occurance in the string pointed to by S1 of
    19         the string pointed to by S2.  Returns a pointer to the substring
    20         found, or a NULL pointer if not found.  If S2 points to a string
    21         with zero length, the function returns S1.
    22        
    23 BUGS
    2416
    2517*/
     
    3628  extern char *strchr ();
    3729  extern int strncmp ();
    38 #if __GNUC__==2
    39   extern __SIZE_TYPE__ strlen ();
     30#if __GNUC__ >= 2
     31  extern __SIZE_TYPE__ strlen (const char *);
    4032#endif
    4133  register int len = strlen (s2);
  • branches/GNU/src/binutils/libiberty/strtod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Implementation of strtod for systems with atof.
    2    Copyright (C) 1991, 1995 Free Software Foundation, Inc.
     2   Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc.
    33
    44This file is part of the libiberty library.  This library is free
     
    2222This exception does not however invalidate any other reasons why
    2323the executable file might be covered by the GNU General Public License. */
     24
     25/*
     26
     27@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
     28
     29This ISO C function converts the initial portion of @var{string} to a
     30@code{double}.  If @var{endptr} is not @code{NULL}, a pointer to the
     31character after the last character used in the conversion is stored in
     32the location referenced by @var{endptr}.  If no conversion is
     33performed, zero is returned and the value of @var{string} is stored in
     34the location referenced by @var{endptr}.
     35
     36@end deftypefn
     37
     38*/
    2439
    2540#include "ansidecl.h"
     
    6176          && (p[7] == 'y' || p[7] == 'Y'))
    6277        {
    63           *ptr = p + 7;
     78          *ptr = p + 8;
    6479          return atof (str);
    6580        }
  • branches/GNU/src/binutils/libiberty/strtol.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2828 * SUCH DAMAGE.
    2929 */
     30
     31/*
     32
     33@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
     34@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
     35
     36The @code{strtol} function converts the string in @var{string} to a
     37long integer value according to the given @var{base}, which must be
     38between 2 and 36 inclusive, or be the special value 0.  If @var{base}
     39is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
     40to indicate bases 8 and 16, respectively, else default to base 10.
     41When the base is 16 (either explicitly or implicitly), a prefix of
     42@code{0x} is allowed.  The handling of @var{endptr} is as that of
     43@code{strtod} above.  The @code{strtoul} function is the same, except
     44that the converted value is unsigned.
     45
     46@end deftypefn
     47
     48*/
    3049
    3150#ifdef HAVE_CONFIG_H
  • branches/GNU/src/binutils/libiberty/testsuite/Makefile.in

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11#
    22# Makefile
    3 #   Copyright (C) 1999
     3#   Copyright (C) 1999, 2002
    44#   Free Software Foundation
    55#
     
    4646
    4747# Run some tests of the demangler.
    48 check-cplus-dem: test-filter $(srcdir)/demangle-expected
    49         $(SHELL) $(srcdir)/regress-demangle $(srcdir)/demangle-expected
     48check-cplus-dem: test-demangle $(srcdir)/demangle-expected
     49        ./test-demangle < $(srcdir)/demangle-expected
    5050
    51 # Note that we just hard-code prepends_underscore to 0.  This doesn't
    52 # matter since any particular test can override the default if need
    53 # be.
    5451TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES)
    55 test-filter: $(srcdir)/../cplus-dem.c
    56         echo 'int prepends_underscore = 0;' > test-us.c
    57         $(TEST_COMPILE) -o test-filter -DMAIN -DVERSION='"none"' @DEFS@ \
    58                 $(srcdir)/../cplus-dem.c test-us.c -L.. -liberty
    59 
     52test-demangle: $(srcdir)/test-demangle.c
     53        $(TEST_COMPILE) -o test-demangle \
     54                $(srcdir)/test-demangle.c ../libiberty.a
    6055
    6156# Standard (either GNU or Cygnus) rules we don't use.
     
    6459# The standard clean rules.
    6560mostlyclean:
    66         rm -f test-us.c test-filter
     61        rm -f test-demangle
    6762clean: mostlyclean
    6863distclean: clean
     
    7065maintainer-clean realclean: distclean
    7166
    72 
    7367Makefile: $(srcdir)/Makefile.in ../config.status
    7468        CONFIG_FILES=testsuite/Makefile CONFIG_HEADERS= \
  • branches/GNU/src/binutils/libiberty/testsuite/demangle-expected

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    128128#
    129129--format=gnu
    130 _10PageButton\$__both
     130_10PageButton$__both
    131131PageButton::__both
    132132#
    133133--format=gnu
    134 _3RNG\$singleMantissa
     134_3RNG$singleMantissa
    135135RNG::singleMantissa
    136136#
    137137--format=gnu
    138 _5IComp\$_release
     138_5IComp$_release
    139139IComp::_release
    140140#
    141141--format=gnu
    142 _\$_10BitmapComp
     142_$_10BitmapComp
    143143BitmapComp::~BitmapComp(void)
    144144#
    145145--format=gnu
    146 _\$_9__io_defs
     146_$_9__io_defs
    147147__io_defs::~__io_defs(void)
    148148#
    149149--format=gnu
    150 _\$_Q23foo3bar
     150_$_Q23foo3bar
    151151foo::bar::~bar(void)
    152152#
    153153--format=gnu
    154 _\$_Q33foo3bar4bell
     154_$_Q33foo3bar4bell
    155155foo::bar::bell::~bell(void)
    156156#
     
    436436#
    437437--format=gnu
    438 _vt\$foo
     438_vt$foo
    439439foo virtual table
    440440#
    441441--format=gnu
    442 _vt\$foo\$bar
     442_vt$foo$bar
    443443foo::bar virtual table
    444444#
     
    648648#
    649649--format=gnu
    650 _2T4\$N
     650_2T4$N
    651651T4::N
    652652#
    653653--format=gnu
    654 _Q22T42t1\$N
     654_Q22T42t1$N
    655655T4::t1::N
    656656#
     
    728728#
    729729--format=gnu
    730 _\$_t6vector1Zdi
     730_$_t6vector1Zdi
    731731vector<double>::~vector(int)
    732732#
    733733--format=gnu
    734 _\$_t6vector1Zii
     734_$_t6vector1Zii
    735735vector<int>::~vector(int)
    736736#
     
    828828#
    829829--format=gnu
    830 _GLOBAL_\$D\$set
     830_GLOBAL_$D$set
    831831global destructors keyed to set
    832832#
    833833--format=gnu
    834 _GLOBAL_\$I\$set
     834_GLOBAL_$I$set
    835835global constructors keyed to set
    836836#
     
    876876#
    877877--format=gnu
    878 _vt\$t8BDDHookV1ZPc
     878_vt$t8BDDHookV1ZPc
    879879BDDHookV<char *> virtual table
    880880#
     
    24772477#
    24782478--format=gnu
     2479f__FGt3Bar1i2G1i
     2480f(Bar<2>, i)
     2481#
     2482--format=gnu
    24792483f__FGt3Bar1i21i
    2480 f(Bar<2>, i)
    2481 #
    2482 --format=gnu
    2483 f__FGt3Bar1i_21_i
    24842484f(Bar<21>, int)
    24852485#
    24862486--format=gnu
    2487 f__FGt3Bar1i24XY_t
     2487f__FGt3Bar1i2G4XY_t
    24882488f(Bar<2>, XY_t)
    24892489#
     
    24932493#
    24942494--format=gnu
    2495 foo__H1Zt2TA2ZcZt2NA1Ui_20__X01_i
     2495foo__H1Zt2TA2ZcZt2NA1Ui20_X01_i
    24962496int foo<TA<char, NA<20> > >(TA<char, NA<20> >)
    24972497#
    24982498--format=gnu
    2499 foo__H1Zt2TA2ZiZt8N___A___1Ui_99__X01_i
     2499foo__H1Zt2TA2ZiZt8N___A___1Ui99_X01_i
    25002500int foo<TA<int, N___A___<99> > >(TA<int, N___A___<99> >)
    25012501#
     
    25332533#
    25342534--format=gnu
    2535 foo___bar__baz_____H1Zt2TA2ZiZt8N___A___1i_99__X01_i
     2535foo___bar__baz_____H1Zt2TA2ZiZt8N___A___1i99_X01_i
    25362536int foo___bar__baz___<TA<int, N___A___<99> > >(TA<int, N___A___<99> >)
    25372537#
     
    25652565#
    25662566--format=gnu
    2567 _26_GLOBAL_\$N\$_tmp_n.iilg4Gya\$app_instance
     2567_26_GLOBAL_$N$_tmp_n.iilg4Gya$app_instance
    25682568{anonymous}::app_instance
     2569#
     2570--format=java
     2571_ZN4java3awt10ScrollPane7addImplEPNS0_9ComponentEPNS_4lang6ObjectEi
     2572java.awt.ScrollPane.addImpl(java.awt.Component, java.lang.Object, int)
     2573#
     2574--format=java
     2575_ZN4java3awt4geom15AffineTransform9getMatrixEP6JArrayIdE
     2576java.awt.geom.AffineTransform.getMatrix(double[])
     2577#
     2578--format=java
     2579_ZN23Mangle$Inner$InnerInner3fooEP6JArrayIPS0_IiEEdPS0_IPS0_IPS0_IPS0_IPN4java4lang6StringEEEEEPS0_IPS0_IPN6MangleEEE
     2580Mangle$Inner$InnerInner.foo(int[][], double, java.lang.String[][][][], Mangle[][])
     2581#
     2582--format=java
     2583_ZN6JArray1tEP6JArrayIPS_E
     2584JArray.t(JArray[])
     2585#
     2586--format=java
     2587_ZN4Prim1iEibcdfwPN4java4lang6StringEsx
     2588Prim.i(int, boolean, byte, double, float, char, java.lang.String, short, long)
     2589#
     2590--format=java
     2591_ZN4java4util14Map__U24_Entry11class__U24_E
     2592java.util.Map$Entry.class$
     2593#
     2594--format=hp
     2595_Utf58_0_1__1_2147483647__2147483648
     2596_Utf58_0_1__1_2147483647__2147483648
     2597#
     2598--format=gnu-v3
     2599St9bad_alloc
     2600std::bad_alloc
     2601#
     2602# This caused an infinite loop.
     2603# We still don't demangle this correctly, but at least we don't hang.
     2604--format=auto
     2605__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator
     2606_Z1ZZ2Z::__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm(iterator)
  • branches/GNU/src/binutils/libiberty/tmpnam.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     1/*
     2
     3@deftypefn Supplemental char* tmpnam (char *@var{s})
     4
     5This function attempts to create a name for a temporary file, which
     6will be a valid file name yet not exist when @code{tmpnam} checks for
     7it.  @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
     8or be @code{NULL}.  Use of this function creates a security risk, and it must
     9not be used in new projects.  Use @code{mkstemp} instead.
     10
     11@end deftypefn
     12
     13*/
     14
    115#include <stdio.h>
    216
  • branches/GNU/src/binutils/libiberty/vasprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2929#endif
    3030#include <stdio.h>
     31#ifdef HAVE_STRING_H
    3132#include <string.h>
     33#endif
    3234#ifdef HAVE_STDLIB_H
    3335#include <stdlib.h>
     
    4244#endif
    4345
     46/*
     47
     48@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
     49
     50Like @code{vsprintf}, but instead of passing a pointer to a buffer,
     51you pass a pointer to a pointer.  This function will compute the size
     52of the buffer needed, allocate memory with @code{malloc}, and store a
     53pointer to the allocated memory in @code{*@var{resptr}}.  The value
     54returned is the same as @code{vsprintf} would return.  If memory could
     55not be allocated, zero is returned and @code{NULL} is stored in
     56@code{*@var{resptr}}.
     57
     58@end deftypefn
     59
     60*/
    4461
    4562static int int_vasprintf PARAMS ((char **, const char *, va_list *));
     
    122139  global_total_width = total_width;
    123140#endif
    124   *result = malloc (total_width);
     141  *result = (char *) malloc (total_width);
    125142  if (*result != NULL)
    126143    return vsprintf (*result, format, *args);
     
    143160
    144161#ifdef TEST
    145 static void checkit PARAMS ((const char *, ...));
     162static void ATTRIBUTE_PRINTF_1
     163checkit VPARAMS ((const char *format, ...))
     164{
     165  char *result;
     166  VA_OPEN (args, format);
     167  VA_FIXEDARG (args, const char *, format);
     168  vasprintf (&result, format, args);
     169  VA_CLOSE (args);
    146170
    147 static void
    148 checkit VPARAMS ((const char* format, ...))
    149 {
    150   va_list args;
    151   char *result;
    152 #ifndef ANSI_PROTOTYPES
    153   const char *format;
    154 #endif
    155 
    156   VA_START (args, format);
    157 
    158 #ifndef ANSI_PROTOTYPES
    159   format = va_arg (args, const char *);
    160 #endif
    161 
    162   vasprintf (&result, format, args);
    163171  if (strlen (result) < (size_t) global_total_width)
    164172    printf ("PASS: ");
     
    166174    printf ("FAIL: ");
    167175  printf ("%d %s\n", global_total_width, result);
     176
     177  free (result);
    168178}
    169179
  • branches/GNU/src/binutils/libiberty/vfork.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Emulate vfork using just plain fork, for systems without a real vfork.
    22   This function is in the public domain. */
     3
     4/*
     5
     6@deftypefn Supplemental int vfork (void)
     7
     8Emulates @code{vfork} by calling @code{fork} and returning its value.
     9
     10@end deftypefn
     11
     12*/
    313
    414#include "ansidecl.h"
  • branches/GNU/src/binutils/libiberty/vfprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    44 */
    55
    6 #ifdef __STDC__
     6#include "ansidecl.h"
     7#ifdef ANSI_PROTOTYPES
    78#include <stdarg.h>
    89#else
  • branches/GNU/src/binutils/libiberty/vprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 #ifdef __STDC__
     1/*
     2
     3@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
     4@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
     5@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
     6
     7These functions are the same as @code{printf}, @code{fprintf}, and
     8@code{sprintf}, respectively, except that they are called with a
     9@code{va_list} instead of a variable number of arguments.  Note that
     10they do not call @code{va_end}; this is the application's
     11responsibility.  In @libib{} they are implemented in terms of the
     12nonstandard but common function @code{_doprnt}.
     13
     14@end deftypefn
     15
     16*/
     17
     18#include <ansidecl.h>
     19#ifdef ANSI_PROTOTYPES
    220#include <stdarg.h>
    321#else
     
    523#endif
    624#include <stdio.h>
    7 #include <ansidecl.h>
    825#undef vprintf
    926int
  • branches/GNU/src/binutils/libiberty/vsprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    44   Written by Per Bothner of Cygnus Support.
    55   Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
    6    Copyright (C) 1991, 1995 Free Software Foundation, Inc.
     6   Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc.
    77
    88This file is part of the libiberty library.  This library is free
     
    2727the executable file might be covered by the GNU General Public License. */
    2828
     29#include <ansidecl.h>
     30#ifdef ANSI_PROTOTYPES
     31#include <stdarg.h>
     32#else
    2933#include <varargs.h>
     34#endif
    3035#include <stdio.h>
    31 #include <ansidecl.h>
    3236#undef vsprintf
     37
     38#if defined _IOSTRG && defined _IOWRT
    3339
    3440int
     
    5460
    5561}
     62
     63#endif
  • branches/GNU/src/binutils/libiberty/waitpid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     1/*
     2
     3@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
     4
     5This is a wrapper around the @code{wait} function.  Any ``special''
     6values of @var{pid} depend on your implementation of @code{wait}, as
     7does the return value.  The third argument is unused in @libib{}.
     8
     9@end deftypefn
     10
     11*/
     12
    113#ifdef HAVE_CONFIG_H
    214#include "config.h"
    315#endif
     16
     17/* On some systems (such as WindISS), you must include <sys/types.h>
     18   to get the definition of "pid_t" before you include <sys/wait.h>.  */
     19#include <sys/types.h>
     20
    421#ifdef HAVE_SYS_WAIT_H
    522#include <sys/wait.h>
    623#endif
    724
    8 int
     25pid_t
    926waitpid (pid, stat_loc, options)
    10         int pid, *stat_loc, options;
     27     pid_t pid;
     28     int *stat_loc, options;
    1129{
    1230  for (;;)
  • branches/GNU/src/binutils/libiberty/xatexit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    55 * %sccs.include.redist.c%
    66 */
     7
     8
     9/*
     10
     11@deftypefun int xatexit (void (*@var{fn}) (void))
     12
     13Behaves as the standard @code{atexit} function, but with no limit on
     14the number of registered functions.  Returns 0 on success, or @minus{}1 on
     15failure.  If you use @code{xatexit} to register functions, you must use
     16@code{xexit} to terminate your program.
     17
     18@end deftypefun
     19
     20*/
    721
    822/* Adapted from newlib/libc/stdlib/{,at}exit.[ch].
     
    1428#include <stdio.h>
    1529
    16 #ifdef __STDC__
     30#ifdef ANSI_PROTOTYPES
    1731#include <stddef.h>
    1832#else
     
    2034#endif
    2135
     36#if VMS
     37#include <stdlib.h>
     38#include <unixlib.h>
     39#else
    2240/* For systems with larger pointers than ints, this must be declared.  */
    2341PTR malloc PARAMS ((size_t));
     42#endif
    2443
    2544static void xatexit_cleanup PARAMS ((void));
  • branches/GNU/src/binutils/libiberty/xexit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1717to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1818Boston, MA 02111-1307, USA.  */
     19
     20/*
     21
     22@deftypefn Replacement void xexit (int @var{code})
     23
     24Terminates the program.  If any functions have been registered with
     25the @code{xatexit} replacement function, they will be called first.
     26Termination is handled via the system's normal @code{exit} call.
     27
     28@end deftypefn
     29
     30*/
    1931
    2032#ifdef HAVE_CONFIG_H
  • branches/GNU/src/binutils/libiberty/xmalloc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1818Boston, MA 02111-1307, USA.  */
    1919
     20/*
     21
     22@deftypefn Replacement void* xmalloc (size_t)
     23
     24Allocate memory without fail.  If @code{malloc} fails, this will print
     25a message to @code{stderr} (using the name set by
     26@code{xmalloc_set_program_name},
     27if any) and then call @code{xexit}.  Note that it is therefore safe for
     28a program to contain @code{#define malloc xmalloc} in its source.
     29
     30@end deftypefn
     31
     32@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
     33Reallocate memory without fail.  This routine functions like @code{realloc},
     34but will behave the same as @code{xmalloc} if memory cannot be found.
     35
     36@end deftypefn
     37
     38@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
     39
     40Allocate memory without fail, and set it to zero.  This routine functions
     41like @code{calloc}, but will behave the same as @code{xmalloc} if memory
     42cannot be found.
     43
     44@end deftypefn
     45
     46@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
     47
     48You can use this to set the name of the program used by
     49@code{xmalloc_failed} when printing a failure message.
     50
     51@end deftypefn
     52
     53@deftypefn Replacement void xmalloc_failed (size_t)
     54
     55This function is not meant to be called by client code, and is listed
     56here for completeness only.  If any of the allocation routines fail, this
     57function will be called to print an error message and terminate execution.
     58
     59@end deftypefn
     60
     61*/
     62
    2063#ifdef HAVE_CONFIG_H
    2164#include "config.h"
     
    2669#include <stdio.h>
    2770
    28 #ifdef __STDC__
     71#ifdef ANSI_PROTOTYPES
    2972#include <stddef.h>
    3073#else
     
    78121    allocated = (char *) sbrk (0) - (char *) &environ;
    79122  fprintf (stderr,
    80            "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n",
     123           "\n%s%sout of memory allocating %lu bytes after a total of %lu bytes\n",
    81124           name, *name ? ": " : "",
    82125           (unsigned long) size, (unsigned long) allocated);
    83126#else /* HAVE_SBRK */
    84127  fprintf (stderr,
    85            "\n%s%sCannot allocate %lu bytes\n",
     128           "\n%s%sout of memory allocating %lu bytes\n",
    86129           name, *name ? ": " : "",
    87130           (unsigned long) size);
  • branches/GNU/src/binutils/libiberty/xmemdup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22   This trivial function is in the public domain.
    33   Jeff Garzik, September 1999.  */
     4
     5/*
     6
     7@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
     8
     9Duplicates a region of memory without fail.  First, @var{alloc_size} bytes
     10are allocated, then @var{copy_size} bytes from @var{input} are copied into
     11it, and the new memory is returned.  If fewer bytes are copied than were
     12allocated, the remaining memory is zeroed.
     13
     14@end deftypefn
     15
     16*/
    417
    518#ifdef HAVE_CONFIG_H
  • branches/GNU/src/binutils/libiberty/xstrdup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22   This trivial function is in the public domain.
    33   Ian Lance Taylor, Cygnus Support, December 1995.  */
     4
     5/*
     6
     7@deftypefn Replacement char* xstrdup (const char *@var{s})
     8
     9Duplicates a character string without fail, using @code{xmalloc} to
     10obtain memory.
     11
     12@end deftypefn
     13
     14*/
    415
    516#include <sys/types.h>
  • branches/GNU/src/binutils/libiberty/xstrerror.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22   Fri Jun 16 18:30:00 1995  Pat Rankin  <rankin@eql.caltech.edu>
    33   This code is in the public domain.  */
     4
     5/*
     6
     7@deftypefn Replacement char* xstrerror (int @var{errnum})
     8
     9Behaves exactly like the standard @code{strerror} function, but
     10will never return a @code{NULL} pointer.
     11
     12@end deftypefn
     13
     14*/
    415
    516#include <stdio.h>
Note: See TracChangeset for help on using the changeset viewer.