From: Zack Weinberg Date: Wed, 22 Nov 2000 08:32:26 +0000 (+0000) Subject: Makefile.in, [...]: Expunge remaining traces of facility for running MD files through... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1209685fa061309f5f7ad73eb4fb5ef30b402d0;p=gcc.git Makefile.in, [...]: Expunge remaining traces of facility for running MD files through C preprocessor. gcc: * Makefile.in, config.gcc, configure.in: Expunge remaining traces of facility for running MD files through C preprocessor. libiberty: * aclocal.m4 (LIB_AC_PROG_CC): Moved here from configure.in. (AC_DEFINE_NOAUTOHEADER): New - work around bug in autoheader. * configure.in: Call AC_C_INLINE and AC_C_CONST. Use three argument form of AC_DEFINE in dummy definitions block. Use AC_DEFINE_NOAUTOHEADER for real definitions of things defined in dummy block. Preload cache variables instead of bypassing tests, where possible. * acconfig.h: Removed. * xmalloc.c (xmalloc_failed): New function, does error reporting on failed allocation. (xmalloc, xcalloc, xrealloc): Use it. * libiberty.h: Move #includes to top. Prototype xmalloc_failed. From-SVN: r37650 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c4070c4b43..4100db53874 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-11-22 Zack Weinberg + + * Makefile.in, config.gcc, configure.in: Expunge remaining + traces of facility for running MD files through C preprocessor. + 2000-11-22 Joseph S. Myers * gcov.texi: Add magic comments for texi2pod.pl. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 10ad10589d1..fd32ef4f469 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -495,10 +495,6 @@ GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PART # Directory to link to, when using the target `maketest'. DIR = ../gcc -# Guaranteed to not exist when not passing md through cpp. -# This value is overridden directly by configure. -MD_FILE = md-cpp-not-used - # Flags to use when cross-building GCC. # Prefix to apply to names of object files when using them # to run on the machine we are compiling on. @@ -1647,12 +1643,6 @@ s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H) # about the target machine. They do depend on config.h itself, # since that describes the host machine. -# Pass the md file through cpp if the target requests it. -$(MD_FILE): $(MD_DEPS) - rm -f $@ - $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@ - mv tmp-$@ $@ - gensupport.o: gensupport.c $(RTL_H) $(OBSTACK_H) system.h errors.h gensupport.h $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gensupport.c @@ -2237,9 +2227,6 @@ clean: mostlyclean $(INTL_CLEAN) lang.clean -rm -rf libgcc -rm -f *.dvi -rm -f */*.dvi - -if [ -f md.pre-cpp ]; then \ - rm -f md ; \ - fi # Delete the include directory. -rm -rf include # Delete files used by the "multilib" facility (including libgcc subdirs). @@ -2259,7 +2246,7 @@ clean: mostlyclean $(INTL_CLEAN) lang.clean INTL_DISTCLEAN = intl.distclean distclean: clean $(INTL_DISTCLEAN) lang.distclean -rm -f tm.h tm_p.h config.h auto-host.h auto-build.h tconfig.h hconfig.h - -rm -f md cstamp-h + -rm -f cstamp-h -rm -f config.status config.run config.cache config.bak -rm -f Make-lang Make-hooks Make-host Make-target -rm -f Makefile specs.h options.h gencheck.h *.oaux diff --git a/gcc/config.gcc b/gcc/config.gcc index 21db142a32e..8d5306a3747 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -119,9 +119,6 @@ # build_install_headers_dir # Target to use when installing header files. # -# md_cppflags Non-empty list of args to pass to cpp if the target -# wants its .md file passed through cpp. -# # host_truncate_target # Non-empty if the target name should be truncated # on this host, due to filename length issues. @@ -182,9 +179,6 @@ use_collect2= target_cpu_default= # Set this to control how the header file directory is installed. install_headers_dir=install-headers-tar -# Set this to a non-empty list of args to pass to cpp if the target -# wants its .md file passed through cpp. -md_cppflags= # Set this if directory names should be truncated to 14 characters. truncate_target= # Set this if gdb needs a dir command with `dirname $out_file` diff --git a/gcc/configure b/gcc/configure index 54080aee315..4f58f5f9426 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1575,7 +1575,7 @@ for ac_kw in inline __inline__ __inline; do #include "confdefs.h" int main() { -} $ac_kw foo() { +} int $ac_kw foo() { ; return 0; } EOF if { (eval echo configure:1582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then @@ -1605,7 +1605,7 @@ esac # Find some useful tools -for ac_prog in gawk mawk nawk awk +for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -4013,7 +4013,7 @@ else int main() { /* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; +typedef int charset[2]; const charset x = {0,0}; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; @@ -4154,7 +4154,7 @@ else #include "confdefs.h" #include int main() { -char *p = alloca(2 * sizeof(int)); +void *p = alloca(2 * sizeof(int)); ; return 0; } EOF if { (eval echo configure:4161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then @@ -5708,20 +5708,6 @@ else maybe_use_collect2="-DUSE_COLLECT2" fi -# NEED TO CONVERT -# Set MD_DEPS if the real md file is in md.pre-cpp. -# Set MD_CPP to the cpp to pass the md file through. Md files use ';' -# for line oriented comments, so we must always use a GNU cpp. If -# building gcc with a cross compiler, use the cross compiler just -# built. Otherwise, we can use the cpp just built. -md_file_sub= -if test "x$md_cppflags" = x -then - md_file_sub=$srcdir/config/$md_file -else - md_file=md -fi - # If we have gas in the build tree, make a link to it. if test -f ../gas/Makefile; then rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null @@ -5743,7 +5729,7 @@ fi # Figure out what assembler we will be using. echo $ac_n "checking what assembler to use""... $ac_c" 1>&6 -echo "configure:5747: checking what assembler to use" >&5 +echo "configure:5733: checking what assembler to use" >&5 gcc_cv_as= gcc_cv_gas_major_version= gcc_cv_gas_minor_version= @@ -5828,7 +5814,7 @@ fi # Figure out what nm we will be using. echo $ac_n "checking what nm to use""... $ac_c" 1>&6 -echo "configure:5832: checking what nm to use" >&5 +echo "configure:5818: checking what nm to use" >&5 if test -x nm$host_exeext; then gcc_cv_nm=./nm$host_exeext elif test x$host = x$target; then @@ -5839,7 +5825,7 @@ echo "$ac_t""$gcc_cv_nm" 1>&6 # Figure out what assembler alignment features are present. echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6 -echo "configure:5843: checking assembler alignment features" >&5 +echo "configure:5829: checking assembler alignment features" >&5 gcc_cv_as_alignment_features=none if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then # Gas version 2.6 and later support for .balign and .p2align. @@ -5887,7 +5873,7 @@ fi echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6 echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6 -echo "configure:5891: checking assembler subsection support" >&5 +echo "configure:5877: checking assembler subsection support" >&5 gcc_cv_as_subsections=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -5927,7 +5913,7 @@ fi echo "$ac_t""$gcc_cv_as_subsections" 1>&6 echo $ac_n "checking assembler weak support""... $ac_c" 1>&6 -echo "configure:5931: checking assembler weak support" >&5 +echo "configure:5917: checking assembler weak support" >&5 gcc_cv_as_weak=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then @@ -5950,7 +5936,7 @@ fi echo "$ac_t""$gcc_cv_as_weak" 1>&6 echo $ac_n "checking assembler hidden support""... $ac_c" 1>&6 -echo "configure:5954: checking assembler hidden support" >&5 +echo "configure:5940: checking assembler hidden support" >&5 gcc_cv_as_hidden=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -5976,7 +5962,7 @@ echo "$ac_t""$gcc_cv_as_hidden" 1>&6 case "$target" in sparc*-*-*) echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6 -echo "configure:5980: checking assembler .register pseudo-op support" >&5 +echo "configure:5966: checking assembler .register pseudo-op support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_register_pseudo_op'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6004,7 +5990,7 @@ EOF fi echo $ac_n "checking assembler supports -relax""... $ac_c" 1>&6 -echo "configure:6008: checking assembler supports -relax" >&5 +echo "configure:5994: checking assembler supports -relax" >&5 if eval "test \"`echo '$''{'gcc_cv_as_relax_opt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6034,7 +6020,7 @@ EOF case "$tm_file" in *64*) echo $ac_n "checking for 64 bit support in assembler ($gcc_cv_as)""... $ac_c" 1>&6 -echo "configure:6038: checking for 64 bit support in assembler ($gcc_cv_as)" >&5 +echo "configure:6024: checking for 64 bit support in assembler ($gcc_cv_as)" >&5 if eval "test \"`echo '$''{'gcc_cv_as_flags64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6079,7 +6065,7 @@ EOF if test "x$gcc_cv_as_flags64" != xno; then echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6 -echo "configure:6083: checking for assembler offsetable %lo() support" >&5 +echo "configure:6069: checking for assembler offsetable %lo() support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6118,7 +6104,7 @@ EOF i[34567]86-*-*) echo $ac_n "checking assembler instructions""... $ac_c" 1>&6 -echo "configure:6122: checking assembler instructions" >&5 +echo "configure:6108: checking assembler instructions" >&5 gcc_cv_as_instructions= if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then @@ -6147,7 +6133,7 @@ EOF esac echo $ac_n "checking assembler dwarf2 debug_line support""... $ac_c" 1>&6 -echo "configure:6151: checking assembler dwarf2 debug_line support" >&5 +echo "configure:6137: checking assembler dwarf2 debug_line support" >&5 gcc_cv_as_dwarf2_debug_line=no # ??? Not all targets support dwarf2 debug_line, even within a version # of gas. Moreover, we need to emit a valid instruction to trigger any @@ -6324,7 +6310,7 @@ EOF echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:6328: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:6314: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" diff --git a/gcc/configure.in b/gcc/configure.in index 5fb2bb7e4f6..b37f35ef794 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -1077,20 +1077,6 @@ else maybe_use_collect2="-DUSE_COLLECT2" fi -# NEED TO CONVERT -# Set MD_DEPS if the real md file is in md.pre-cpp. -# Set MD_CPP to the cpp to pass the md file through. Md files use ';' -# for line oriented comments, so we must always use a GNU cpp. If -# building gcc with a cross compiler, use the cross compiler just -# built. Otherwise, we can use the cpp just built. -md_file_sub= -if test "x$md_cppflags" = x -then - md_file_sub=$srcdir/config/$md_file -else - md_file=md -fi - # If we have gas in the build tree, make a link to it. if test -f ../gas/Makefile; then rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null diff --git a/include/ChangeLog b/include/ChangeLog index fa58ae7c2ac..07bea1f8397 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2000-11-22 Zack Weinberg + + * libiberty.h: Move #includes to top. Prototype xmalloc_failed. + 2000-11-15 Kenneth Block * demangle.h: Add gnat and java demangle styles. diff --git a/include/libiberty.h b/include/libiberty.h index e6eb34739ce..64d072be392 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -16,6 +16,13 @@ extern "C" { #include "ansidecl.h" +#ifdef ANSI_PROTOTYPES +/* Get a definition for size_t. */ +#include +/* Get a definition for va_list. */ +#include +#endif + /* Build an argument vector from a string. Allocates memory using malloc. Use freeargv to free the vector. */ @@ -130,16 +137,13 @@ extern void xexit PARAMS ((int status)) ATTRIBUTE_NORETURN; extern void xmalloc_set_program_name PARAMS ((const char *)); +/* Report an allocation failure. */ +extern void xmalloc_failed PARAMS ((size_t)) ATTRIBUTE_NORETURN; + /* Allocate memory without fail. If malloc fails, this will print a message to stderr (using the name set by xmalloc_set_program_name, if any) and then call xexit. */ -#ifdef ANSI_PROTOTYPES -/* Get a definition for size_t. */ -#include -/* Get a definition for va_list. */ -#include -#endif extern PTR xmalloc PARAMS ((size_t)) ATTRIBUTE_MALLOC; /* Reallocate memory without fail. This works like xmalloc. Note, diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 044a60319f5..1769a28ef48 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,18 @@ +2000-11-22 Zack Weinberg + + * aclocal.m4 (LIB_AC_PROG_CC): Moved here from configure.in. + (AC_DEFINE_NOAUTOHEADER): New - work around bug in autoheader. + * configure.in: Call AC_C_INLINE and AC_C_CONST. Use three + argument form of AC_DEFINE in dummy definitions block. Use + AC_DEFINE_NOAUTOHEADER for real definitions of things defined + in dummy block. Preload cache variables instead of bypassing + tests, where possible. + * acconfig.h: Removed. + + * xmalloc.c (xmalloc_failed): New function, does error + reporting on failed allocation. + (xmalloc, xcalloc, xrealloc): Use it. + 2000-11-21 Hans-Peter Nilsson * cplus-dem.c (cplus_demangle): Fix formatting. @@ -52,13 +67,13 @@ (result_caret_pos): New macro. (result_append_string): Rename to... (result_add_string): ... this, and insert at caret position. - Rename throughout. + Rename throughout. (result_append): Rename to... (result_add): ... this, and insert at caret position. Rename - throughout. + throughout. (result_append_char): Rename to... (result_add_char): ... this, and insert at caret position. Rename - throughout. + throughout. (result_append_space): Remove. (string_list_new): Initialize caret position. (result_add_separated_char): Use caret position. @@ -70,13 +85,13 @@ (substitution_add): Likewise. (demangling_new): Initialize caret position. (demangle_encoding): Use caret position. - (demanglin_nested_name): Put CV qualifiers after name. + (demanglin_nested_name): Put CV qualifiers after name. (demangle_type_ptr): Use switch statement. Handle pointers to arrays. Don't use result_append_space. Use caret position. (demangle_type): Emit CV qualifiers after underlying type. Adjust - call to demangle_array_type. - (demangle_array_type): Add parameter to handle pointers to arrays. - + call to demangle_array_type. + (demangle_array_type): Add parameter to handle pointers to arrays. + 2000-10-01 Mark Mitchell * splay-tree.c (splay_tree_insert): Fix formatting. @@ -133,7 +148,7 @@ (demangle_special_name): Fix comment. (demangle_type): Rename variable. (demangle_bare_function_type): Check for missing return type and - parameter. + parameter. (demangle_class_enum_type): Rename parameter. (demangle_discriminator): Fix misspelling in comment. @@ -145,8 +160,8 @@ 2000-09-04 Alex Samuel * cp-demangle.c (demangle_template_arg): Eat an `E' after an - . - + . + 2000-09-04 Alex Samuel * cp-demangle.c (demangle_type_ptr): Increment position past @@ -159,7 +174,7 @@ (demangle_call_offset): Likewise. (demangle_special_name): Update thunk demangling to comply with ABI changes. - + 2000-09-03 Alex Samuel * cp-demangle.c (ANONYMOUS_NAMESPACE_PREFIX): New macro. @@ -169,17 +184,17 @@ (result_insert): Likewise. (result_insert_char): Likewise. (substitution_add): Remove last parameter. Don't store template - parm number. + parm number. (BFT_NO_RETURN_TYPE): Define as NULL. (demangle_encoding): Adjust call to demangle_bare_function_type. (demangle_name): Adjust substitution. Adjust call to - substitution_add. + substitution_add. (demangle_prefix): Adjust call to substitution_add. (demangle_identifier): Handle anonymous namespaces. (demangle_operator_name): Change demangling of vendor-extended operator to match ABI changes. (demangle_type_ptr): Change parameters. Make recursive. Handle - substitutions here. + substitutions here. (demangle_type): Adjust calls to demangle_template_param, substitution_add, and demangle_type_ptr. Fix substitution of templated types. @@ -187,7 +202,7 @@ (demangle_bare_function_type): Likewise. Adjust insertion point. (demangle_template_param): Remove last parameter. (demangle_expr_primary): Remove unused variable. Adjust call to - demangle_template_param. + demangle_template_param. (is_mangled_char): Accept `$' and `.'. * cplus-dem.c (gnu_new_abi_symbol_characters): Add '$' and '.'. * dyn-string.c (dyn_string_insert_char): New function. @@ -232,7 +247,7 @@ (demangle_type): Don't treat r as built-in type. Remove argument to demangle_substitution. Fix substitution candidate mechanics. Handle s. Improve comments. - (demangle_template_param): Don't handle template arg lists here. + (demangle_template_param): Don't handle template arg lists here. (demangle_substitution): Remove parameter. (print_usage): Remove extra fprintf option. @@ -257,12 +272,12 @@ (demangle_type_ptr): Remove duplicate RETURN_IF_ERROR. (demangle_type): Check for template args after substitution. (demangle_template_args): Use result_open_template_list. - + 2000-08-02 Zack Weinberg * pexecute.c: Don't use vfork. Initialize 'pid' before retry loop. -2000-07-26 Dave Pitts +2000-07-26 Dave Pitts * config/mh-openedition.h: Added -DLE370 definition. @@ -300,7 +315,7 @@ 2000-07-24 Daniel Berlin - * cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to + * cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to if (AUTO_DEMANGLING || GNU_DEMANGLING) 2000-07-21 Alex Samuel @@ -379,7 +394,7 @@ (demangle_subtitution): Set template_p for special substitutions. (main): Fix typos. - + 2000-06-27 Alex Samuel * cp-demangle.c (demangle_special_name): Swap base and derived @@ -437,7 +452,7 @@ (dyn_string_append_cstr): Likewise. (dyn_string_append_char): Likewise. (dyn_string_substring): Likewise. - + 2000-06-09 Zack Weinberg * cp-demangle.c (demangle_operator_name): Add spaces before @@ -460,7 +475,7 @@ Thu Jun 8 09:25:54 2000 Philippe De Muyter 2000-06-07 Kaveh R. Ghazi * configure.in (ac_libiberty_warn_cflags): Add -pedantic. - + * choose-temp.c (try, choose_temp_base, make_temp_file): Constify. * cp-demangle.c (demangle_char): Change parameter from char to int. @@ -479,7 +494,7 @@ Thu Jun 8 09:25:54 2000 Philippe De Muyter const-ness. * setenv.c (setenv): Use braces to avoid ambiguous `else'. - + 2000-06-07 Kaveh R. Ghazi * Makefile.in (cp-demangle.o): Depend on $(INCDIR)/demangle.h. @@ -517,7 +532,7 @@ Thu Jun 8 09:25:54 2000 Philippe De Muyter (main): Use gnu_new_abi_symbol_characters. * cp-demangle.c: New file. * cp-demangle.c: New file. - + Tue May 30 16:45:25 2000 Andrew Cagney * floatformat.c: Add name to each floatformat field. @@ -549,7 +564,7 @@ Tue May 30 15:07:52 2000 Jeffrey A Law (law@cygnus.com) 2000-05-16 Horst von Brand - * hashtab.c (hash_pointer): Delete low-order bits which are + * hashtab.c (hash_pointer): Delete low-order bits which are probably zero, also eliminate a warning on alpha. 2000-05-15 David Edelsohn @@ -584,9 +599,9 @@ Thu May 4 17:14:41 2000 Philippe De Muyter 2000-04-28 Kenneth Block Jason Merrill - * cplus-dem.c (libiberty_demanglers): New table for demangle styles. - (cplus_demangle_set_style): New function for setting style. - (cplus_demangle_name_to_style): New function to translate name. + * cplus-dem.c (libiberty_demanglers): New table for demangle styles. + (cplus_demangle_set_style): New function for setting style. + (cplus_demangle_name_to_style): New function to translate name. 2000-04-27 Kaveh R. Ghazi @@ -638,7 +653,7 @@ Tue Apr 18 16:23:31 2000 Richard Kenner 2000-04-16 Dave Pitts * cplus-dem.c (cplus_demangle_opname): Changed to use islower. - + 2000-04-05 Richard Henderson * splay-tree.c (splay_tree_remove): New. @@ -649,7 +664,7 @@ Tue Apr 18 16:23:31 2000 Richard Kenner codes. (htab_find_with_hash): Likewise. (htab_find_slot_with_hash): Likewise. - + 2000-03-29 Zack Weinberg * hashtab.c (htab_find_with_hash): Avoid calculating hash2 @@ -678,7 +693,7 @@ Thu Mar 16 01:33:58 2000 Jeffrey A Law (law@cygnus.com) (REQUIRED_OFILES): Add partition.o. (partition.o): New rule. * partition.c: New file. - + 2000-03-09 Zack Weinberg * hashtab.c (htab_create): Set del_f. diff --git a/libiberty/acconfig.h b/libiberty/acconfig.h deleted file mode 100644 index f7c599df7ac..00000000000 --- a/libiberty/acconfig.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST - -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR - -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4 index b6c611e132d..c5628352773 100644 --- a/libiberty/aclocal.m4 +++ b/libiberty/aclocal.m4 @@ -83,3 +83,54 @@ then AC_DEFINE(NEED_DECLARATION_ERRNO, 1, [Define if errno must be declared even when is included.]) fi ]) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_PROVIDE([AC_PROG_CC]) +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + ac_libiberty_warn_cflags= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +AC_SUBST(ac_libiberty_warn_cflags) +]) + +# Work around a bug in autoheader. This can go away when we switch to +# autoconf >2.50. The use of define instead of AC_DEFUN is +# deliberate. +define(AC_DEFINE_NOAUTOHEADER, +[cat >> confdefs.h <<\EOF +[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) +EOF +]) diff --git a/libiberty/config.in b/libiberty/config.in index 797e2a74bd6..5fed1ccc834 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -3,6 +3,9 @@ /* Define if using alloca.c. */ #undef C_ALLOCA +/* Define to empty if the keyword does not work. */ +#undef const + /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END @@ -22,6 +25,9 @@ /* Define if you have . */ #undef HAVE_VFORK_H +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + /* Define to `int' if doesn't define. */ #undef pid_t @@ -46,18 +52,6 @@ /* Define vfork as fork if vfork does not work. */ #undef vfork -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST - -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR - -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - /* Define if you have the asprintf function. */ #undef HAVE_ASPRINTF @@ -244,3 +238,12 @@ /* Define if errno must be declared even when is included. */ #undef NEED_DECLARATION_ERRNO +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST + +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR + +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST + diff --git a/libiberty/configure b/libiberty/configure index d2c5d920dca..8c51dcb79f1 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -733,20 +733,11 @@ fi fi -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - - - - # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:750: checking for $ac_word" >&5 +echo "configure:741: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -776,7 +767,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:780: checking for $ac_word" >&5 +echo "configure:771: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -825,7 +816,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:829: checking whether we are using GNU C" >&5 +echo "configure:820: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -834,7 +825,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -850,7 +841,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:854: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:845: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -879,8 +870,9 @@ else fi + echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:884: checking for POSIXized ISC" >&5 +echo "configure:876: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -900,6 +892,121 @@ else ISC= fi +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:897: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:972: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 -echo "configure:922: checking for a BSD compatible install" >&5 +echo "configure:1029: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -979,7 +1086,7 @@ host_makefile_frag=${frag} # able to link anything, it had better be able to at least compile # something. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:983: checking how to run the C preprocessor" >&5 +echo "configure:1090: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -994,13 +1101,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1011,13 +1118,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1028,13 +1135,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1062,17 +1169,17 @@ for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1066: checking for $ac_hdr" >&5 +echo "configure:1173: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1099,12 +1206,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1103: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1210: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1120,7 +1227,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1141,12 +1248,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1145: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1252: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1155,7 +1262,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1159: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1177,19 +1284,19 @@ fi echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6 -echo "configure:1181: checking whether errno must be declared" >&5 +echo "configure:1288: checking whether errno must be declared" >&5 if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int x = errno; ; return 0; } EOF -if { (eval echo configure:1193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_declare_errno=no else @@ -1265,12 +1372,12 @@ if test "x" = "y"; then for ac_func in asprintf atexit basename bcmp bcopy bzero calloc clock getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1269: checking for $ac_func" >&5 +echo "configure:1376: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1320,12 +1427,12 @@ done for ac_func in getpagesize index insque mkstemps memchr memcmp memcpy memmove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1324: checking for $ac_func" >&5 +echo "configure:1431: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1375,12 +1482,12 @@ done for ac_func in memset putenv random rename rindex sigsetmask strcasecmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1379: checking for $ac_func" >&5 +echo "configure:1486: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1430,12 +1537,12 @@ done for ac_func in setenv strchr strdup strncasecmp strrchr strstr strtod strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1434: checking for $ac_func" >&5 +echo "configure:1541: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1485,12 +1592,12 @@ done for ac_func in strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1489: checking for $ac_func" >&5 +echo "configure:1596: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1537,27 +1644,15 @@ else fi done - cat >> confdefs.h <<\EOF -#define HAVE_SYS_ERRLIST 1 -EOF - - cat >> confdefs.h <<\EOF -#define HAVE_SYS_NERR 1 -EOF - - cat >> confdefs.h <<\EOF -#define HAVE_SYS_SIGLIST 1 -EOF - for ac_func in getrusage on_exit psignal strerror strsignal sysconf times do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1556: checking for $ac_func" >&5 +echo "configure:1651: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1607,12 +1702,12 @@ done for ac_func in sbrk gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1611: checking for $ac_func" >&5 +echo "configure:1706: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1659,6 +1754,18 @@ else fi done + cat >> confdefs.h <<\EOF +#define HAVE_SYS_ERRLIST 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_NERR 1 Define if you have the sys_nerr variable. +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_SIGLIST 1 +EOF + fi # For each of these functions, if the host does not provide the @@ -1788,15 +1895,8 @@ if test -z "${setobjs}"; then *-*-mingw32*) # Under mingw32, sys_nerr and sys_errlist exist, but they are # macros, so the test below won't find them. - vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`" - cat >> confdefs.h <<\EOF -#define HAVE_SYS_NERR 1 -EOF - - cat >> confdefs.h <<\EOF -#define HAVE_SYS_ERRLIST 1 -EOF - + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes ;; *-*-uwin*) @@ -1807,14 +1907,8 @@ EOF # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are # macros (actually, these are imported from a DLL, but the end effect # is the same), so the test below won't find them. - cat >> confdefs.h <<\EOF -#define HAVE_SYS_NERR 1 -EOF - - cat >> confdefs.h <<\EOF -#define HAVE_SYS_ERRLIST 1 -EOF - + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes ;; esac @@ -1822,7 +1916,7 @@ EOF # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1821: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1920: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1833,12 +1927,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1832 "configure" +#line 1931 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1864,19 +1958,19 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1863: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1962: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross for ac_func in $funcs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1870: checking for $ac_func" >&5 +echo "configure:1969: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1946,19 +2040,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1945: checking for working alloca.h" >&5 +echo "configure:2044: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { -char *p = alloca(2 * sizeof(int)); +void *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1979,12 +2073,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1978: checking for alloca" >&5 +echo "configure:2077: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2044,12 +2138,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2043: checking whether alloca needs Cray hooks" >&5 +echo "configure:2142: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2073: checking for $ac_func" >&5 +echo "configure:2172: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2129,7 +2223,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2128: checking stack direction for C alloca" >&5 +echo "configure:2227: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2137,7 +2231,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2181,12 +2275,12 @@ fi esac echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2180: checking for ANSI C header files" >&5 +echo "configure:2279: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2194,7 +2288,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2211,7 +2305,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2229,7 +2323,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2250,7 +2344,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2261,7 +2355,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2285,12 +2379,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2284: checking for pid_t" >&5 +echo "configure:2383: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2319,17 +2413,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2318: checking for vfork.h" >&5 +echo "configure:2417: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2354,18 +2448,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2353: checking for working vfork" >&5 +echo "configure:2452: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2359: checking for vfork" >&5 +echo "configure:2458: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2410,7 +2504,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -2505,7 +2599,7 @@ main() { } } EOF -if { (eval echo configure:2504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2532,19 +2626,19 @@ fi fi for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:2531: checking for $v" >&5 +echo "configure:2630: checking for $v" >&5 if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "libiberty_cv_var_$v=yes" else @@ -2570,12 +2664,12 @@ EOF for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2569: checking for $ac_func" >&5 +echo "configure:2668: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2628,17 +2722,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2627: checking for $ac_hdr" >&5 +echo "configure:2726: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2667,12 +2761,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2666: checking for $ac_func" >&5 +echo "configure:2765: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2720,7 +2814,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2719: checking for working mmap" >&5 +echo "configure:2818: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2728,7 +2822,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < #include #include +#include +#include + +#ifdef HAVE_UNISTD_H +# include +#endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -2815,7 +2912,7 @@ main() /* * First, make a file with some known garbage in it. */ - data = malloc(pagesize); + data = (char*)malloc(pagesize); if (!data) exit(1); for (i = 0; i < pagesize; ++i) @@ -2836,7 +2933,7 @@ main() fd = open("conftestmmap", O_RDWR); if (fd < 0) exit(1); - data2 = malloc(2 * pagesize); + data2 = (char*)malloc(2 * pagesize); if (!data2) exit(1); data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); @@ -2854,7 +2951,7 @@ main() */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); + data3 = (char*)malloc(pagesize); if (!data3) exit(1); if (read(fd, data3, pagesize) != pagesize) @@ -2868,7 +2965,7 @@ main() } EOF -if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -2892,7 +2989,7 @@ fi echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:2891: checking for working strncmp" >&5 +echo "configure:2993: checking for working strncmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2900,7 +2997,7 @@ else ac_cv_func_strncmp_works=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strncmp_works=yes else @@ -3137,8 +3234,8 @@ s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g -s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g s%@CC@%$CC%g +s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g diff --git a/libiberty/configure.in b/libiberty/configure.in index adfbd5ff670..6d06c0af2d0 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -36,51 +36,11 @@ dnl to call AC_CHECK_PROG. AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(RANLIB, ranlib, :) -# FIXME: We temporarily define our own version of AC_PROG_CC. This is -# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We -# are probably using a cross compiler, which will not be able to fully -# link an executable. This should really be fixed in autoconf -# itself. - -AC_DEFUN(LIB_AC_PROG_CC, -[AC_BEFORE([$0], [AC_PROG_CPP])dnl -AC_PROVIDE([AC_PROG_CC]) -AC_CHECK_PROG(CC, gcc, gcc) -if test -z "$CC"; then - AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) -fi - -AC_PROG_CC_GNU - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' -dnl Check whether -g works, even if CFLAGS is set, in case the package -dnl plays around with CFLAGS (such as to build both debugging and -dnl normal versions of a library), tasteless as that idea is. - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - AC_PROG_CC_G - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - ac_libiberty_warn_cflags= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi -]) -AC_SUBST(ac_libiberty_warn_cflags) - LIB_AC_PROG_CC AC_ISC_POSIX +AC_C_CONST +AC_C_INLINE dnl When we start using libtool: dnl Default to a non shared library. This may be overridden by the @@ -172,11 +132,11 @@ if test "x" = "y"; then AC_CHECK_FUNCS(memset putenv random rename rindex sigsetmask strcasecmp) AC_CHECK_FUNCS(setenv strchr strdup strncasecmp strrchr strstr strtod strtol) AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid) - AC_DEFINE(HAVE_SYS_ERRLIST) - AC_DEFINE(HAVE_SYS_NERR) - AC_DEFINE(HAVE_SYS_SIGLIST) AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times) AC_CHECK_FUNCS(sbrk gettimeofday) + AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) + AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) + AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) fi # For each of these functions, if the host does not provide the @@ -215,7 +175,7 @@ if test -n "${with_target_subdir}"; then # dont have to check them here. # Of the functions in $checkfuncs, newlib only has strerror. - AC_DEFINE(HAVE_STRERROR) + AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) setobjs=yes @@ -256,7 +216,7 @@ if test -z "${setobjs}"; then # don't have to check them here. # Of the functions in $checkfuncs, VxWorks only has strerror. - AC_DEFINE(HAVE_STRERROR) + AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) setobjs=yes ;; @@ -294,9 +254,8 @@ if test -z "${setobjs}"; then *-*-mingw32*) # Under mingw32, sys_nerr and sys_errlist exist, but they are # macros, so the test below won't find them. - vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`" - AC_DEFINE(HAVE_SYS_NERR) - AC_DEFINE(HAVE_SYS_ERRLIST) + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes ;; *-*-uwin*) @@ -307,8 +266,8 @@ if test -z "${setobjs}"; then # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are # macros (actually, these are imported from a DLL, but the end effect # is the same), so the test below won't find them. - AC_DEFINE(HAVE_SYS_NERR) - AC_DEFINE(HAVE_SYS_ERRLIST) + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes ;; esac diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index 08c23f8126e..3ea2d4afc06 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -64,6 +64,31 @@ xmalloc_set_program_name (s) #endif /* HAVE_SBRK */ } +void +xmalloc_failed (size) + size_t size; +{ +#ifdef HAVE_SBRK + extern char **environ; + size_t allocated; + + if (first_break != NULL) + allocated = (char *) sbrk (0) - first_break; + else + allocated = (char *) sbrk (0) - (char *) &environ; + fprintf (stderr, + "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size, (unsigned long) allocated); +#else /* HAVE_SBRK */ + fprintf (stderr, + "\n%s%sCannot allocate %lu bytes\n", + name, *name ? ": " : "", + (unsigned long) size); +#endif /* HAVE_SBRK */ + xexit (1); +} + PTR xmalloc (size) size_t size; @@ -74,27 +99,8 @@ xmalloc (size) size = 1; newmem = malloc (size); if (!newmem) - { -#ifdef HAVE_SBRK - extern char **environ; - size_t allocated; - - if (first_break != NULL) - allocated = (char *) sbrk (0) - first_break; - else - allocated = (char *) sbrk (0) - (char *) &environ; - fprintf (stderr, - "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size, (unsigned long) allocated); -#else /* HAVE_SBRK */ - fprintf (stderr, - "\n%s%sCannot allocate %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size); -#endif /* HAVE_SBRK */ - xexit (1); - } + xmalloc_failed (size); + return (newmem); } @@ -109,27 +115,8 @@ xcalloc (nelem, elsize) newmem = calloc (nelem, elsize); if (!newmem) - { -#ifdef HAVE_SBRK - extern char **environ; - size_t allocated; - - if (first_break != NULL) - allocated = (char *) sbrk (0) - first_break; - else - allocated = (char *) sbrk (0) - (char *) &environ; - fprintf (stderr, - "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) (nelem * elsize), (unsigned long) allocated); -#else /* HAVE_SBRK */ - fprintf (stderr, - "\n%s%sCannot allocate %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) (nelem * elsize)); -#endif /* HAVE_SBRK */ - xexit (1); - } + xmalloc_failed (nelem * elsize); + return (newmem); } @@ -147,26 +134,7 @@ xrealloc (oldmem, size) else newmem = realloc (oldmem, size); if (!newmem) - { -#ifdef HAVE_SBRK - extern char **environ; - size_t allocated; - - if (first_break != NULL) - allocated = (char *) sbrk (0) - first_break; - else - allocated = (char *) sbrk (0) - (char *) &environ; - fprintf (stderr, - "\n%s%sCannot reallocate %lu bytes after allocating %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size, (unsigned long) allocated); -#else /* HAVE_SBRK */ - fprintf (stderr, - "\n%s%sCannot reallocate %lu bytes\n", - name, *name ? ": " : "", - (unsigned long) size); -#endif /* HAVE_SBRK */ - xexit (1); - } + xmalloc_failed (size); + return (newmem); }