From f91ca6bc00c1e3c70c1d2f4527d4297b76e2eaca Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Wed, 24 Jun 2015 21:43:02 +0200 Subject: [PATCH] Sync libiberty from GCC, replaying updates to configure scripts --- ChangeLog | 7 + Makefile.in | 140 +- Makefile.tpl | 20 +- config/ChangeLog | 15 + config/mh-darwin | 31 +- config/picflag.m4 | 12 +- include/ChangeLog | 5 + include/libiberty.h | 2 +- libiberty/ChangeLog | 98 ++ libiberty/Makefile.in | 5 +- libiberty/config.in | 32 + libiberty/configure | 1676 +++++++++++++---------- libiberty/configure.ac | 1 + libiberty/cp-demangle.c | 3 + libiberty/d-demangle.c | 469 +++++-- libiberty/floatformat.c | 4 +- libiberty/testsuite/Makefile.in | 2 +- libiberty/testsuite/d-demangle-expected | 168 ++- libiberty/testsuite/demangle-expected | 3 + 19 files changed, 1746 insertions(+), 947 deletions(-) diff --git a/ChangeLog b/ChangeLog index 583b822c95f..615e266e4f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,13 @@ (sim_release): Pass gdb as fifth parameter to tar_compress. (SIM_SUPPORT_DIRS): Add gdb/common/create-version.sh. +2015-04-14 Max Ostapenko + + * Makefile.tpl (EXTRA_HOST_EXPORTS): New variables. + (EXTRA_BOOTSTRAP_FLAGS): Likewise. + (check-[+module+]): Add EXTRA_HOST_EXPORTS and EXTRA_BOOTSTRAP_FLAGS. + * Makefile.in: Regenerate. + 2015-04-01 H.J. Lu * configure.ac: Add --with-system-zlib. diff --git a/Makefile.in b/Makefile.in index 8ae261fd459..61e0ab62c5a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -833,6 +833,14 @@ POSTSTAGE1_FLAGS_TO_PASS = \ $(LTO_FLAGS_TO_PASS) \ "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" +@if gcc-bootstrap +EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \ + $(POSTSTAGE1_HOST_EXPORTS) \ + fi ; + +EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS" +@endif gcc-bootstrap + # Flags to pass down to makes which are built with the target environment. # The double $ decreases the length of the command line; those variables # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The @@ -3651,9 +3659,9 @@ check-bfd: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/bfd && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif bfd @@ -4525,9 +4533,9 @@ check-opcodes: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/opcodes && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif opcodes @@ -5399,9 +5407,9 @@ check-binutils: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/binutils && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif binutils @@ -5829,9 +5837,9 @@ check-bison: @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/bison && \ - $(MAKE) $(FLAGS_TO_PASS) check); \ + $(MAKE) $(FLAGS_TO_PASS) check) fi @endif bison @@ -6271,7 +6279,7 @@ check-cgen: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/cgen && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -6712,7 +6720,7 @@ check-dejagnu: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/dejagnu && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -7153,7 +7161,7 @@ check-etc: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/etc && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -7596,9 +7604,9 @@ check-fastjar: @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/fastjar && \ - $(MAKE) $(FLAGS_TO_PASS) check); \ + $(MAKE) $(FLAGS_TO_PASS) check) fi @endif fastjar @@ -8484,9 +8492,9 @@ check-fixincludes: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/fixincludes && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif fixincludes @@ -8899,9 +8907,9 @@ check-flex: @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/flex && \ - $(MAKE) $(FLAGS_TO_PASS) check); \ + $(MAKE) $(FLAGS_TO_PASS) check) fi @endif flex @@ -9787,9 +9795,9 @@ check-gas: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gas && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif gas @@ -10661,9 +10669,9 @@ check-gcc: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gcc && \ - $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif gcc @@ -11541,9 +11549,9 @@ check-gmp: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gmp && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif gmp @@ -12409,9 +12417,9 @@ check-mpfr: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/mpfr && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif mpfr @@ -13277,9 +13285,9 @@ check-mpc: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/mpc && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif mpc @@ -14145,9 +14153,9 @@ check-isl: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/isl && \ - $(MAKE) $(FLAGS_TO_PASS) V=1 check) + $(MAKE) $(FLAGS_TO_PASS) V=1 $(EXTRA_BOOTSTRAP_FLAGS) check) @endif isl @@ -15013,9 +15021,9 @@ check-libelf: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libelf && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif libelf @@ -15875,9 +15883,9 @@ check-gold: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gold && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif gold @@ -16303,7 +16311,7 @@ check-gprof: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gprof && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -17190,9 +17198,9 @@ check-intl: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/intl && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif intl @@ -17618,7 +17626,7 @@ check-tcl: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/tcl && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -18044,7 +18052,7 @@ check-itcl: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/itcl && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -18931,9 +18939,9 @@ check-ld: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/ld && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif ld @@ -19805,9 +19813,9 @@ check-libbacktrace: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libbacktrace && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif libbacktrace @@ -20679,9 +20687,9 @@ check-libcpp: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libcpp && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif libcpp @@ -21553,9 +21561,9 @@ check-libdecnumber: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libdecnumber && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif libdecnumber @@ -21981,7 +21989,7 @@ check-libgui: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libgui && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -22874,9 +22882,9 @@ check-libiberty: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libiberty && \ - $(MAKE) $(FLAGS_TO_PASS) check) + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) @endif libiberty @@ -23754,9 +23762,9 @@ check-libiberty-linker-plugin: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libiberty-linker-plugin && \ - $(MAKE) $(FLAGS_TO_PASS) @extra_linker_plugin_flags@ check) + $(MAKE) $(FLAGS_TO_PASS) @extra_linker_plugin_flags@ $(EXTRA_BOOTSTRAP_FLAGS) check) @endif libiberty-linker-plugin @@ -24182,7 +24190,7 @@ check-libiconv: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libiconv && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -24560,7 +24568,7 @@ check-m4: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/m4 && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -25001,7 +25009,7 @@ check-readline: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/readline && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -25442,7 +25450,7 @@ check-sid: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/sid && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -25883,7 +25891,7 @@ check-sim: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/sim && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -26324,7 +26332,7 @@ check-texinfo: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/texinfo && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -27615,7 +27623,7 @@ check-gdb: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gdb && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -28056,7 +28064,7 @@ check-expect: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/expect && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -28497,7 +28505,7 @@ check-guile: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/guile && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -28938,7 +28946,7 @@ check-tk: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/tk && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -30189,7 +30197,7 @@ check-gnattools: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gnattools && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -31082,9 +31090,9 @@ check-lto-plugin: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/lto-plugin && \ - $(MAKE) $(FLAGS_TO_PASS) @extra_linker_plugin_flags@ check) + $(MAKE) $(FLAGS_TO_PASS) @extra_linker_plugin_flags@ $(EXTRA_BOOTSTRAP_FLAGS) check) @endif lto-plugin @@ -31510,7 +31518,7 @@ check-libcc1: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/libcc1 && \ $(MAKE) $(FLAGS_TO_PASS) check) @@ -31951,7 +31959,7 @@ check-gotools: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/gotools && \ $(MAKE) $(FLAGS_TO_PASS) check) diff --git a/Makefile.tpl b/Makefile.tpl index f737cfca6c9..5d2cea230b8 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -634,6 +634,14 @@ POSTSTAGE1_FLAGS_TO_PASS = \ $(LTO_FLAGS_TO_PASS) \ "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" +@if gcc-bootstrap +EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \ + $(POSTSTAGE1_HOST_EXPORTS) \ + fi ; + +EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS" +@endif gcc-bootstrap + # Flags to pass down to makes which are built with the target environment. # The double $ decreases the length of the command line; those variables # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The @@ -1203,18 +1211,22 @@ check-[+module+]: @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+ + ENDIF bootstrap +] \ (cd $(HOST_SUBDIR)/[+module+] && \ - $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \ + $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+ + IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check) fi [+ ELSE check +] check-[+module+]: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ + $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+ + ENDIF bootstrap +] \ (cd $(HOST_SUBDIR)/[+module+] && \ - $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check) + $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+ + IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check) [+ ENDIF no_check +] @endif [+module+] diff --git a/config/ChangeLog b/config/ChangeLog index 6ffb0ed1e66..30314370241 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,18 @@ +2015-04-10 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * mh-darwin: Only apply -mdynamic-no-pic for m32 Darwin when the + compiler in use supports -mno-dynamic-no-pic. + * picflag.m4: Only append -mno-dynamic-no-pic for Darwin when + -mdynamic-no-pic is present in CFLAGS. + +2015-04-07 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * picflag.m4: Append -mno-dynamic-no-pic for Darwin. + 2015-04-02 H.J. Lu * zlib.m4 (AM_ZLIB): Set zlibdir to -L\$(top_builddir)/../zlib diff --git a/config/mh-darwin b/config/mh-darwin index a039f201410..148b73038c3 100644 --- a/config/mh-darwin +++ b/config/mh-darwin @@ -1,18 +1,29 @@ # The -mdynamic-no-pic ensures that the compiler executable is built without # position-independent-code -- the usual default on Darwin. This fix speeds -# compiles by 3-5%. -BOOT_CFLAGS += \ +# compiles by 3-5%. Don't add it if the compiler doesn't also support +# -mno-dynamic-no-pic to undo it. +DARWIN_MDYNAMIC_NO_PIC := \ `case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \ - echo -mdynamic-no-pic ;; esac;` + $(CC) -S -xc /dev/null -o /dev/null -mno-dynamic-no-pic 2>/dev/null \ + && echo -mdynamic-no-pic ;; esac` +DARWIN_GCC_MDYNAMIC_NO_PIC := \ +`case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \ + $(CC) -S -xc /dev/null -o /dev/null -mno-dynamic-no-pic 2>/dev/null \ + || echo -mdynamic-no-pic ;; esac` # ld on Darwin versions >= 10.7 defaults to PIE executables. Disable this for # gcc components, since it is incompatible with our pch implementation. -BOOT_LDFLAGS += \ -`case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;` +DARWIN_NO_PIE := `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;` + +BOOT_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC) +BOOT_LDFLAGS += $(DARWIN_NO_PIE) # Similarly, for cross-compilation. -STAGE1_CFLAGS += \ -`case ${host} in i?86-*-darwin* | powerpc-*-darwin*)\ - echo -mdynamic-no-pic ;; esac;` -STAGE1_LDFLAGS += \ -`case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;` +STAGE1_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC) +STAGE1_LDFLAGS += $(DARWIN_NO_PIE) + +# Without -mno-dynamic-no-pic support, add -mdynamic-no-pic just to later +# stages when we know it is built with gcc. +STAGE2_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC) +STAGE3_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC) +STAGE4_CFLAGS += $(DARWIN_GCC_MDYNAMIC_NO_PIC) diff --git a/config/picflag.m4 b/config/picflag.m4 index 3bcdbf1de30..2f5b9721eb2 100644 --- a/config/picflag.m4 +++ b/config/picflag.m4 @@ -7,9 +7,15 @@ AC_DEFUN([_GCC_PICFLAG], [ case "${$2}" in # PIC is the default on some targets or must not be used. *-*-darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - $1=-fno-common + # For darwin, common symbols are not allowed in MH_DYLIB files + case "${CFLAGS}" in + # If we are using a compiler supporting mdynamic-no-pic + # and the option has been tested as safe to add, then cancel + # it here, since the code generated is incompatible with shared + # libs. + *-mdynamic-no-pic*) $1='-fno-common -mno-dynamic-no-pic' ;; + *) $1=-fno-common ;; + esac ;; alpha*-dec-osf5*) # PIC is the default. diff --git a/include/ChangeLog b/include/ChangeLog index c924c56e8b3..89b4bbebccd 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -7,6 +7,11 @@ include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. +2015-05-22 Yunlian Jiang + + * libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is + not defined. + 2015-05-12 Jiong Wang * elf/aarch64.h (R_AARCH64_P32_LD32_GOTPAGE_LO14): New enumeration. diff --git a/include/libiberty.h b/include/libiberty.h index b33dd65982d..8e096a0db0c 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -621,7 +621,7 @@ extern int pexecute (const char *, char * const *, const char *, extern int pwait (int, int *, int); -#if !HAVE_DECL_ASPRINTF +#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 923613d8caf..f2b014841aa 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,85 @@ +2015-06-01 Jason Merrill + + * cp-demangle.c (cplus_demangle_type): Handle arguments to vendor + extended qualifier. + +2015-05-22 Yunlian Jiang + + * configure.ac: Add AC_GNU_SOURCE. + * Makefile.in (COMPILE.c): Add -D_GNU_SOURCE. + * configure, config.in: Rebuild. + * floatformat.c (_GNU_SOURCE): Don't define if already defined. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_symbol_kinds): New enum. + (dlang_parse_symbol): Update signature. Handle an ambiguity between + pascal functions and template value arguments. Only check for a type + if parsing a function, or at the top level. Return failure if the + entire symbol was not successfully demangled. + (dlang_identifier): Update signature. Handle an ambiguity between two + adjacent digits in a mangled symbol string. + (dlang_type): Update call to dlang_parse_symbol. + (dlang_template_args): Likewise. + (dlang_parse_template): Likewise. + (dlang_demangle): Likewise. + * testsuite/d-demangle-expected: Fix bad tests found, and add problematic + examples to the unittests. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_template_args): Skip over specialized template + parameters in mangled symbol. + * testsuite/d-demangle-expected: Add coverage and unittest for specialized + template parameters. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_type): Handle cent and ucent types. + * testsuite/d-demangle-expected: Add coverage tests for cent and ucent. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_attributes): Handle return attributes, ignoring + return parameters in the mangled string. Return NULL if have encountered + an unknown attribute. + (dlang_function_args): Handle return parameters in the mangled string. + * testsuite/d-demangle-expected: Add coverage tests for functions with + return parameters and return attributes. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_identifier): Check encoded length of identifier + to verify strncmp matches entire string. + * testsuite/d-demangle-expected: Fix wrong test for postblit symbol. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_type_modifiers): New function. + (dlang_type_modifier_p): New function. + (dlang_call_convention_p): Ignore any kind of type modifier. + (dlang_type): Handle and emit the type modifier after delegate types. + (dlang_parse_symbol): Handle and emit the type modifier after the symbol. + * testsuite/d-demangle-expected: Add coverage tests for all valid + usages of function symbols with type modifiers. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_call_convention): Return NULL if have reached the + end of the symbol, but expected something to read. + (dlang_attributes): Likewise. + (dlang_function_type): Likewise. + (dlang_type): Likewise. + (dlang_identifier): Likewise. + (dlang_value): Likewise. + +2015-05-16 Iain Buclaw + + * d-demangle.c (dlang_parse_string): Represent embedded whitespace or + non-printable characters as hex or escape sequences. + * testsuite/d-demangle-expected: Add test for templates with tabs and + newlines embedded into the signature. + 2015-05-08 Joel Brobecker * mkstemps.c: #include if HAVE_TIME_H is defined @@ -7,6 +89,22 @@ * setenv.c : Declare only if not a macro. +2015-04-14 Max Ostapenko + + * testsuite/Makefile.in (LIBCFLAGS): Add LDFLAGS. + +2015-04-10 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * configure: Regenerate. + +2015-04-07 Jakub Jelinek + Iain Sandoe + + PR target/65351 + * configure: Regenerate. + 2015-01-19 Eli Zaretskii * strerror.c : Declare only if they aren't diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index f06cc69a973..7d7e2f41efa 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -3,7 +3,7 @@ # # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -# 2012, 2014 Free Software Foundation +# 2012, 2014, 2015 Free Software Foundation # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or @@ -113,7 +113,8 @@ installcheck: installcheck-subdir INCDIR=$(srcdir)/$(MULTISRCTOP)../include -COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ +COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) \ + $(HDEFINES) @ac_libiberty_warn_cflags@ -D_GNU_SOURCE # Just to make sure we don't use a built-in rule with VPATH .c.$(objext): diff --git a/libiberty/config.in b/libiberty/config.in index 7c05b9d846e..0dedbf08e0f 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -485,6 +485,28 @@ /* Define to an unsigned 64-bit type available in the compiler. */ #undef UNSIGNED_64BIT_TYPE +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD @@ -503,6 +525,16 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/libiberty/configure b/libiberty/configure index 2007ecc76b1..da2df4ec740 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -599,11 +599,11 @@ PICFLAG INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM -EGREP -GREP OUTPUT_OPTION NO_MINUS_C_MINUS_O ac_libiberty_warn_cflags +EGREP +GREP CPP OBJEXT EXEEXT @@ -1480,6 +1480,93 @@ fi } # ac_fn_c_try_cpp +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes @@ -1522,6 +1609,37 @@ fi } # ac_fn_c_try_run +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + # ac_fn_c_check_header_preproc LINENO HEADER VAR # ---------------------------------------------- # Tests whether HEADER is present, setting the cache variable VAR accordingly. @@ -3610,312 +3728,114 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Check whether --enable-largefile was given. -if test "${enable_largefile+set}" = set; then : - enableval=$enable_largefile; +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= fi - -if test "$enable_largefile" != no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if test "${ac_cv_sys_largefile_CC+set}" = set; then : +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then - ac_save_CC=$CC - while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : - break +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue fi -rm -f core conftest.err conftest.$ac_objext - CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_largefile_CC=' -n32'; break +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break fi -rm -f core conftest.err conftest.$ac_objext - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -$as_echo "$ac_cv_sys_largefile_CC" >&6; } - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test "${ac_cv_sys_file_offset_bits+set}" = set; then : - $as_echo_n "(cached) " >&6 + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP else - while :; do + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_file_offset_bits=no; break +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_file_offset_bits=64; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_sys_file_offset_bits=unknown - break -done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -$as_echo "$ac_cv_sys_file_offset_bits" >&6; } -case $ac_cv_sys_file_offset_bits in #( - no | unknown) ;; - *) -cat >>confdefs.h <<_ACEOF -#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF -;; -esac -rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if test "${ac_cv_sys_large_files+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_large_files=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_large_files=1; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_sys_large_files=unknown - break -done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -$as_echo "$ac_cv_sys_large_files" >&6; } -case $ac_cv_sys_large_files in #( - no | unknown) ;; - *) -cat >>confdefs.h <<_ACEOF -#define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF -;; -esac -rm -rf conftest* - fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +#include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. @@ -3946,66 +3866,147 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_c_preproc_warn_flag=yes - -ac_libiberty_warn_cflags= -save_CFLAGS="$CFLAGS" -for real_option in -W -Wall -Wwrite-strings -Wc++-compat \ - -Wstrict-prototypes; do - # Do the check with the no- prefix removed since gcc silently - # accepts any -Wno-* option on purpose - case $real_option in - -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;; - *) option=$real_option ;; - esac - as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh` - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5 -$as_echo_n "checking whether $CC supports $option... " >&6; } -if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else - CFLAGS="$option" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_acx_Woption=yes" -else - eval "$as_acx_Woption=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -eval ac_res=\$$as_acx_Woption - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then : - ac_libiberty_warn_cflags="$ac_libiberty_warn_cflags${ac_libiberty_warn_cflags:+ }$real_option" -fi - done -CFLAGS="$save_CFLAGS" - -# Do the check with the no- prefix removed from the warning options -# since gcc silently accepts any -Wno-* option on purpose -if test "$GCC" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pedantic " >&5 -$as_echo_n "checking whether $CC supports -pedantic ... " >&6; } -if test "${acx_cv_prog_cc_pedantic_+set}" = set; then : - $as_echo_n "(cached) " >&6 + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - save_CFLAGS="$CFLAGS" -CFLAGS="-pedantic " -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +#include +#include int main () @@ -4016,522 +4017,703 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - acx_cv_prog_cc_pedantic_=yes + ac_cv_header_stdc=yes else - acx_cv_prog_cc_pedantic_=no + ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$save_CFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_prog_cc_pedantic_" >&5 -$as_echo "$acx_cv_prog_cc_pedantic_" >&6; } -if test $acx_cv_prog_cc_pedantic_ = yes; then : - ac_libiberty_warn_cflags="$ac_libiberty_warn_cflags${ac_libiberty_warn_cflags:+ }-pedantic " + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no fi +rm -f conftest* fi +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : -if test "x$CC" != xcc; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 -$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 -$as_echo_n "checking whether cc understands -c and -o together... " >&6; } + ac_cv_header_stdc=no fi -set dummy $CC; ac_cc=`$as_echo "$2" | - sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { - - ; + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; return 0; } _ACEOF -# Make sure it works both with $CC and with simple cc. -# We do the test twice because some compilers refuse to overwrite an -# existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; -then - eval ac_cv_prog_cc_${ac_cc}_c_o=yes - if test "x$CC" != xcc; then - # Test first that cc exists at all. - if { ac_try='cc -c conftest.$ac_ext >&5' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' - rm -f conftest2.* - if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; - then - # cc works too. - : - else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi - fi - fi +if ac_fn_c_try_run "$LINENO"; then : + else - eval ac_cv_prog_cc_${ac_cc}_c_o=no + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest* fi -if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then -$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi -# autoconf is lame and doesn't give us any substitution variable for this. -if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then - NO_MINUS_C_MINUS_O=yes +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = x""yes; then : + MINIX=yes else - OUTPUT_OPTION='-o $@' + MINIX= fi + if test "$MINIX" = yes; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then : +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +# define __EXTENSIONS__ 1 + $ac_includes_default int main () { -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes + ac_cv_safe_to_define___extensions__=yes else - ac_cv_c_const=no + ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + -$as_echo "#define const /**/" >>confdefs.h +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if test "${ac_cv_sys_largefile_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + ; + return 0; +} _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw + ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF - ;; +;; esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi +fi + + +ac_c_preproc_warn_flag=yes + +ac_libiberty_warn_cflags= +save_CFLAGS="$CFLAGS" +for real_option in -W -Wall -Wwrite-strings -Wc++-compat \ + -Wstrict-prototypes; do + # Do the check with the no- prefix removed since gcc silently + # accepts any -Wno-* option on purpose + case $real_option in + -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;; + *) option=$real_option ;; + esac + as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh` + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5 +$as_echo_n "checking whether $CC supports $option... " >&6; } +if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + CFLAGS="$option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - $ac_path_GREP_found && break 3 - done - done +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_acx_Woption=yes" +else + eval "$as_acx_Woption=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +eval ac_res=\$$as_acx_Woption + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then : + ac_libiberty_warn_cflags="$ac_libiberty_warn_cflags${ac_libiberty_warn_cflags:+ }$real_option" +fi done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi +CFLAGS="$save_CFLAGS" + +# Do the check with the no- prefix removed from the warning options +# since gcc silently accepts any -Wno-* option on purpose +if test "$GCC" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -pedantic " >&5 +$as_echo_n "checking whether $CC supports -pedantic ... " >&6; } +if test "${acx_cv_prog_cc_pedantic_+set}" = set; then : + $as_echo_n "(cached) " >&6 else - ac_cv_path_GREP=$GREP + save_CFLAGS="$CFLAGS" +CFLAGS="-pedantic " +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + acx_cv_prog_cc_pedantic_=yes +else + acx_cv_prog_cc_pedantic_=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_prog_cc_pedantic_" >&5 +$as_echo "$acx_cv_prog_cc_pedantic_" >&6; } +if test $acx_cv_prog_cc_pedantic_ = yes; then : + ac_libiberty_warn_cflags="$ac_libiberty_warn_cflags${ac_libiberty_warn_cflags:+ }-pedantic " fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi fi else - ac_cv_path_EGREP=$EGREP + eval ac_cv_prog_cc_${ac_cc}_c_o=no fi +rm -f core conftest* - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +fi + +# autoconf is lame and doesn't give us any substitution variable for this. +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then + NO_MINUS_C_MINUS_O=yes +else + OUTPUT_OPTION='-o $@' +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include int main () { +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes + ac_cv_c_const=yes else - ac_cv_header_stdc=no + ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* +$as_echo "#define const /**/" >>confdefs.h fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then : + $as_echo_n "(cached) " >&6 else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } #endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_preproc "$LINENO" "$ac_header" "$as_ac_Header" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif _ACEOF - -fi -done - + ;; +esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } @@ -4885,9 +5067,15 @@ fi case "${host}" in # PIC is the default on some targets or must not be used. *-*-darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - PICFLAG=-fno-common + # For darwin, common symbols are not allowed in MH_DYLIB files + case "${CFLAGS}" in + # If we are using a compiler supporting mdynamic-no-pic + # and the option has been tested as safe to add, then cancel + # it here, since the code generated is incompatible with shared + # libs. + *-mdynamic-no-pic*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;; + *) PICFLAG=-fno-common ;; + esac ;; alpha*-dec-osf5*) # PIC is the default. diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 922aa86e9b0..868be8e72d1 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -155,6 +155,7 @@ AC_MSG_NOTICE([target_header_dir = $target_header_dir]) GCC_NO_EXECUTABLES AC_PROG_CC +AC_GNU_SOURCE AC_SYS_LARGEFILE AC_PROG_CPP_WERROR diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 77c2cee9d17..2988b6bcb01 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -2470,6 +2470,9 @@ cplus_demangle_type (struct d_info *di) case 'U': d_advance (di, 1); ret = d_source_name (di); + if (d_peek_char (di) == 'I') + ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, + d_template_args (di)); ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL, cplus_demangle_type (di), ret); break; diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c index bb481c0998e..a2a3b32af6a 100644 --- a/libiberty/d-demangle.c +++ b/libiberty/d-demangle.c @@ -1,5 +1,5 @@ /* Demangler for the D programming language - Copyright 2014 Free Software Foundation, Inc. + Copyright 2014, 2015 Free Software Foundation, Inc. Written by Iain Buclaw (ibuclaw@gdcproject.org) This file is part of the libiberty library. @@ -165,6 +165,21 @@ string_prepend (string *p, const char *s) } } +/* What kinds of symbol we could be parsing. */ +enum dlang_symbol_kinds +{ + /* Top-level symbol, needs it's type checked. */ + dlang_top_level, + /* Function symbol, needs it's type checked. */ + dlang_function, + /* Strongly typed name, such as for classes, structs and enums. */ + dlang_type_name, + /* Template identifier. */ + dlang_template_ident, + /* Template symbol parameter. */ + dlang_template_param +}; + /* Prototypes for forward referenced functions */ static const char *dlang_function_args (string *, const char *); @@ -172,7 +187,8 @@ static const char *dlang_type (string *, const char *); static const char *dlang_value (string *, const char *, const char *, char); -static const char *dlang_parse_symbol (string *, const char *); +static const char *dlang_parse_symbol (string *, const char *, + enum dlang_symbol_kinds); static const char *dlang_parse_tuple (string *, const char *); @@ -185,7 +201,7 @@ static const char * dlang_call_convention (string *decl, const char *mangled) { if (mangled == NULL || *mangled == '\0') - return mangled; + return NULL; switch (*mangled) { @@ -215,13 +231,51 @@ dlang_call_convention (string *decl, const char *mangled) return mangled; } +/* Extract the type modifiers from MANGLED and append them to DECL. + Returns the remaining signature on success or NULL on failure. */ +static const char * +dlang_type_modifiers (string *decl, const char *mangled) +{ + if (mangled == NULL || *mangled == '\0') + return NULL; + + switch (*mangled) + { + case 'x': /* const */ + mangled++; + string_append (decl, " const"); + return mangled; + case 'y': /* immutable */ + mangled++; + string_append (decl, " immutable"); + return mangled; + case 'O': /* shared */ + mangled++; + string_append (decl, " shared"); + return dlang_type_modifiers (decl, mangled); + case 'N': + mangled++; + if (*mangled == 'g') /* wild */ + { + mangled++; + string_append (decl, " inout"); + return dlang_type_modifiers (decl, mangled); + } + else + return NULL; + + default: + return mangled; + } +} + /* Demangle the D function attributes from MANGLED and append it to DECL. Return the remaining string on success or NULL on failure. */ static const char * dlang_attributes (string *decl, const char *mangled) { if (mangled == NULL || *mangled == '\0') - return mangled; + return NULL; while (*mangled == 'N') { @@ -254,8 +308,10 @@ dlang_attributes (string *decl, const char *mangled) continue; case 'g': case 'h': + case 'k': /* inout parameter is represented as 'Ng'. vector parameter is represented as 'Nh'. + return paramenter is represented as 'Nk'. If we see this, then we know we're really in the parameter list. Rewind and break. */ mangled--; @@ -264,6 +320,13 @@ dlang_attributes (string *decl, const char *mangled) mangled++; string_append (decl, "@nogc "); continue; + case 'j': /* return */ + mangled++; + string_append (decl, "return "); + continue; + + default: /* unknown attribute */ + return NULL; } break; } @@ -280,7 +343,7 @@ dlang_function_type (string *decl, const char *mangled) size_t szattr, szargs, sztype; if (mangled == NULL || *mangled == '\0') - return mangled; + return NULL; /* The order of the mangled string is: CallConvention FuncAttrs Arguments ArgClose Type @@ -353,6 +416,12 @@ dlang_function_args (string *decl, const char *mangled) string_append (decl, "scope "); } + if (mangled[0] == 'N' && mangled[1] == 'k') /* return(T) */ + { + mangled += 2; + string_append (decl, "return "); + } + switch (*mangled) { case 'J': /* out(T) */ @@ -380,7 +449,7 @@ static const char * dlang_type (string *decl, const char *mangled) { if (mangled == NULL || *mangled == '\0') - return mangled; + return NULL; switch (*mangled) { @@ -474,12 +543,24 @@ dlang_type (string *decl, const char *mangled) case 'E': /* enum T */ case 'T': /* typedef T */ mangled++; - return dlang_parse_symbol (decl, mangled); + return dlang_parse_symbol (decl, mangled, dlang_type_name); case 'D': /* delegate T */ + { + string mods; + size_t szmods; mangled++; + + string_init (&mods); + mangled = dlang_type_modifiers (&mods, mangled); + szmods = string_length (&mods); + mangled = dlang_function_type (decl, mangled); string_append (decl, "delegate"); + string_appendn (decl, mods.b, szmods); + + string_delete (&mods); return mangled; + } case 'B': /* tuple T */ mangled++; return dlang_parse_tuple (decl, mangled); @@ -588,6 +669,20 @@ dlang_type (string *decl, const char *mangled) mangled++; string_append (decl, "dchar"); return mangled; + case 'z': + mangled++; + switch (*mangled) + { + case 'i': + mangled++; + string_append (decl, "cent"); + return mangled; + case 'k': + mangled++; + string_append (decl, "ucent"); + return mangled; + } + return NULL; default: /* unhandled */ return NULL; @@ -597,97 +692,162 @@ dlang_type (string *decl, const char *mangled) /* Extract the identifier from MANGLED and append it to DECL. Return the remaining string on success or NULL on failure. */ static const char * -dlang_identifier (string *decl, const char *mangled) +dlang_identifier (string *decl, const char *mangled, + enum dlang_symbol_kinds kind) { + char *endptr; + long len; + if (mangled == NULL || *mangled == '\0') - return mangled; + return NULL; - if (ISDIGIT (*mangled)) + len = strtol (mangled, &endptr, 10); + + if (endptr == NULL || len <= 0) + return NULL; + + /* In template parameter symbols, the first character of the mangled + name can be a digit. This causes ambiguity issues because the + digits of the two numbers are adjacent. */ + if (kind == dlang_template_param) { - char *endptr; - long i = strtol (mangled, &endptr, 10); + long psize = len; + char *pend; + int saved = string_length (decl); - if (endptr == NULL || i <= 0 || strlen (endptr) < (size_t) i) + /* Work backwards until a match is found. */ + for (pend = endptr; endptr != NULL; pend--) + { + mangled = pend; + + /* Reached the beginning of the pointer to the name length, + try parsing the entire symbol. */ + if (psize == 0) + { + psize = len; + pend = endptr; + endptr = NULL; + } + + /* Check whether template parameter is a function with a valid + return type or an untyped identifier. */ + if (ISDIGIT (*mangled)) + mangled = dlang_parse_symbol (decl, mangled, dlang_template_ident); + else if (strncmp (mangled, "_D", 2) == 0) + { + mangled += 2; + mangled = dlang_parse_symbol (decl, mangled, dlang_function); + } + + /* Check for name length mismatch. */ + if (mangled && (mangled - pend) == psize) + return mangled; + + psize /= 10; + string_setlength (decl, saved); + } + + /* No match on any combinations. */ + return NULL; + } + else + { + if (strlen (endptr) < (size_t) len) return NULL; mangled = endptr; /* May be a template instance. */ - if (i >= 5 && strncmp (mangled, "__T", 3) == 0) + if (len >= 5 && strncmp (mangled, "__T", 3) == 0) { /* Template symbol. */ if (ISDIGIT (mangled[3]) && mangled[3] != '0') - return dlang_parse_template (decl, mangled, i); + return dlang_parse_template (decl, mangled, len); return NULL; } - if (strncmp (mangled, "__ctor", i) == 0) - { - /* Constructor symbol for a class/struct. */ - string_append (decl, "this"); - mangled += i; - return mangled; - } - else if (strncmp (mangled, "__dtor", i) == 0) - { - /* Destructor symbol for a class/struct. */ - string_append (decl, "~this"); - mangled += i; - return mangled; - } - else if (strncmp (mangled, "__postblit", i) == 0) - { - /* Postblit symbol for a struct. */ - string_append (decl, "this(this)"); - mangled += i; - return mangled; - } - else if (strncmp (mangled, "__initZ", i+1) == 0) - { - /* The static initialiser for a given symbol. */ - string_append (decl, "init$"); - mangled += i + 1; - return mangled; - } - else if (strncmp (mangled, "__ClassZ", i+1) == 0) + switch (len) { - /* The classinfo symbol for a given class. */ - string_prepend (decl, "ClassInfo for "); - string_setlength (decl, string_length (decl) - 1); - mangled += i + 1; - return mangled; - } - else if (strncmp (mangled, "__vtblZ", i+1) == 0) - { - /* The vtable symbol for a given class. */ - string_prepend (decl, "vtable for "); - string_setlength (decl, string_length (decl) - 1); - mangled += i + 1; - return mangled; - } - else if (strncmp (mangled, "__InterfaceZ", i+1) == 0) - { - /* The interface symbol for a given class. */ - string_prepend (decl, "Interface for "); - string_setlength (decl, string_length (decl) - 1); - mangled += i + 1; - return mangled; - } - else if (strncmp (mangled, "__ModuleInfoZ", i+1) == 0) - { - /* The ModuleInfo symbol for a given module. */ - string_prepend (decl, "ModuleInfo for "); - string_setlength (decl, string_length (decl) - 1); - mangled += i + 1; - return mangled; + case 6: + if (strncmp (mangled, "__ctor", len) == 0) + { + /* Constructor symbol for a class/struct. */ + string_append (decl, "this"); + mangled += len; + return mangled; + } + else if (strncmp (mangled, "__dtor", len) == 0) + { + /* Destructor symbol for a class/struct. */ + string_append (decl, "~this"); + mangled += len; + return mangled; + } + else if (strncmp (mangled, "__initZ", len+1) == 0) + { + /* The static initialiser for a given symbol. */ + string_append (decl, "init$"); + mangled += len; + return mangled; + } + else if (strncmp (mangled, "__vtblZ", len+1) == 0) + { + /* The vtable symbol for a given class. */ + string_prepend (decl, "vtable for "); + string_setlength (decl, string_length (decl) - 1); + mangled += len; + return mangled; + } + break; + + case 7: + if (strncmp (mangled, "__ClassZ", len+1) == 0) + { + /* The classinfo symbol for a given class. */ + string_prepend (decl, "ClassInfo for "); + string_setlength (decl, string_length (decl) - 1); + mangled += len; + return mangled; + } + break; + + case 10: + if (strncmp (mangled, "__postblitMFZ", len+3) == 0) + { + /* Postblit symbol for a struct. */ + string_append (decl, "this(this)"); + mangled += len + 3; + return mangled; + } + break; + + case 11: + if (strncmp (mangled, "__InterfaceZ", len+1) == 0) + { + /* The interface symbol for a given class. */ + string_prepend (decl, "Interface for "); + string_setlength (decl, string_length (decl) - 1); + mangled += len; + return mangled; + } + break; + + case 12: + if (strncmp (mangled, "__ModuleInfoZ", len+1) == 0) + { + /* The ModuleInfo symbol for a given module. */ + string_prepend (decl, "ModuleInfo for "); + string_setlength (decl, string_length (decl) - 1); + mangled += len; + return mangled; + } + break; } - string_appendn (decl, mangled, i); - mangled += i; + string_appendn (decl, mangled, len); + mangled += len; } - else - return NULL; return mangled; } @@ -931,7 +1091,38 @@ dlang_parse_string (string *decl, const char *mangled) char a = ascii2hex (mangled[0]); char b = ascii2hex (mangled[1]); char val = (a << 4) | b; - string_appendn (decl, &val, 1); + + /* Sanitize white and non-printable characters. */ + switch (val) + { + case ' ': + string_append (decl, " "); + break; + case '\t': + string_append (decl, "\\t"); + break; + case '\n': + string_append (decl, "\\n"); + break; + case '\r': + string_append (decl, "\\r"); + break; + case '\f': + string_append (decl, "\\f"); + break; + case '\v': + string_append (decl, "\\v"); + break; + + default: + if (ISPRINT (val)) + string_appendn (decl, &val, 1); + else + { + string_append (decl, "\\x"); + string_appendn (decl, mangled, 2); + } + } } else return NULL; @@ -1030,7 +1221,7 @@ static const char * dlang_value (string *decl, const char *mangled, const char *name, char type) { if (mangled == NULL || *mangled == '\0') - return mangled; + return NULL; switch (*mangled) { @@ -1104,28 +1295,54 @@ dlang_value (string *decl, const char *mangled, const char *name, char type) return mangled; } +/* Extract the type modifiers from MANGLED and return the string + length that it consumes in MANGLED on success or 0 on failure. */ static int -dlang_call_convention_p (const char *mangled) +dlang_type_modifier_p (const char *mangled) { - size_t i; + int i; switch (*mangled) { - case 'F': case 'U': case 'V': - case 'W': case 'R': + case 'x': case 'y': return 1; - case 'M': /* Prefix for functions needing 'this' */ - i = 1; - if (mangled[i] == 'x') - i++; + case 'O': + mangled++; + i = dlang_type_modifier_p (mangled); + return i + 1; - switch (mangled[i]) + case 'N': + mangled++; + if (*mangled == 'g') { - case 'F': case 'U': case 'V': - case 'W': case 'R': - return 1; + mangled++; + i = dlang_type_modifier_p (mangled); + return i + 2; } + } + + return 0; +} + +/* Extract the function calling convention from MANGLED and + return 1 on success or 0 on failure. */ +static int +dlang_call_convention_p (const char *mangled) +{ + /* Prefix for functions needing 'this' */ + if (*mangled == 'M') + { + mangled++; + /* Also skip over any type modifiers. */ + mangled += dlang_type_modifier_p (mangled); + } + + switch (*mangled) + { + case 'F': case 'U': case 'V': + case 'W': case 'R': + return 1; default: return 0; @@ -1135,23 +1352,41 @@ dlang_call_convention_p (const char *mangled) /* Extract and demangle the symbol in MANGLED and append it to DECL. Returns the remaining signature on success or NULL on failure. */ static const char * -dlang_parse_symbol (string *decl, const char *mangled) +dlang_parse_symbol (string *decl, const char *mangled, + enum dlang_symbol_kinds kind) { + int saved; size_t n = 0; do { if (n++) string_append (decl, "."); - mangled = dlang_identifier (decl, mangled); + mangled = dlang_identifier (decl, mangled, kind); if (mangled && dlang_call_convention_p (mangled)) { - int saved; + string mods; + const char *start = NULL; + int checkpoint = 0; /* Skip over 'this' parameter. */ if (*mangled == 'M') - mangled += (mangled[1] == 'x') ? 2 : 1; + mangled++; + + /* We have reached here because we expect an extern(Pascal) function. + However this is so rare, that it is more likely a template value + parameter. Since this can't be assumed, first attempt parsing + the symbol as a function, and then back out on failure. */ + if (*mangled == 'V') + { + start = mangled; + checkpoint = string_length (decl); + } + + /* Save the type modifiers for appending at the end. */ + string_init (&mods); + mangled = dlang_type_modifiers (&mods, mangled); /* Skip over calling convention and attributes in qualified name. */ saved = string_length (decl); @@ -1163,17 +1398,41 @@ dlang_parse_symbol (string *decl, const char *mangled) mangled = dlang_function_args (decl, mangled); string_append (decl, ")"); - /* Demangle the function return type as a kind of sanity test. */ - if (mangled && !ISDIGIT (*mangled)) + /* Add any const/immutable/shared modifier. */ + string_appendn (decl, mods.b, string_length (&mods)); + string_delete (&mods); + + if (mangled == NULL && checkpoint != 0) { - saved = string_length (decl); - mangled = dlang_type (decl, mangled); - string_setlength (decl, saved); + mangled = start; + string_setlength (decl, checkpoint); } } } while (mangled && ISDIGIT (*mangled)); + /* Only top-level symbols or function template parameters have + a type that needs checking. */ + if (kind == dlang_top_level || kind == dlang_function) + { + /* Artificial symbols end with 'Z' and have no type. */ + if (mangled && *mangled == 'Z') + mangled++; + else + { + saved = string_length (decl); + mangled = dlang_type (decl, mangled); + string_setlength (decl, saved); + } + + /* Check that the entire symbol was successfully demangled. */ + if (kind == dlang_top_level) + { + if (mangled == NULL || *mangled != '\0') + return NULL; + } + } + return mangled; } @@ -1221,11 +1480,15 @@ dlang_template_args (string *decl, const char *mangled) if (n++) string_append (decl, ", "); + /* Skip over specialised template prefix. */ + if (*mangled == 'H') + mangled++; + switch (*mangled) { case 'S': /* Symbol parameter. */ mangled++; - mangled = dlang_parse_symbol (decl, mangled); + mangled = dlang_parse_symbol (decl, mangled, dlang_template_param); break; case 'T': /* Type parameter. */ mangled++; @@ -1283,7 +1546,7 @@ dlang_parse_template (string *decl, const char *mangled, long len) mangled += 3; /* Template identifier. */ - mangled = dlang_identifier (decl, mangled); + mangled = dlang_identifier (decl, mangled, dlang_template_ident); /* Template arguments. */ string_append (decl, "!("); @@ -1322,7 +1585,7 @@ dlang_demangle (const char *mangled, int option ATTRIBUTE_UNUSED) { mangled += 2; - if (dlang_parse_symbol (&decl, mangled) == NULL) + if (dlang_parse_symbol (&decl, mangled, dlang_top_level) == NULL) string_delete (&decl); } diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index 789fa05777d..9190e1469d9 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -1,5 +1,5 @@ /* IEEE floating point support routines, for GDB, the GNU Debugger. - Copyright 1991, 1994, 1999, 2000, 2003, 2005, 2006, 2010, 2012 + Copyright 1991, 1994, 1999, 2000, 2003, 2005, 2006, 2010, 2012, 2015 Free Software Foundation, Inc. This file is part of GDB. @@ -19,7 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This is needed to pick up the NAN macro on some systems. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 4324a8f1dc4..8f5f7b50b73 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -33,7 +33,7 @@ SHELL = @SHELL@ CC = @CC@ CFLAGS = @CFLAGS@ -LIBCFLAGS = $(CFLAGS) +LIBCFLAGS = $(CFLAGS) $(LDFLAGS) # Multilib support variables. MULTISRCTOP = diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected index 2aeacb8389f..6c8ccdff4b5 100644 --- a/libiberty/testsuite/d-demangle-expected +++ b/libiberty/testsuite/d-demangle-expected @@ -114,6 +114,14 @@ _D8demangle4testFwZv demangle.test(dchar) # --format=dlang +_D8demangle4testFziZv +demangle.test(cent) +# +--format=dlang +_D8demangle4testFzkZv +demangle.test(ucent) +# +--format=dlang _D8demangle4testFOaZv demangle.test(shared(char)) # @@ -314,6 +322,14 @@ _D8demangle4testFMaZv demangle.test(scope char) # --format=dlang +_D8demangle4testFNjaZv +demangle.test(char) +# +--format=dlang +_D8demangle4testFNkaZv +demangle.test(return char) +# +--format=dlang _D8demangle4testFaXv demangle.test(char...) # @@ -434,6 +450,22 @@ _D8demangle4testFDFNdNfNaZaZv demangle.test(char() @property @safe pure delegate) # --format=dlang +_D8demangle4testFNjDFZaZv +demangle.test(char() delegate) +# +--format=dlang +_D8demangle4testFNkDFZaZv +demangle.test(return char() delegate) +# +--format=dlang +_D8demangle4testFDFNjZaZv +demangle.test(char() return delegate) +# +--format=dlang +_D8demangle4testFNjNkDFNjZaZv +demangle.test(return char() return delegate) +# +--format=dlang _D8demangle4testFFNaZaZv demangle.test(char() pure function) # @@ -474,6 +506,22 @@ _D8demangle4testFFNdNfNaZaZv demangle.test(char() @property @safe pure function) # --format=dlang +_D8demangle4testFNjFZaZv +demangle.test(char() function) +# +--format=dlang +_D8demangle4testFNkFZaZv +demangle.test(return char() function) +# +--format=dlang +_D8demangle4testFFNjZaZv +demangle.test(char() return function) +# +--format=dlang +_D8demangle4testFNjNkFNjZaZv +demangle.test(return char() return function) +# +--format=dlang _D8demangle4test6__initZ demangle.test.init$ # @@ -502,7 +550,7 @@ _D8demangle4test6__dtorMFZv demangle.test.~this() # --format=dlang -_D8demangle4test6__postblitMFZv +_D8demangle4test10__postblitMFZv demangle.test.this(this) # --format=dlang @@ -566,12 +614,12 @@ _D8demangle17__T4testS6symbolZv demangle.test!(symbol) # --format=dlang -_D8demangle21__T4testS6symbol3fooZv +_D8demangle23__T4testS116symbol3fooZv demangle.test!(symbol.foo) # --format=dlang -_D8demangle25__T4testS6symbol3foo3barZv -demangle.test!(symbol.foo.bar) +_D8demangle32__T4testS20_D6symbol3foo3barFZvZv +demangle.test!(symbol.foo.bar()) # --format=dlang _D8demangle19__T4testTaS6symbolZv @@ -582,6 +630,10 @@ _D8demangle19__T4testS6symbolTaZv demangle.test!(symbol, char) # --format=dlang +_D8demangle12__T4testHTaZv +demangle.test!(char) +# +--format=dlang _D8demangle13__T4testVPinZv demangle.test!(null) # @@ -753,6 +805,70 @@ demangle.test!(demangle.S(1, 2)) _D8demangle35__T4testVS8demangle1SS2i1a3_616263Zv demangle.test!(demangle.S(1, "abc")) # +--format=dlang +_D8demangle4testMxFZv +demangle.test() const +# +--format=dlang +_D8demangle4testMyFZv +demangle.test() immutable +# +--format=dlang +_D8demangle4testMNgFZv +demangle.test() inout +# +--format=dlang +_D8demangle4testMNgxFZv +demangle.test() inout const +# +--format=dlang +_D8demangle4testMOFZv +demangle.test() shared +# +--format=dlang +_D8demangle4testMOxFZv +demangle.test() shared const +# +--format=dlang +_D8demangle4testMONgFZv +demangle.test() shared inout +# +--format=dlang +_D8demangle4testMONgxFZv +demangle.test() shared inout const +# +--format=dlang +_D8demangle4testFDxFZaZv +demangle.test(char() delegate const) +# +--format=dlang +_D8demangle4testFDyFZaZv +demangle.test(char() delegate immutable) +# +--format=dlang +_D8demangle4testFDNgFZaZv +demangle.test(char() delegate inout) +# +--format=dlang +_D8demangle4testFDNgxFZaZv +demangle.test(char() delegate inout const) +# +--format=dlang +_D8demangle4testFDOFZaZv +demangle.test(char() delegate shared) +# +--format=dlang +_D8demangle4testFDOxFZaZv +demangle.test(char() delegate shared const) +# +--format=dlang +_D8demangle4testFDONgFZaZv +demangle.test(char() delegate shared inout) +# +--format=dlang +_D8demangle4testFDONgxFZaZv +demangle.test(char() delegate shared inout const) +# # Unittests # --format=dlang @@ -816,19 +932,19 @@ _D6plugin8generateFiiZAOa plugin.generate(int, int) # --format=dlang -_D8demangle3fnAFZv3fnBMFZv +_D8demangle3fnAFZ3fnBMFZv demangle.fnA().fnB() # --format=dlang -_D8demangle4mainFZv1S3fnCFZv +_D8demangle4mainFZ1S3fnCMFZv demangle.main().S.fnC() # --format=dlang -_D8demangle4mainFZv1S3fnDMFZv +_D8demangle4mainFZ1S3fnDMFZv demangle.main().S.fnD() # --format=dlang -_D8demangle4mainFZv5localMFZi +_D8demangle4mainFZ5localMFZi demangle.main().local() # --format=dlang @@ -872,7 +988,7 @@ _D6object14TypeInfo_Array8argTypesMFNbNfJC8TypeInfoJC8TypeInfoZi object.TypeInfo_Array.argTypes(out TypeInfo, out TypeInfo) # --format=dlang -_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZi7tryExecMFMDFZvZv +_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function*).tryExec(scope void() delegate) # --format=dlang @@ -928,9 +1044,37 @@ _D2gc11gctemplates56__T8mkBitmapTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ8mkB gc.gctemplates.mkBitmap!(std.range.iota!(int, int).iota(int, int).Result).mkBitmap(ulong*, ulong) # --format=dlang -_D8serenity9persister6Sqlite70__T15SqlitePersisterTS8serenity9persister6Sqlite11__unittest6FZv4TestZ15SqlitePersister12__T7opIndexZ7opIndexMFmZS8serenity9persister6Sqlite11__unittest6FZv4Test +_D8serenity9persister6Sqlite69__T15SqlitePersisterTS8serenity9persister6Sqlite11__unittest6FZ4TestZ15SqlitePersister12__T7opIndexZ7opIndexMFmZS8serenity9persister6Sqlite11__unittest6FZ4Test serenity.persister.Sqlite.SqlitePersister!(serenity.persister.Sqlite.__unittest6().Test).SqlitePersister.opIndex!().opIndex(ulong) # --format=dlang -_D4test4mainFZv5localMFZi -test.main().local() +_D3std6socket12InternetHost221__T13getHostNoSyncVAyaa96_0a09202020206175746f2078203d2068746f6e6c28706172616d293b0a09202020206175746f206865203d20676574686f73746279616464722826782c20342c206361737428696e74294164647265737346616d696c792e494e4554293b0a09TkZ13getHostNoSyncMFkZb +std.socket.InternetHost.getHostNoSync!("\n\t auto x = htonl(param);\n\t auto he = gethostbyaddr(&x, 4, cast(int)AddressFamily.INET);\n\t", uint).getHostNoSync(uint) +# +--format=dlang +_D2gc6config13__T5parseHTfZ5parseFNbNiAxaKAxaKfZb +gc.config.parse!(float).parse(const(char)[], ref const(char)[], ref float) +# +--format=dlang +_D3std11parallelism273__T4TaskS213std11parallelism3runTDFS3std9algorithm87__T9MapResultS27_D4test4mainFZ7getTermMFiZeTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ9MapResultmmZeTS3std9algorithm87__T9MapResultS27_D4test4mainFZ7getTermMFiZeTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ9MapResultTmTmZ4Task4implFPvZv +std.parallelism.Task!(std.parallelism.run, real(std.algorithm.MapResult!(test.main().getTerm(int), std.range.iota!(int, int).iota(int, int).Result).MapResult, ulong, ulong) delegate, std.algorithm.MapResult!(test.main().getTerm(int), std.range.iota!(int, int).iota(int, int).Result).MapResult, ulong, ulong).Task.impl(void*) +# +--format=dlang +_D2rt5minfo16__unittestL518_6FZ12UTModuleInfo6__ctorMFNckZS2rt5minfo16__unittestL518_6FZ12UTModuleInfo +rt.minfo.__unittestL518_6().UTModuleInfo.this(uint) +# +--format=dlang +_D3std6traits37__T7fqnTypeTC6ObjectVbi0Vbi0Vbi0Vbi0Z13addQualifiersFAyabbbbZAya +std.traits.fqnType!(Object, false, false, false, false).addQualifiers(immutable(char)[], bool, bool, bool, bool) +# +--format=dlang +_D3std9algorithm117__T9MapResultS153std5range4onlyTS3std9algorithm53__T12FilterResultS28_D3std3uni7isUpperFNaNbNfwZbTAyaZ12FilterResultZ9MapResult5frontMFNaNdNfZS3std5range22__T10OnlyResultTwVmi1Z10OnlyResult +std.algorithm.MapResult!(std.range.only, std.algorithm.FilterResult!(std.uni.isUpper(dchar), immutable(char)[]).FilterResult).MapResult.front() +# +--format=dlang +_D3std6traits17__T6fqnSymS43stdZ11adjustIdentFAyaZAya +std.traits.fqnSym!(std).adjustIdent(immutable(char)[]) +# +--format=dlang +_D2rt8lifetime36__T14_d_newarrayOpTS13_d_newarrayiTZ14_d_newarrayOpTFNaNbxC8TypeInfomPmZAv +rt.lifetime._d_newarrayOpT!(_d_newarrayiT)._d_newarrayOpT(const(TypeInfo), ulong, ulong*) diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index a030685de08..6ea64aef859 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4356,3 +4356,6 @@ _QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z --format=gnu-v3 _Z1fSsB3fooS_ f(std::string[abi:foo], std::string[abi:foo]) +--format=gnu-v3 +_Z18IndirectExternCallIPU7stdcallU7regparmILi3EEFviiEiEvT_T0_S3_ +void IndirectExternCall stdcall*)(int, int), int>(void ( regparm<3> stdcall*)(int, int), int, void ( regparm<3> stdcall*)(int, int)) -- 2.30.2