diff options
author | nobody <> | 2009-01-03 17:43:47 +0000 |
---|---|---|
committer | nobody <> | 2009-01-03 17:43:47 +0000 |
commit | 98efba94c8d14ffea399e9a1859a6ced1e4869dc (patch) | |
tree | 03a93ec394427860fa23e131b4c834b417c614bf /libiberty | |
parent | e7c73f57df961ee3db9b81f5dec5b3c5d9c3d288 (diff) | |
download | binutils-gdb-98efba94c8d14ffea399e9a1859a6ced1e4869dc.tar.gz |
This commit was manufactured by cvs2svn to create branchbinutils-arc-20081103-branchpointarc-20081103-branchpointarc-20081103-branch
'arc-20081103-branch'.
Sprout from binutils-2_19-branch 2008-09-08 08:56:58 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'binutils-'
Cherrypick from binutils-2_19-branch 2009-01-03 17:43:46 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'binutils-':
gas/testsuite/gas/ppc/common.d
gas/testsuite/gas/ppc/common.s
ld/testsuite/ld-powerpc/attr-gnu-12-1.s
ld/testsuite/ld-powerpc/attr-gnu-12-11.d
ld/testsuite/ld-powerpc/attr-gnu-12-2.s
ld/testsuite/ld-powerpc/attr-gnu-12-21.d
Cherrypick from binutils-2_19-branch 2008-09-11 09:06:56 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'binutils-':
gprof/po/ro.po
Cherrypick from binutils-2_19-branch 2008-09-26 07:02:45 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'binutils-':
gas/config/te-solaris.h
Cherrypick from master 2008-11-02 23:59:45 UTC Alan Modra <amodra@gmail.com> 'daily update':
ChangeLog
Makefile.def
Makefile.in
Makefile.tpl
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/aclocal.m4
bfd/bfd-in2.h
bfd/cache.c
bfd/coff64-rs6000.c
bfd/coffgen.c
bfd/cofflink.c
bfd/config.in
bfd/configure
bfd/configure.in
bfd/doc/Makefile.in
bfd/dwarf2.c
bfd/elf-bfd.h
bfd/elf-eh-frame.c
bfd/elf.c
bfd/elf32-cris.c
bfd/elf32-ppc.c
bfd/elf32-sh-symbian.c
bfd/elf32-spu.c
bfd/elf32-xtensa.c
bfd/elf64-ppc.c
bfd/elflink.c
bfd/elfxx-mips.c
bfd/libbfd.h
bfd/linker.c
bfd/po/id.po
bfd/po/vi.po
bfd/reloc.c
bfd/version.h
binutils/BRANCHES
binutils/ChangeLog
binutils/Makefile.in
binutils/aclocal.m4
binutils/config.in
binutils/configure
binutils/configure.in
binutils/dlltool.c
binutils/doc/Makefile.in
binutils/dwarf.c
binutils/embedspu.sh
binutils/objcopy.c
binutils/po/id.po
binutils/po/sv.po
binutils/readelf.c
binutils/stabs.c
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/group-2.s
binutils/testsuite/binutils-all/group-3.s
binutils/testsuite/binutils-all/group-4.s
binutils/testsuite/binutils-all/group.s
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/objdump.W
binutils/testsuite/binutils-all/strip-4.d
binutils/testsuite/binutils-all/strip-5.d
binutils/testsuite/binutils-all/strip-6.d
binutils/testsuite/binutils-all/strip-7.d
binutils/testsuite/binutils-all/strip-8.d
binutils/testsuite/binutils-all/strip-9.d
binutils/windmc.c
binutils/windres.c
configure
configure.ac
gas/ChangeLog
gas/Makefile.am
gas/Makefile.in
gas/NEWS
gas/aclocal.m4
gas/app.c
gas/config.in
gas/config/bfin-parse.y
gas/config/tc-bfin.c
gas/config/tc-cris.c
gas/config/tc-frv.c
gas/config/tc-frv.h
gas/config/tc-hppa.c
gas/config/tc-hppa.h
gas/config/tc-i386.c
gas/config/tc-i386.h
gas/config/tc-m68k.c
gas/config/tc-mips.c
gas/config/tc-mmix.c
gas/config/tc-mmix.h
gas/config/tc-mn10300.h
gas/config/tc-ns32k.c
gas/config/tc-ppc.c
gas/config/tc-sh.h
gas/config/tc-sh64.h
gas/config/tc-tic4x.c
gas/config/tc-xtensa.c
gas/config/tc-xtensa.h
gas/config/tc-z80.c
gas/configure
gas/configure.in
gas/configure.tgt
gas/doc/Makefile.in
gas/doc/as.texinfo
gas/doc/internals.texi
gas/dw2gencfi.c
gas/frags.c
gas/hash.c
gas/listing.c
gas/po/id.po
gas/read.c
gas/symbols.c
gas/testsuite/ChangeLog
gas/testsuite/gas/all/gas.exp
gas/testsuite/gas/cfi/cfi-alpha-1.d
gas/testsuite/gas/cfi/cfi-alpha-3.d
gas/testsuite/gas/cfi/cfi-arm-1.d
gas/testsuite/gas/cfi/cfi-common-1.d
gas/testsuite/gas/cfi/cfi-common-2.d
gas/testsuite/gas/cfi/cfi-common-3.d
gas/testsuite/gas/cfi/cfi-common-4.d
gas/testsuite/gas/cfi/cfi-common-5.d
gas/testsuite/gas/cfi/cfi-common-6.d
gas/testsuite/gas/cfi/cfi-hppa-1.d
gas/testsuite/gas/cfi/cfi-i386-2.d
gas/testsuite/gas/cfi/cfi-i386.d
gas/testsuite/gas/cfi/cfi-m68k.d
gas/testsuite/gas/cfi/cfi-mips-1.d
gas/testsuite/gas/cfi/cfi-ppc-1.d
gas/testsuite/gas/cfi/cfi-s390-1.d
gas/testsuite/gas/cfi/cfi-s390x-1.d
gas/testsuite/gas/cfi/cfi-sh-1.d
gas/testsuite/gas/cfi/cfi-sparc-1.d
gas/testsuite/gas/cfi/cfi-sparc64-1.d
gas/testsuite/gas/cfi/cfi-x86_64.d
gas/testsuite/gas/cris/rd-tls-1.d
gas/testsuite/gas/cris/rd-tls-1.s
gas/testsuite/gas/cris/rd-tls-2.d
gas/testsuite/gas/cris/rd-tls-2.s
gas/testsuite/gas/cris/tls-err-1.s
gas/testsuite/gas/cris/tls-err-2.s
gas/testsuite/gas/cris/tls-err-3.s
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/nops-5-i686.d
gas/testsuite/gas/i386/nops-5.d
gas/testsuite/gas/i386/nops-5.s
gas/testsuite/gas/i386/sse2avx.d
gas/testsuite/gas/i386/sse2avx.s
gas/testsuite/gas/i386/x86-64-nops-5-k8.d
gas/testsuite/gas/i386/x86-64-nops-5.d
gas/testsuite/gas/i386/x86-64-sse2avx.d
gas/testsuite/gas/i386/x86-64-sse2avx.s
gas/testsuite/gas/ppc/power4_32.d
gas/testsuite/gas/ppc/power4_32.s
gas/testsuite/gas/ppc/power6.d
gas/testsuite/gas/ppc/power6.s
gas/testsuite/gas/ppc/ppc.exp
gas/testsuite/gas/s390/esa-g5.d
gas/testsuite/gas/s390/esa-g5.s
gas/testsuite/gas/s390/esa-z990.d
gas/testsuite/gas/s390/esa-z990.s
gas/testsuite/gas/s390/zarch-z900.d
gas/testsuite/gas/s390/zarch-z900.s
gas/testsuite/gas/s390/zarch-z990.d
gas/testsuite/gas/s390/zarch-z990.s
gas/testsuite/gas/z80/arith.d
gas/testsuite/gas/z80/arith.s
gas/testsuite/gas/z80/bit.d
gas/testsuite/gas/z80/bit.s
gas/testsuite/gas/z80/block.d
gas/testsuite/gas/z80/block.s
gas/testsuite/gas/z80/branch.d
gas/testsuite/gas/z80/branch.s
gas/testsuite/gas/z80/inout.d
gas/testsuite/gas/z80/inout.s
gas/testsuite/gas/z80/ld-group.d
gas/testsuite/gas/z80/ld-group.s
gas/testsuite/gas/z80/misc.d
gas/testsuite/gas/z80/misc.s
gas/testsuite/gas/z80/rotate.d
gas/testsuite/gas/z80/rotate.s
gas/testsuite/gas/z80/z80.exp
gas/write.c
gold/ChangeLog
gold/Makefile.am
gold/Makefile.in
gold/archive.cc
gold/archive.h
gold/config.in
gold/configure
gold/configure.ac
gold/descriptors.cc
gold/descriptors.h
gold/fileread.cc
gold/fileread.h
gold/gold.cc
gold/i386.cc
gold/layout.cc
gold/main.cc
gold/mapfile.cc
gold/object.cc
gold/object.h
gold/options.cc
gold/options.h
gold/output.cc
gold/output.h
gold/plugin.cc
gold/plugin.h
gold/powerpc.cc
gold/readsyms.cc
gold/reloc.cc
gold/resolve.cc
gold/sparc.cc
gold/symtab.cc
gold/symtab.h
gold/target-reloc.h
gold/target.h
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/plugin_test.c
gold/testsuite/plugin_test_1.sh
gold/testsuite/plugin_test_2.sh
gold/testsuite/thin_archive_main.cc
gold/testsuite/thin_archive_test_1.cc
gold/testsuite/thin_archive_test_2.cc
gold/testsuite/thin_archive_test_3.cc
gold/testsuite/thin_archive_test_4.cc
gold/x86_64.cc
gprof/ChangeLog
gprof/Makefile.in
gprof/aclocal.m4
gprof/configure
gprof/configure.in
gprof/gconfig.in
gprof/po/vi.po
include/ChangeLog
include/demangle.h
include/elf/ChangeLog
include/elf/cris.h
include/elf/dwarf2.h
include/elf/ppc.h
include/obstack.h
include/plugin-api.h
ld/ChangeLog
ld/Makefile.am
ld/Makefile.in
ld/aclocal.m4
ld/config.in
ld/configure
ld/configure.in
ld/emulparams/arcelf.sh
ld/emulparams/criself.sh
ld/emulparams/crislinux.sh
ld/emulparams/elf32_i860.sh
ld/emulparams/elf32_i960.sh
ld/emulparams/elf32_sparc.sh
ld/emulparams/elf32_spu.sh
ld/emulparams/elf32am33lin.sh
ld/emulparams/elf32fr30.sh
ld/emulparams/elf32ip2k.sh
ld/emulparams/elf32mcore.sh
ld/emulparams/elf32openrisc.sh
ld/emulparams/elf32ppccommon.sh
ld/emulparams/elf32ppcwindiss.sh
ld/emulparams/elf32vax.sh
ld/emulparams/elf64_s390.sh
ld/emulparams/elf64_sparc.sh
ld/emulparams/elf64alpha.sh
ld/emulparams/elf64mmix.sh
ld/emulparams/elf64ppc.sh
ld/emulparams/elf_i386.sh
ld/emulparams/elf_i386_be.sh
ld/emulparams/elf_i386_ldso.sh
ld/emulparams/elf_i386_vxworks.sh
ld/emulparams/elf_s390.sh
ld/emulparams/elf_x86_64.sh
ld/emulparams/h8300elf.sh
ld/emulparams/hppa64linux.sh
ld/emulparams/hppalinux.sh
ld/emulparams/i386lynx.sh
ld/emulparams/i386moss.sh
ld/emulparams/i386nto.sh
ld/emulparams/m68kelf.sh
ld/emulparams/mn10200.sh
ld/emulparams/or32elf.sh
ld/emulparams/pjelf.sh
ld/emulparams/ppclynx.sh
ld/emulparams/scoreelf.sh
ld/emulparams/shelf.sh
ld/emulparams/shelf32.sh
ld/emulparams/shelf_nto.sh
ld/emulparams/shelf_vxworks.sh
ld/emulparams/shlelf32_linux.sh
ld/emulparams/shlelf_linux.sh
ld/emulparams/shlelf_nto.sh
ld/emultempl/armelf.em
ld/emultempl/beos.em
ld/emultempl/elf32.em
ld/emultempl/genelf.em
ld/emultempl/mmo.em
ld/emultempl/pe.em
ld/emultempl/pep.em
ld/emultempl/spuelf.em
ld/emultempl/sunos.em
ld/ldemul.c
ld/ldemul.h
ld/ldexp.c
ld/ldlang.c
ld/ldlang.h
ld/pe-dll.c
ld/po/id.po
ld/po/vi.po
ld/scripttempl/avr.sc
ld/scripttempl/elf.sc
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/comm1.c
ld/testsuite/ld-elf/eh-frame-hdr.d
ld/testsuite/ld-elf/eh-group.exp
ld/testsuite/ld-elf/eh-group1.s
ld/testsuite/ld-elf/eh-group2.s
ld/testsuite/ld-elf/eh1.d
ld/testsuite/ld-elf/eh2.d
ld/testsuite/ld-elf/eh3.d
ld/testsuite/ld-elf/eh4.d
ld/testsuite/ld-elf/eh5.d
ld/testsuite/ld-elf/eh5b.s
ld/testsuite/ld-elf/eh6.d
ld/testsuite/ld-elf/extract-symbol-1sec.d
ld/testsuite/ld-elf/func1.c
ld/testsuite/ld-elf/group4.d
ld/testsuite/ld-elf/group5.d
ld/testsuite/ld-elf/group6.d
ld/testsuite/ld-elf/group7.d
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-elf/stab.d
ld/testsuite/ld-elfcomm/common1b.c
ld/testsuite/ld-gc/gc.c
ld/testsuite/ld-ia64/tlsbin.rd
ld/testsuite/ld-ia64/tlspic.rd
ld/testsuite/ld-mips-elf/eh-frame1-n32.d
ld/testsuite/ld-mips-elf/eh-frame1-n64.d
ld/testsuite/ld-mips-elf/eh-frame2-n32.d
ld/testsuite/ld-mips-elf/eh-frame2-n64.d
ld/testsuite/ld-mips-elf/eh-frame3.d
ld/testsuite/ld-mips-elf/eh-frame4.d
ld/testsuite/ld-mips-elf/reloc-estimate-1.d
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-powerpc/vxworks1-lib.rd
ld/testsuite/ld-shared/main.c
ld/testsuite/lib/ld-lib.exp
libiberty/ChangeLog
libiberty/Makefile.in
libiberty/config.in
libiberty/configure
libiberty/configure.ac
libiberty/cp-demangle.c
libiberty/cp-demangle.h
libiberty/testsuite/demangle-expected
libiberty/xstrdup.c
libtool.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
opcodes/ChangeLog
opcodes/Makefile.am
opcodes/Makefile.in
opcodes/aclocal.m4
opcodes/configure
opcodes/configure.in
opcodes/i386-gen.c
opcodes/i386-opc.tbl
opcodes/i386-tbl.h
opcodes/po/fr.po
opcodes/po/vi.po
opcodes/s390-opc.c
opcodes/s390-opc.txt
opcodes/z80-dis.c
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 55 | ||||
-rw-r--r-- | libiberty/Makefile.in | 10 | ||||
-rw-r--r-- | libiberty/config.in | 6 | ||||
-rwxr-xr-x | libiberty/configure | 367 | ||||
-rw-r--r-- | libiberty/configure.ac | 1 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 364 | ||||
-rw-r--r-- | libiberty/cp-demangle.h | 2 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 30 | ||||
-rw-r--r-- | libiberty/xstrdup.c | 2 |
9 files changed, 775 insertions, 62 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 837035c05f1..fd9d3000217 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,56 @@ +2008-10-22 Daniel Jacobowitz <dan@codesourcery.com> + + * Makefile.in (CPPFLAGS): Define. + (FLAGS_TO_PASS, COMPILE.c): Add CPPFLAGS. + +2008-10-15 Paolo Bonzini <bonzini@gnu.org> + + PR bootstrap/37137 + * Makefile.in (LIBCFLAGS): Remove. + (FLAGS_TO_PASS): Don't mention it. + (COMPILE.c, MULTIOSDIR): Replace it with CFLAGS. + +2008-10-08 David Edelsohn <edelsohn@gnu.org> + + * xstrdup.c: Include <sys/types.h> after "config.h" + +2008-10-07 Jan Kratochvil <jan.kratochvil@redhat.com> + + * configure.ac: Call AC_SYS_LARGEFILE. + * config.in: Regenerated. + * configure: Likewise. + +2008-10-06 Jason Merrill <jason@redhat.com> + + * cp-demangle.c (struct d_print_info): Add pack_index. + (d_dump): Add DEMANGLE_COMPONENT_PACK_EXPANSION. + (d_make_comp): Likewise. DEMANGLE_COMPONENT_ARGLIST and + DEMANGLE_COMPONENT_TEMPLATE_ARGLIST can have two null args. + (cplus_demangle_builtin_types): Add char16/32_t. + (cplus_demangle_type): Recognize them. + (d_template_args): Handle empty argument packs. + (d_template_arg): Handle argument packs. + (d_expression): Handle dependent name. + (d_index_template_argument): New fn. + (d_lookup_template_argument): New fn. + (d_find_pack, d_pack_length): New fn. + (d_print_subexpr): Split out... + (d_print_comp): ...from here. Use d_*_template_argument. + Handle empty arg lists. Support pack expansions. + * cp-demangle.h (D_BUILTIN_TYPE_COUNT): Increase to 32. + +2008-09-09 Jason Merrill <jason@redhat.com> + + * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_DECLTYPE. + (d_make_comp): Likewise. + (cplus_demangle_type): Handle decltype and DFP types. + (cplus_demangle_operators): Call operator takes 2 args. + (cplus_demangle_builtin_types): Add DFP types. + (d_exprlist): New fn. + (d_expression): Handle parm placeholders, T() and calls. + (d_print_comp): Handle decltype, T() and calls. + * testsuite/demangle-expected: Test the above. + 2008-08-07 Aaron W. LaFramboise <aaronavay62@aaronwl.com> * pex-win32.c (argv_to_argc): New function. @@ -4901,7 +4954,7 @@ Thu Oct 8 23:42:08 1998 Jeffrey A Law (law@cygnus.com) * Merge egcs & devo libiberty. -1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de> +1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de> * cplus-dem.c (demangle_arm_pt): Demangle anonymous namespaces. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index e18aff75363..41a71f5ea32 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -55,7 +55,7 @@ AR_FLAGS = rc CC = @CC@ CFLAGS = @CFLAGS@ -LIBCFLAGS = $(CFLAGS) +CPPFLAGS = @CPPFLAGS@ RANLIB = @RANLIB@ MAKEINFO = @MAKEINFO@ PERL = @PERL@ @@ -79,8 +79,8 @@ FLAGS_TO_PASS = \ "AR_FLAGS=$(AR_FLAGS)" \ "CC=$(CC)" \ "CFLAGS=$(CFLAGS)" \ + "CPPFLAGS=$(CPPFLAGS)" \ "DESTDIR=$(DESTDIR)" \ - "LIBCFLAGS=$(LIBCFLAGS)" \ "EXTRA_OFILES=$(EXTRA_OFILES)" \ "HDEFINES=$(HDEFINES)" \ "INSTALL=$(INSTALL)" \ @@ -111,7 +111,7 @@ installcheck: installcheck-subdir INCDIR=$(srcdir)/$(MULTISRCTOP)../include -COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ +COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ # Just to make sure we don't use a built-in rule with VPATH .c.o: @@ -350,9 +350,9 @@ install: install_to_$(INSTALL_DEST) install-subdir # This is tricky. Even though CC in the Makefile contains # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the -# default multilib, so we have to take LIBCFLAGS into account as well, +# default multilib, so we have to take CFLAGS into account as well, # since it will be passed the multilib flags. -MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory` +MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory` install_to_libdir: all ${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR) $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(libdir)/$(MULTIOSDIR)/$(TARGETLIB)n diff --git a/libiberty/config.in b/libiberty/config.in index 436a58d7e79..9260d560a6e 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -425,6 +425,12 @@ first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/libiberty/configure b/libiberty/configure index 50e9ba3699e..71b6ccd95b5 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -849,6 +849,7 @@ Optional Features: enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-multilib build many library versions (default) + --disable-largefile omit support for large files --enable-install-libiberty Install headers for end users Optional Packages: @@ -2741,6 +2742,371 @@ 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 + +# Check whether --enable-largefile or --disable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + +fi; +if test "$enable_largefile" != no; then + + echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> + /* 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 + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_CC=' -n32'; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_file_offset_bits=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> + /* 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 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* 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 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_file_offset_bits=64; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 +if test "$ac_cv_sys_file_offset_bits" != no; then + +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF + +fi +rm -f conftest* + echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_large_files=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> + /* 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 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include <sys/types.h> + /* 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 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_large_files=1; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6 +if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF + +fi +rm -f conftest* +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2980,7 +3346,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_c_preproc_warn_flag=yes - ac_libiberty_warn_cflags= save_CFLAGS="$CFLAGS" for option in -W -Wall -Wwrite-strings -Wc++-compat \ diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 419351bbb93..ff0ae6a81e4 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -130,6 +130,7 @@ fi GCC_NO_EXECUTABLES AC_PROG_CC +AC_SYS_LARGEFILE AC_PROG_CPP_WERROR ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wc++-compat \ diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 82107bc3548..3fa5f1f21d3 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -299,6 +299,9 @@ struct d_print_info struct d_print_mod *modifiers; /* Set to 1 if we saw a demangling error. */ int demangle_failure; + /* The current index into any template argument packs we are using + for printing. */ + int pack_index; }; #ifdef CP_DEMANGLE_DEBUG @@ -660,6 +663,12 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_CHARACTER: printf ("character '%c'\n", dc->u.s_character.character); return; + case DEMANGLE_COMPONENT_DECLTYPE: + printf ("decltype\n"); + break; + case DEMANGLE_COMPONENT_PACK_EXPANSION: + printf ("pack expansion\n"); + break; } d_dump (d_left (dc), indent + 2); @@ -803,10 +812,10 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_COMPLEX: case DEMANGLE_COMPONENT_IMAGINARY: case DEMANGLE_COMPONENT_VENDOR_TYPE: - case DEMANGLE_COMPONENT_ARGLIST: - case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: case DEMANGLE_COMPONENT_CAST: case DEMANGLE_COMPONENT_JAVA_RESOURCE: + case DEMANGLE_COMPONENT_DECLTYPE: + case DEMANGLE_COMPONENT_PACK_EXPANSION: if (left == NULL) return NULL; break; @@ -827,6 +836,8 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_RESTRICT_THIS: case DEMANGLE_COMPONENT_VOLATILE_THIS: case DEMANGLE_COMPONENT_CONST_THIS: + case DEMANGLE_COMPONENT_ARGLIST: + case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: break; /* Other types should not be seen here. */ @@ -1422,13 +1433,14 @@ const struct demangle_operator_info cplus_demangle_operators[] = { "aa", NL ("&&"), 2 }, { "ad", NL ("&"), 1 }, { "an", NL ("&"), 2 }, - { "cl", NL ("()"), 0 }, + { "cl", NL ("()"), 2 }, { "cm", NL (","), 2 }, { "co", NL ("~"), 1 }, { "dV", NL ("/="), 2 }, { "da", NL ("delete[]"), 1 }, { "de", NL ("*"), 1 }, { "dl", NL ("delete"), 1 }, + { "dt", NL ("."), 2 }, { "dv", NL ("/"), 2 }, { "eO", NL ("^="), 2 }, { "eo", NL ("^"), 2 }, @@ -1883,6 +1895,12 @@ cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT] = /* y */ { NL ("unsigned long long"), NL ("unsigned long long"), D_PRINT_UNSIGNED_LONG_LONG }, /* z */ { NL ("..."), NL ("..."), D_PRINT_DEFAULT }, + /* 26 */ { NL ("decimal32"), NL ("decimal32"), D_PRINT_DEFAULT }, + /* 27 */ { NL ("decimal64"), NL ("decimal64"), D_PRINT_DEFAULT }, + /* 28 */ { NL ("decimal128"), NL ("decimal128"), D_PRINT_DEFAULT }, + /* 29 */ { NL ("half"), NL ("half"), D_PRINT_FLOAT }, + /* 30 */ { NL ("char16_t"), NL ("char16_t"), D_PRINT_DEFAULT }, + /* 31 */ { NL ("char32_t"), NL ("char32_t"), D_PRINT_DEFAULT }, }; CP_STATIC_IF_GLIBCPP_V3 @@ -2046,6 +2064,60 @@ cplus_demangle_type (struct d_info *di) cplus_demangle_type (di), ret); break; + case 'D': + can_subst = 0; + d_advance (di, 1); + peek = d_next_char (di); + switch (peek) + { + case 'T': + case 't': + /* decltype (expression) */ + ret = d_make_comp (di, DEMANGLE_COMPONENT_DECLTYPE, + d_expression (di), NULL); + if (ret && d_next_char (di) != 'E') + ret = NULL; + break; + + case 'p': + /* Pack expansion. */ + ret = d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION, + cplus_demangle_type (di), NULL); + break; + + case 'f': + /* 32-bit decimal floating point */ + ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[26]); + di->expansion += ret->u.s_builtin.type->len; + break; + case 'd': + /* 64-bit DFP */ + ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[27]); + di->expansion += ret->u.s_builtin.type->len; + break; + case 'e': + /* 128-bit DFP */ + ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[28]); + di->expansion += ret->u.s_builtin.type->len; + break; + case 'h': + /* 16-bit half-precision FP */ + ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[29]); + di->expansion += ret->u.s_builtin.type->len; + break; + case 's': + /* char16_t */ + ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[30]); + di->expansion += ret->u.s_builtin.type->len; + break; + case 'i': + /* char32_t */ + ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[31]); + di->expansion += ret->u.s_builtin.type->len; + break; + } + break; + default: return NULL; } @@ -2337,6 +2409,13 @@ d_template_args (struct d_info *di) if (! d_check_char (di, 'I')) return NULL; + if (d_peek_char (di) == 'E') + { + /* An argument pack can be empty. */ + d_advance (di, 1); + return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, NULL, NULL); + } + al = NULL; pal = &al; while (1) @@ -2386,14 +2465,54 @@ d_template_arg (struct d_info *di) case 'L': return d_expr_primary (di); + case 'I': + /* An argument pack. */ + return d_template_args (di); + default: return cplus_demangle_type (di); } } +/* Subroutine of <expression> ::= cl <expression>+ E */ + +static struct demangle_component * +d_exprlist (struct d_info *di) +{ + struct demangle_component *list = NULL; + struct demangle_component **p = &list; + + if (d_peek_char (di) == 'E') + { + d_advance (di, 1); + return d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, NULL, NULL); + } + + while (1) + { + struct demangle_component *arg = d_expression (di); + if (arg == NULL) + return NULL; + + *p = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, arg, NULL); + if (*p == NULL) + return NULL; + p = &d_right (*p); + + if (d_peek_char (di) == 'E') + { + d_advance (di, 1); + break; + } + } + + return list; +} + /* <expression> ::= <(unary) operator-name> <expression> ::= <(binary) operator-name> <expression> <expression> ::= <(trinary) operator-name> <expression> <expression> <expression> + ::= cl <expression>+ E ::= st <type> ::= <template-param> ::= sr <type> <unqualified-name> @@ -2426,6 +2545,25 @@ d_expression (struct d_info *di) d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name, d_template_args (di))); } + else if (peek == 's' && d_peek_next_char (di) == 'T') + { + /* Just demangle a parameter placeholder as its type. */ + d_advance (di, 2); + return cplus_demangle_type (di); + } + else if (IS_DIGIT (peek)) + { + /* We can get an unqualified name as an expression in the case of + a dependent member access, i.e. decltype(T().i). */ + struct demangle_component *name = d_unqualified_name (di); + if (name == NULL) + return NULL; + if (d_peek_char (di) == 'I') + return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name, + d_template_args (di)); + else + return name; + } else { struct demangle_component *op; @@ -2454,7 +2592,12 @@ d_expression (struct d_info *di) args = op->u.s_extended_operator.args; break; case DEMANGLE_COMPONENT_CAST: - args = 1; + if (d_peek_char (di) == 'v') + /* T() encoded as an operand of void. */ + return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op, + cplus_demangle_type (di)); + else + args = 1; break; } @@ -2466,13 +2609,18 @@ d_expression (struct d_info *di) case 2: { struct demangle_component *left; + struct demangle_component *right; left = d_expression (di); + if (!strcmp (op->u.s_operator.op->code, "cl")) + right = d_exprlist (di); + else + right = d_expression (di); + return d_make_comp (di, DEMANGLE_COMPONENT_BINARY, op, d_make_comp (di, DEMANGLE_COMPONENT_BINARY_ARGS, - left, - d_expression (di))); + left, right)); } case 3: { @@ -2968,6 +3116,123 @@ cplus_demangle_print (int options, const struct demangle_component *dc, return dgs.buf; } +/* Returns the I'th element of the template arglist ARGS, or NULL on + failure. */ + +static struct demangle_component * +d_index_template_argument (struct demangle_component *args, int i) +{ + struct demangle_component *a; + + for (a = args; + a != NULL; + a = d_right (a)) + { + if (a->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) + return NULL; + if (i <= 0) + break; + --i; + } + if (i != 0 || a == NULL) + return NULL; + + return d_left (a); +} + +/* Returns the template argument from the current context indicated by DC, + which is a DEMANGLE_COMPONENT_TEMPLATE_PARAM, or NULL. */ + +static struct demangle_component * +d_lookup_template_argument (struct d_print_info *dpi, + const struct demangle_component *dc) +{ + if (dpi->templates == NULL) + { + d_print_error (dpi); + return NULL; + } + + return d_index_template_argument + (d_right (dpi->templates->template_decl), + dc->u.s_number.number); +} + +/* Returns a template argument pack used in DC (any will do), or NULL. */ + +static struct demangle_component * +d_find_pack (struct d_print_info *dpi, + const struct demangle_component *dc) +{ + struct demangle_component *a; + if (dc == NULL) + return NULL; + + switch (dc->type) + { + case DEMANGLE_COMPONENT_TEMPLATE_PARAM: + a = d_lookup_template_argument (dpi, dc); + if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) + return a; + return NULL; + + case DEMANGLE_COMPONENT_PACK_EXPANSION: + return NULL; + + case DEMANGLE_COMPONENT_NAME: + case DEMANGLE_COMPONENT_OPERATOR: + case DEMANGLE_COMPONENT_BUILTIN_TYPE: + case DEMANGLE_COMPONENT_SUB_STD: + case DEMANGLE_COMPONENT_CHARACTER: + return NULL; + + case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: + return d_find_pack (dpi, dc->u.s_extended_operator.name); + case DEMANGLE_COMPONENT_CTOR: + return d_find_pack (dpi, dc->u.s_ctor.name); + case DEMANGLE_COMPONENT_DTOR: + return d_find_pack (dpi, dc->u.s_dtor.name); + + default: + a = d_find_pack (dpi, d_left (dc)); + if (a) + return a; + return d_find_pack (dpi, d_right (dc)); + } +} + +/* Returns the length of the template argument pack DC. */ + +static int +d_pack_length (const struct demangle_component *dc) +{ + int count = 0; + while (dc && dc->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST + && d_left (dc) != NULL) + { + ++count; + dc = d_right (dc); + } + return count; +} + +/* DC is a component of a mangled expression. Print it, wrapped in parens + if needed. */ + +static void +d_print_subexpr (struct d_print_info *dpi, + const struct demangle_component *dc) +{ + int simple = 0; + if (dc->type == DEMANGLE_COMPONENT_NAME) + simple = 1; + if (!simple) + d_append_char (dpi, '('); + d_print_comp (dpi, dc); + if (!simple) + d_append_char (dpi, ')'); +} + /* Subroutine to handle components. */ static void @@ -3153,30 +3418,13 @@ d_print_comp (struct d_print_info *dpi, case DEMANGLE_COMPONENT_TEMPLATE_PARAM: { - long i; - struct demangle_component *a; struct d_print_template *hold_dpt; + struct demangle_component *a = d_lookup_template_argument (dpi, dc); - if (dpi->templates == NULL) - { - d_print_error (dpi); - return; - } - i = dc->u.s_number.number; - for (a = d_right (dpi->templates->template_decl); - a != NULL; - a = d_right (a)) - { - if (a->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) - { - d_print_error (dpi); - return; - } - if (i <= 0) - break; - --i; - } - if (i != 0 || a == NULL) + if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) + a = d_index_template_argument (a, dpi->pack_index); + + if (a == NULL) { d_print_error (dpi); return; @@ -3190,7 +3438,7 @@ d_print_comp (struct d_print_info *dpi, hold_dpt = dpi->templates; dpi->templates = hold_dpt->next; - d_print_comp (dpi, d_left (a)); + d_print_comp (dpi, a); dpi->templates = hold_dpt; @@ -3479,7 +3727,8 @@ d_print_comp (struct d_print_info *dpi, case DEMANGLE_COMPONENT_ARGLIST: case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: - d_print_comp (dpi, d_left (dc)); + if (d_left (dc) != NULL) + d_print_comp (dpi, d_left (dc)); if (d_right (dc) != NULL) { d_append_string (dpi, ", "); @@ -3519,9 +3768,12 @@ d_print_comp (struct d_print_info *dpi, d_print_cast (dpi, d_left (dc)); d_append_char (dpi, ')'); } - d_append_char (dpi, '('); - d_print_comp (dpi, d_right (dc)); - d_append_char (dpi, ')'); + if (d_left (dc)->type == DEMANGLE_COMPONENT_CAST + && d_right (dc)->type == DEMANGLE_COMPONENT_BUILTIN_TYPE) + /* type() -- FIXME what about type(multiple,args) */ + d_append_string (dpi, "()"); + else + d_print_subexpr (dpi, d_right (dc)); return; case DEMANGLE_COMPONENT_BINARY: @@ -3539,13 +3791,10 @@ d_print_comp (struct d_print_info *dpi, && d_left (dc)->u.s_operator.op->name[0] == '>') d_append_char (dpi, '('); - d_append_char (dpi, '('); - d_print_comp (dpi, d_left (d_right (dc))); - d_append_string (dpi, ") "); - d_print_expr_op (dpi, d_left (dc)); - d_append_string (dpi, " ("); - d_print_comp (dpi, d_right (d_right (dc))); - d_append_char (dpi, ')'); + d_print_subexpr (dpi, d_left (d_right (dc))); + if (strcmp (d_left (dc)->u.s_operator.op->code, "cl") != 0) + d_print_expr_op (dpi, d_left (dc)); + d_print_subexpr (dpi, d_right (d_right (dc))); if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR && d_left (dc)->u.s_operator.op->len == 1 @@ -3566,15 +3815,11 @@ d_print_comp (struct d_print_info *dpi, d_print_error (dpi); return; } - d_append_char (dpi, '('); - d_print_comp (dpi, d_left (d_right (dc))); - d_append_string (dpi, ") "); + d_print_subexpr (dpi, d_left (d_right (dc))); d_print_expr_op (dpi, d_left (dc)); - d_append_string (dpi, " ("); - d_print_comp (dpi, d_left (d_right (d_right (dc)))); - d_append_string (dpi, ") : ("); - d_print_comp (dpi, d_right (d_right (d_right (dc)))); - d_append_char (dpi, ')'); + d_print_subexpr (dpi, d_left (d_right (d_right (dc)))); + d_append_string (dpi, " : "); + d_print_subexpr (dpi, d_right (d_right (d_right (dc)))); return; case DEMANGLE_COMPONENT_TRINARY_ARG1: @@ -3681,6 +3926,29 @@ d_print_comp (struct d_print_info *dpi, d_append_char (dpi, dc->u.s_character.character); return; + case DEMANGLE_COMPONENT_DECLTYPE: + d_append_string (dpi, "decltype ("); + d_print_comp (dpi, d_left (dc)); + d_append_char (dpi, ')'); + return; + + case DEMANGLE_COMPONENT_PACK_EXPANSION: + { + struct demangle_component *a = d_find_pack (dpi, d_left (dc)); + int len = d_pack_length (a); + int i; + + dc = d_left (dc); + for (i = 0; i < len; ++i) + { + dpi->pack_index = i; + d_print_comp (dpi, dc); + if (i < len-1) + d_append_string (dpi, ", "); + } + } + return; + default: d_print_error (dpi); return; diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h index 8622f29ca89..aad37437400 100644 --- a/libiberty/cp-demangle.h +++ b/libiberty/cp-demangle.h @@ -147,7 +147,7 @@ struct d_info extern const struct demangle_operator_info cplus_demangle_operators[]; #endif -#define D_BUILTIN_TYPE_COUNT (26) +#define D_BUILTIN_TYPE_COUNT (32) CP_STATIC_IF_GLIBCPP_V3 const struct demangle_builtin_type_info diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 2745dd3d13b..d9efbc0d24e 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -3345,7 +3345,7 @@ f<X> # --format=gnu-v3 --no-params _ZngILi42EEvN1AIXplT_Li2EEE1TE -void operator-<42>(A<(42) + (2)>::T) +void operator-<42>(A<(42)+(2)>::T) operator-<42> # --format=gnu-v3 --no-params @@ -3385,7 +3385,7 @@ int* const volatile restrict _far # --format=gnu-v3 --no-params _Z3fooILi2EEvRAplT_Li1E_i -void foo<2>(int (&) [(2) + (1)]) +void foo<2>(int (&) [(2)+(1)]) foo<2> # --format=gnu-v3 --no-params @@ -3612,13 +3612,13 @@ hairyfunc5 # This is from gcc PR 8861 --format=gnu-v3 --no-params _Z1fILi1ELc120EEv1AIXplT_cviLd810000000000000000703DAD7A370C5EEE -void f<1, (char)120>(A<(1) + ((int)((double)[810000000000000000703DAD7A370C5]))>) +void f<1, (char)120>(A<(1)+((int)((double)[810000000000000000703DAD7A370C5]))>) f<1, (char)120> # # This is also from gcc PR 8861 --format=gnu-v3 --no-params _Z1fILi1EEv1AIXplT_cvingLf3f800000EEE -void f<1>(A<(1) + ((int)(-((float)[3f800000])))>) +void f<1>(A<(1)+((int)(-((float)[3f800000])))>) f<1> # # This is from a libstdc++ debug mode patch. @@ -3643,7 +3643,7 @@ f # confusion with the '>' which ends the template parameters. --format=gnu-v3 --no-params _Z4dep9ILi3EEvP3fooIXgtT_Li2EEE -void dep9<3>(foo<((3) > (2))>*) +void dep9<3>(foo<((3)>(2))>*) dep9<3> # # Watch out for templated version of `operator<'--it needs an extra @@ -3882,3 +3882,23 @@ myspace::foo()::localstruct::f(myspace::foo()::otherlocalstruct) --format=gnu-v3 _ZGr32_java$Sutil$Siso4217$_properties java resource java/util/iso4217.properties +# decltype/param placeholder test +--format=gnu-v3 +_Z3addIidEDTplsTT_sTT0_ES0_S1_ +decltype ((int)+(double)) add<int, double>(int, double) +# decltype/fn call test +--format=gnu-v3 +_Z4add3IidEDTclL_Z1gEsTT_sTT0_EES0_S1_ +decltype (g(int, double)) add3<int, double>(int, double) +# new (2008) built in types test +--format=gnu-v3 +_Z1fDfDdDeDhDsDi +f(decimal32, decimal64, decimal128, half, char16_t, char32_t) +# pack expansion test +--format=gnu-v3 +_Z1fIIPiPfPdEEvDpT_ +void f<int*, float*, double*>(int*, float*, double*) +# '.' test +--format=gnu-v3 +_Z1hI1AIiEdEDTcldtsTT_1gIT0_EEES2_S3_ +decltype (((A<int>).(g<double>))()) h<A<int>, double>(A<int>, double) diff --git a/libiberty/xstrdup.c b/libiberty/xstrdup.c index 9ac2ea038f3..fa12c96a3cd 100644 --- a/libiberty/xstrdup.c +++ b/libiberty/xstrdup.c @@ -13,10 +13,10 @@ obtain memory. */ -#include <sys/types.h> #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include <sys/types.h> #ifdef HAVE_STRING_H #include <string.h> #else |